From patchwork Thu Jul 1 15:25:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 469098 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp496130jao; Thu, 1 Jul 2021 08:26:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyiARCv8hdRojNWveiLNRplOrLze0AbzpTzPaF+Li4D1XgTyKDJe+y5ysSo8aO4u1htdDDc X-Received: by 2002:a05:6402:845:: with SMTP id b5mr511839edz.266.1625153218017; Thu, 01 Jul 2021 08:26:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625153218; cv=none; d=google.com; s=arc-20160816; b=meHzpvBhXQHvTWB3wWz/wTWIkAShI5vo2hHcUKVGpDIXtPHW9ajtIIBciUjR2cvQgG BDrj55bI+xrhre3kJ8AAx+P5q2GSgAedLXGPFNOH2L5A/456qFEURF4tbY7X51EqKzeX gKS8X/1H1IUZm6nPdOj0oIlA1ryjNy4mK1tdkQ+AmLDT4iRZZW5r0FNSP4bewhvbZfsz KYlMQSH1l3PsmqSaZa/KYzYtAMK50Eir0MDU2YdjwFmWx6pXg0b879wim0CLChMq093R NmPCnAZwmOFxEwRY2R17zXh/R7piOim9t/zGAb5yG2VHAssxhkWZQuMeKRyJULPAAbxU VIZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=BiRmqcZNF2hJVvi+mtvT/dUtK5fKY7sdVO7TwBKWEiU=; b=f9cD5P1Y0RRdnKgGQ5aZv8onqGQVViOVkWy9BaC4FVXf5EBUvCmjmZjBssXWkc6enN Qcf3qJFNRTYaxe8pNtOIkTUupvB3k5dYcU/Bt1fnDRVN+raHlS657mOyJtPVLcbVAdTP 4v+ALFefLzulXrGIneL8W1SZLJbw+E1yYFR/2LKr3mtAG8hf+GOrnmi7PZ4EmS8U1Gtu QM/9tWWSVoiGJ2Z4/4FbQZgWAf7SbuV3UkzAPm/1zXKfekLBtYWlGCm+/e2ptrMG30iI J1aH8roR++HyxXXcmS3iXX27p+HCWej6slW69mxbwznhklIj9dNX7T1up85t40Szrcfw MlVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=aN1KSX6A; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id bj22si315553ejb.53.2021.07.01.08.26.57 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 01 Jul 2021 08:26:58 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=aN1KSX6A; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:34400 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lyyae-0004cq-RC for patch@linaro.org; Thu, 01 Jul 2021 11:26:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52882) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lyyZZ-0004Od-V6 for qemu-devel@nongnu.org; Thu, 01 Jul 2021 11:25:50 -0400 Received: from mail-pj1-x1029.google.com ([2607:f8b0:4864:20::1029]:39522) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lyyZS-00088e-7B for qemu-devel@nongnu.org; Thu, 01 Jul 2021 11:25:48 -0400 Received: by mail-pj1-x1029.google.com with SMTP id in17-20020a17090b4391b0290170ba0ec7fcso6856963pjb.4 for ; Thu, 01 Jul 2021 08:25:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=BiRmqcZNF2hJVvi+mtvT/dUtK5fKY7sdVO7TwBKWEiU=; b=aN1KSX6A5zT5OsJG+87PrIONda1RxJ77H2jH+QMO0/+DnA+Uk2XfeGyh+zyhtjOzvL trSDUiigqx1V+b13P6TCTd/ma8/IgcQgh7JqO3+nW+IaOK+EcEW+Q3A12aWoD6LXBckN npC5rCCFn0Ycq6ZCh9Q7yp5pbNCYuV9zwOZ4j9b6rJosgf8/JaG7NPZYjT6nKaRffIy5 9HTA/5A1DkkxvmcppVutwmOsaA7PBtbvXHhUb2GN8iVQAMhwGIGdglk13Ay+1SV3H3VK u5QieRd3zNRjtcrO4XE4bvbPN6Ra3oYXn3m0Mto+9wWSIfY7fj9LRS8UCYJvmOuUlEPq Gipw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=BiRmqcZNF2hJVvi+mtvT/dUtK5fKY7sdVO7TwBKWEiU=; b=qtEiJ28pratzLD/Z0N9IVupoYGz76bBZ+sY8qkUgJl9m4rzjGaGKvKOOgemV2GhKHJ fcL1nEDfGe5m/gHBa8BJqEMd9ByK3pN8OGLu3BDPHC/v4ScMhozOKO2L7Sf8nOc43+rt VxFcqKKj+G5pmuoAi7O3Uib0imIA4RislDmcmpxzXCROCgU3+s5PK4b+baj+anmyDx/8 RYVr2YuewJPIoVfwgtXzGsfUksjRHDCuTOShU9kUsx8lsyiXDLibTQP1PsslYNqcsPuT xsXnu58f/j7VUnIObxRUm3ldz4FunmuZOEglHMf0q8s09muDmZzLNcFGkyNdF0rL7xGt p+yg== X-Gm-Message-State: AOAM531OFi7FANwSuEE7PvieYH/3XCOnbcug2DkzO/oGKddLme3mCbgP OeNOrYjPcnkWfovsusii5CdMwwLcCUWXGQ== X-Received: by 2002:a17:90a:f485:: with SMTP id bx5mr268051pjb.194.1625153139431; Thu, 01 Jul 2021 08:25:39 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id j4sm10213197pjv.7.2021.07.01.08.25.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Jul 2021 08:25:39 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 01/17] target/i386: Use cpu_breakpoint_test in breakpoint_handler Date: Thu, 1 Jul 2021 08:25:21 -0700 Message-Id: <20210701152537.3330420-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210701152537.3330420-1-richard.henderson@linaro.org> References: <20210701152537.3330420-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1029; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1029.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, mark.cave-ayland@ilande.co.uk, alex.bennee@linaro.org, f4bug@amsat.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" The loop is performing a simple boolean test for the existence of a BP_CPU breakpoint at EIP. Plus it gets the iteration wrong, if we happen to have a BP_GDB breakpoint at the same address. We have a function for this: cpu_breakpoint_test. Signed-off-by: Richard Henderson --- target/i386/tcg/sysemu/bpt_helper.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) -- 2.25.1 diff --git a/target/i386/tcg/sysemu/bpt_helper.c b/target/i386/tcg/sysemu/bpt_helper.c index 9bdf7e170b..f1fb479ad9 100644 --- a/target/i386/tcg/sysemu/bpt_helper.c +++ b/target/i386/tcg/sysemu/bpt_helper.c @@ -210,7 +210,6 @@ void breakpoint_handler(CPUState *cs) { X86CPU *cpu = X86_CPU(cs); CPUX86State *env = &cpu->env; - CPUBreakpoint *bp; if (cs->watchpoint_hit) { if (cs->watchpoint_hit->flags & BP_CPU) { @@ -222,14 +221,9 @@ void breakpoint_handler(CPUState *cs) } } } else { - QTAILQ_FOREACH(bp, &cs->breakpoints, entry) { - if (bp->pc == env->eip) { - if (bp->flags & BP_CPU) { - check_hw_breakpoints(env, true); - raise_exception(env, EXCP01_DB); - } - break; - } + if (cpu_breakpoint_test(cs, env->eip, BP_CPU)) { + check_hw_breakpoints(env, true); + raise_exception(env, EXCP01_DB); } } } From patchwork Thu Jul 1 15:25:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 469096 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp496082jao; Thu, 1 Jul 2021 08:26:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyMrqPH/gIHbQBXNrx9WWhLCc84etBpCVeQlIU35zi5oh98Gjr4DaC/y8Ocm1htJ7wjHUlG X-Received: by 2002:a05:6402:2749:: with SMTP id z9mr517335edd.300.1625153214962; Thu, 01 Jul 2021 08:26:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625153214; cv=none; d=google.com; s=arc-20160816; b=BcweAr9hYn2v8UZhxctYDaxIq+iHqD4AzxGhJ64Uz4DvqFkX9CsHfiITJXZeawFqBY YDdre4lkMaSlnz762Cju64s4g0DCzAijvGTKmJBoMM6LUclOWt3vzzHMflMpfIESu0c8 48/bgV3Y34sRbUpsbYeNHjtGtOkRrgE/ctocr/Aw4SJcQP89NjYyitsMGoYD/l0rRSnj D+mYE4Vcxc6deqP+yzY+AZOpeb8rWrC4P0gI9G88kFlQVTwdZ+fMNkB/OSu6jPPkvN+0 m42vH1db3aG3ZOjukNeZRQD9XHWzeONedEFfeF6cIsLGZrmMV6TRBpRZfVWFjahXQX1H C84A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=0vRIHqeRyM8fI+g5SmswZ/3igwA5aeF29s3zHSl2bx4=; b=0wzV3qXKJkEun4nWolhSFaS6x2BNQEueMjBeq/0Z6k0Ziz0GIdZACAM65ZCAPfxyBl Oi/oq9miqGnz1WpkFuNgjjFBvBQpHxGWfRs48B7nci6ULlOROCOD39xlm9yLbnoymKmy cVQ9pWrOnfbRBHIIosXVuxs/U14zY35GRoNP/Tl/NiWQoVJOYQjuKvjGliPNNganeiaU xTc8qBdZKS0lLcO9o57fvqGCiv7QOcLYsiLHo9ZDy4clFDPjp17ZlS3pRPHhs1D3ynaa DZ7XOHZaWeUdn7HSsJKQDmZEC7hXs4GDF7hKKN+x9ThKKj3LIcHYsp/0OtfYIYAvRBlp OQew== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=lHjUzNrq; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id b3si78185edf.362.2021.07.01.08.26.54 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 01 Jul 2021 08:26:54 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=lHjUzNrq; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:34158 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lyyab-0004Ol-UN for patch@linaro.org; Thu, 01 Jul 2021 11:26:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52842) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lyyZY-0004OO-4S for qemu-devel@nongnu.org; Thu, 01 Jul 2021 11:25:48 -0400 Received: from mail-pg1-x529.google.com ([2607:f8b0:4864:20::529]:35693) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lyyZS-00088m-70 for qemu-devel@nongnu.org; Thu, 01 Jul 2021 11:25:47 -0400 Received: by mail-pg1-x529.google.com with SMTP id v7so6432556pgl.2 for ; Thu, 01 Jul 2021 08:25:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=0vRIHqeRyM8fI+g5SmswZ/3igwA5aeF29s3zHSl2bx4=; b=lHjUzNrqdJ4ZuELys5pKoTIHkUjdfwcnsW8eZ9zvW1MR3ms9JG1Hz6CTgfDiy3rJXB mU9Jsi8eBVgObjHQLOOMCcKc1ORrsljCtZqlJpVd2mtpoir0w5j9yxfz5hDkwg80ilWj SmPJvNYgaG9HN3CpQskfvb6A0LRn2v53+hKYzu74c+LX7Qi6h9GwqPELuMkBbETzIrKt TX5F30VkFjSuqKBJ3sayzGHNCKnQtxR3BX2OoOhm1zlm43e2nPuLmHg5JT+IBXZJpX7J guETt57AdEb/eeUczjRiXyPGLYN53TsGhNxaqg3vWIEz3QF2KVe32W5M6eqVl3YhE4on tVSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=0vRIHqeRyM8fI+g5SmswZ/3igwA5aeF29s3zHSl2bx4=; b=RjG5dEqSEcP6Q7b0nCRo7uwgPd/D3EKBHHTALGfMQJaOQds9iqF/wprYpbxzTGJDFa 7jnz2RNCAyKX2Yf1lQQGkm/vZqzbfBuAF4Nd2ZXE4iPLd92UMUux0c6wHRVktwvTP3zO fvIraZg2M+d5/ua0kaX7lb3lyCwyolSQA4KcZZcG06Wcy+cZLBxvPge7HFV86j61kBMh xiXe6A43DHCee8uNvPkzt+w41N3DoqeIQV9SqKFjgLNqePwETVFdidHql8w70lxcdBc8 zOAf4YhI33rsSztxXR4NH/xWrXLm5t2NwnSs/vzBcOBapc+NjNlyEylBpmtxWss2Wvvn ogvg== X-Gm-Message-State: AOAM532ryfYnxB2IUhnSm+N3oADHzBTnBKmlRIkKH5rhNQhN7Vm2+972 EhHmaR/1S7pkRS3UrofeRNl/SZWK0scy3w== X-Received: by 2002:a63:5d5c:: with SMTP id o28mr194707pgm.22.1625153139956; Thu, 01 Jul 2021 08:25:39 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id j4sm10213197pjv.7.2021.07.01.08.25.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Jul 2021 08:25:39 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 02/17] accel/tcg: Move helper_lookup_tb_ptr to cpu-exec.c Date: Thu, 1 Jul 2021 08:25:22 -0700 Message-Id: <20210701152537.3330420-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210701152537.3330420-1-richard.henderson@linaro.org> References: <20210701152537.3330420-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::529; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x529.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, mark.cave-ayland@ilande.co.uk, alex.bennee@linaro.org, f4bug@amsat.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" This will allow additional code sharing. No functional change. Signed-off-by: Richard Henderson --- accel/tcg/cpu-exec.c | 30 ++++++++++++++++++++++++++++++ accel/tcg/tcg-runtime.c | 22 ---------------------- 2 files changed, 30 insertions(+), 22 deletions(-) -- 2.25.1 Reviewed-by: Philippe Mathieu-Daudé diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c index ad1279d2ed..fb6668606f 100644 --- a/accel/tcg/cpu-exec.c +++ b/accel/tcg/cpu-exec.c @@ -38,6 +38,7 @@ #include "exec/cpu-all.h" #include "sysemu/cpu-timers.h" #include "sysemu/replay.h" +#include "exec/helper-proto.h" #include "tb-hash.h" #include "tb-lookup.h" #include "tb-context.h" @@ -145,6 +146,35 @@ static void init_delay_params(SyncClocks *sc, const CPUState *cpu) } #endif /* CONFIG USER ONLY */ +/** + * helper_lookup_tb_ptr: quick check for next tb + * @env: current cpu state + * + * Look for an existing TB matching the current cpu state. + * If found, return the code pointer. If not found, return + * the tcg epilogue so that we return into cpu_tb_exec. + */ +const void *HELPER(lookup_tb_ptr)(CPUArchState *env) +{ + CPUState *cpu = env_cpu(env); + TranslationBlock *tb; + target_ulong cs_base, pc; + uint32_t flags; + + cpu_get_tb_cpu_state(env, &pc, &cs_base, &flags); + + tb = tb_lookup(cpu, pc, cs_base, flags, curr_cflags(cpu)); + if (tb == NULL) { + return tcg_code_gen_epilogue; + } + qemu_log_mask_and_addr(CPU_LOG_EXEC, pc, + "Chain %d: %p [" + TARGET_FMT_lx "/" TARGET_FMT_lx "/%#x] %s\n", + cpu->cpu_index, tb->tc.ptr, cs_base, pc, flags, + lookup_symbol(pc)); + return tb->tc.ptr; +} + /* Execute a TB, and fix up the CPU state afterwards if necessary */ /* * Disable CFI checks. diff --git a/accel/tcg/tcg-runtime.c b/accel/tcg/tcg-runtime.c index 66ac830e2f..e4e030043f 100644 --- a/accel/tcg/tcg-runtime.c +++ b/accel/tcg/tcg-runtime.c @@ -30,7 +30,6 @@ #include "disas/disas.h" #include "exec/log.h" #include "tcg/tcg.h" -#include "tb-lookup.h" /* 32-bit helpers */ @@ -145,27 +144,6 @@ uint64_t HELPER(ctpop_i64)(uint64_t arg) return ctpop64(arg); } -const void *HELPER(lookup_tb_ptr)(CPUArchState *env) -{ - CPUState *cpu = env_cpu(env); - TranslationBlock *tb; - target_ulong cs_base, pc; - uint32_t flags; - - cpu_get_tb_cpu_state(env, &pc, &cs_base, &flags); - - tb = tb_lookup(cpu, pc, cs_base, flags, curr_cflags(cpu)); - if (tb == NULL) { - return tcg_code_gen_epilogue; - } - qemu_log_mask_and_addr(CPU_LOG_EXEC, pc, - "Chain %d: %p [" - TARGET_FMT_lx "/" TARGET_FMT_lx "/%#x] %s\n", - cpu->cpu_index, tb->tc.ptr, cs_base, pc, flags, - lookup_symbol(pc)); - return tb->tc.ptr; -} - void HELPER(exit_atomic)(CPUArchState *env) { cpu_loop_exit_atomic(env_cpu(env), GETPC()); From patchwork Thu Jul 1 15:25:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 469104 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp499562jao; Thu, 1 Jul 2021 08:30:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxRakzYD+Dpl2a/LTZSuX92ak2ftR8JrYlSKWWLbidcn/PdnwFgAcGFHMwBtV2Z92IjSz30 X-Received: by 2002:a05:6402:4308:: with SMTP id m8mr496294edc.237.1625153454599; Thu, 01 Jul 2021 08:30:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625153454; cv=none; d=google.com; s=arc-20160816; b=XGRjOvWxyvHNqY5QrKl54Gqy3nNtESnQEaHegY3iESXw/dXZ8r1IRhJfqRFUo/t8EI UbllqI/1FF4iOE+pPGBfFJZ2r5o7af3/fuZFrDdD5wfWIBpvX6OAn8wmqvumaqEHuC34 0YyEnuS3IbkR66lQDGYAZGvPzOk0b3d+ZavXWSm6P5DOr42i7MJi9l3ngU5mXMNxbQVk 7lmfnsCuVgLbi1wWj9oIEtSE8blwDFYyvQWpj5PEXPUXEK3zv4Ptk11zGwxHVnEys6TK v+XJyQxP9ticQTzxM6skBmmcXvnh1V/9ikyBy/j6UVwuYDe+2uwayEBad7GbG10wLssd ///Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=TJZF8LWW+S/evT7bkuT0HfWov+1lUwCTXAU5MMH8g9E=; b=H6u9dFJkiujbJYVrpMQkm1aGvGBXhBiFz4bCQoWHpeE66uYtTmo9+ZCVnSLP3twawm UtN4xG91A94PUP4e6naJtYnYIeSTf0CHQ6kSWAEtw9pctwgbcRtIyQaC0MVJlFz5mCzC jW3FyNUSCWJpP0s2uzzcyyshRAURBED8d4/PIkGu39OlWzIELJ4qJTek2asfUIccptEG HMaAr/zma/3PTNrjKKmsP1RdGs9ScTGoBcu85oC/ey96FbzNuc38dU3UFxTbWqT1ktTU PQBzjtHMbGYBrq1fMS3HmCMDhyQZI+EZuPIgPGA8HP7YIqhVnT9Z+yTFA8mullO7EDWg Udow== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=pqpfExdd; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id y15si101080eda.75.2021.07.01.08.30.54 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 01 Jul 2021 08:30:54 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=pqpfExdd; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:51766 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lyyeT-0007xc-HT for patch@linaro.org; Thu, 01 Jul 2021 11:30:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52968) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lyyZi-0004Yw-E0 for qemu-devel@nongnu.org; Thu, 01 Jul 2021 11:25:58 -0400 Received: from mail-pj1-x102a.google.com ([2607:f8b0:4864:20::102a]:42742) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lyyZS-00089P-BO for qemu-devel@nongnu.org; Thu, 01 Jul 2021 11:25:58 -0400 Received: by mail-pj1-x102a.google.com with SMTP id p17-20020a17090b0111b02901723ab8d11fso4171216pjz.1 for ; Thu, 01 Jul 2021 08:25:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=TJZF8LWW+S/evT7bkuT0HfWov+1lUwCTXAU5MMH8g9E=; b=pqpfExdd9ILT2SiRxYpTlokLdbQMiKqjgAySps1UuI3DN0chCCiv5UAyQ7hAwc1FP+ mg7z3/JBGh7vgcPgEIHIVUFdmw/maGZxMUsKCun/4BuqnY6k/wNEnvFaCp1AsPJ21gYC vhuGSo6aTTPbpOzsIIOvhsJLNBqlverPt1t6YrJunA/4wo4w0khVrGFUxPpCIw/ocdX2 BCOmxadi78rd4jjiJdk/ZzoEyGfRSErB236oJoagWPkXybt7553JQ0lk+YzXS0ZDl+Ug Tkox6wtQfns8e55fxoAnyhKe139i57gt5PqIdNl7aegaC/ApziOlo0pNDdJs7/7X3FSH jM3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=TJZF8LWW+S/evT7bkuT0HfWov+1lUwCTXAU5MMH8g9E=; b=e4vcouGJGZbkky92beMp3PXaAABXGCfy/DFh0DtdgdVjKPmuA2p+2+r8NyB58PGGvZ PDEP1KkJeHdE0GJVrCJUq03GB+qVhTOZ5C0bjLzFjGbnUlhR0llqL/ImLweAp7LVSpgB WZdgrcHLWMrJmFKZmct59waKkoirppjFXUCzk/3Dczg5PS9gsn3GWDqBbzEM/Slx2JQf Pkfv9uqWlVosmKhqiPgfTkcNMoJ1q3ZyV4O02/EUA1eiQF57OfNX7AOyyzX3XpbAzjTk YfS4ZcOcXAXW92g+YQjQue4fHnBKVxnk5ohek4TP3Dd+BZ2UtF39XgjoHV9tUBp5tK42 78qg== X-Gm-Message-State: AOAM53095rK4nPenQyHkxCFYkT8gbsQAZIGPMABoKezsAC66zGO2b4oH yRcuiHOrJo8CvX4sciqnUCZX3wYbJncM/w== X-Received: by 2002:a17:90a:a087:: with SMTP id r7mr10756966pjp.84.1625153140620; Thu, 01 Jul 2021 08:25:40 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id j4sm10213197pjv.7.2021.07.01.08.25.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Jul 2021 08:25:40 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 03/17] accel/tcg: Move tb_lookup to cpu-exec.c Date: Thu, 1 Jul 2021 08:25:23 -0700 Message-Id: <20210701152537.3330420-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210701152537.3330420-1-richard.henderson@linaro.org> References: <20210701152537.3330420-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102a; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, mark.cave-ayland@ilande.co.uk, alex.bennee@linaro.org, f4bug@amsat.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Now that we've moved helper_lookup_tb_ptr, the only user of tb-lookup.h is cpu-exec.c; merge the contents in. Signed-off-by: Richard Henderson --- accel/tcg/tb-lookup.h | 49 ------------------------------------------- accel/tcg/cpu-exec.c | 31 ++++++++++++++++++++++++++- 2 files changed, 30 insertions(+), 50 deletions(-) delete mode 100644 accel/tcg/tb-lookup.h -- 2.25.1 Reviewed-by: Philippe Mathieu-Daudé diff --git a/accel/tcg/tb-lookup.h b/accel/tcg/tb-lookup.h deleted file mode 100644 index 9c9e0079da..0000000000 --- a/accel/tcg/tb-lookup.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (C) 2017, Emilio G. Cota - * - * License: GNU GPL, version 2 or later. - * See the COPYING file in the top-level directory. - */ -#ifndef EXEC_TB_LOOKUP_H -#define EXEC_TB_LOOKUP_H - -#ifdef NEED_CPU_H -#include "cpu.h" -#else -#include "exec/poison.h" -#endif - -#include "exec/exec-all.h" -#include "tb-hash.h" - -/* Might cause an exception, so have a longjmp destination ready */ -static inline TranslationBlock *tb_lookup(CPUState *cpu, target_ulong pc, - target_ulong cs_base, - uint32_t flags, uint32_t cflags) -{ - TranslationBlock *tb; - uint32_t hash; - - /* we should never be trying to look up an INVALID tb */ - tcg_debug_assert(!(cflags & CF_INVALID)); - - hash = tb_jmp_cache_hash_func(pc); - tb = qatomic_rcu_read(&cpu->tb_jmp_cache[hash]); - - if (likely(tb && - tb->pc == pc && - tb->cs_base == cs_base && - tb->flags == flags && - tb->trace_vcpu_dstate == *cpu->trace_dstate && - tb_cflags(tb) == cflags)) { - return tb; - } - tb = tb_htable_lookup(cpu, pc, cs_base, flags, cflags); - if (tb == NULL) { - return NULL; - } - qatomic_set(&cpu->tb_jmp_cache[hash], tb); - return tb; -} - -#endif /* EXEC_TB_LOOKUP_H */ diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c index fb6668606f..0d92698030 100644 --- a/accel/tcg/cpu-exec.c +++ b/accel/tcg/cpu-exec.c @@ -40,7 +40,6 @@ #include "sysemu/replay.h" #include "exec/helper-proto.h" #include "tb-hash.h" -#include "tb-lookup.h" #include "tb-context.h" #include "internal.h" @@ -146,6 +145,36 @@ static void init_delay_params(SyncClocks *sc, const CPUState *cpu) } #endif /* CONFIG USER ONLY */ +/* Might cause an exception, so have a longjmp destination ready */ +static inline TranslationBlock *tb_lookup(CPUState *cpu, target_ulong pc, + target_ulong cs_base, + uint32_t flags, uint32_t cflags) +{ + TranslationBlock *tb; + uint32_t hash; + + /* we should never be trying to look up an INVALID tb */ + tcg_debug_assert(!(cflags & CF_INVALID)); + + hash = tb_jmp_cache_hash_func(pc); + tb = qatomic_rcu_read(&cpu->tb_jmp_cache[hash]); + + if (likely(tb && + tb->pc == pc && + tb->cs_base == cs_base && + tb->flags == flags && + tb->trace_vcpu_dstate == *cpu->trace_dstate && + tb_cflags(tb) == cflags)) { + return tb; + } + tb = tb_htable_lookup(cpu, pc, cs_base, flags, cflags); + if (tb == NULL) { + return NULL; + } + qatomic_set(&cpu->tb_jmp_cache[hash], tb); + return tb; +} + /** * helper_lookup_tb_ptr: quick check for next tb * @env: current cpu state From patchwork Thu Jul 1 15:25:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 469095 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp495704jao; Thu, 1 Jul 2021 08:26:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxfjVWS1IpPds7vASilvL61UB4Ao1gYsOoIg/LcmHV6heovdMH3Y1Ic6Bh+4FfeRvs/U51q X-Received: by 2002:aa7:d150:: with SMTP id r16mr549669edo.210.1625153186979; Thu, 01 Jul 2021 08:26:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625153186; cv=none; d=google.com; s=arc-20160816; b=Doo+4XWsEZRkrOorwn9Na8kFOIQq+voWNmb98jWnUqT5yuBwXvkFoPvmHeBh948EBX vD3wcFKDTobrNwMMh9TmdSHjODFmxK06oBl7AhOFv34b8pKxpAUTIVT8Md8lwrFcXuaW HHMKo0JN/kzxzrtO1V6z7+YyXkTSf/Rj3IrPJHLmTBl5xSkpbGWFw2XC14B/cKSVZLDQ VSBwWWmdu/CMyGPF4QcDwjobi3031SNavcgBNAKPI5uF2XrkBVafMDLAVWUD7V62I6BW xArz445LS14MxEdbLx7+Qw1cPhmzLG5pkn45X7tczEiavZ1/uEK8bMKrPlVLbAH/iQPF iTeA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=i7Yv44S3soVKhBIR2nVe5GqBZQT4ofBHKeU6kY+QU8k=; b=apU188qlXsPh5Ower7IWRZurQ0YkgjbmAAYbkUaDQ4BkRYe84dOjgrUCklQ48ptd+y 97wiURA3BzbdVW78sE7JoM06hbLS+oFb4E9E5PuxE9Z4aVxzv4faSiT4keDW96i4YSnk jym3PgpHOhxliwXiwTdqqlU5c729e2p4POntUzS249k701gyUs3qdHfy+hJtGmERGPSO 3/D8OFsRV1Ko2GOMqxB+ENUXVwGLTkEJPJsLqbtcFl9L50+yOAQ9nAzJ6sTvoIlJpFkz +W+oc18po40cEgVPAgwjJjzAXv3lOcFt3CEEOODT4j4cJCHGHGNmIxhzj05n2AbpEOrK zjyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=ey5e9myc; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id m7si90510edq.86.2021.07.01.08.26.26 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 01 Jul 2021 08:26:26 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=ey5e9myc; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:34270 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lyya9-0004Wi-Vs for patch@linaro.org; Thu, 01 Jul 2021 11:26:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52916) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lyyZd-0004Q8-RO for qemu-devel@nongnu.org; Thu, 01 Jul 2021 11:25:54 -0400 Received: from mail-pg1-x531.google.com ([2607:f8b0:4864:20::531]:38810) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lyyZT-0008A3-VH for qemu-devel@nongnu.org; Thu, 01 Jul 2021 11:25:51 -0400 Received: by mail-pg1-x531.google.com with SMTP id h4so6415067pgp.5 for ; Thu, 01 Jul 2021 08:25:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=i7Yv44S3soVKhBIR2nVe5GqBZQT4ofBHKeU6kY+QU8k=; b=ey5e9mycMNZxCgnId6p6mxPLm0GuUqM8fVAG2z6e1B/mdNm5/2SerTryPobih7msfi SyqZ6lrysWm41m56AJbgcyBdYP6d11BdKS4FJlZH1gq8HOgTHUIcJCogHt5JBD1qJoSh Zc1cKqq3910mPTXxpUB7Iw+Rl76Q3FE4hYilyK7Vte+B/3XioCrwwGvstp1cV+80XVZ2 o1IcPUsrjVfyEcmoe4Htt+zDgei5LXG+T3LoGzWbFDBxLw3+4/Cqef1pdChsTofuXjPa Tdqb73hjQqYPYVD6y1VetxttNF7M/wQ0K9r+YROhM8oyH9tasYxyp3uM9yQxNo4uoQOk aYhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=i7Yv44S3soVKhBIR2nVe5GqBZQT4ofBHKeU6kY+QU8k=; b=ewvUzBGndpwJJkuefLrCWgh945NF6Rh4kfqBKNSiTuQlL4/N+4K/dktp7maNvH3TQD XNS/fEEGcKlTON/dCsFy6OLDhVEQbJ8uK85GgRnFzbAvYXMWf7yOj+08XitJnBdYdxFX 9Fw7tcH8Lh5FKDwgrdI8G9MMeBa6TNUwGx87cMdODNiNRbPYdmM63P0A9s5mKTEQjoYW j05EZarFv5shN6fyHdLzAASMHt3F6m57DHPSDUeWsn55OTzq5kU1qvCMqwdV1fm8xjRk I2xhzzxvisOC1oknawWrpoqhmoEwk6ysDqFjq+T7XfvM7wJ2ZAzMuhck7uS9jgf8K4ah 2pGQ== X-Gm-Message-State: AOAM532L/IF9qa6vlah4Bt4a9Ru46O0MD9GeY4pIQkffMWBlifvHCXQK LzniZyl+K9DQAPf4L1VMcPGrQFxLicg4XA== X-Received: by 2002:a62:e318:0:b029:30a:bdd:f979 with SMTP id g24-20020a62e3180000b029030a0bddf979mr282460pfh.8.1625153141096; Thu, 01 Jul 2021 08:25:41 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id j4sm10213197pjv.7.2021.07.01.08.25.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Jul 2021 08:25:40 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 04/17] accel/tcg: Split out log_cpu_exec Date: Thu, 1 Jul 2021 08:25:24 -0700 Message-Id: <20210701152537.3330420-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210701152537.3330420-1-richard.henderson@linaro.org> References: <20210701152537.3330420-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::531; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x531.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, mark.cave-ayland@ilande.co.uk, alex.bennee@linaro.org, f4bug@amsat.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Split out CPU_LOG_EXEC and CPU_LOG_TB_CPU logging from cpu_tb_exec to a new function. Perform only one pc range check after a combined mask check. Use the new function in lookup_tb_ptr. This enables CPU_LOG_TB_CPU between indirectly chained tbs. Signed-off-by: Richard Henderson --- accel/tcg/cpu-exec.c | 61 ++++++++++++++++++++++++-------------------- 1 file changed, 34 insertions(+), 27 deletions(-) -- 2.25.1 diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c index 0d92698030..67ed25beb9 100644 --- a/accel/tcg/cpu-exec.c +++ b/accel/tcg/cpu-exec.c @@ -175,6 +175,36 @@ static inline TranslationBlock *tb_lookup(CPUState *cpu, target_ulong pc, return tb; } +static inline void log_cpu_exec(target_ulong pc, CPUState *cpu, + const TranslationBlock *tb) +{ + if (unlikely(qemu_loglevel_mask(CPU_LOG_TB_CPU | CPU_LOG_EXEC)) + && qemu_log_in_addr_range(pc)) { + + qemu_log_mask(CPU_LOG_EXEC, + "Trace %d: %p [" TARGET_FMT_lx + "/" TARGET_FMT_lx "/%#x] %s\n", + cpu->cpu_index, tb->tc.ptr, tb->cs_base, pc, tb->flags, + lookup_symbol(pc)); + +#if defined(DEBUG_DISAS) + if (qemu_loglevel_mask(CPU_LOG_TB_CPU)) { + FILE *logfile = qemu_log_lock(); + int flags = 0; + + if (qemu_loglevel_mask(CPU_LOG_TB_FPU)) { + flags |= CPU_DUMP_FPU; + } +#if defined(TARGET_I386) + flags |= CPU_DUMP_CCOP; +#endif + log_cpu_state(cpu, flags); + qemu_log_unlock(logfile); + } +#endif /* DEBUG_DISAS */ + } +} + /** * helper_lookup_tb_ptr: quick check for next tb * @env: current cpu state @@ -196,11 +226,9 @@ const void *HELPER(lookup_tb_ptr)(CPUArchState *env) if (tb == NULL) { return tcg_code_gen_epilogue; } - qemu_log_mask_and_addr(CPU_LOG_EXEC, pc, - "Chain %d: %p [" - TARGET_FMT_lx "/" TARGET_FMT_lx "/%#x] %s\n", - cpu->cpu_index, tb->tc.ptr, cs_base, pc, flags, - lookup_symbol(pc)); + + log_cpu_exec(pc, cpu, tb); + return tb->tc.ptr; } @@ -222,28 +250,7 @@ cpu_tb_exec(CPUState *cpu, TranslationBlock *itb, int *tb_exit) TranslationBlock *last_tb; const void *tb_ptr = itb->tc.ptr; - qemu_log_mask_and_addr(CPU_LOG_EXEC, itb->pc, - "Trace %d: %p [" - TARGET_FMT_lx "/" TARGET_FMT_lx "/%#x] %s\n", - cpu->cpu_index, itb->tc.ptr, - itb->cs_base, itb->pc, itb->flags, - lookup_symbol(itb->pc)); - -#if defined(DEBUG_DISAS) - if (qemu_loglevel_mask(CPU_LOG_TB_CPU) - && qemu_log_in_addr_range(itb->pc)) { - FILE *logfile = qemu_log_lock(); - int flags = 0; - if (qemu_loglevel_mask(CPU_LOG_TB_FPU)) { - flags |= CPU_DUMP_FPU; - } -#if defined(TARGET_I386) - flags |= CPU_DUMP_CCOP; -#endif - log_cpu_state(cpu, flags); - qemu_log_unlock(logfile); - } -#endif /* DEBUG_DISAS */ + log_cpu_exec(itb->pc, cpu, itb); qemu_thread_jit_execute(); ret = tcg_qemu_tb_exec(env, tb_ptr); From patchwork Thu Jul 1 15:25:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 469100 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp497408jao; Thu, 1 Jul 2021 08:28:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzmh2yT3mHu3mwp8b/xELgOlMfRj8l/5RY/Ucp8ksl9POeDlsAiZSMiKLYtBck5AlynSjsD X-Received: by 2002:a05:6402:1345:: with SMTP id y5mr544003edw.206.1625153308178; Thu, 01 Jul 2021 08:28:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625153308; cv=none; d=google.com; s=arc-20160816; b=JZjUe+ELp0ln1cxFIA3mY/Y+vhHHrwcr9t7duDWnxm28+eqnVwsMZXXgeGOAj4dIkm DXLTaEOZlnCPZnDW/L+Yh/AwW30VjKQCFGVNkG9eM7A+7Jn+2u0538CbXM/llFksPmfT EbXqVzq1VepG+etl8G+lvUD/94O50zA0cfIiJRpFU+YGRqsgVpTkb9AwsJraoZC3u2qI YXOmMRY1eBLl4UXGEtFGjgtc7ZJmrZJmh3iVf+INzktZudxeczOV4Pd4+Ledv1yLSkb+ eWmtfVmWJMxbGwU/EdVQFa2PYXDxh0urzEnnYtK+oEdz9JhG/pffvHV7UITr50JLTtSL crEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=uAAmFhWv7ETFd0R5nmqABtUFi5nWOXa6WEzfz5fyTtw=; b=Gf31X/7hOga/WumnQg6IJ6Ro/PFY1K4/LJRAVUABXl3ZR5lukT4LAO81yDZukCV1Rd 8Q8Y6zSgdclApBQ2n9KEcU45ygrysdo3senrSGEVtEEsoCVqGG5naC87qluVLckzp3L7 2Wsjwaa7pTqE1adJShCd70OZDvZ+sqsvlDTnSjGhkfo+Q/s8BViJB4ZERyWTg2zq5Q8s 8M5+P9WjWw1Z+vCJEU/9izC5YABZdj9p4TYmTYFgbq7OJzjBZP8k0XCZkog7+v1hnj7K ug901NW7+9Hi3okoIWnREgybx6kwuDuYlZncA9Z1pk3NDbAVRE/WCLWDqND+3puP+adv jgtg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=asJ6kI5G; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id r21si320217ejo.665.2021.07.01.08.28.28 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 01 Jul 2021 08:28:28 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=asJ6kI5G; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:42898 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lyyc7-0001vj-3M for patch@linaro.org; Thu, 01 Jul 2021 11:28:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52942) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lyyZf-0004SO-S8 for qemu-devel@nongnu.org; Thu, 01 Jul 2021 11:25:57 -0400 Received: from mail-pf1-x434.google.com ([2607:f8b0:4864:20::434]:47064) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lyyZU-0008AY-00 for qemu-devel@nongnu.org; Thu, 01 Jul 2021 11:25:54 -0400 Received: by mail-pf1-x434.google.com with SMTP id x16so6163972pfa.13 for ; Thu, 01 Jul 2021 08:25:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=uAAmFhWv7ETFd0R5nmqABtUFi5nWOXa6WEzfz5fyTtw=; b=asJ6kI5G2uAY8rqPFp5tlwuic62fDFbksWKoeJ2ddtD82IJWGxj/jYFXLODq4h4Tp0 dd+Yt7SNzTF28/WnZ6UUd05KAguMzAZLDny/wGiBITTVzEaRuvI2h44cvMnNQar1JYgD a0N+QB7S9Zq/KRoVv7awpUERj0/+a28Xw2nno/XeGsxBk5VHgXM9NBpMayUGCmq3osbc JPto+wCtxulMF1U/HEMki0y4PkKVSX60upslBLw898qrr7j6EW3KBvKew/2lwMq/0ZgT Nzi9RE0zH3yybUpmPHKwY5iNE26htCAiLKHfzrH3S/bQCXM+o/GTaOpr8DXpv2NNMLjE LYjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=uAAmFhWv7ETFd0R5nmqABtUFi5nWOXa6WEzfz5fyTtw=; b=sz3hLNx3+crbgblpkZsPlRx5Ke6s6ZxLiuP+9D5p/Q/33O+ytmqg4jPswxIekAlmFk J7i++x49iIS+zS7W5vhYWmawcDw9qhfBJZSmBdhNb/w7NqPo+o5gVyacaIlpCzPkx5UB MDakjYnarFuqKh5fz13/TIt3iFGWmVIqAMNzC4irscv0nPAVTbyXXupLxur74RX5e7lo gTRjL3ENL139P6vW05TghvggE94+8tFU74BTwXl/gCuVW3H18qT4kCumToQ++mt6/ysF VFr3JcnF2bf1u5jTLa6C5KMHPipUy3HoQFS29nNLkOIpu3OdwCNfpoi2Y5Zu7zleioYa 9GBw== X-Gm-Message-State: AOAM530jBL5eYgSnQmln0YLsnlW52NoapSJ0b1NQzSF8+qH97X71wQ4l b++5ga+fdcjcVsUcOjwr7CHldjX169WH1Q== X-Received: by 2002:a65:4985:: with SMTP id r5mr183835pgs.122.1625153141665; Thu, 01 Jul 2021 08:25:41 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id j4sm10213197pjv.7.2021.07.01.08.25.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Jul 2021 08:25:41 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 05/17] accel/tcg: Log tb->cflags with -d exec Date: Thu, 1 Jul 2021 08:25:25 -0700 Message-Id: <20210701152537.3330420-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210701152537.3330420-1-richard.henderson@linaro.org> References: <20210701152537.3330420-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::434; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x434.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, mark.cave-ayland@ilande.co.uk, alex.bennee@linaro.org, f4bug@amsat.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Richard Henderson --- accel/tcg/cpu-exec.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) -- 2.25.1 Reviewed-by: Philippe Mathieu-Daudé diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c index 67ed25beb9..e22bcb99f7 100644 --- a/accel/tcg/cpu-exec.c +++ b/accel/tcg/cpu-exec.c @@ -183,9 +183,9 @@ static inline void log_cpu_exec(target_ulong pc, CPUState *cpu, qemu_log_mask(CPU_LOG_EXEC, "Trace %d: %p [" TARGET_FMT_lx - "/" TARGET_FMT_lx "/%#x] %s\n", - cpu->cpu_index, tb->tc.ptr, tb->cs_base, pc, tb->flags, - lookup_symbol(pc)); + "/" TARGET_FMT_lx "/%08x/%08x] %s\n", + cpu->cpu_index, tb->tc.ptr, tb->cs_base, pc, + tb->flags, tb->cflags, lookup_symbol(pc)); #if defined(DEBUG_DISAS) if (qemu_loglevel_mask(CPU_LOG_TB_CPU)) { From patchwork Thu Jul 1 15:25:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 469097 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp496097jao; Thu, 1 Jul 2021 08:26:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyMM9FJx4kBF5iGgQxdQwyqQFUzCc29d8yZ8nTJa+0feURi4UV9zU60HEpAruhFhWj4r/zl X-Received: by 2002:a17:907:7ba3:: with SMTP id ne35mr445413ejc.12.1625153216020; Thu, 01 Jul 2021 08:26:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625153216; cv=none; d=google.com; s=arc-20160816; b=EaDAbVVPqHxGQQPIeuj67IoMMHLQt1jit2ZUCkAZSJRbnXZR4NlpJnFkNK5fuSEKxb cl+UXwbvQa4m/KOgnXZlxaNMAlTtpYt8h7hsHoZzOoUjrjNEIM6CXZYXWxXYzVSSeJz5 IY1Nf0y0ppSYX6rpDcdmHL6si/QxuotsCdbSg1KjRqO5WGEX3QkSFIzUQDTThS/xUU+H 1Q2hwBu0BDvTjkfRk77gXMp0GRbzkgH6YebdMZ1bYc2yjV47fpvwUmOhBe+xI8tSFDjf RBiVL59GvIesc/0rnKYzaN0DL8Zp+wVvfxECqMJuhG230c1iP7oUxsbF4HJlS/OeY7D3 Ym4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=9ePUGZsAHBEe26yDZRAfe0zEes3hGcdtnoFWRa0Va/E=; b=HiUhnZZR0q2bcLw8LBrPXk/j1YzBs6WLeDGEuVZ7pCGS9wL8q9l4vxxXNO4y+IqJ4l g2gy/OrxoVqZCpMyrxavGSoW+WlkIlqjbQs5zOoCe7nSnKE7MtisytAKPLI3g+Vp5BTN G410jTjltu+6Fn9FE0MFHoNK1UuIPKo+pDT1xCMIU+yaDpvQp226v0t6iywUGrrFHBSQ qcVxNOiuFmIkDjG7ri2n7prME8YFXKzf+H8u+FwvDlgFxQiXNETCydLfTGmHv7aP4OVj SAwrVSazVNqc7tq/ZFJJy9E2BFWLYVENCLH+vHob17bYKnN/A7UH/tZELWpA2IHLAeOE 7syQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=XwOVVLwg; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id gb26si282676ejc.507.2021.07.01.08.26.55 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 01 Jul 2021 08:26:56 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=XwOVVLwg; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:34182 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lyyac-0004Pm-St for patch@linaro.org; Thu, 01 Jul 2021 11:26:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52884) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lyyZa-0004Of-0h for qemu-devel@nongnu.org; Thu, 01 Jul 2021 11:25:50 -0400 Received: from mail-pf1-x429.google.com ([2607:f8b0:4864:20::429]:47054) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lyyZU-0008Bs-0U for qemu-devel@nongnu.org; Thu, 01 Jul 2021 11:25:49 -0400 Received: by mail-pf1-x429.google.com with SMTP id x16so6164013pfa.13 for ; Thu, 01 Jul 2021 08:25:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=9ePUGZsAHBEe26yDZRAfe0zEes3hGcdtnoFWRa0Va/E=; b=XwOVVLwghZpeBv16a3H0V66ony/ubKCTXzTLYoV6mJOlka1sOtyz/Lgv+JcyXpJOiM 9umLD0iZ/cdYF4TsXrDkrLz3Xw441FWe7w8wham1bsy8lYMieXTyQkgQCYltqXmxJ90f NaUJAhe6KpcCFhG2BYhz3ba0fHtLWIcoYfpRBhfT3o+AjOFgaSvsTgTNewqImUeLctIh nMqRioBmQIoF7kl1iBE0gk5u7vSCYNSZrioKEu2GSv9ZDxLrEzGngEUGaFDVDLOV1//i Km3Y5HXvbSXkTGvNTur17xQfwNW1tyx2fYUSO7OOuk0AapFwIWObcehhvjU8PQBOin15 VUEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=9ePUGZsAHBEe26yDZRAfe0zEes3hGcdtnoFWRa0Va/E=; b=sFeZ80NRwEarO9Q+QHgs5jrJROYcNwkRhVwhC0FsfQfHURe5TMVz1eYlqw410Nfdqy SZ5hwSIW5VnM23BhAcnVQd0IYM9vtfN60PbJCDcZqtk8lgkQy1yEp4g+72RBruae907l 44+EeV4PJ3A2GSOc2KxwhFAkV/3tABvcMk9VQDAxCs0UegnSdeDV1Biq+RsCtSodN8Ry D9Ex1jTace727tH+woYAIlcwq6aIYaEYkXLVfRw/0zIbBcf6U8QkDh9HHXVCWB4U8vKk YjOYXc8svvbnk1cQirLM1S0FAHbZK5ktgfzF0qAy68FA7WXpGSVvYVW2UhGndREdHWUL X/FQ== X-Gm-Message-State: AOAM531Z5ViipbF70x7H+bOdIfAhm5No+jYA20owLfmmKWOTmK1eV8qi jj35/hK4dSo7Hr51l1MVDxRFcKRNCtEd3w== X-Received: by 2002:a62:7950:0:b029:30f:cffa:a25e with SMTP id u77-20020a6279500000b029030fcffaa25emr557213pfc.50.1625153142264; Thu, 01 Jul 2021 08:25:42 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id j4sm10213197pjv.7.2021.07.01.08.25.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Jul 2021 08:25:42 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 06/17] tcg: Remove TCG_TARGET_HAS_goto_ptr Date: Thu, 1 Jul 2021 08:25:26 -0700 Message-Id: <20210701152537.3330420-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210701152537.3330420-1-richard.henderson@linaro.org> References: <20210701152537.3330420-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::429; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x429.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, mark.cave-ayland@ilande.co.uk, alex.bennee@linaro.org, f4bug@amsat.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Since 6eea04347eb6, all tcg backends support goto_ptr. Remove the conditional, making support mandatory. Signed-off-by: Richard Henderson --- include/tcg/tcg-opc.h | 3 +-- tcg/aarch64/tcg-target.h | 1 - tcg/arm/tcg-target.h | 1 - tcg/i386/tcg-target.h | 1 - tcg/mips/tcg-target.h | 1 - tcg/ppc/tcg-target.h | 1 - tcg/riscv/tcg-target.h | 1 - tcg/s390/tcg-target.h | 1 - tcg/sparc/tcg-target.h | 1 - tcg/tci/tcg-target.h | 1 - tcg/tcg-op.c | 2 +- tcg/tcg.c | 8 ++------ 12 files changed, 4 insertions(+), 18 deletions(-) -- 2.25.1 Reviewed-by: Philippe Mathieu-Daudé diff --git a/include/tcg/tcg-opc.h b/include/tcg/tcg-opc.h index 993992373e..675873e200 100644 --- a/include/tcg/tcg-opc.h +++ b/include/tcg/tcg-opc.h @@ -194,8 +194,7 @@ DEF(insn_start, 0, 0, TLADDR_ARGS * TARGET_INSN_START_WORDS, TCG_OPF_NOT_PRESENT) DEF(exit_tb, 0, 0, 1, TCG_OPF_BB_EXIT | TCG_OPF_BB_END) DEF(goto_tb, 0, 0, 1, TCG_OPF_BB_EXIT | TCG_OPF_BB_END) -DEF(goto_ptr, 0, 1, 0, - TCG_OPF_BB_EXIT | TCG_OPF_BB_END | IMPL(TCG_TARGET_HAS_goto_ptr)) +DEF(goto_ptr, 0, 1, 0, TCG_OPF_BB_EXIT | TCG_OPF_BB_END) DEF(plugin_cb_start, 0, 0, 3, TCG_OPF_NOT_PRESENT) DEF(plugin_cb_end, 0, 0, 0, TCG_OPF_NOT_PRESENT) diff --git a/tcg/aarch64/tcg-target.h b/tcg/aarch64/tcg-target.h index 551baf8da3..7a93ac8023 100644 --- a/tcg/aarch64/tcg-target.h +++ b/tcg/aarch64/tcg-target.h @@ -88,7 +88,6 @@ typedef enum { #define TCG_TARGET_HAS_mulsh_i32 0 #define TCG_TARGET_HAS_extrl_i64_i32 0 #define TCG_TARGET_HAS_extrh_i64_i32 0 -#define TCG_TARGET_HAS_goto_ptr 1 #define TCG_TARGET_HAS_qemu_st8_i32 0 #define TCG_TARGET_HAS_div_i64 1 diff --git a/tcg/arm/tcg-target.h b/tcg/arm/tcg-target.h index 95fcef33bc..d113b7f8db 100644 --- a/tcg/arm/tcg-target.h +++ b/tcg/arm/tcg-target.h @@ -148,7 +148,6 @@ extern bool use_neon_instructions; #define TCG_TARGET_HAS_mulsh_i32 0 #define TCG_TARGET_HAS_div_i32 use_idiv_instructions #define TCG_TARGET_HAS_rem_i32 0 -#define TCG_TARGET_HAS_goto_ptr 1 #define TCG_TARGET_HAS_direct_jump 0 #define TCG_TARGET_HAS_qemu_st8_i32 0 diff --git a/tcg/i386/tcg-target.h b/tcg/i386/tcg-target.h index ac10066c3e..b00a6da293 100644 --- a/tcg/i386/tcg-target.h +++ b/tcg/i386/tcg-target.h @@ -135,7 +135,6 @@ extern bool have_movbe; #define TCG_TARGET_HAS_muls2_i32 1 #define TCG_TARGET_HAS_muluh_i32 0 #define TCG_TARGET_HAS_mulsh_i32 0 -#define TCG_TARGET_HAS_goto_ptr 1 #define TCG_TARGET_HAS_direct_jump 1 #if TCG_TARGET_REG_BITS == 64 diff --git a/tcg/mips/tcg-target.h b/tcg/mips/tcg-target.h index e81e824cab..3a62055f04 100644 --- a/tcg/mips/tcg-target.h +++ b/tcg/mips/tcg-target.h @@ -136,7 +136,6 @@ extern bool use_mips32r2_instructions; #define TCG_TARGET_HAS_muluh_i32 1 #define TCG_TARGET_HAS_mulsh_i32 1 #define TCG_TARGET_HAS_bswap32_i32 1 -#define TCG_TARGET_HAS_goto_ptr 1 #define TCG_TARGET_HAS_direct_jump 1 #if TCG_TARGET_REG_BITS == 64 diff --git a/tcg/ppc/tcg-target.h b/tcg/ppc/tcg-target.h index c13ed5640a..0943192cde 100644 --- a/tcg/ppc/tcg-target.h +++ b/tcg/ppc/tcg-target.h @@ -108,7 +108,6 @@ extern bool have_vsx; #define TCG_TARGET_HAS_muls2_i32 0 #define TCG_TARGET_HAS_muluh_i32 1 #define TCG_TARGET_HAS_mulsh_i32 1 -#define TCG_TARGET_HAS_goto_ptr 1 #define TCG_TARGET_HAS_direct_jump 1 #define TCG_TARGET_HAS_qemu_st8_i32 0 diff --git a/tcg/riscv/tcg-target.h b/tcg/riscv/tcg-target.h index 87ea94666b..ef78b99e98 100644 --- a/tcg/riscv/tcg-target.h +++ b/tcg/riscv/tcg-target.h @@ -85,7 +85,6 @@ typedef enum { #define TCG_TARGET_CALL_STACK_OFFSET 0 /* optional instructions */ -#define TCG_TARGET_HAS_goto_ptr 1 #define TCG_TARGET_HAS_movcond_i32 0 #define TCG_TARGET_HAS_div_i32 1 #define TCG_TARGET_HAS_rem_i32 1 diff --git a/tcg/s390/tcg-target.h b/tcg/s390/tcg-target.h index b04b72b7eb..2e4ede2ea2 100644 --- a/tcg/s390/tcg-target.h +++ b/tcg/s390/tcg-target.h @@ -98,7 +98,6 @@ extern uint64_t s390_facilities; #define TCG_TARGET_HAS_mulsh_i32 0 #define TCG_TARGET_HAS_extrl_i64_i32 0 #define TCG_TARGET_HAS_extrh_i64_i32 0 -#define TCG_TARGET_HAS_goto_ptr 1 #define TCG_TARGET_HAS_direct_jump (s390_facilities & FACILITY_GEN_INST_EXT) #define TCG_TARGET_HAS_qemu_st8_i32 0 diff --git a/tcg/sparc/tcg-target.h b/tcg/sparc/tcg-target.h index 86bb9a2d39..c050763049 100644 --- a/tcg/sparc/tcg-target.h +++ b/tcg/sparc/tcg-target.h @@ -121,7 +121,6 @@ extern bool use_vis3_instructions; #define TCG_TARGET_HAS_muls2_i32 1 #define TCG_TARGET_HAS_muluh_i32 0 #define TCG_TARGET_HAS_mulsh_i32 0 -#define TCG_TARGET_HAS_goto_ptr 1 #define TCG_TARGET_HAS_direct_jump 1 #define TCG_TARGET_HAS_qemu_st8_i32 0 diff --git a/tcg/tci/tcg-target.h b/tcg/tci/tcg-target.h index 7b6089f304..033e613f24 100644 --- a/tcg/tci/tcg-target.h +++ b/tcg/tci/tcg-target.h @@ -87,7 +87,6 @@ #define TCG_TARGET_HAS_muls2_i32 1 #define TCG_TARGET_HAS_muluh_i32 0 #define TCG_TARGET_HAS_mulsh_i32 0 -#define TCG_TARGET_HAS_goto_ptr 1 #define TCG_TARGET_HAS_direct_jump 0 #define TCG_TARGET_HAS_qemu_st8_i32 0 diff --git a/tcg/tcg-op.c b/tcg/tcg-op.c index 44d711c0fc..3d5db9a33c 100644 --- a/tcg/tcg-op.c +++ b/tcg/tcg-op.c @@ -2754,7 +2754,7 @@ void tcg_gen_goto_tb(unsigned idx) void tcg_gen_lookup_and_goto_ptr(void) { - if (TCG_TARGET_HAS_goto_ptr && !qemu_loglevel_mask(CPU_LOG_TB_NOCHAIN)) { + if (!qemu_loglevel_mask(CPU_LOG_TB_NOCHAIN)) { TCGv_ptr ptr; plugin_gen_disable_mem_helpers(); diff --git a/tcg/tcg.c b/tcg/tcg.c index 5150ed700e..cba598c9d3 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -791,9 +791,7 @@ void tcg_prologue_init(TCGContext *s) * For tci, we use NULL as the signal to return from the interpreter, * so skip this check. */ - if (TCG_TARGET_HAS_goto_ptr) { - tcg_debug_assert(tcg_code_gen_epilogue != NULL); - } + tcg_debug_assert(tcg_code_gen_epilogue != NULL); #endif } @@ -1176,6 +1174,7 @@ bool tcg_op_supported(TCGOpcode op) case INDEX_op_insn_start: case INDEX_op_exit_tb: case INDEX_op_goto_tb: + case INDEX_op_goto_ptr: case INDEX_op_qemu_ld_i32: case INDEX_op_qemu_st_i32: case INDEX_op_qemu_ld_i64: @@ -1185,9 +1184,6 @@ bool tcg_op_supported(TCGOpcode op) case INDEX_op_qemu_st8_i32: return TCG_TARGET_HAS_qemu_st8_i32; - case INDEX_op_goto_ptr: - return TCG_TARGET_HAS_goto_ptr; - case INDEX_op_mov_i32: case INDEX_op_setcond_i32: case INDEX_op_brcond_i32: From patchwork Thu Jul 1 15:25:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 469103 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp499488jao; Thu, 1 Jul 2021 08:30:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJznrplc4LtP0xbGWesaZkCGx6kFDJHPI6y0RD294GkzH6c4zDKSST7vuuk7hOgNvDxEZ5hV X-Received: by 2002:a50:c907:: with SMTP id o7mr563582edh.120.1625153450777; Thu, 01 Jul 2021 08:30:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625153450; cv=none; d=google.com; s=arc-20160816; b=xXhcxW9gZI2ixysAA5LFJRCCugEfVHVaIKdFTtuxssnkPeh4yOOXFR2s9yANpXCspU dcLZS0aXcv5Vuanqv9oeaJFcUehdQ9cCUl2AHZKcccvUX2AKeI6qlKVgHhplltmXR0kq U8RAZGGpIhAyqBAKDSmGlI5uDyP+7ydIHHxAFzEsDrWR/n89gVtt+5NfeGwx4Z7YAJzC BQdgzvoHh4rGtKZrREqiNwm6QoPQt47Ys4RY64kiISIKYPNz7jAlomd0Oz8XBVG6j7lj a1pBlbhsJTBWeLsx9fWd02ONoGtKMaii5key73vFfTzgBgAe/kB6rhpiSvGmpmUchfxJ 3H1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=dzNhtHE9m5XdMcEWBRnySR9gbMAPjCgqzhKLirKjfi4=; b=ng5CEOrxvv5Esl2mEiuKCiuqRLGw/2ZumDWw3CQsNuQOTkjQUeSWX7xkUiuf6s2r7E tG2RY95uRq/2TtEqUMgdm823m0CMx57k1TnBw/hP2hI9F/9Yi9QUAnB1zzWwmYs1gVEk dwYhEQpaITZumO+68N/Qm5ppaQTKQf5xknUYLsqLYH8biQkPfTWkXFTiNGzwidnm+ewQ w5SoAqwPw7rCgnDvazNbVHORg1ySnsIQsgDGTDOPGI5GHnBpQbYbGTUmVFVFwi0dMpHx cC6flswqF0cuHJItTh3T++qmO/IZ1Any2zCfgEQwOVj2VOHLbZxi+lHLaBYrvdNzVNZV cuug== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=uWVlZtQK; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id q19si104888edv.125.2021.07.01.08.30.50 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 01 Jul 2021 08:30:50 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=uWVlZtQK; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:51470 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lyyeP-0007mD-OZ for patch@linaro.org; Thu, 01 Jul 2021 11:30:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52920) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lyyZd-0004QJ-St for qemu-devel@nongnu.org; Thu, 01 Jul 2021 11:25:54 -0400 Received: from mail-pj1-x102a.google.com ([2607:f8b0:4864:20::102a]:51896) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lyyZU-0008Cp-2E for qemu-devel@nongnu.org; Thu, 01 Jul 2021 11:25:53 -0400 Received: by mail-pj1-x102a.google.com with SMTP id n11so4484626pjo.1 for ; Thu, 01 Jul 2021 08:25:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=dzNhtHE9m5XdMcEWBRnySR9gbMAPjCgqzhKLirKjfi4=; b=uWVlZtQK5bcbJRvJkDvc1IE7dZh1VDMbsl+qLfXeunWzjksfmghbsiQbXqJzFC7t4A ZJGwPIURZKOSIc3YhGhhJ+Ew8+/g/pOkKKppLCsP0K7LMCvybPcSmBJDc1jSfkzX9Sy9 YuKNb0cKquxY1CTTQFbmZrTW1mXUgr8TZtwtDjsYYuU7uKWrAItm+tlPTckAL8X89mLt du+cbI5dEq7EpNBQavzl1An2UXCzcTbSvMlrGcGNUyKu0fFE3qaZEVE+0Go59Oi8Knou jUqBU/QJnA2gQ4sQCBuj69d7JTytjHQ/0cVhb31NUMldjdSWnxrr7yGyTl3697xszZW/ a6sQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=dzNhtHE9m5XdMcEWBRnySR9gbMAPjCgqzhKLirKjfi4=; b=EddaFW5JUT/kQlmRybSa3a1bnZBkCRmGStjDiAc+5dJcSmThIgNC8GhYqkb/6ymIlb +ZVLvKnxRD/kVkXw21tScUyUOK49XZoOXgCE59XM6aIniaDzTI09bWsqBpx1LnJQi7uG k6c3l9POJoNfOuCyaporSKcyR5zOG7ZwWcESslm6eAZVPD998X0MJeQLer7/c/JNnKoe wSaEZ7REDTjDCeW/MJ9VlZpyKxZveFDTZgMX8zCZvy6Tz2FdQfKqksIsEB/nBnXJIs01 kiTCAaB9BjDzPCDamWbHGx3xGv+44RBL24XBVhfIK++tVZljovWrh55Wgha1kW9wBuqQ pezg== X-Gm-Message-State: AOAM533Eogr7LpQ/G/whY/UoyhUrrBWjqEP7m5eF77h6F/aDikKV+92l 1OyOMYyC6k+jOpPoeNHV9pjSKwq2KflSvg== X-Received: by 2002:a17:90b:4a90:: with SMTP id lp16mr238826pjb.137.1625153142842; Thu, 01 Jul 2021 08:25:42 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id j4sm10213197pjv.7.2021.07.01.08.25.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Jul 2021 08:25:42 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 07/17] accel/tcg: Reduce CF_COUNT_MASK to match TCG_MAX_INSNS Date: Thu, 1 Jul 2021 08:25:27 -0700 Message-Id: <20210701152537.3330420-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210701152537.3330420-1-richard.henderson@linaro.org> References: <20210701152537.3330420-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102a; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, mark.cave-ayland@ilande.co.uk, alex.bennee@linaro.org, f4bug@amsat.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" The space reserved for CF_COUNT_MASK was overly large. Reduce to free up cflags bits and eliminate an extra test. Signed-off-by: Richard Henderson --- include/exec/exec-all.h | 4 +++- accel/tcg/translate-all.c | 5 ++--- 2 files changed, 5 insertions(+), 4 deletions(-) -- 2.25.1 diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h index 754f4130c9..dfe82ed19c 100644 --- a/include/exec/exec-all.h +++ b/include/exec/exec-all.h @@ -492,7 +492,9 @@ struct TranslationBlock { target_ulong cs_base; /* CS base for this block */ uint32_t flags; /* flags defining in which context the code was generated */ uint32_t cflags; /* compile flags */ -#define CF_COUNT_MASK 0x00007fff + +/* Note that TCG_MAX_INSNS is 512; we validate this match elsewhere. */ +#define CF_COUNT_MASK 0x000001ff #define CF_LAST_IO 0x00008000 /* Last insn may be an IO access. */ #define CF_MEMI_ONLY 0x00010000 /* Only instrument memory ops */ #define CF_USE_ICOUNT 0x00020000 diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c index 7929a7e320..d0177d772d 100644 --- a/accel/tcg/translate-all.c +++ b/accel/tcg/translate-all.c @@ -1435,9 +1435,8 @@ TranslationBlock *tb_gen_code(CPUState *cpu, if (max_insns == 0) { max_insns = CF_COUNT_MASK; } - if (max_insns > TCG_MAX_INSNS) { - max_insns = TCG_MAX_INSNS; - } + QEMU_BUILD_BUG_ON(CF_COUNT_MASK + 1 != TCG_MAX_INSNS); + if (cpu->singlestep_enabled || singlestep) { max_insns = 1; } From patchwork Thu Jul 1 15:25:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 469102 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp497809jao; Thu, 1 Jul 2021 08:28:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw4oQaqx7FIqo/TiTgFnd26sljXwRC+ltpBdOFw0jN/EFVbvDeRDtYvHn34Hi/pPtH+KZI6 X-Received: by 2002:aa7:dad2:: with SMTP id x18mr478227eds.319.1625153336748; Thu, 01 Jul 2021 08:28:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625153336; cv=none; d=google.com; s=arc-20160816; b=gou5BM9Ay/T/UNnJENUC1YopHbAOttD8CiSdBID/tIyPosw05U/nqs4vXtHEjYZdZN J2SWZ+lBRn/lT397fksBrrP9zcdCnHwVZau1PaM/CvfNF5qyo5wpYCZtbnoa0ayAqw83 K/u0H0Em5WWhSXcWcvOMxE/gGVqkzvQAspuy10g1gqkISMd3voFaE5HhQd9hsV377rNG c5nCQNnDumYyplLIvjywbFZbJVWRkQWG9NrMsNz6ffXIltGBVEa/Jp1V459TZk3ua3ih vC3piLOWd6sSDVY6NHfry4DZyKud+nROpo6gByy4MtXjoqwCj2jPq89Z9OMXqNDpqLDE YB1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=se0upj8uwwed3TnJTE/iIfzC0n2efWNdGM2VdkwZygY=; b=piUo6WeEyfbfLydJJRUaFEC5DAA52mW0dAGkZOAAceXK2uElNldZtWXJYIQWKxOZt3 6lTXq5OG/syQF/JA04vvJrNfLsgyfPMXvARya9aAX5R/soErHepWsHGiazS4rXKwwfqu 2amlsLTMSFNwYrRBnSRfJgn5puqB+pd50VQ0q3/RB0DiFylMncGA3i/s+tasgTv07p++ aGfwtuxoQigImpUrizQpOALhcwxp9NG2KxPXgsfZHEEOXHO2ruDpX0ia4PSLbCxReloD LuPhPfatVWWBNVvXOccxDDKErew0reLlJ2DSeTEjc2oS8ZjkRWysiUmrOT2tM8MORKEt ZUqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=KOqZw+rx; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id i9si108933edf.46.2021.07.01.08.28.56 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 01 Jul 2021 08:28:56 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=KOqZw+rx; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:43080 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lyycZ-00023P-Q5 for patch@linaro.org; Thu, 01 Jul 2021 11:28:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52954) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lyyZh-0004WP-RK for qemu-devel@nongnu.org; Thu, 01 Jul 2021 11:25:57 -0400 Received: from mail-pg1-x534.google.com ([2607:f8b0:4864:20::534]:37428) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lyyZU-0008DI-Kv for qemu-devel@nongnu.org; Thu, 01 Jul 2021 11:25:57 -0400 Received: by mail-pg1-x534.google.com with SMTP id t9so6428251pgn.4 for ; Thu, 01 Jul 2021 08:25:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=se0upj8uwwed3TnJTE/iIfzC0n2efWNdGM2VdkwZygY=; b=KOqZw+rxJfNVRBW97RxKMPpf1mHicOBT7+X8PwrobaYRY6fWZKG2gf9FrKUcyymsnv TTRx9O1c6GzV6OU5i8iQ81GhBQQaARjrlLnW6oZnf7jDenEHRzaY3SsKghoJYbxsfquR T5+PO0VDcANvArVcLkx4DZlk9vTiHq7NmDU8wWWTO1CR0o14yzm42MMjgeRODHHaDPSJ FtC+mEC7ByT/Sl00qYctjfBULrGnBNzrkf3pix14931yYQUTikiU23QcMcvbxj7Y2d6p tCfpeZUEhyIw03zRAVRlZkjjx7R+YLgPncw7LEzq9dhqr4kw03cnG5BI261pAk2bLiqU k+Ug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=se0upj8uwwed3TnJTE/iIfzC0n2efWNdGM2VdkwZygY=; b=GENSq71RVAb1De5CFN89iDWPFvVU/2zbJo18JKu26EtMFQnVK8qa41Sd1sWdhfxAF0 bbSd0YkpeX45/kDGWdOT7HakVNTwhIBnhX+KpJMCJuVEop3LrP8cbv8in049t2Tf+5vz KWLJB9wotgplIsm7roLD+9MqTkOkzoWCiuAIR2hO3RMuQjKYWmEHohM62bZmHs1R4/Es DmCRH9YHvwmsVKt3Q2X+cINMjDQdNbvoGJLCnMUJYcaCeA1sUbYYvDF3FyBVYI+T95FR 6xXzvnvsIM/WUdunB+ARFDaTqkvwj9k2RSxWgJI+EvH+Xo9Ym2CtzAqdao3U9hZaSe4L ZZog== X-Gm-Message-State: AOAM5307DL8fMUP/IUU+7RfrRiczxwU9Wo53qoJkWo3FZYKoaT48g9dA d+Rso5Gr0iGlQSj9dPFFMGR8h9exWH011A== X-Received: by 2002:a05:6a00:23cf:b029:2d5:302e:dc77 with SMTP id g15-20020a056a0023cfb02902d5302edc77mr514244pfc.63.1625153143392; Thu, 01 Jul 2021 08:25:43 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id j4sm10213197pjv.7.2021.07.01.08.25.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Jul 2021 08:25:43 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 08/17] accel/tcg: Move curr_cflags into cpu-exec.c Date: Thu, 1 Jul 2021 08:25:28 -0700 Message-Id: <20210701152537.3330420-9-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210701152537.3330420-1-richard.henderson@linaro.org> References: <20210701152537.3330420-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::534; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x534.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, mark.cave-ayland@ilande.co.uk, alex.bennee@linaro.org, f4bug@amsat.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" We will shortly have more than a simple member read here, with stuff not necessarily exposed to exec/exec-all.h. Signed-off-by: Richard Henderson --- include/exec/exec-all.h | 5 +---- accel/tcg/cpu-exec.c | 5 +++++ 2 files changed, 6 insertions(+), 4 deletions(-) -- 2.25.1 diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h index dfe82ed19c..ae7603ca75 100644 --- a/include/exec/exec-all.h +++ b/include/exec/exec-all.h @@ -565,10 +565,7 @@ static inline uint32_t tb_cflags(const TranslationBlock *tb) } /* current cflags for hashing/comparison */ -static inline uint32_t curr_cflags(CPUState *cpu) -{ - return cpu->tcg_cflags; -} +uint32_t curr_cflags(CPUState *cpu); /* TranslationBlock invalidate API */ #if defined(CONFIG_USER_ONLY) diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c index e22bcb99f7..ef4214d893 100644 --- a/accel/tcg/cpu-exec.c +++ b/accel/tcg/cpu-exec.c @@ -145,6 +145,11 @@ static void init_delay_params(SyncClocks *sc, const CPUState *cpu) } #endif /* CONFIG USER ONLY */ +uint32_t curr_cflags(CPUState *cpu) +{ + return cpu->tcg_cflags; +} + /* Might cause an exception, so have a longjmp destination ready */ static inline TranslationBlock *tb_lookup(CPUState *cpu, target_ulong pc, target_ulong cs_base, From patchwork Thu Jul 1 15:25:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 469111 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp504239jao; Thu, 1 Jul 2021 08:36:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx52t7tDkYOhsm+m809Y03PmtUorhByvaZ7LjGzqp0iRaoel8B2xDfij/H8TLXeLGmF80tL X-Received: by 2002:aa7:c54c:: with SMTP id s12mr631926edr.24.1625153768540; Thu, 01 Jul 2021 08:36:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625153768; cv=none; d=google.com; s=arc-20160816; b=NBreVWAqLc7tk+jHo9POwEDLzlnfdLU931hjB6NMc3kxOzA9F64Tub1yjwFKUWWqfJ Z2j9Uz/pZG1E3Hipheblsx5nkFGDJ6bA+gKQmomYMzr5921WWXwweqFU8hb5Y3DjAXXQ ITi4tvThj2HzoQsrp20FEUB8UHJ2yBZZpn9MWjLQ65E2uUNb+xSTU52YD7IOa9Re+ZKC ENrWxS6Gqn3uCM/khMabkrKgmpEQxO0TbdU13JX67D/Ux/0FbS19QU5ve0WQsSt7SOru guMe8JPA5GYziRmq1xWNWBLie5wZj5hg+LQ2cKj9MNfiRoZQhvKUT63TBACIm1BkB0Di YbZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=Hqj+uWbhnsfiTWFNH/G75o3RLfPft/KoLGnIxnofpUQ=; b=RVAJl8EDV/Gm4OPW9qnVkE+vmuo2fzbY/c1AhDh8+Rs0C6xGyQWqx99TL/MXPkyd5t NAqHXA6lfaekCpskwNvA+FuN/CGLYrfP7AK8NFd3YhnwVAvjYjHhUsLQic+igp3KqMoF OVzRdAXFChQ60MkDQbwcz/kndFXcUjz2DvFxFEkDotevWPfnyMqzcalJegAzfjBtreef PK5yermrI+fmdgR9elkIo3gIkNA5enOrinodiSezcDMeZ4/7ecu9xIP/OrayDjIlxlTN Wm7JYFT/tw99jgXP8jT+bZt5pWMAZ4thYrRN++g8imGVs/9agaS8pLdd2gmiPLxBDdlX Jeag== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=eZl5x55p; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id u16si88554edb.334.2021.07.01.08.36.08 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 01 Jul 2021 08:36:08 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=eZl5x55p; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:36560 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lyyjX-0008Qi-CN for patch@linaro.org; Thu, 01 Jul 2021 11:36:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53092) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lyyZq-0004pX-Cx for qemu-devel@nongnu.org; Thu, 01 Jul 2021 11:26:07 -0400 Received: from mail-pj1-x102b.google.com ([2607:f8b0:4864:20::102b]:53997) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lyyZX-0008Dd-CN for qemu-devel@nongnu.org; Thu, 01 Jul 2021 11:26:06 -0400 Received: by mail-pj1-x102b.google.com with SMTP id q91so4465728pjk.3 for ; Thu, 01 Jul 2021 08:25:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Hqj+uWbhnsfiTWFNH/G75o3RLfPft/KoLGnIxnofpUQ=; b=eZl5x55pnpQJp/t846f0gHe2SSD4oseXDQUMwHqDD1iK1MLoLArUNMSw0pok7smx61 KEOiZXAfAJrfZdHM/ADMykU/GzhulBtxsyB3qC9EkGQ2mbZMR0sylnKYheqslJFCwCjW YKaMoYVNkINLdmDaEANiXiUzvQFyvHZ1hghubiBHQ3Td3O8iIvBM6JAERRodgCI42acR vEwK5ZHDp//3bkm1tf6PL+vetu6+jQEPt3UJc+BJCxfkkVU7g5fEjHE3DdvSf4M0nadi lCnalqJ+zKQRXAnaUkjj54H8xP/X0m4P1XNQ5SGXx7ycPaPHv+U7PwY8yWgaDkZePpLv rwTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Hqj+uWbhnsfiTWFNH/G75o3RLfPft/KoLGnIxnofpUQ=; b=TdxVdHaYLjKLZdeyplNmRrarTrv6M4lksZJNgoF0yv0H5WFjB0kvHc8s5Nqix+AH+B tJdcJeOaGCx8yLpIxyEHpzrLPUnC6zkEnpzYW6BB16RndptQK2EcJ1BmoTObB2mL0cjR EGNY9eR8AD47fsbu8wkLARw8fZRZP55fDbLXrBoroBbybl2eXJZksA4YBGNexdpwlDXs il4KeeRUdqOvG5z8rQBja6Tt/6NiC28+UsNTWfwHQjuSdk8kkaKrxpcbGocV1l5JhauO N058VuxW4672V+eRQPtJisTtjzX8Kz46lB6epJ42TZY/yAOJoj8vsV2rLsIPPV1nILs8 YDPA== X-Gm-Message-State: AOAM530TgreDDIcL7PP2iQlDVHg9CZnrQ4CD/FJOhWJm4DqRrEnaT0eR I9DvjwLN1ci36RuEa35B4N5nTLmd2AhCsw== X-Received: by 2002:a17:90a:f2d7:: with SMTP id gt23mr10421409pjb.21.1625153143910; Thu, 01 Jul 2021 08:25:43 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id j4sm10213197pjv.7.2021.07.01.08.25.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Jul 2021 08:25:43 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 09/17] accel/tcg: Add CF_NO_GOTO_TB and CF_NO_GOTO_PTR Date: Thu, 1 Jul 2021 08:25:29 -0700 Message-Id: <20210701152537.3330420-10-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210701152537.3330420-1-richard.henderson@linaro.org> References: <20210701152537.3330420-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102b; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, mark.cave-ayland@ilande.co.uk, alex.bennee@linaro.org, f4bug@amsat.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Move the -d nochain check to bits on tb->cflags. These will be used for more than -d nochain shortly. Set bits during curr_cflags, test them in translator_use_goto_tb, assert we're not doing anything odd in tcg_gen_goto_tb. The test in tcg_gen_exit_tb is redundant with the assert for goto_tb_issue_mask. Signed-off-by: Richard Henderson --- include/exec/exec-all.h | 16 +++++++++------- accel/tcg/cpu-exec.c | 8 +++++++- accel/tcg/translator.c | 5 +++++ tcg/tcg-op.c | 28 ++++++++++++---------------- 4 files changed, 33 insertions(+), 24 deletions(-) -- 2.25.1 diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h index ae7603ca75..6873cce8df 100644 --- a/include/exec/exec-all.h +++ b/include/exec/exec-all.h @@ -494,13 +494,15 @@ struct TranslationBlock { uint32_t cflags; /* compile flags */ /* Note that TCG_MAX_INSNS is 512; we validate this match elsewhere. */ -#define CF_COUNT_MASK 0x000001ff -#define CF_LAST_IO 0x00008000 /* Last insn may be an IO access. */ -#define CF_MEMI_ONLY 0x00010000 /* Only instrument memory ops */ -#define CF_USE_ICOUNT 0x00020000 -#define CF_INVALID 0x00040000 /* TB is stale. Set with @jmp_lock held */ -#define CF_PARALLEL 0x00080000 /* Generate code for a parallel context */ -#define CF_CLUSTER_MASK 0xff000000 /* Top 8 bits are cluster ID */ +#define CF_COUNT_MASK 0x000001ff +#define CF_NO_GOTO_TB 0x00000200 /* Do not chain with goto_tb */ +#define CF_NO_GOTO_PTR 0x00000400 /* Do not chain with goto_ptr */ +#define CF_LAST_IO 0x00008000 /* Last insn may be an IO access. */ +#define CF_MEMI_ONLY 0x00010000 /* Only instrument memory ops */ +#define CF_USE_ICOUNT 0x00020000 +#define CF_INVALID 0x00040000 /* TB is stale. Set with @jmp_lock held */ +#define CF_PARALLEL 0x00080000 /* Generate code for a parallel context */ +#define CF_CLUSTER_MASK 0xff000000 /* Top 8 bits are cluster ID */ #define CF_CLUSTER_SHIFT 24 /* Per-vCPU dynamic tracing state used to generate this TB */ diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c index ef4214d893..d3232d5764 100644 --- a/accel/tcg/cpu-exec.c +++ b/accel/tcg/cpu-exec.c @@ -147,7 +147,13 @@ static void init_delay_params(SyncClocks *sc, const CPUState *cpu) uint32_t curr_cflags(CPUState *cpu) { - return cpu->tcg_cflags; + uint32_t cflags = cpu->tcg_cflags; + + if (qemu_loglevel_mask(CPU_LOG_TB_NOCHAIN)) { + cflags |= CF_NO_GOTO_TB | CF_NO_GOTO_PTR; + } + + return cflags; } /* Might cause an exception, so have a longjmp destination ready */ diff --git a/accel/tcg/translator.c b/accel/tcg/translator.c index 59804af37b..2ea5a74f30 100644 --- a/accel/tcg/translator.c +++ b/accel/tcg/translator.c @@ -33,6 +33,11 @@ void translator_loop_temp_check(DisasContextBase *db) bool translator_use_goto_tb(DisasContextBase *db, target_ulong dest) { + /* Suppress goto_tb if requested. */ + if (tb_cflags(db->tb) & CF_NO_GOTO_TB) { + return false; + } + /* Suppress goto_tb in the case of single-steping. */ if (db->singlestep_enabled || singlestep) { return false; diff --git a/tcg/tcg-op.c b/tcg/tcg-op.c index 3d5db9a33c..1c08fc55d8 100644 --- a/tcg/tcg-op.c +++ b/tcg/tcg-op.c @@ -2723,10 +2723,6 @@ void tcg_gen_exit_tb(const TranslationBlock *tb, unsigned idx) seen this numbered exit before, via tcg_gen_goto_tb. */ tcg_debug_assert(tcg_ctx->goto_tb_issue_mask & (1 << idx)); #endif - /* When not chaining, exit without indicating a link. */ - if (qemu_loglevel_mask(CPU_LOG_TB_NOCHAIN)) { - val = 0; - } } else { /* This is an exit via the exitreq label. */ tcg_debug_assert(idx == TB_EXIT_REQUESTED); @@ -2738,6 +2734,8 @@ void tcg_gen_exit_tb(const TranslationBlock *tb, unsigned idx) void tcg_gen_goto_tb(unsigned idx) { + /* We tested CF_NO_GOTO_TB in translator_use_goto_tb. */ + tcg_debug_assert(!(tcg_ctx->tb_cflags & CF_NO_GOTO_TB)); /* We only support two chained exits. */ tcg_debug_assert(idx <= TB_EXIT_IDXMAX); #ifdef CONFIG_DEBUG_TCG @@ -2746,25 +2744,23 @@ void tcg_gen_goto_tb(unsigned idx) tcg_ctx->goto_tb_issue_mask |= 1 << idx; #endif plugin_gen_disable_mem_helpers(); - /* When not chaining, we simply fall through to the "fallback" exit. */ - if (!qemu_loglevel_mask(CPU_LOG_TB_NOCHAIN)) { - tcg_gen_op1i(INDEX_op_goto_tb, idx); - } + tcg_gen_op1i(INDEX_op_goto_tb, idx); } void tcg_gen_lookup_and_goto_ptr(void) { - if (!qemu_loglevel_mask(CPU_LOG_TB_NOCHAIN)) { - TCGv_ptr ptr; + TCGv_ptr ptr; - plugin_gen_disable_mem_helpers(); - ptr = tcg_temp_new_ptr(); - gen_helper_lookup_tb_ptr(ptr, cpu_env); - tcg_gen_op1i(INDEX_op_goto_ptr, tcgv_ptr_arg(ptr)); - tcg_temp_free_ptr(ptr); - } else { + if (tcg_ctx->tb_cflags & CF_NO_GOTO_PTR) { tcg_gen_exit_tb(NULL, 0); + return; } + + plugin_gen_disable_mem_helpers(); + ptr = tcg_temp_new_ptr(); + gen_helper_lookup_tb_ptr(ptr, cpu_env); + tcg_gen_op1i(INDEX_op_goto_ptr, tcgv_ptr_arg(ptr)); + tcg_temp_free_ptr(ptr); } static inline MemOp tcg_canonicalize_memop(MemOp op, bool is64, bool st) From patchwork Thu Jul 1 15:25:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 469106 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp501539jao; Thu, 1 Jul 2021 08:33:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxDn/F+9LAnQ6Y5WPJfHWq4zKjYgXODWK/oR2SEeRipfyXmGGz77N9JAhK3/EIrfQ4GZ+zT X-Received: by 2002:a17:907:9483:: with SMTP id dm3mr440843ejc.155.1625153586567; Thu, 01 Jul 2021 08:33:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625153586; cv=none; d=google.com; s=arc-20160816; b=tJuvWbVDRJ/Xh7avFVZnHSNl44Ecnuspd/4PrvF9hT9NgEMTQhqgSDLRsRSbGA2lf1 qG2mMx5DBGGCJzh79IqjVuQ8Qn/4BgcX4cI6fE7hwqwQP+h+eKJ4pmSSsJ7M1jF7d1Fj mQP2t24e7765uyfyS6Zb+vVZgibV6BeRDvnY4+0M38Kv45HxrOpa3BplKWcMIwaF9uwS hacccI1rtYm8upUdlewyvRFWzOl4HDb7A2LfCNRNgP33pXYRV1vuQnQExznmnd5RE4bn KhgS1znQKBt0xPFeKuPRk/1W9Gg3M2dxcHYqHsQS17eLP6ronFqLXhnLgbIND5wIt9pf UAnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=QXN13A+EVZfIbPM/1TIJvsr4KsfxBAPJnkVnda2aJXw=; b=AyNQ+8Ac2V8gpNgk0JEtKZmmE0ek6VQDSEp2motLqU1MLqjzGAKvU/C8Jr7ApeAQcG ADS06pNsrJV9m0zyyCbBKcbgj9EGbLN24mI1dFepOpAkBTgVWrWii84V8EuK67Nh7EqX VECnjwVH4z2bIY3ajSwlQ8kDc2kskswosyOAR9ty64BLtEtIYuV8PWludzXhDnnPeKVy qyegmxp+WhAIhf2bb+NtLFjY1T0DnZ6PWVnPSD8AqFZWMU0TkV3zuqIgH7oZUeIrT0+d vHFiX7wdBYLjLq7P4RHTn/+5SL3l+gP1Jc/HF9OZ/M2z9EVG0m2cZjQxGl2cqCh5wRSQ 6S+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=HLk2AkTt; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id z19si88114edr.551.2021.07.01.08.33.06 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 01 Jul 2021 08:33:06 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=HLk2AkTt; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:58196 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lyygb-0003zo-Hv for patch@linaro.org; Thu, 01 Jul 2021 11:33:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53006) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lyyZk-0004eH-6w for qemu-devel@nongnu.org; Thu, 01 Jul 2021 11:26:00 -0400 Received: from mail-pl1-x634.google.com ([2607:f8b0:4864:20::634]:46022) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lyyZW-0008Ez-Gx for qemu-devel@nongnu.org; Thu, 01 Jul 2021 11:25:59 -0400 Received: by mail-pl1-x634.google.com with SMTP id s13so739598plg.12 for ; Thu, 01 Jul 2021 08:25:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=QXN13A+EVZfIbPM/1TIJvsr4KsfxBAPJnkVnda2aJXw=; b=HLk2AkTtwOsBTpKS3AyU1e0Nt6/vo5MQWvVc+6vyABvk0vMZX6Gi6zJ74qZrL09CYT 6QRUIDFnIu7rCdRYGwn8/Enrj4qXPlrZqQoeuE8bZCge6UH47F9HhBma9KOgHKbx6Zo/ 5+0Naw/GPvX3Pp0GG2xx6S+zeDnZjmbxHHHOiXvq/ESKzpJGjGOQumU18TZiAg40P4zp MkMEhoG3V6DeoY2IzqVaE+Zy8ar1FAns0UZyu+O89l82Y/JDWfRbmkiZPeq7vqcc3yTI 4w5uGIEmLQZtHGLvyZWo4UAI/7OyOK3ZC88T9KkD2TgpxigWma0d0FBH8ao8LmDJH0mF i5qw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=QXN13A+EVZfIbPM/1TIJvsr4KsfxBAPJnkVnda2aJXw=; b=o378D1Ag5Cb7RUuMQ0qmsVsE9kPnG5TqW6sbxHlTw4M815adyh1hCGnnagL123ZJ7R mc8I/jffLhQhxK0AsZlHEvTY8PL+6FDJtXx3Zif7lmbpE+HhGNCpK9+pfKX1S4HFb7N7 T4Ct7xIKKWYbLdXaGX6pcH1/kg0DeFwlsIA6TezcIs67G4qUzyE/+DWyWDZtePiXpRhT H3Gf2JaksnGLp7Br1CG9PG+mHBLXvclmafwblVWPozgDoo4mLAvrNE5MpNaSL5dHLWrv z44l7I5idMUTDmmSJvCip7vZuzt5zC5y0q9tc5zMCRq7/guhOO5rg6whJhBatLP+5GPe cNCA== X-Gm-Message-State: AOAM531O+U4OmHE/ltoexUanIECl6Pi4GnrV5llb0HjC/cp5/+zVWHA0 2yETbSIxqETJnFv96CuN1BjtcfpdlqZp9Q== X-Received: by 2002:a17:90a:9205:: with SMTP id m5mr10628081pjo.172.1625153144640; Thu, 01 Jul 2021 08:25:44 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id j4sm10213197pjv.7.2021.07.01.08.25.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Jul 2021 08:25:44 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 10/17] accel/tcg: Drop CF_NO_GOTO_PTR from -d nochain Date: Thu, 1 Jul 2021 08:25:30 -0700 Message-Id: <20210701152537.3330420-11-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210701152537.3330420-1-richard.henderson@linaro.org> References: <20210701152537.3330420-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::634; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x634.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, mark.cave-ayland@ilande.co.uk, alex.bennee@linaro.org, f4bug@amsat.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" The purpose of suppressing goto_ptr from -d nochain had been to return to the main loop so that -d cpu would be recognized. But we now include -d cpu logging in helper_lookup_tb_ptr so there is no need to exclude goto_ptr. Signed-off-by: Richard Henderson --- accel/tcg/cpu-exec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.25.1 diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c index d3232d5764..70ea3c7d68 100644 --- a/accel/tcg/cpu-exec.c +++ b/accel/tcg/cpu-exec.c @@ -150,7 +150,7 @@ uint32_t curr_cflags(CPUState *cpu) uint32_t cflags = cpu->tcg_cflags; if (qemu_loglevel_mask(CPU_LOG_TB_NOCHAIN)) { - cflags |= CF_NO_GOTO_TB | CF_NO_GOTO_PTR; + cflags |= CF_NO_GOTO_TB; } return cflags; From patchwork Thu Jul 1 15:25:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 469108 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp502437jao; Thu, 1 Jul 2021 08:34:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz0cyJK7Z7FikE+A39hZXWu6IlqfoZPe0sw41vl493knq6OKm3iE+VmbVsg2b9ytwkgX2g0 X-Received: by 2002:a17:907:d9f:: with SMTP id go31mr445290ejc.165.1625153645511; Thu, 01 Jul 2021 08:34:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625153645; cv=none; d=google.com; s=arc-20160816; b=Bzr+d6EVPojcWFf38KrnBcqd+hYr/bDwyOtWMgDXZPbNLFmr4aVYctUQzWPKlPB8tV Z7lQCasIJql1HJrFS3oF+VrEnelOHrN+94aeXbj/cC47AHpDPvxiVh60Db5QPABc39F6 jvl3n4n5zkrmyHFb8z7NW8WgAoNX2Fw/YM9tIJwxsMT/hcPkKR6sVAURYdAXxh8fu1U7 oYJsKrB1CIk2VdxVcYiSisXlWXXOWiE/b50Ya96HRnD2nGh5vWJ01CJ/n1vxunf+merU aa8aOz/d6Fv/muuUvVmeRqV/FcZCzq0ZhZ0zJjSGp6Lq8S6Fb4Hf7lx+Kj7qtWprkC3T bmqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=Ml7uB0OtQwcxX5TZhhBtWO2veCNQTvvwJhhIq0gQl44=; b=p/SLOeU+6WvdFXoi3QA9XeQwnAluGYNHfbmzkYdlXr6RLJ13yC8LqK1GSP8zyxsEIo cAKuvggoCYIW/0R2vHqziNST+10ZxdDF7fPnRyWx/djG5oKpqEDNtTiszMb/3XlSq15X kfMmOhweJpar7PY9xg3hCqGQodsrrGNbzsKxqm+hpmOIzAd5OOAb/8FA6rPCZS193KZo /I1uBs6epWZ9zF0XGCQiwk7qI9YAJHJWCjYDrB+IdQaSJLPCrVHr9IbGNqJoTxMScQ4H hS/crP0Da1cqH0u7NVUnIuemcuNaZcFHDvq3yzhB0t7oIbKkFRFeObPnoGsxI+S3SM/H rJmg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=i1cgegt7; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id jy12si291971ejc.519.2021.07.01.08.34.05 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 01 Jul 2021 08:34:05 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=i1cgegt7; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:58400 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lyyhY-00047d-IJ for patch@linaro.org; Thu, 01 Jul 2021 11:34:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53000) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lyyZj-0004dC-PA for qemu-devel@nongnu.org; Thu, 01 Jul 2021 11:25:59 -0400 Received: from mail-pg1-x52f.google.com ([2607:f8b0:4864:20::52f]:43773) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lyyZX-0008FY-Od for qemu-devel@nongnu.org; Thu, 01 Jul 2021 11:25:59 -0400 Received: by mail-pg1-x52f.google.com with SMTP id o18so5784662pgu.10 for ; Thu, 01 Jul 2021 08:25:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Ml7uB0OtQwcxX5TZhhBtWO2veCNQTvvwJhhIq0gQl44=; b=i1cgegt7gkgPQ7KB4t5PbQCp2cztGtdmmUfl1Bn5m9ArVgu87g2+IfHsF3J+e3LHAH MHtaJGUaL4COmZXZAsrHCIoYHXHQidSboKxMUR/nPzBBECqJKQBPdV8FxEOEzIMyzOPf nDbD06XHUmp9xNTgwuqwtkJdNKSKn91QHbO8AO4QU95XuUgK5EaikaXMw5q6+nTkHixk Y8zIKVlqsngyBcGLClI1bgeDaw/5O5lyq6dVvh41vxW8Ryj+0cOYWxpUcXRhW5tfFjLn 3BEb11lHbsqGlIrje3l6IRP2laSqWE+l7+0qRX/65ZgKOsNe1I0O0EsDJFdieYNaLItM Hf5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Ml7uB0OtQwcxX5TZhhBtWO2veCNQTvvwJhhIq0gQl44=; b=HjUFe4xyH/oEzr8Jh4AHvf+VMplIs8HAAQ5JEjfmqQLITVhK5zqKyh3Gx2m+skWaiT bSHaJmtobnpk6bPQO9iN8TsFY0M85Vs+tTfo+r1TBqQBUfdrHtNE9QRyLqniGUODzurg SLNVa4ckD4UFs3gRou4+70eTtlGOwMwl0lthm0HHUNz1VhIASwen5ASqpcjqzibgiZM6 jDlWetdiJrNyImNtivYdqTRl/v4Rn1vNbSk8Hsao3fRLMMsLWgOmG9AGlhwkWD/J4USw PpTSCmhRe04Z1aRMxKKrfj6+ZRiAdKy5pJcXm5i6IdgbFHib+XJNjWqPfrbHzDGJK+94 UxQA== X-Gm-Message-State: AOAM533fuYINmd14EGmoJhnuSOnvAFF8l8rA1kVX3UBG1kzmBZMIE9ut NNKQDrSSUsMciAkAkG60Fk2E4RLGYDO0BQ== X-Received: by 2002:a05:6a00:c84:b029:311:dced:c744 with SMTP id a4-20020a056a000c84b0290311dcedc744mr557641pfv.52.1625153145201; Thu, 01 Jul 2021 08:25:45 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id j4sm10213197pjv.7.2021.07.01.08.25.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Jul 2021 08:25:44 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 11/17] accel/tcg: Handle -singlestep in curr_cflags Date: Thu, 1 Jul 2021 08:25:31 -0700 Message-Id: <20210701152537.3330420-12-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210701152537.3330420-1-richard.henderson@linaro.org> References: <20210701152537.3330420-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::52f; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, mark.cave-ayland@ilande.co.uk, alex.bennee@linaro.org, f4bug@amsat.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Exchange the test in translator_use_goto_tb for CF_NO_GOTO_TB, and the test in tb_gen_code for setting CF_COUNT_MASK to 1. Signed-off-by: Richard Henderson --- accel/tcg/cpu-exec.c | 8 +++++++- accel/tcg/translate-all.c | 2 +- accel/tcg/translator.c | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) -- 2.25.1 diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c index 70ea3c7d68..2206c463f5 100644 --- a/accel/tcg/cpu-exec.c +++ b/accel/tcg/cpu-exec.c @@ -149,7 +149,13 @@ uint32_t curr_cflags(CPUState *cpu) { uint32_t cflags = cpu->tcg_cflags; - if (qemu_loglevel_mask(CPU_LOG_TB_NOCHAIN)) { + /* + * For singlestep and -d nochain, suppress goto_tb so that + * we can log -d cpu,exec after every TB. + */ + if (singlestep) { + cflags |= CF_NO_GOTO_TB | 1; + } else if (qemu_loglevel_mask(CPU_LOG_TB_NOCHAIN)) { cflags |= CF_NO_GOTO_TB; } diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c index d0177d772d..586f8ca4ef 100644 --- a/accel/tcg/translate-all.c +++ b/accel/tcg/translate-all.c @@ -1437,7 +1437,7 @@ TranslationBlock *tb_gen_code(CPUState *cpu, } QEMU_BUILD_BUG_ON(CF_COUNT_MASK + 1 != TCG_MAX_INSNS); - if (cpu->singlestep_enabled || singlestep) { + if (cpu->singlestep_enabled) { max_insns = 1; } diff --git a/accel/tcg/translator.c b/accel/tcg/translator.c index 2ea5a74f30..a59eb7c11b 100644 --- a/accel/tcg/translator.c +++ b/accel/tcg/translator.c @@ -39,7 +39,7 @@ bool translator_use_goto_tb(DisasContextBase *db, target_ulong dest) } /* Suppress goto_tb in the case of single-steping. */ - if (db->singlestep_enabled || singlestep) { + if (db->singlestep_enabled) { return false; } From patchwork Thu Jul 1 15:25:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 469105 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp500329jao; Thu, 1 Jul 2021 08:31:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyqo2vGBG/WJCSwD12qsFEyjHXvaz/BGXZOtbxRhciTXXYpNdrw1A3q1puhxHA5ZUHJGaCB X-Received: by 2002:a17:906:6b90:: with SMTP id l16mr402505ejr.439.1625153502339; Thu, 01 Jul 2021 08:31:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625153502; cv=none; d=google.com; s=arc-20160816; b=X0ddeeSYfAYM5erRzH5+kQTMEb2qbn/kG43juBEaJxoiBCMk3tjBf1GeeCcU/vMq0I pC1N9kSmCNZ9nccbE1/QUZk3tkLhYNiAt5jPuj26Z7bS/8SUDssMF5jj9Zx/pyVkkJEn r6NBf0oiitfJbOMTq/GSwsU862tPbfsfP5YTM8oxMv+fsVgHHfw+PUUNWClzKLSwESaw Rc4+oOAIhXEv99SCp7EPalM+Fo1ZcY/eU098e8Ga3tTZ/KF6/aoSq+wQQX/thBSZhMIc DdKZZooLJVoFIITU1qifNd5qcJ2O4A8NaOAWYdwaOYMYV4N2vawA47P8XTuhwHZYZBIR 6sLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=aZodwPrqQjUt8vQ3rujRtm0PKCZdI4rcPhp5DEtvTCc=; b=il7tBMoH7e4lo0SlUhsw63rZJY80ss2PpaMJB2WjgezDqbN2OCkuaCl1GapthM4ryr j2V21+bOFT0WZ6EJqaQtfnyhFoyT37vrLd/jrl2tAw9QEUCqnENwVbwUME6qnztZRpXp /IcbPsfomVf5mJZWYzpHcYqSuqFblpd8vEkoYgapHSrmsBqo8P9rDpf4weO+a12gJE9u a/+zEKBKua6W0DNpKlydMGw+y4sOU2ex+RxP1qJC99w2gT0JYYplny1DwbSwDDVqmtGm sDgrjCHjrACJwdJTlu5RWSosXwAL8bpo16UNnBCJ+0yAWNJoi1fUkbx3pF9uNJ2UCogl BMNQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=hVhivn0J; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id t21si110141edq.73.2021.07.01.08.31.42 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 01 Jul 2021 08:31:42 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=hVhivn0J; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:51670 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lyyfF-0007te-DY for patch@linaro.org; Thu, 01 Jul 2021 11:31:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53020) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lyyZl-0004hj-2T for qemu-devel@nongnu.org; Thu, 01 Jul 2021 11:26:01 -0400 Received: from mail-pg1-x52b.google.com ([2607:f8b0:4864:20::52b]:38805) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lyyZX-0008Fw-P6 for qemu-devel@nongnu.org; Thu, 01 Jul 2021 11:26:00 -0400 Received: by mail-pg1-x52b.google.com with SMTP id h4so6415299pgp.5 for ; Thu, 01 Jul 2021 08:25:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=aZodwPrqQjUt8vQ3rujRtm0PKCZdI4rcPhp5DEtvTCc=; b=hVhivn0JQBLhfo15kUBHoJZe79uniU31FuCuDuDsAXIk+FCoCVEEMvHEaKqFUkpyQn 10BiUMQ+/xjSlN0Aki51DpahvczC31+rm/4tCTGjy4Y52arC4wnWGpFYaeli2o4TQyls aykoNZqo7pTzSjFP2iKwBNe5utrSbySGUizAZXONlZ5SPkz0xA05k/eEu8xRZSuSUder MQMLxI3S/RcPi/KRd4w11ptEyQlMFu9AhfuraAMGU22EK3q3P7bHTNC45rs+Jsl1aHs7 P5SYKa2O+igOULuLShCNFyg1ySNy57So40cAMDxLl+dx0n4l+0tDvKC0FOzS6+hrAHNp mpag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=aZodwPrqQjUt8vQ3rujRtm0PKCZdI4rcPhp5DEtvTCc=; b=oUPaXE5Ufey22KyXvABa2IJ8SQxgOul0i/KzVFA4ffjN8yEDWqzXzhap0amr4W2a7Q lzyVV8WbRXQppJsAuNgJwsiFZ1Qip5aCT/MiVEZldIj+8jsgjXef1GbYWA+ThRQSxvQ+ xTGZl786EnnLG3voSeRtyz8MYX92giHB5rfTGF3ilJoTdtHYS6aCHWSHmoCrvy2R7v5p fkhmravId8IQrEitRTkMALb2e6wyeERrabUpaSFxZ7KQ7xND7VK8tLt+OElJShApV3+h 6ASHiGouZNx4POXynslI9mhCRRT0Ny5kUf+fBTFuBb6aIKwv4dlOBLbqOxj2Zdgnix9+ 0GsQ== X-Gm-Message-State: AOAM532AILoCM2Y8ILIAFGesqxhoupgYOqftacvncIhStvqK5v864LqV K7rT9wnCpWmpeEMspRi7Tmp2I1OgS/PwpQ== X-Received: by 2002:aa7:96f0:0:b029:312:8eda:61e1 with SMTP id i16-20020aa796f00000b02903128eda61e1mr266767pfq.42.1625153145759; Thu, 01 Jul 2021 08:25:45 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id j4sm10213197pjv.7.2021.07.01.08.25.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Jul 2021 08:25:45 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 12/17] accel/tcg: Use CF_NO_GOTO_{TB, PTR} in cpu_exec_step_atomic Date: Thu, 1 Jul 2021 08:25:32 -0700 Message-Id: <20210701152537.3330420-13-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210701152537.3330420-1-richard.henderson@linaro.org> References: <20210701152537.3330420-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::52b; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, mark.cave-ayland@ilande.co.uk, alex.bennee@linaro.org, f4bug@amsat.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Request that the one TB returns immediately, so that we release the exclusive lock as soon as possible. Signed-off-by: Richard Henderson --- accel/tcg/cpu-exec.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) -- 2.25.1 diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c index 2206c463f5..5bb099174f 100644 --- a/accel/tcg/cpu-exec.c +++ b/accel/tcg/cpu-exec.c @@ -330,8 +330,7 @@ void cpu_exec_step_atomic(CPUState *cpu) CPUArchState *env = (CPUArchState *)cpu->env_ptr; TranslationBlock *tb; target_ulong cs_base, pc; - uint32_t flags; - uint32_t cflags = (curr_cflags(cpu) & ~CF_PARALLEL) | 1; + uint32_t flags, cflags; int tb_exit; if (sigsetjmp(cpu->jmp_env, 0) == 0) { @@ -341,8 +340,14 @@ void cpu_exec_step_atomic(CPUState *cpu) cpu->running = true; cpu_get_tb_cpu_state(env, &pc, &cs_base, &flags); - tb = tb_lookup(cpu, pc, cs_base, flags, cflags); + cflags = curr_cflags(cpu); + /* Execute in a serial context. */ + cflags &= ~CF_PARALLEL; + /* After 1 insn, return and release the exclusive lock. */ + cflags |= CF_NO_GOTO_TB | CF_NO_GOTO_PTR | 1; + + tb = tb_lookup(cpu, pc, cs_base, flags, cflags); if (tb == NULL) { mmap_lock(); tb = tb_gen_code(cpu, pc, cs_base, flags, cflags); From patchwork Thu Jul 1 15:25:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 469099 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp497404jao; Thu, 1 Jul 2021 08:28:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwRa4GFI5/pl+tUTyZ0d78a+ToH35m243Xxv32jagOgf2TbCg6lH/P0Da5B8dMlVZ3PqIhB X-Received: by 2002:aa7:cd85:: with SMTP id x5mr501366edv.115.1625153307955; Thu, 01 Jul 2021 08:28:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625153307; cv=none; d=google.com; s=arc-20160816; b=Fmkj2CQ0SI/jEwQJGIB8Ft7Z0CvMVJKObH1P5SXpE2L1MvfxjfEopytejKiPaKz21I T4F3i8FL6dlc76g1Yd/NGCFD9UbhTpAzGS5qAIFErBFCLWWbXSL6zwd0wZvdB0twLF49 BeTBruXsS4h2i8vHJPo71U+7Uuah8wLXza+WPlLsqYbbBAvV7671h4MAv9roJIFL2gBe oHuNCc05522DSQHCLUN2om24zI6ORuxduF7KiZmaXbr18gGXEqTwMU3OpwBVrMObQbEQ n5yBj1eExkHjtlOsOrRfK6eqVjHN9axc4CGTJRVSOWygW5dUVZObbsuKekZX9uUmVk+q fRdw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=XZ18+TbN3l0IvM4lcz8To1nUnlGMGwhY3IWR1y85/oQ=; b=E2TCl62gRoi6AoHRxpXZYKAyEPIiCe217j23Bo8woFBHMHEj4cb578JneAvfg9mfxB LtQyr2BoKb81eCccuVwExAm+m/xDgLPkMhhIc8syeq33z9r77Zs2TcCIeY93CTeY4SHn T32Ho1j4g+lALrA7nIpNAiCwxaxLt1Z2tGJD/XZ3avbZlTf29mTY5xhAokGmMesn00hl N9Qw/4mKco0hd9rQAJoiMcplaMxmEwIolHti6iay8kiehUE2fFQNxaw629k1LHuDvPRP vL9xj6fm5ilOkR8GYBwA+l9+a8KxgpcsBquyp2GmIcKxxKjWmYlF8LSRNBHpDsrTeZxT qP8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=rm1rgNTj; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id t19si87214edd.255.2021.07.01.08.28.27 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 01 Jul 2021 08:28:27 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=rm1rgNTj; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:42886 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lyyc7-0001vW-1L for patch@linaro.org; Thu, 01 Jul 2021 11:28:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53012) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lyyZk-0004fC-JS for qemu-devel@nongnu.org; Thu, 01 Jul 2021 11:26:00 -0400 Received: from mail-pg1-x52b.google.com ([2607:f8b0:4864:20::52b]:36720) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lyyZX-0008GB-Oi for qemu-devel@nongnu.org; Thu, 01 Jul 2021 11:26:00 -0400 Received: by mail-pg1-x52b.google.com with SMTP id e33so6434632pgm.3 for ; Thu, 01 Jul 2021 08:25:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=XZ18+TbN3l0IvM4lcz8To1nUnlGMGwhY3IWR1y85/oQ=; b=rm1rgNTjRpqMa7rc2vr+W+erhXheLaeVTlGq/9dc2gvf8wTjBi39J2gS119tSgkCTs 2vPHtTSJvs3MWW97rmMDlGgcnioRYhqqf9qhlxSmaJJS0wrUf3zBI3jH4G+6+H7mxvU6 65Usd1I4j2U9RYnMZbv0pGPcfZzzH6zi7KlRx9OwgqDqvmr92kERKyfhdI+sIPW0w8nM Labo90gEiFR9ViGzZanCqPbbHaDw6cSz5qFYwSxPghCkQQmy4xQ3FZW+n36ReeiYLIen 7W/Xq65jCL2stXaPM8jXdCV9xsqvPqFTFIgLrSHNxFSzI0XYWq0+x3qb/q7s+tANVQXi GN2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=XZ18+TbN3l0IvM4lcz8To1nUnlGMGwhY3IWR1y85/oQ=; b=T3h/agTyTKtWn6ZpQ0rE4DQ5S6phm/Qor0trSAR5/1s8WJelRRae3axmZmexFeVFrI j7n2qB6frjNsnZ2HjAnA6P5az+i5LqZypi17G8HhaQRo22nOCqNMqISTx6KljbVhCmf9 FUfVMFTpY+tYHREBQvAiJqVS0yGQd/XUwLQFW1ZDuwfch1so0bR2umAxf9WDbAv6Mskp BCJOS9Y6xTLVAut/Lvv81heunPmHQ2tYO0Sw1JZ8kCWVDSmz4Yjuv7BZfzQ0qOlnEVnL qveYaSS2OBQwVCRUJ6xAfw8RGsezSNhVAW7d6f++O9rumrz7eVVLebofE53oa1DybMgy 08Mw== X-Gm-Message-State: AOAM533Nisl+ri98SqOyloAYZO9z0vhyBU2Iz3VHgvZam/s9EzLkQ6zQ mmjBFN3Mri5s0vtiQnLF6JG1ywZoc8S+sw== X-Received: by 2002:a62:87ca:0:b029:303:1dd3:572 with SMTP id i193-20020a6287ca0000b02903031dd30572mr509872pfe.33.1625153146373; Thu, 01 Jul 2021 08:25:46 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id j4sm10213197pjv.7.2021.07.01.08.25.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Jul 2021 08:25:46 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 13/17] accel/tcg: Move cflags lookup into tb_find Date: Thu, 1 Jul 2021 08:25:33 -0700 Message-Id: <20210701152537.3330420-14-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210701152537.3330420-1-richard.henderson@linaro.org> References: <20210701152537.3330420-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::52b; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, mark.cave-ayland@ilande.co.uk, alex.bennee@linaro.org, f4bug@amsat.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" We will shortly require the guest pc for computing cflags, so move the choice just after cpu_get_tb_cpu_state. Signed-off-by: Richard Henderson --- accel/tcg/cpu-exec.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) -- 2.25.1 diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c index 5bb099174f..4d043a11aa 100644 --- a/accel/tcg/cpu-exec.c +++ b/accel/tcg/cpu-exec.c @@ -502,15 +502,29 @@ static inline void tb_add_jump(TranslationBlock *tb, int n, static inline TranslationBlock *tb_find(CPUState *cpu, TranslationBlock *last_tb, - int tb_exit, uint32_t cflags) + int tb_exit) { CPUArchState *env = (CPUArchState *)cpu->env_ptr; TranslationBlock *tb; target_ulong cs_base, pc; - uint32_t flags; + uint32_t flags, cflags; cpu_get_tb_cpu_state(env, &pc, &cs_base, &flags); + /* + * When requested, use an exact setting for cflags for the next + * execution. This is used for icount, precise smc, and stop- + * after-access watchpoints. Since this request should never + * have CF_INVALID set, -1 is a convenient invalid value that + * does not require tcg headers for cpu_common_reset. + */ + cflags = cpu->cflags_next_tb; + if (cflags == -1) { + cflags = curr_cflags(cpu); + } else { + cpu->cflags_next_tb = -1; + } + tb = tb_lookup(cpu, pc, cs_base, flags, cflags); if (tb == NULL) { mmap_lock(); @@ -868,21 +882,7 @@ int cpu_exec(CPUState *cpu) int tb_exit = 0; while (!cpu_handle_interrupt(cpu, &last_tb)) { - uint32_t cflags = cpu->cflags_next_tb; - TranslationBlock *tb; - - /* When requested, use an exact setting for cflags for the next - execution. This is used for icount, precise smc, and stop- - after-access watchpoints. Since this request should never - have CF_INVALID set, -1 is a convenient invalid value that - does not require tcg headers for cpu_common_reset. */ - if (cflags == -1) { - cflags = curr_cflags(cpu); - } else { - cpu->cflags_next_tb = -1; - } - - tb = tb_find(cpu, last_tb, tb_exit, cflags); + TranslationBlock *tb = tb_find(cpu, last_tb, tb_exit); cpu_loop_exec_tb(cpu, tb, &last_tb, &tb_exit); /* Try to align the host and virtual clocks if the guest is in advance */ From patchwork Thu Jul 1 15:25:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 469110 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp503768jao; Thu, 1 Jul 2021 08:35:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw//FA0jsfa5hBuqX0yP5k2QgiNYfSOZNKCwg0PSYR8bkkikpefh55Uwb4W79pQf/ia+VOD X-Received: by 2002:a17:907:10d8:: with SMTP id rv24mr457266ejb.542.1625153735862; Thu, 01 Jul 2021 08:35:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625153735; cv=none; d=google.com; s=arc-20160816; b=tu7PmPS6ljHkeBsHrRoEsGQBMMGRAUtegQ08ZWX8C52uFWWlF0IJo98OKsQAAewxrc KhfoosMApueQziheWZO/UB6K/H8tHYEzjq/2k6Qxa86ND6WCocuI2Wiaj3iUPpHc1J13 FLmU98ZOyWbHlkJt4ovCUwm4JLuQyitzS2znXCwgOAHJNQL+zRGIHfVjlN5ud7oNtB5f V7V1BTkhM4LRTeaKAP54/aEw0vX8/klcF+mXpX1sRwJV4kYjfor6ui9aKsTNzW+nzLIy vbnhKyIuhgH2zC7xRshg3P1YtebHDk/45qCBfsCt1XhYye2h+8KdE97D5FcGup3g6Tdg vYVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=dV3LuCTcwHlXu6bhF819dEgGFeDbEGWqZjzK4w6nRoM=; b=Z5MNkyZT++reDONOXMOLqy8ptx+6OObb/udNPpoUzI9/03vQDqUzvBpZCjz9Gk77C0 zQZvkEK8fzzzNPUjIoWHvBWr/UmadzYHQO28M09iZqpXl8hQtz7z2h+CSQSRrMV9CrGl qviv21T3jVabVMy1saHj2LyMQRTins3yXZllmSFMifNeUFc7+0PokB//QTzCrErFp2uH N08ydBlCaxYdXFhB5b0ZiYqUZrE1OX/8wKPXxTzkfn9AzGPCjzfVYK+4BA/7teHJw9yk yMa21/5oKu85kjAv2zSNIDt60kW2uoXeinOZnccbEjciuHn+S4L9nChi9FYN13zxOgun 2smw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=CnoWYHuI; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id l19si312999eje.408.2021.07.01.08.35.35 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 01 Jul 2021 08:35:35 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=CnoWYHuI; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:36610 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lyyj0-0008ST-KL for patch@linaro.org; Thu, 01 Jul 2021 11:35:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53094) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lyyZq-0004py-OJ for qemu-devel@nongnu.org; Thu, 01 Jul 2021 11:26:07 -0400 Received: from mail-pj1-x102f.google.com ([2607:f8b0:4864:20::102f]:39528) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lyyZZ-0008HT-9n for qemu-devel@nongnu.org; Thu, 01 Jul 2021 11:26:06 -0400 Received: by mail-pj1-x102f.google.com with SMTP id in17-20020a17090b4391b0290170ba0ec7fcso6857204pjb.4 for ; Thu, 01 Jul 2021 08:25:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=dV3LuCTcwHlXu6bhF819dEgGFeDbEGWqZjzK4w6nRoM=; b=CnoWYHuInUARbBQUUBQNLjrP9JLHpoXZRNR+JdA15s6qFNEpwRUAE3JSHIv6i49q2N J7VP3nwj1cHQlZsGmUCG5/AqHjEWuaDozwCu8eIKAIpzMhwtUMf17cTGICkz0ujy95eH 5TyjIs8D5yk39ntRB0iifcQSYSRHw21obXGlF+kr06dycn8cHyCq9MzwsUZqFKtGwmkJ V5lNuUQljVELIU8qX+xiZP6bi8WBdIuIaCpWp0SRy5unbAO/CTyaAIaiSaKsdDRiN20q ojle6o4+hc3OfUN+JEWg3Bm8faXnWhxb0U2cKIJjelC013CSKCtHra06EIXF7x/iH6eA 8JCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=dV3LuCTcwHlXu6bhF819dEgGFeDbEGWqZjzK4w6nRoM=; b=nWUhE1/N+iEPUYIw33uUeXs5U4Y3ILdnMHTC8w2I6yx0OWIm/ohxZy0xY/jSgun/qc l7RBh72ymJnJY2sAT39TQT/0laypz8u7cM1O4EpjGX3+i+kN5m32NkA5CGuok86hU6Ya 0JmfcP7NItvzlq4SBD3Y4yVh7lumf7VR9qvcqA6gXfhLs6fAnMgo9BlSFytygBTuEgR+ KRI/wa0wgnzsugN++HN+w6Ru4Smw3GPlcQ3Ylz/HjsBqnskBkXQdetg3mlAj84H3hvtx 46G2pWbPX4xCE/9yHaJzCszAJk91/tzfsEKxNxot2x2cJEpOwIdetRHgE0jepUdTOYW2 5EcA== X-Gm-Message-State: AOAM531xJumyhuGfmRA1qDwSDffnExxAMXvgcGd1p7es1u4bXPx/KJJ7 icuZrhCzOwaIg2Ji4i/xyhmnwHkkRIRM0w== X-Received: by 2002:a17:90a:d595:: with SMTP id v21mr293046pju.50.1625153147124; Thu, 01 Jul 2021 08:25:47 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id j4sm10213197pjv.7.2021.07.01.08.25.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Jul 2021 08:25:46 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 14/17] accel/tcg: Adjust interface of TranslatorOps.breakpoint_check Date: Thu, 1 Jul 2021 08:25:34 -0700 Message-Id: <20210701152537.3330420-15-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210701152537.3330420-1-richard.henderson@linaro.org> References: <20210701152537.3330420-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102f; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, mark.cave-ayland@ilande.co.uk, alex.bennee@linaro.org, f4bug@amsat.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" We don't need the whole CPUBreakpoint structure in the check, only the flags. Return the instruction length to consolidate the adjustment of db->pc_next. Signed-off-by: Richard Henderson --- include/exec/translator.h | 17 +++++++++------ accel/tcg/translator.c | 40 ++++++++++++++++++++++++----------- target/alpha/translate.c | 12 +++-------- target/arm/translate-a64.c | 14 ++++-------- target/arm/translate.c | 20 +++++++----------- target/avr/translate.c | 6 +++--- target/cris/translate.c | 14 ++++-------- target/hexagon/translate.c | 13 +++--------- target/hppa/translate.c | 7 +++--- target/i386/tcg/translate.c | 15 ++++--------- target/m68k/translate.c | 14 +++--------- target/microblaze/translate.c | 14 +++--------- target/mips/tcg/translate.c | 14 ++++-------- target/nios2/translate.c | 13 +++--------- target/openrisc/translate.c | 11 +++------- target/ppc/translate.c | 13 +++--------- target/riscv/translate.c | 11 +++------- target/rx/translate.c | 8 +++---- target/s390x/translate.c | 12 ++++------- target/sh4/translate.c | 12 ++++------- target/sparc/translate.c | 9 ++++---- target/tricore/translate.c | 13 +++--------- target/xtensa/translate.c | 12 ++++------- 23 files changed, 115 insertions(+), 199 deletions(-) -- 2.25.1 diff --git a/include/exec/translator.h b/include/exec/translator.h index dd9c06d40d..433b753c5c 100644 --- a/include/exec/translator.h +++ b/include/exec/translator.h @@ -92,11 +92,15 @@ typedef struct DisasContextBase { * @breakpoint_check: * When called, the breakpoint has already been checked to match the PC, * but the target may decide the breakpoint missed the address - * (e.g., due to conditions encoded in their flags). Return true to - * indicate that the breakpoint did hit, in which case no more breakpoints - * are checked. If the breakpoint did hit, emit any code required to - * signal the exception, and set db->is_jmp as necessary to terminate - * the main loop. + * (e.g., due to conditions encoded in their flags), in which case + * db->is_jmp may be left as DISAS_NEXT or DISAS_TOO_MANY to indicate + * that the insn should be translated. Anything other than those two + * will be taken to indicate an exception has been raised, but in most + * cases db->is_jmp should be set to DISAS_NORETURN. + * + * Return the minimum instruction size that should be applied to the TB. + * The size of any TB cannot be zero, as that breaks the math used to + * invalidate TBs. * * @translate_insn: * Disassemble one instruction and set db->pc_next for the start @@ -113,8 +117,7 @@ typedef struct TranslatorOps { void (*init_disas_context)(DisasContextBase *db, CPUState *cpu); void (*tb_start)(DisasContextBase *db, CPUState *cpu); void (*insn_start)(DisasContextBase *db, CPUState *cpu); - bool (*breakpoint_check)(DisasContextBase *db, CPUState *cpu, - const CPUBreakpoint *bp); + int (*breakpoint_check)(DisasContextBase *db, CPUState *cpu, int flags); void (*translate_insn)(DisasContextBase *db, CPUState *cpu); void (*tb_stop)(DisasContextBase *db, CPUState *cpu); void (*disas_log)(const DisasContextBase *db, CPUState *cpu); diff --git a/accel/tcg/translator.c b/accel/tcg/translator.c index a59eb7c11b..1c44d096d8 100644 --- a/accel/tcg/translator.c +++ b/accel/tcg/translator.c @@ -50,7 +50,6 @@ bool translator_use_goto_tb(DisasContextBase *db, target_ulong dest) void translator_loop(const TranslatorOps *ops, DisasContextBase *db, CPUState *cpu, TranslationBlock *tb, int max_insns) { - int bp_insn = 0; bool plugin_enabled; /* Initialize DisasContext */ @@ -91,19 +90,35 @@ void translator_loop(const TranslatorOps *ops, DisasContextBase *db, CPUBreakpoint *bp; QTAILQ_FOREACH(bp, &cpu->breakpoints, entry) { if (bp->pc == db->pc_next) { - if (ops->breakpoint_check(db, cpu, bp)) { - bp_insn = 1; - break; + int len = ops->breakpoint_check(db, cpu, bp->flags); + + /* + * The breakpoint_check hook may use DISAS_TOO_MANY + * to indicate that only one more instruction is to + * be executed. Otherwise it should use DISAS_NORETURN + * when generating an exception, but may use a + * DISAS_TARGET_* value for Something Else. + */ + if (db->is_jmp > DISAS_TOO_MANY) { + /* + * The address covered by the breakpoint must be + * included in [tb->pc, tb->pc + tb->size) in order + * to for it to be properly cleared. Thus we + * increment the PC here so that the logic setting + * tb->size below does the right thing. + */ + tcg_debug_assert(len > 0); + db->pc_next += len; + + /* + * The breakpoint definitely hit, so decrement the + * number of instructions completed for icount. + */ + db->num_insns--; + goto done; } } } - /* The breakpoint_check hook may use DISAS_TOO_MANY to indicate - that only one more instruction is to be executed. Otherwise - it should use DISAS_NORETURN when generating an exception, - but may use a DISAS_TARGET_* value for Something Else. */ - if (db->is_jmp > DISAS_TOO_MANY) { - break; - } } /* Disassemble one instruction. The translate_insn hook should @@ -142,9 +157,10 @@ void translator_loop(const TranslatorOps *ops, DisasContextBase *db, } } + done: /* Emit code to exit the TB, as indicated by db->is_jmp. */ ops->tb_stop(db, cpu); - gen_tb_end(db->tb, db->num_insns - bp_insn); + gen_tb_end(db->tb, db->num_insns); if (plugin_enabled) { plugin_gen_tb_end(cpu); diff --git a/target/alpha/translate.c b/target/alpha/translate.c index de769f7633..6521bea7af 100644 --- a/target/alpha/translate.c +++ b/target/alpha/translate.c @@ -3013,19 +3013,13 @@ static void alpha_tr_insn_start(DisasContextBase *dcbase, CPUState *cpu) tcg_gen_insn_start(dcbase->pc_next); } -static bool alpha_tr_breakpoint_check(DisasContextBase *dcbase, CPUState *cpu, - const CPUBreakpoint *bp) +static int alpha_tr_breakpoint_check(DisasContextBase *dcbase, CPUState *cpu, + int bp_flags) { DisasContext *ctx = container_of(dcbase, DisasContext, base); ctx->base.is_jmp = gen_excp(ctx, EXCP_DEBUG, 0); - - /* The address covered by the breakpoint must be included in - [tb->pc, tb->pc + tb->size) in order to for it to be - properly cleared -- thus we increment the PC here so that - the logic setting tb->size below does the right thing. */ - ctx->base.pc_next += 4; - return true; + return 4; /* minimum instruction length */ } static void alpha_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index eb1907d049..74bbee1360 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -14917,28 +14917,22 @@ static void aarch64_tr_insn_start(DisasContextBase *dcbase, CPUState *cpu) dc->insn_start = tcg_last_op(); } -static bool aarch64_tr_breakpoint_check(DisasContextBase *dcbase, CPUState *cpu, - const CPUBreakpoint *bp) +static int aarch64_tr_breakpoint_check(DisasContextBase *dcbase, + CPUState *cpu, int bp_flags) { DisasContext *dc = container_of(dcbase, DisasContext, base); - if (bp->flags & BP_CPU) { + if (bp_flags & BP_CPU) { gen_a64_set_pc_im(dc->base.pc_next); gen_helper_check_breakpoints(cpu_env); /* End the TB early; it likely won't be executed */ dc->base.is_jmp = DISAS_TOO_MANY; } else { gen_exception_internal_insn(dc, dc->base.pc_next, EXCP_DEBUG); - /* The address covered by the breakpoint must be - included in [tb->pc, tb->pc + tb->size) in order - to for it to be properly cleared -- thus we - increment the PC here so that the logic setting - tb->size below does the right thing. */ - dc->base.pc_next += 4; dc->base.is_jmp = DISAS_NORETURN; } - return true; + return 4; /* minimum instruction length */ } static void aarch64_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) diff --git a/target/arm/translate.c b/target/arm/translate.c index 87c3c09df5..452b5a8168 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -9116,12 +9116,12 @@ static void arm_tr_insn_start(DisasContextBase *dcbase, CPUState *cpu) dc->insn_start = tcg_last_op(); } -static bool arm_tr_breakpoint_check(DisasContextBase *dcbase, CPUState *cpu, - const CPUBreakpoint *bp) +static int arm_tr_breakpoint_check(DisasContextBase *dcbase, CPUState *cpu, + int bp_flags) { DisasContext *dc = container_of(dcbase, DisasContext, base); - if (bp->flags & BP_CPU) { + if (bp_flags & BP_CPU) { gen_set_condexec(dc); gen_set_pc_im(dc, dc->base.pc_next); gen_helper_check_breakpoints(cpu_env); @@ -9129,18 +9129,14 @@ static bool arm_tr_breakpoint_check(DisasContextBase *dcbase, CPUState *cpu, dc->base.is_jmp = DISAS_TOO_MANY; } else { gen_exception_internal_insn(dc, dc->base.pc_next, EXCP_DEBUG); - /* The address covered by the breakpoint must be - included in [tb->pc, tb->pc + tb->size) in order - to for it to be properly cleared -- thus we - increment the PC here so that the logic setting - tb->size below does the right thing. */ - /* TODO: Advance PC by correct instruction length to - * avoid disassembler error messages */ - dc->base.pc_next += 2; dc->base.is_jmp = DISAS_NORETURN; } - return true; + /* + * TODO: Advance PC by correct instruction length to avoid disassembler + * error messages. In the meantime, minimum instruction length. + */ + return 2; } static bool arm_pre_translate_insn(DisasContext *dc) diff --git a/target/avr/translate.c b/target/avr/translate.c index 8237a03c23..73ff467926 100644 --- a/target/avr/translate.c +++ b/target/avr/translate.c @@ -2944,13 +2944,13 @@ static void avr_tr_insn_start(DisasContextBase *dcbase, CPUState *cs) tcg_gen_insn_start(ctx->npc); } -static bool avr_tr_breakpoint_check(DisasContextBase *dcbase, CPUState *cs, - const CPUBreakpoint *bp) +static int avr_tr_breakpoint_check(DisasContextBase *dcbase, CPUState *cs, + int bp_flags) { DisasContext *ctx = container_of(dcbase, DisasContext, base); gen_breakpoint(ctx); - return true; + return 2; /* minimum instruction length */ } static void avr_tr_translate_insn(DisasContextBase *dcbase, CPUState *cs) diff --git a/target/cris/translate.c b/target/cris/translate.c index e33a3bb326..97710ef4a6 100644 --- a/target/cris/translate.c +++ b/target/cris/translate.c @@ -3119,8 +3119,8 @@ static void cris_tr_insn_start(DisasContextBase *dcbase, CPUState *cpu) tcg_gen_insn_start(dc->delayed_branch == 1 ? dc->ppc | 1 : dc->pc); } -static bool cris_tr_breakpoint_check(DisasContextBase *dcbase, CPUState *cpu, - const CPUBreakpoint *bp) +static int cris_tr_breakpoint_check(DisasContextBase *dcbase, CPUState *cpu, + int bp_flags) { DisasContext *dc = container_of(dcbase, DisasContext, base); @@ -3128,14 +3128,8 @@ static bool cris_tr_breakpoint_check(DisasContextBase *dcbase, CPUState *cpu, tcg_gen_movi_tl(env_pc, dc->pc); t_gen_raise_exception(EXCP_DEBUG); dc->base.is_jmp = DISAS_NORETURN; - /* - * The address covered by the breakpoint must be included in - * [tb->pc, tb->pc + tb->size) in order to for it to be - * properly cleared -- thus we increment the PC here so that - * the logic setting tb->size below does the right thing. - */ - dc->pc += 2; - return true; + + return 2; /* minimum instruction length */ } static void cris_tr_translate_insn(DisasContextBase *dcbase, CPUState *cs) diff --git a/target/hexagon/translate.c b/target/hexagon/translate.c index 9a37644182..ce3569fa7c 100644 --- a/target/hexagon/translate.c +++ b/target/hexagon/translate.c @@ -547,20 +547,13 @@ static void hexagon_tr_insn_start(DisasContextBase *dcbase, CPUState *cpu) tcg_gen_insn_start(ctx->base.pc_next); } -static bool hexagon_tr_breakpoint_check(DisasContextBase *dcbase, CPUState *cpu, - const CPUBreakpoint *bp) +static int hexagon_tr_breakpoint_check(DisasContextBase *dcbase, + CPUState *cpu, int bp_flags) { DisasContext *ctx = container_of(dcbase, DisasContext, base); gen_exception_end_tb(ctx, EXCP_DEBUG); - /* - * The address covered by the breakpoint must be included in - * [tb->pc, tb->pc + tb->size) in order to for it to be - * properly cleared -- thus we increment the PC here so that - * the logic setting tb->size below does the right thing. - */ - ctx->base.pc_next += 4; - return true; + return 4; /* minimum packet length */ } static bool pkt_crosses_page(CPUHexagonState *env, DisasContext *ctx) diff --git a/target/hppa/translate.c b/target/hppa/translate.c index 952cfe09a6..1c7bb2a413 100644 --- a/target/hppa/translate.c +++ b/target/hppa/translate.c @@ -4205,14 +4205,13 @@ static void hppa_tr_insn_start(DisasContextBase *dcbase, CPUState *cs) tcg_gen_insn_start(ctx->iaoq_f, ctx->iaoq_b); } -static bool hppa_tr_breakpoint_check(DisasContextBase *dcbase, CPUState *cs, - const CPUBreakpoint *bp) +static int hppa_tr_breakpoint_check(DisasContextBase *dcbase, CPUState *cs, + int bp_flags) { DisasContext *ctx = container_of(dcbase, DisasContext, base); gen_excp(ctx, EXCP_DEBUG); - ctx->base.pc_next += 4; - return true; + return 4; /* minimum instruction length */ } static void hppa_tr_translate_insn(DisasContextBase *dcbase, CPUState *cs) diff --git a/target/i386/tcg/translate.c b/target/i386/tcg/translate.c index eb9ee0296f..08fc90518b 100644 --- a/target/i386/tcg/translate.c +++ b/target/i386/tcg/translate.c @@ -8583,23 +8583,16 @@ static void i386_tr_insn_start(DisasContextBase *dcbase, CPUState *cpu) tcg_gen_insn_start(dc->base.pc_next, dc->cc_op); } -static bool i386_tr_breakpoint_check(DisasContextBase *dcbase, CPUState *cpu, - const CPUBreakpoint *bp) +static int i386_tr_breakpoint_check(DisasContextBase *dcbase, CPUState *cpu, + int bp_flags) { DisasContext *dc = container_of(dcbase, DisasContext, base); /* If RF is set, suppress an internally generated breakpoint. */ int flags = dc->base.tb->flags & HF_RF_MASK ? BP_GDB : BP_ANY; - if (bp->flags & flags) { + if (bp_flags & flags) { gen_debug(dc); - /* The address covered by the breakpoint must be included in - [tb->pc, tb->pc + tb->size) in order to for it to be - properly cleared -- thus we increment the PC here so that - the generic logic setting tb->size later does the right thing. */ - dc->base.pc_next += 1; - return true; - } else { - return false; } + return 1; /* minimum instruction length */ } static void i386_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) diff --git a/target/m68k/translate.c b/target/m68k/translate.c index 05b96fdda7..2c921d4260 100644 --- a/target/m68k/translate.c +++ b/target/m68k/translate.c @@ -6209,21 +6209,13 @@ static void m68k_tr_insn_start(DisasContextBase *dcbase, CPUState *cpu) tcg_gen_insn_start(dc->base.pc_next, dc->cc_op); } -static bool m68k_tr_breakpoint_check(DisasContextBase *dcbase, CPUState *cpu, - const CPUBreakpoint *bp) +static int m68k_tr_breakpoint_check(DisasContextBase *dcbase, CPUState *cpu, + int bp_flags) { DisasContext *dc = container_of(dcbase, DisasContext, base); gen_exception(dc, dc->base.pc_next, EXCP_DEBUG); - /* - * The address covered by the breakpoint must be included in - * [tb->pc, tb->pc + tb->size) in order to for it to be - * properly cleared -- thus we increment the PC here so that - * the logic setting tb->size below does the right thing. - */ - dc->base.pc_next += 2; - - return true; + return 2; /* minimum instruction length */ } static void m68k_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) diff --git a/target/microblaze/translate.c b/target/microblaze/translate.c index b753f080e7..b0c355a3eb 100644 --- a/target/microblaze/translate.c +++ b/target/microblaze/translate.c @@ -1674,21 +1674,13 @@ static void mb_tr_insn_start(DisasContextBase *dcb, CPUState *cs) dc->insn_start = tcg_last_op(); } -static bool mb_tr_breakpoint_check(DisasContextBase *dcb, CPUState *cs, - const CPUBreakpoint *bp) +static int mb_tr_breakpoint_check(DisasContextBase *dcb, CPUState *cs, + int bp_flags) { DisasContext *dc = container_of(dcb, DisasContext, base); gen_raise_exception_sync(dc, EXCP_DEBUG); - - /* - * The address covered by the breakpoint must be included in - * [tb->pc, tb->pc + tb->size) in order to for it to be - * properly cleared -- thus we increment the PC here so that - * the logic setting tb->size below does the right thing. - */ - dc->base.pc_next += 4; - return true; + return 4; /* minimum instruction length */ } static void mb_tr_translate_insn(DisasContextBase *dcb, CPUState *cs) diff --git a/target/mips/tcg/translate.c b/target/mips/tcg/translate.c index 17e79f3de3..441c36fad9 100644 --- a/target/mips/tcg/translate.c +++ b/target/mips/tcg/translate.c @@ -25442,22 +25442,16 @@ static void mips_tr_insn_start(DisasContextBase *dcbase, CPUState *cs) ctx->btarget); } -static bool mips_tr_breakpoint_check(DisasContextBase *dcbase, CPUState *cs, - const CPUBreakpoint *bp) +static int mips_tr_breakpoint_check(DisasContextBase *dcbase, CPUState *cs, + int bp_flags) { DisasContext *ctx = container_of(dcbase, DisasContext, base); save_cpu_state(ctx, 1); ctx->base.is_jmp = DISAS_NORETURN; gen_helper_raise_exception_debug(cpu_env); - /* - * The address covered by the breakpoint must be included in - * [tb->pc, tb->pc + tb->size) in order to for it to be - * properly cleared -- thus we increment the PC here so that - * the logic setting tb->size below does the right thing. - */ - ctx->base.pc_next += 4; - return true; + + return 2; /* minimum instruction length */ } static void mips_tr_translate_insn(DisasContextBase *dcbase, CPUState *cs) diff --git a/target/nios2/translate.c b/target/nios2/translate.c index 17742cebc7..1d1c66b88f 100644 --- a/target/nios2/translate.c +++ b/target/nios2/translate.c @@ -777,20 +777,13 @@ static void nios2_tr_insn_start(DisasContextBase *dcbase, CPUState *cs) tcg_gen_insn_start(dcbase->pc_next); } -static bool nios2_tr_breakpoint_check(DisasContextBase *dcbase, CPUState *cs, - const CPUBreakpoint *bp) +static int nios2_tr_breakpoint_check(DisasContextBase *dcbase, CPUState *cs, + int bp_flags) { DisasContext *dc = container_of(dcbase, DisasContext, base); gen_exception(dc, EXCP_DEBUG); - /* - * The address covered by the breakpoint must be included in - * [tb->pc, tb->pc + tb->size) in order to for it to be - * properly cleared -- thus we increment the PC here so that - * the logic setting tb->size below does the right thing. - */ - dc->base.pc_next += 4; - return true; + return 4; /* minimum instruction length */ } static void nios2_tr_translate_insn(DisasContextBase *dcbase, CPUState *cs) diff --git a/target/openrisc/translate.c b/target/openrisc/translate.c index 2d142d8577..1da064edb4 100644 --- a/target/openrisc/translate.c +++ b/target/openrisc/translate.c @@ -1640,20 +1640,15 @@ static void openrisc_tr_insn_start(DisasContextBase *dcbase, CPUState *cs) | (dc->base.num_insns > 1 ? 2 : 0)); } -static bool openrisc_tr_breakpoint_check(DisasContextBase *dcbase, CPUState *cs, - const CPUBreakpoint *bp) +static int openrisc_tr_breakpoint_check(DisasContextBase *dcbase, + CPUState *cs, int bp_flags) { DisasContext *dc = container_of(dcbase, DisasContext, base); tcg_gen_movi_tl(cpu_pc, dc->base.pc_next); gen_exception(dc, EXCP_DEBUG); dc->base.is_jmp = DISAS_NORETURN; - /* The address covered by the breakpoint must be included in - [tb->pc, tb->pc + tb->size) in order to for it to be - properly cleared -- thus we increment the PC here so that - the logic setting tb->size below does the right thing. */ - dc->base.pc_next += 4; - return true; + return 4; /* minimum instruction length */ } static void openrisc_tr_translate_insn(DisasContextBase *dcbase, CPUState *cs) diff --git a/target/ppc/translate.c b/target/ppc/translate.c index 0fb09f2301..ffefb5e78b 100644 --- a/target/ppc/translate.c +++ b/target/ppc/translate.c @@ -8561,21 +8561,14 @@ static void ppc_tr_insn_start(DisasContextBase *dcbase, CPUState *cs) tcg_gen_insn_start(dcbase->pc_next); } -static bool ppc_tr_breakpoint_check(DisasContextBase *dcbase, CPUState *cs, - const CPUBreakpoint *bp) +static int ppc_tr_breakpoint_check(DisasContextBase *dcbase, CPUState *cs, + int bp_flags) { DisasContext *ctx = container_of(dcbase, DisasContext, base); gen_update_nip(ctx, ctx->base.pc_next); gen_debug_exception(ctx); - /* - * The address covered by the breakpoint must be included in - * [tb->pc, tb->pc + tb->size) in order to for it to be properly - * cleared -- thus we increment the PC here so that the logic - * setting tb->size below does the right thing. - */ - ctx->base.pc_next += 4; - return true; + return 4; /* minimum instruction length */ } static bool is_prefix_insn(DisasContext *ctx, uint32_t insn) diff --git a/target/riscv/translate.c b/target/riscv/translate.c index deda0c8a44..8a6bc58572 100644 --- a/target/riscv/translate.c +++ b/target/riscv/translate.c @@ -961,20 +961,15 @@ static void riscv_tr_insn_start(DisasContextBase *dcbase, CPUState *cpu) tcg_gen_insn_start(ctx->base.pc_next); } -static bool riscv_tr_breakpoint_check(DisasContextBase *dcbase, CPUState *cpu, - const CPUBreakpoint *bp) +static int riscv_tr_breakpoint_check(DisasContextBase *dcbase, CPUState *cpu, + int bp_flags) { DisasContext *ctx = container_of(dcbase, DisasContext, base); tcg_gen_movi_tl(cpu_pc, ctx->base.pc_next); ctx->base.is_jmp = DISAS_NORETURN; gen_exception_debug(); - /* The address covered by the breakpoint must be included in - [tb->pc, tb->pc + tb->size) in order to for it to be - properly cleared -- thus we increment the PC here so that - the logic setting tb->size below does the right thing. */ - ctx->base.pc_next += 4; - return true; + return 2; /* minimum instruction length */ } static void riscv_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) diff --git a/target/rx/translate.c b/target/rx/translate.c index 2443406de5..b0cd517e0b 100644 --- a/target/rx/translate.c +++ b/target/rx/translate.c @@ -2310,8 +2310,8 @@ static void rx_tr_insn_start(DisasContextBase *dcbase, CPUState *cs) tcg_gen_insn_start(ctx->base.pc_next); } -static bool rx_tr_breakpoint_check(DisasContextBase *dcbase, CPUState *cs, - const CPUBreakpoint *bp) +static int rx_tr_breakpoint_check(DisasContextBase *dcbase, CPUState *cs, + int bp_flags) { DisasContext *ctx = container_of(dcbase, DisasContext, base); @@ -2319,8 +2319,8 @@ static bool rx_tr_breakpoint_check(DisasContextBase *dcbase, CPUState *cs, tcg_gen_movi_i32(cpu_pc, ctx->base.pc_next); gen_helper_debug(cpu_env); ctx->base.is_jmp = DISAS_NORETURN; - ctx->base.pc_next += 1; - return true; + + return 1; /* minimum instruction length */ } static void rx_tr_translate_insn(DisasContextBase *dcbase, CPUState *cs) diff --git a/target/s390x/translate.c b/target/s390x/translate.c index 4742f59ca9..4634bb79e6 100644 --- a/target/s390x/translate.c +++ b/target/s390x/translate.c @@ -6566,8 +6566,8 @@ static void s390x_tr_insn_start(DisasContextBase *dcbase, CPUState *cs) { } -static bool s390x_tr_breakpoint_check(DisasContextBase *dcbase, CPUState *cs, - const CPUBreakpoint *bp) +static int s390x_tr_breakpoint_check(DisasContextBase *dcbase, CPUState *cs, + int bp_flags) { DisasContext *dc = container_of(dcbase, DisasContext, base); @@ -6581,12 +6581,8 @@ static bool s390x_tr_breakpoint_check(DisasContextBase *dcbase, CPUState *cs, dc->base.is_jmp = DISAS_PC_STALE; dc->do_debug = true; - /* The address covered by the breakpoint must be included in - [tb->pc, tb->pc + tb->size) in order to for it to be - properly cleared -- thus we increment the PC here so that - the logic setting tb->size does the right thing. */ - dc->base.pc_next += 2; - return true; + + return 2; /* minimum instruction length */ } static void s390x_tr_translate_insn(DisasContextBase *dcbase, CPUState *cs) diff --git a/target/sh4/translate.c b/target/sh4/translate.c index db09a0bce3..3672802785 100644 --- a/target/sh4/translate.c +++ b/target/sh4/translate.c @@ -2290,8 +2290,8 @@ static void sh4_tr_insn_start(DisasContextBase *dcbase, CPUState *cs) tcg_gen_insn_start(ctx->base.pc_next, ctx->envflags); } -static bool sh4_tr_breakpoint_check(DisasContextBase *dcbase, CPUState *cs, - const CPUBreakpoint *bp) +static int sh4_tr_breakpoint_check(DisasContextBase *dcbase, CPUState *cs, + int bp_flags) { DisasContext *ctx = container_of(dcbase, DisasContext, base); @@ -2299,12 +2299,8 @@ static bool sh4_tr_breakpoint_check(DisasContextBase *dcbase, CPUState *cs, gen_save_cpu_state(ctx, true); gen_helper_debug(cpu_env); ctx->base.is_jmp = DISAS_NORETURN; - /* The address covered by the breakpoint must be included in - [tb->pc, tb->pc + tb->size) in order to for it to be - properly cleared -- thus we increment the PC here so that - the logic setting tb->size below does the right thing. */ - ctx->base.pc_next += 2; - return true; + + return 2; /* minimum instruction length */ } static void sh4_tr_translate_insn(DisasContextBase *dcbase, CPUState *cs) diff --git a/target/sparc/translate.c b/target/sparc/translate.c index fb0c242606..fbc77b693d 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -5855,8 +5855,8 @@ static void sparc_tr_insn_start(DisasContextBase *dcbase, CPUState *cs) } } -static bool sparc_tr_breakpoint_check(DisasContextBase *dcbase, CPUState *cs, - const CPUBreakpoint *bp) +static int sparc_tr_breakpoint_check(DisasContextBase *dcbase, CPUState *cs, + int bp_flags) { DisasContext *dc = container_of(dcbase, DisasContext, base); @@ -5866,9 +5866,8 @@ static bool sparc_tr_breakpoint_check(DisasContextBase *dcbase, CPUState *cs, gen_helper_debug(cpu_env); tcg_gen_exit_tb(NULL, 0); dc->base.is_jmp = DISAS_NORETURN; - /* update pc_next so that the current instruction is included in tb->size */ - dc->base.pc_next += 4; - return true; + + return 4; /* minimum instruction length */ } static void sparc_tr_translate_insn(DisasContextBase *dcbase, CPUState *cs) diff --git a/target/tricore/translate.c b/target/tricore/translate.c index 865020754d..8c39134d52 100644 --- a/target/tricore/translate.c +++ b/target/tricore/translate.c @@ -8810,19 +8810,12 @@ static void tricore_tr_insn_start(DisasContextBase *dcbase, CPUState *cpu) tcg_gen_insn_start(ctx->base.pc_next); } -static bool tricore_tr_breakpoint_check(DisasContextBase *dcbase, CPUState *cpu, - const CPUBreakpoint *bp) +static int tricore_tr_breakpoint_check(DisasContextBase *dcbase, + CPUState *cpu, int bp_flags) { DisasContext *ctx = container_of(dcbase, DisasContext, base); generate_qemu_excp(ctx, EXCP_DEBUG); - /* - * The address covered by the breakpoint must be included in - * [tb->pc, tb->pc + tb->size) in order to for it to be - * properly cleared -- thus we increment the PC here so that - * the logic setting tb->size below does the right thing. - */ - ctx->base.pc_next += 4; - return true; + return 4; /* minimum instruction length */ } static bool insn_crosses_page(CPUTriCoreState *env, DisasContext *ctx) diff --git a/target/xtensa/translate.c b/target/xtensa/translate.c index ac42f5efdc..347187d588 100644 --- a/target/xtensa/translate.c +++ b/target/xtensa/translate.c @@ -1233,20 +1233,16 @@ static void xtensa_tr_insn_start(DisasContextBase *dcbase, CPUState *cpu) tcg_gen_insn_start(dcbase->pc_next); } -static bool xtensa_tr_breakpoint_check(DisasContextBase *dcbase, CPUState *cpu, - const CPUBreakpoint *bp) +static int xtensa_tr_breakpoint_check(DisasContextBase *dcbase, CPUState *cpu, + int bp_flags) { DisasContext *dc = container_of(dcbase, DisasContext, base); tcg_gen_movi_i32(cpu_pc, dc->base.pc_next); gen_exception(dc, EXCP_DEBUG); dc->base.is_jmp = DISAS_NORETURN; - /* The address covered by the breakpoint must be included in - [tb->pc, tb->pc + tb->size) in order to for it to be - properly cleared -- thus we increment the PC here so that - the logic setting tb->size below does the right thing. */ - dc->base.pc_next += 2; - return true; + + return 2; /* minimum instruction length */ } static void xtensa_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) From patchwork Thu Jul 1 15:25:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 469109 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp503676jao; Thu, 1 Jul 2021 08:35:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyJGFdFSLJeaD63p8EbfhZzNCaZSD73mfmnEVJw2K/sYU3iMdtqLlQegIvnEOxoOGwiC6MH X-Received: by 2002:a05:6402:3450:: with SMTP id l16mr570245edc.358.1625153729551; Thu, 01 Jul 2021 08:35:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625153729; cv=none; d=google.com; s=arc-20160816; b=TOy/KJUkC+NRJsD/5C9IycigxVyYu5G28cnHZBpFdlYQq13RqdpQu4T9VGzBw5tqsX cruPkmeb7DgvWMr91bqswQRwF3HD6L7Cg6a4lFiGiHyw4At1OlHeYF3hTEuj7QNrZWW/ DJL1T0g1D1+DDQYhUEQSaEJZemeXDvw9yNrWzyE1QtgL9dL0s5Q23b+b3KqmZZ3GxxVj ecjMRQyUdv8JAoD8tKZCpBeC1kJw/lbox886pWCPKGAeGVmQlGCvI4u8IyQT1VsbOxA4 pg1Py4lfnumb/9rM4ijk+nVmWrJJlo2VAFNboYCwEw4c9llMa83w5NHUXparN6D1ByrB PGuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=DeiOM3E/by38ksgPe4YGpd7ba5mJVtkTjbeFMUwSxAA=; b=FHBpDrZPRJLVAw3/lIFRBc7fbiExORfFcDBa5S2XBiX/xTpt61E4TrmTSeUQgdbkO6 y0kC+GKaPfo2ZzG9FwF0ekFowfkTa2Fr3oVxViD3o60XimZ79wfSoPmb4qvqanRTVOuS djODS37MZltIxHlQw88EjBmTf2mi9Y2HOeGVjJFxIB40vKAhGZ9ZdaTlAJvAv6ERSLYx hThZmzQNle2FP/FkSZ5fzMcu69PnlLEq9mqIK1t8KpaFaOjz3PDFcWqJGd+AWWH//ZLh dKzEg5RRaL9LM02nfKcW6BDRgBn04fsWtwGaATwM9QaztUhK4dLslc9tGu1HI0wnNQrU +2+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=vk6slx4W; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id w20si81082edc.462.2021.07.01.08.35.29 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 01 Jul 2021 08:35:29 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=vk6slx4W; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:36354 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lyyiu-0008Il-JW for patch@linaro.org; Thu, 01 Jul 2021 11:35:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53030) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lyyZm-0004jp-0R for qemu-devel@nongnu.org; Thu, 01 Jul 2021 11:26:02 -0400 Received: from mail-pj1-x1030.google.com ([2607:f8b0:4864:20::1030]:39529) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lyyZZ-0008IG-Ol for qemu-devel@nongnu.org; Thu, 01 Jul 2021 11:26:01 -0400 Received: by mail-pj1-x1030.google.com with SMTP id in17-20020a17090b4391b0290170ba0ec7fcso6857219pjb.4 for ; Thu, 01 Jul 2021 08:25:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=DeiOM3E/by38ksgPe4YGpd7ba5mJVtkTjbeFMUwSxAA=; b=vk6slx4WjHcLjaxMb7LE1nOcg1I4Y4pK0+0vzpCR30oObBLEg9Ga8bJ8zWdl6z+Nkp lJX+LAEkTMIHXcxl1V06HmMF32X7MCH6mTXzJ+s5dzou3X5Ukds4Mn0qmSHecoXw5/GH ZV7UYUsNExIV8rbSP/z/SiTJKbXdlLE/j9BqWSlmI27xX4iQs8iVEQN/9VmYAViORfQV SJw+xdmbednJI/tqu57/uiY/C8DcaKrALYuTos+LmwFQSkHHpaDy9IC0Rlk/d8+vahNQ z4dea7iqPYFWs5m7jj3z+TCxPp6GwJ+iDuVX+MSUTasdvqftk/SlvxNTs+g0GqctUDQI gHtQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=DeiOM3E/by38ksgPe4YGpd7ba5mJVtkTjbeFMUwSxAA=; b=Rld7sJfL1CivzVjJ9JFeKz55NmWRIM4cW4zNTzttEiPddn5tyZcM90+zgFERtg2yda dMEWIjNy6F6uaSaqZZTkt5DRyMLgekbdhj/EHD3KYLvWwINUsvxMnMLQ3A2x/hAWHQ8w VAyrSE0FtCJAcr3HW62HwqQ/LsOqB6vt53J2Ge11UGtBoJi2L/jkP4SylalbRSHmWoqM baWKnGRbVIHE4MbCAmTnYBxIVWFBoINbR4AaCTJiUiLtSlUM3DNAxy2Yyj7Jio/SSqCC nHvDsWwfVLWpoNJwS3sQq/+m4h0oLcIPZVjnskyX/5Qus7KIbc176x72v1asljHa0VX8 8KsQ== X-Gm-Message-State: AOAM533xJPK+NvOp1wVdb0mcDtkZsDn8Peo5oNdgK6HwuOwcKzv6/2Nu 0PhRm4AQPNAQ5DGBHFciluso2ah6hJEbMA== X-Received: by 2002:a17:902:fe10:b029:127:6549:fe98 with SMTP id g16-20020a170902fe10b02901276549fe98mr115714plj.25.1625153147853; Thu, 01 Jul 2021 08:25:47 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id j4sm10213197pjv.7.2021.07.01.08.25.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Jul 2021 08:25:47 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 15/17] accel/tcg: Hoist tb_cflags to a local in translator_loop Date: Thu, 1 Jul 2021 08:25:35 -0700 Message-Id: <20210701152537.3330420-16-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210701152537.3330420-1-richard.henderson@linaro.org> References: <20210701152537.3330420-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1030; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1030.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, mark.cave-ayland@ilande.co.uk, alex.bennee@linaro.org, f4bug@amsat.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" The access internal to tb_cflags() is atomic. Avoid re-reading it as such for the multiple uses. Signed-off-by: Richard Henderson --- accel/tcg/translator.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) -- 2.25.1 diff --git a/accel/tcg/translator.c b/accel/tcg/translator.c index 1c44d096d8..449159a27c 100644 --- a/accel/tcg/translator.c +++ b/accel/tcg/translator.c @@ -50,6 +50,7 @@ bool translator_use_goto_tb(DisasContextBase *db, target_ulong dest) void translator_loop(const TranslatorOps *ops, DisasContextBase *db, CPUState *cpu, TranslationBlock *tb, int max_insns) { + uint32_t cflags = tb_cflags(tb); bool plugin_enabled; /* Initialize DisasContext */ @@ -72,8 +73,7 @@ void translator_loop(const TranslatorOps *ops, DisasContextBase *db, ops->tb_start(db, cpu); tcg_debug_assert(db->is_jmp == DISAS_NEXT); /* no early exit */ - plugin_enabled = plugin_gen_tb_start(cpu, tb, - tb_cflags(db->tb) & CF_MEMI_ONLY); + plugin_enabled = plugin_gen_tb_start(cpu, tb, cflags & CF_MEMI_ONLY); while (true) { db->num_insns++; @@ -125,14 +125,13 @@ void translator_loop(const TranslatorOps *ops, DisasContextBase *db, update db->pc_next and db->is_jmp to indicate what should be done next -- either exiting this loop or locate the start of the next instruction. */ - if (db->num_insns == db->max_insns - && (tb_cflags(db->tb) & CF_LAST_IO)) { + if (db->num_insns == db->max_insns && (cflags & CF_LAST_IO)) { /* Accept I/O on the last instruction. */ gen_io_start(); ops->translate_insn(db, cpu); } else { /* we should only see CF_MEMI_ONLY for io_recompile */ - tcg_debug_assert(!(tb_cflags(db->tb) & CF_MEMI_ONLY)); + tcg_debug_assert(!(cflags & CF_MEMI_ONLY)); ops->translate_insn(db, cpu); } From patchwork Thu Jul 1 15:25:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 469107 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp502428jao; Thu, 1 Jul 2021 08:34:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwQKh0M6HwK/+N6n25v//XFSTHiBTlsSC6Sy8jnIEaT4S4kccfJ1HgRMZW6eyocgiXhx+PB X-Received: by 2002:a17:907:990f:: with SMTP id ka15mr497005ejc.132.1625153645030; Thu, 01 Jul 2021 08:34:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625153645; cv=none; d=google.com; s=arc-20160816; b=vwwX5gxTI2PUcqYBNC3YpRxL9dv2oRkJTB2z06lhem5QcOi7LGJR4momO9+qUmREM1 9x6+qs8M0j6gzlLIRuAVscS9WkoNM4V2fwDDyqWF45Fmn90YN+3fnXq4D99R7Eke4RiR OhQ6yxv8+shnQBtZNg3fmlwP4jQ65Yjn4wav524oMgagAPKzNjFpyS4CyGEpHyjPTGu+ 8hpc/V2kQd5DYTx6TKpG21+f2azBWY1uJrjsFYAqWvGtjqw9wEaDwvrDpFmc3W/s5ZrJ eKk+2FR7g06pRJ9Xe3pZq2R9xwJCS6m/3Scl5gaPnfQOps4E/8A6xuuzupvGyYODa68f wuIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=E/tYL3rdESuVTgFNPqWmy6yzujnFLahXqd+j6XzzrMA=; b=m9R0IwffiWtUPc9Pr67i8zZZae3GiabZORxuAdYnSOqCyN9tN6UA2xnNH1U0XfB3IT oKNG/FnDf9JBG28MNy7y7xXqeyq3VNi6qTpyiTYo8aOB43vFu8rInoFgS2Zwy9WIIPaP V+Zgs0u+SYU4mlF6dwWz/rlEtoJuTqPCPCIa8oz9HsPV08SflSmY7I8oB2vRG+VH2Sl7 gvWDnJwnzqIIjHruf13rcRGAW/G4IdY5fAnBO+N9LgwVqBs1DUjYuOX4hgjFpjnEor2L 68ey0uZ25hn/1AsQHa4xjhCBqnpO/wvibIgYufJjcU+djIM974v+elucu5gNDb/VZD+s SUTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=LsTSEy+4; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id h9si324768eje.11.2021.07.01.08.34.04 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 01 Jul 2021 08:34:05 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=LsTSEy+4; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:58254 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lyyhX-00042A-Ty for patch@linaro.org; Thu, 01 Jul 2021 11:34:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53060) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lyyZn-0004mp-G8 for qemu-devel@nongnu.org; Thu, 01 Jul 2021 11:26:05 -0400 Received: from mail-pf1-x435.google.com ([2607:f8b0:4864:20::435]:34567) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lyyZZ-0008JA-QE for qemu-devel@nongnu.org; Thu, 01 Jul 2021 11:26:03 -0400 Received: by mail-pf1-x435.google.com with SMTP id i6so6230908pfq.1 for ; Thu, 01 Jul 2021 08:25:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=E/tYL3rdESuVTgFNPqWmy6yzujnFLahXqd+j6XzzrMA=; b=LsTSEy+4+ywsmOUkpHbRPs63Ieuww+EoCpX2gX+ePCPoLtk4Kga64iH9jPnfrbkTMz gIgOjh96ZxYFwVT+ihZvyPbz9Ry5wAdZxUMuuaJjhqS7TA113+1KQr9n24Daz22cSDYl 5UtS5cuQ0daZN/iUFhU+kt2ytwjuY8nsBv5YTG5LLSbfF31udIXkkbUpgRhOs8ulVr4R pCeWTVTkO+WEuz+DzWseMn82LTY6lkS7/h5StN2Fq0y3/A2BfNSOKtMvtus9g99ze1tT S0WfY1lRENotXBTHMTZjTxjSpTRvYVPFMQlIQoEOz1Ns/3PlVPkGTXPR1mXCAION5xjU z0cQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=E/tYL3rdESuVTgFNPqWmy6yzujnFLahXqd+j6XzzrMA=; b=fFbnhQHUPQjUjusNr+IHzNb7s/tFSVljsseONlsP7bTx2i6pHR86zLUu+N6WhQrNY5 /Jb8XXqY8vxTmRfZqtRmdD98NCPAhgxWStoVYtavH4iScl9AefO3QIGBugnHR/PGHSbh 4sCS4xOw5Xa0pR4tOjkmfDmvK4y/l4AadXKHF8esKOYqxB6s4sjgxXPCYWKmM5xfJIpY XfqEXIuAPJ5ZOWWYQVJ3cixVlF80yj13YhUEbfdiNhmJKGWPFmkqXt65N5kie5M/Ldt2 sBu/9WavWK43Yz62ODDim0X0AVMyh0cGFIe1ne+QR8eAnfuKKLnKqeRsCsMrdkicAQIe gxSA== X-Gm-Message-State: AOAM53069cGukIw5t7JKi+I7D3Vumt4O6BRNb0d5XYOTiw1XG0auO4w9 IoETqLN3pngrChyaQqvTMlvwGUOUwMxOaQ== X-Received: by 2002:a63:164c:: with SMTP id 12mr153302pgw.141.1625153148465; Thu, 01 Jul 2021 08:25:48 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id j4sm10213197pjv.7.2021.07.01.08.25.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Jul 2021 08:25:48 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 16/17] accel/tcg: Encode breakpoint info into tb->cflags Date: Thu, 1 Jul 2021 08:25:36 -0700 Message-Id: <20210701152537.3330420-17-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210701152537.3330420-1-richard.henderson@linaro.org> References: <20210701152537.3330420-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::435; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x435.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, mark.cave-ayland@ilande.co.uk, alex.bennee@linaro.org, f4bug@amsat.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Having this data in cflags means that hashing takes care of selecting a TB with or without exceptions built in. Which means that we no longer need to flush all TBs. This does require that we single-step while we're within a page that contains a breakpoint, so it's not yet ideal, but should be an improvement over some corner-case slowdowns. Resolves: https://gitlab.com/qemu-project/qemu/-/issues/404 Signed-off-by: Richard Henderson --- include/exec/exec-all.h | 7 ++++ accel/tcg/cpu-exec.c | 68 ++++++++++++++++++++++++++++++- accel/tcg/translate-all.c | 4 -- accel/tcg/translator.c | 85 +++++++++++++++++++++------------------ cpu.c | 24 ----------- 5 files changed, 119 insertions(+), 69 deletions(-) -- 2.25.1 diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h index 6873cce8df..7ab2578f71 100644 --- a/include/exec/exec-all.h +++ b/include/exec/exec-all.h @@ -502,9 +502,16 @@ struct TranslationBlock { #define CF_USE_ICOUNT 0x00020000 #define CF_INVALID 0x00040000 /* TB is stale. Set with @jmp_lock held */ #define CF_PARALLEL 0x00080000 /* Generate code for a parallel context */ +#define CF_BP_MASK 0x00300000 /* See below */ +#define CF_BP_SHIFT 20 #define CF_CLUSTER_MASK 0xff000000 /* Top 8 bits are cluster ID */ #define CF_CLUSTER_SHIFT 24 +#define CF_BP_NONE (0 << CF_BP_SHIFT) /* TB does not interact with BPs */ +#define CF_BP_SSTEP (1 << CF_BP_SHIFT) /* gdbstub single-step in effect */ +#define CF_BP_GDB (2 << CF_BP_SHIFT) /* gdbstub breakpoint at tb->pc */ +#define CF_BP_CPU (3 << CF_BP_SHIFT) /* arch breakpoint at tb->pc */ + /* Per-vCPU dynamic tracing state used to generate this TB */ uint32_t trace_vcpu_dstate; diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c index 4d043a11aa..179a425ece 100644 --- a/accel/tcg/cpu-exec.c +++ b/accel/tcg/cpu-exec.c @@ -222,6 +222,65 @@ static inline void log_cpu_exec(target_ulong pc, CPUState *cpu, } } +static uint32_t cflags_for_breakpoints(CPUState *cpu, target_ulong pc, + uint32_t cflags) +{ + uint32_t bflags = 0; + + if (unlikely(cpu->singlestep_enabled)) { + bflags = CF_BP_SSTEP; + } else { + bool match_page = false; + CPUBreakpoint *bp; + + QTAILQ_FOREACH(bp, &cpu->breakpoints, entry) { + /* Note exact pc matches */ + if (pc == bp->pc) { + if (bp->flags & BP_GDB) { + bflags = CF_BP_GDB; + break; + } + if (bp->flags & BP_CPU) { + bflags = CF_BP_CPU; + break; + } + } + /* Note page matches */ + if (((pc ^ bp->pc) & TARGET_PAGE_MASK) == 0) { + match_page = true; + } + } + + if (likely(!bflags)) { + if (likely(!match_page)) { + return cflags; + } + + /* + * Within the same page as a breakpoint, single-step, + * returning to helper_lookup_tb_ptr after each looking + * for the actual breakpoint. + * + * TODO: Perhaps better to record all of the TBs associated + * with a given virtual page that contains a breakpoint, and + * then invalidate them when a new overlapping breakpoint is + * set on the page. Non-overlapping TBs would not be + * invalidated, nor would any TB need to be invalidated as + * breakpoints are removed. + */ + bflags = CF_NO_GOTO_TB; + } + } + + /* + * Reduce the TB to one insn. + * In the case of a BP hit, we will be raising an exception anyway. + * In the case of a page hit, return to helper_lookup_tb_ptr after + * every insn to look for the breakpoint. + */ + return (cflags & ~CF_COUNT_MASK) | 1 | bflags; +} + /** * helper_lookup_tb_ptr: quick check for next tb * @env: current cpu state @@ -235,11 +294,13 @@ const void *HELPER(lookup_tb_ptr)(CPUArchState *env) CPUState *cpu = env_cpu(env); TranslationBlock *tb; target_ulong cs_base, pc; - uint32_t flags; + uint32_t flags, cflags; cpu_get_tb_cpu_state(env, &pc, &cs_base, &flags); - tb = tb_lookup(cpu, pc, cs_base, flags, curr_cflags(cpu)); + cflags = cflags_for_breakpoints(cpu, pc, curr_cflags(cpu)); + + tb = tb_lookup(cpu, pc, cs_base, flags, cflags); if (tb == NULL) { return tcg_code_gen_epilogue; } @@ -346,6 +407,8 @@ void cpu_exec_step_atomic(CPUState *cpu) cflags &= ~CF_PARALLEL; /* After 1 insn, return and release the exclusive lock. */ cflags |= CF_NO_GOTO_TB | CF_NO_GOTO_PTR | 1; + /* Raise any post-instruction debug exceptions. */ + cflags = cflags_for_breakpoints(cpu, pc, cflags); tb = tb_lookup(cpu, pc, cs_base, flags, cflags); if (tb == NULL) { @@ -524,6 +587,7 @@ static inline TranslationBlock *tb_find(CPUState *cpu, } else { cpu->cflags_next_tb = -1; } + cflags = cflags_for_breakpoints(cpu, pc, cflags); tb = tb_lookup(cpu, pc, cs_base, flags, cflags); if (tb == NULL) { diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c index 586f8ca4ef..262659780b 100644 --- a/accel/tcg/translate-all.c +++ b/accel/tcg/translate-all.c @@ -1437,10 +1437,6 @@ TranslationBlock *tb_gen_code(CPUState *cpu, } QEMU_BUILD_BUG_ON(CF_COUNT_MASK + 1 != TCG_MAX_INSNS); - if (cpu->singlestep_enabled) { - max_insns = 1; - } - buffer_overflow: tb = tcg_tb_alloc(tcg_ctx); if (unlikely(!tb)) { diff --git a/accel/tcg/translator.c b/accel/tcg/translator.c index 449159a27c..01b48137da 100644 --- a/accel/tcg/translator.c +++ b/accel/tcg/translator.c @@ -33,13 +33,8 @@ void translator_loop_temp_check(DisasContextBase *db) bool translator_use_goto_tb(DisasContextBase *db, target_ulong dest) { - /* Suppress goto_tb if requested. */ - if (tb_cflags(db->tb) & CF_NO_GOTO_TB) { - return false; - } - - /* Suppress goto_tb in the case of single-steping. */ - if (db->singlestep_enabled) { + /* Suppress goto_tb if requested, or required by breakpoints. */ + if (tb_cflags(db->tb) & (CF_NO_GOTO_TB | CF_BP_MASK)) { return false; } @@ -51,6 +46,7 @@ void translator_loop(const TranslatorOps *ops, DisasContextBase *db, CPUState *cpu, TranslationBlock *tb, int max_insns) { uint32_t cflags = tb_cflags(tb); + int bp_flags = 0; bool plugin_enabled; /* Initialize DisasContext */ @@ -60,7 +56,23 @@ void translator_loop(const TranslatorOps *ops, DisasContextBase *db, db->is_jmp = DISAS_NEXT; db->num_insns = 0; db->max_insns = max_insns; - db->singlestep_enabled = cpu->singlestep_enabled; + db->singlestep_enabled = false; + + switch (cflags & CF_BP_MASK) { + case CF_BP_NONE: + break; + case CF_BP_SSTEP: + db->singlestep_enabled = true; + break; + case CF_BP_GDB: + bp_flags = BP_GDB; + break; + case CF_BP_CPU: + bp_flags = BP_CPU; + break; + default: + g_assert_not_reached(); + } ops->init_disas_context(db, cpu); tcg_debug_assert(db->is_jmp == DISAS_NEXT); /* no early exit */ @@ -85,39 +97,34 @@ void translator_loop(const TranslatorOps *ops, DisasContextBase *db, } /* Pass breakpoint hits to target for further processing */ - if (!db->singlestep_enabled - && unlikely(!QTAILQ_EMPTY(&cpu->breakpoints))) { - CPUBreakpoint *bp; - QTAILQ_FOREACH(bp, &cpu->breakpoints, entry) { - if (bp->pc == db->pc_next) { - int len = ops->breakpoint_check(db, cpu, bp->flags); + if (unlikely(bp_flags)) { + int len = ops->breakpoint_check(db, cpu, bp_flags); - /* - * The breakpoint_check hook may use DISAS_TOO_MANY - * to indicate that only one more instruction is to - * be executed. Otherwise it should use DISAS_NORETURN - * when generating an exception, but may use a - * DISAS_TARGET_* value for Something Else. - */ - if (db->is_jmp > DISAS_TOO_MANY) { - /* - * The address covered by the breakpoint must be - * included in [tb->pc, tb->pc + tb->size) in order - * to for it to be properly cleared. Thus we - * increment the PC here so that the logic setting - * tb->size below does the right thing. - */ - tcg_debug_assert(len > 0); - db->pc_next += len; + /* + * When there is a bp hit, we're going to execute a maximum + * of one instruction. The breakpoint_check hook may use + * DISAS_NEXT or DISAS_TOO_MANY to indicate that the current + * instruction should be translated. Anything else is taken + * to mean that an exception has been raised and that zero + * instructions will be executed. + */ + if (db->is_jmp > DISAS_TOO_MANY) { + /* + * The address covered by the breakpoint must be + * included in [tb->pc, tb->pc + tb->size) in order + * to for it to be properly cleared. Thus we + * increment the PC here so that the logic setting + * tb->size below does the right thing. + */ + tcg_debug_assert(len > 0); + db->pc_next += len; - /* - * The breakpoint definitely hit, so decrement the - * number of instructions completed for icount. - */ - db->num_insns--; - goto done; - } - } + /* + * The breakpoint definitely hit, so decrement the + * number of instructions completed for icount. + */ + db->num_insns--; + goto done; } } diff --git a/cpu.c b/cpu.c index 164fefeaa3..2c9da10d0f 100644 --- a/cpu.c +++ b/cpu.c @@ -224,11 +224,6 @@ void tb_invalidate_phys_addr(target_ulong addr) tb_invalidate_phys_page_range(addr, addr + 1); mmap_unlock(); } - -static void breakpoint_invalidate(CPUState *cpu, target_ulong pc) -{ - tb_invalidate_phys_addr(pc); -} #else void tb_invalidate_phys_addr(AddressSpace *as, hwaddr addr, MemTxAttrs attrs) { @@ -249,17 +244,6 @@ void tb_invalidate_phys_addr(AddressSpace *as, hwaddr addr, MemTxAttrs attrs) ram_addr = memory_region_get_ram_addr(mr) + addr; tb_invalidate_phys_page_range(ram_addr, ram_addr + 1); } - -static void breakpoint_invalidate(CPUState *cpu, target_ulong pc) -{ - /* - * There may not be a virtual to physical translation for the pc - * right now, but there may exist cached TB for this pc. - * Flush the whole TB cache to force re-translation of such TBs. - * This is heavyweight, but we're debugging anyway. - */ - tb_flush(cpu); -} #endif /* Add a breakpoint. */ @@ -280,8 +264,6 @@ int cpu_breakpoint_insert(CPUState *cpu, vaddr pc, int flags, QTAILQ_INSERT_TAIL(&cpu->breakpoints, bp, entry); } - breakpoint_invalidate(cpu, pc); - if (breakpoint) { *breakpoint = bp; } @@ -307,8 +289,6 @@ void cpu_breakpoint_remove_by_ref(CPUState *cpu, CPUBreakpoint *breakpoint) { QTAILQ_REMOVE(&cpu->breakpoints, breakpoint, entry); - breakpoint_invalidate(cpu, breakpoint->pc); - g_free(breakpoint); } @@ -332,10 +312,6 @@ void cpu_single_step(CPUState *cpu, int enabled) cpu->singlestep_enabled = enabled; if (kvm_enabled()) { kvm_update_guest_debug(cpu, 0); - } else { - /* must flush all the translated code to avoid inconsistencies */ - /* XXX: only flush what is necessary */ - tb_flush(cpu); } } } From patchwork Thu Jul 1 15:25:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 469112 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp506328jao; Thu, 1 Jul 2021 08:38:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw9yF7Bb8IPiNc4gAtP0WFywH66PDu30Gw24EuxCACtY34j6WAa3dCpaa83Sgj82vjTYs/0 X-Received: by 2002:a17:907:d1d:: with SMTP id gn29mr472666ejc.175.1625153904359; Thu, 01 Jul 2021 08:38:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625153904; cv=none; d=google.com; s=arc-20160816; b=ts3ihb67ytxPSY2cv+dKcD7NxQia++420mB+TfxBsv2RsIoobtdVkmpP7YsQKhzTaw jZYuKxNBBL84L9xZI9haReEx2Aeg7722qNwciGStR276yfN3ybEyaUfp7rqXmLspBELo R7DmI5E4YQTmrNx+zcMu7irzzkHfzfgky0nlT8fiynH3yH4ZdcR/eJ1pTNWG2PG2QFpR CVkm7VG/IYP881/K0uTVMorAs9L2etKH2amqogJf0A5QAgmUZ19TxLpy/zDYbJh/8YPA odsZc7tQCft56i18WoQh+5Fv4ALMbXFEgLtBUwfDU0e+kU2SF5G5SWNKLWVb6ABVzffE YfcQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=dVAJMlBLnkdiQ0OFyNnG82kaYtMH2wkH/dVTgpA0DcY=; b=NEgcGoIJoljYE3gsS+Sh14JoJcxAbfxjyw7AlNm6YNpOdaDtx0YpO9fB2kBg613jRh 4Qinw+soxkoMhFO1VAEyAxGydI89lmB0HB1nx/HpgHMf0YqIXaWdbOluw6EFzI65rmAb vdHEb3ZOIYRzZO5MPtfbn/5PJyMFyEC/LyTuVTJZOr6zDaWYMuJWydeLPgiYf3949UVV KolTS5GqT26VvyfADmFRxcnkhvHTr29104qfUqCzrWJ7EE1RGMmcotXUoAz5ODVVwDfy ubrcoA0++0AjCi7tqYcBzCM2ET1z3t4mbRhv13s1DIHmE/TbzFDodDh5wyUNPwPr8gcL 2HSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=wRwBt6H6; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id b23si104892edr.473.2021.07.01.08.38.24 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 01 Jul 2021 08:38:24 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=wRwBt6H6; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:42650 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lyylj-0004GT-Eb for patch@linaro.org; Thu, 01 Jul 2021 11:38:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53066) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lyyZn-0004ms-Qb for qemu-devel@nongnu.org; Thu, 01 Jul 2021 11:26:05 -0400 Received: from mail-pl1-x636.google.com ([2607:f8b0:4864:20::636]:41845) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lyyZb-0008Jx-Mr for qemu-devel@nongnu.org; Thu, 01 Jul 2021 11:26:03 -0400 Received: by mail-pl1-x636.google.com with SMTP id z4so3843958plg.8 for ; Thu, 01 Jul 2021 08:25:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=dVAJMlBLnkdiQ0OFyNnG82kaYtMH2wkH/dVTgpA0DcY=; b=wRwBt6H6gaOb13z7lIBrrIeZAcgr4l05FIcKSbWkc2eXHaUvRmyA1SGrNJet4xsA/O Lr9MdzmCcmDP+wAoCOgb0gqMyp19vVGb+G4Vcl5SHewFbexorTtIWSzTLvbwnBffiErs lmDs1WkL7hXklTPvKKuGKiMEfuvIllIZE7xCsJg5nxM/GOXEu65pBX4YeRrNKKuNgBst Azhk0DUXe3aEPPNsP0x4gdjeab9I81mIqOqVK4ACq2QVbb9SJ8wiMKPzEoQhNuEAI7s6 H1Lctrwbv4HuXICFOwNHULO6LHaNvRjss8vcQM5aFxCE316NG61OkG7ffchbt9qL39mq 3/XQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=dVAJMlBLnkdiQ0OFyNnG82kaYtMH2wkH/dVTgpA0DcY=; b=nxM7vSvshmUbAPsBmloAmDU/YvG19vdzRGkSmrZwW9Ng+cZe3wF7Vcnw/AbxlNL2dL thYPiuyWIKzLvptFRAFu1nlMCrpmDNNniF0PJdTBrWWmK4L1I6+9Q8bcYZV5QOemsj4x AAbL9LZEmCHYKTzBDoSVHv7S/rROOOlpZ4ipLNLS8RX2TFJvI05JS0lL2mgy14MW4gEa PGDSW7c/4lUFzD/aKirNBC5TvxfTZfmcDI9c/7cv84sghPqJih43VFyojdBL8rA367dh acnjh8hKbQpBmzYZzIMA/Oscoh2uy8HDzeKsSiUclj6vaPEPp82Z2+2l6iszwYA+tUgr EwpA== X-Gm-Message-State: AOAM533wYH9EGRa2c1uHs0zoqHGG9dGyUvoQXC1E7DfRFZjZyq0QksNH pGAzgegK56dd/MOoX6YsZnWbnNauQWD/3Q== X-Received: by 2002:a17:90a:c58d:: with SMTP id l13mr10614736pjt.186.1625153149047; Thu, 01 Jul 2021 08:25:49 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id j4sm10213197pjv.7.2021.07.01.08.25.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Jul 2021 08:25:48 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 17/17] cpu: Add breakpoint tracepoints Date: Thu, 1 Jul 2021 08:25:37 -0700 Message-Id: <20210701152537.3330420-18-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210701152537.3330420-1-richard.henderson@linaro.org> References: <20210701152537.3330420-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::636; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x636.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, mark.cave-ayland@ilande.co.uk, alex.bennee@linaro.org, f4bug@amsat.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Richard Henderson --- cpu.c | 11 ++++++++--- trace-events | 5 +++++ 2 files changed, 13 insertions(+), 3 deletions(-) -- 2.25.1 Reviewed-by: Philippe Mathieu-Daudé diff --git a/cpu.c b/cpu.c index 2c9da10d0f..addcb5db9c 100644 --- a/cpu.c +++ b/cpu.c @@ -38,6 +38,7 @@ #include "exec/translate-all.h" #include "exec/log.h" #include "hw/core/accel-cpu.h" +#include "trace/trace-root.h" uintptr_t qemu_host_page_size; intptr_t qemu_host_page_mask; @@ -267,6 +268,8 @@ int cpu_breakpoint_insert(CPUState *cpu, vaddr pc, int flags, if (breakpoint) { *breakpoint = bp; } + + trace_breakpoint_insert(cpu->cpu_index, pc, flags); return 0; } @@ -285,11 +288,12 @@ int cpu_breakpoint_remove(CPUState *cpu, vaddr pc, int flags) } /* Remove a specific breakpoint by reference. */ -void cpu_breakpoint_remove_by_ref(CPUState *cpu, CPUBreakpoint *breakpoint) +void cpu_breakpoint_remove_by_ref(CPUState *cpu, CPUBreakpoint *bp) { - QTAILQ_REMOVE(&cpu->breakpoints, breakpoint, entry); + QTAILQ_REMOVE(&cpu->breakpoints, bp, entry); - g_free(breakpoint); + trace_breakpoint_remove(cpu->cpu_index, bp->pc, bp->flags); + g_free(bp); } /* Remove all matching breakpoints. */ @@ -313,6 +317,7 @@ void cpu_single_step(CPUState *cpu, int enabled) if (kvm_enabled()) { kvm_update_guest_debug(cpu, 0); } + trace_breakpoint_singlestep(cpu->cpu_index, enabled); } } diff --git a/trace-events b/trace-events index 765fe251e6..c4cca29939 100644 --- a/trace-events +++ b/trace-events @@ -25,6 +25,11 @@ # # The should be a sprintf()-compatible format string. +# cpu.c +breakpoint_insert(int cpu_index, uint64_t pc, int flags) "cpu=%d pc=0x%" PRIx64 " flags=0x%x" +breakpoint_remove(int cpu_index, uint64_t pc, int flags) "cpu=%d pc=0x%" PRIx64 " flags=0x%x" +breakpoint_singlestep(int cpu_index, int enabled) "cpu=%d enable=%d" + # dma-helpers.c dma_blk_io(void *dbs, void *bs, int64_t offset, bool to_dev) "dbs=%p bs=%p offset=%" PRId64 " to_dev=%d" dma_aio_cancel(void *dbs) "dbs=%p"