From nobody Sun Sep 28 16:28:03 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1758595388; cv=none; d=zohomail.com; s=zohoarc; b=KXLlJGYn/N2QUQYgIvwwXnS8IWtOpId4731OBEWO1LTSQL3mDl6oO0es5g0YOkoHpD1Skt0XvMzIHAWLu/sk/F/G9DvCkX3ngkqkukJhOcjBbWzAHTDKGukfYVkuYv/xzeulj5tnKuUQ6+jp69MM7UBMkOYG/K4cZtwZrcaskX0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1758595388; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=oXxBMnFQ/RPp+Yw4YVGAm6rlpqH3fZoa0yhbkR1+s/I=; b=KK1kD62pZjxNMnY1H98yuOwEdgf0eXi/7H1C36VpGFw2wyoHwo07P9+qhPQBgFA5O5jwIcPxVITouddpDlMHHlSf4VLir0tvf3NrtG0U9mqEpxCyGXvUAmEh3Xqb9kWC7aLrPX2OGJZaGT59+tGf8CB+dwQ8qEOAltyrILgtlj8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1758595388130510.4890946956434; Mon, 22 Sep 2025 19:43:08 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1v0swU-0004Gt-7U; Mon, 22 Sep 2025 22:39:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1v0swO-0004Et-8D for qemu-devel@nongnu.org; Mon, 22 Sep 2025 22:39:40 -0400 Received: from mail-pf1-x430.google.com ([2607:f8b0:4864:20::430]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1v0swF-0003gj-Op for qemu-devel@nongnu.org; Mon, 22 Sep 2025 22:39:39 -0400 Received: by mail-pf1-x430.google.com with SMTP id d2e1a72fcca58-77f429ea4d5so1343007b3a.0 for ; Mon, 22 Sep 2025 19:39:25 -0700 (PDT) Received: from stoup.. ([71.212.157.132]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-77f0da43089sm9899622b3a.90.2025.09.22.19.39.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Sep 2025 19:39:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1758595165; x=1759199965; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=oXxBMnFQ/RPp+Yw4YVGAm6rlpqH3fZoa0yhbkR1+s/I=; b=oU4btQjNGfZ89YNHK6hhfU/LhpuQ4bFyTmjoxHJ1Kql+GZvc7MMoozseEw3DbIsWuC lvEsKK3F2GnsKQ08Do8Geb7Pbwu+7SqPsFbP4ZBNylGyv14CAkCTvuOOVdjHrR+v/LNz LesPptbeTlmPoBXM1EOVe6QY0sFomVwIx8Jv/VHvxzYuwxIpwM/SG3grZxhxb3xJlQ78 u/3D626ogCuhMZakeosL5ssjaFmcOdkbme0fwhCmVoPDB5Todqb7vrETcWW+1GCnD6DF B8ltUlvosJWI+gZpWqzRO1y0qgAKy3/Wczu4+O4Gc1xcHsFlTWk1b0aCU23o8mKq5zCc /Ziw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1758595165; x=1759199965; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=oXxBMnFQ/RPp+Yw4YVGAm6rlpqH3fZoa0yhbkR1+s/I=; b=SWtB+Wb6wksMR6xEFuIU+NwsYI/NM4y4uZ1S9BbpCUSa92ew4KlUC2mcgItOhAJ/4q e2RbkqLODCvisnfKDzyz5cHOQBBzbhXisoMsI8T7ge1G5wxKnNk3xD3MvhjZCrRCb2sc QQc2LbP6V7VoPcZQZI7kh8S5tmVTlobm04cOl4KdGrun4vHt44+nkBauI+FZYsCZac7Z pXl8tjRpGrr6hfV6CDGwreQLoIsuANLhrLHKwhkTfjSeLepwG7ZK+V/WXz8aaYKHYeeN I22m0PsZcmT0vapac1qYm7p5kMxapEMNkI+4Kg691PLLqBhEjHVdeC8hxjAaW9li8DZ/ ml5Q== X-Gm-Message-State: AOJu0Yx/tvtpsjyAWtbz0ycImBmDnZHH07iBCthT8TH2zqJsU58dd3g3 Byplkks1xyxz4ucZbQ/L/5+yHswhBXNY+cf0qYO8OtLb75GpKjqT0AJ/gZAl03psRDlCmMhXJle 7pxol X-Gm-Gg: ASbGncvp4v8WERhd9kp26EQVNl92cUIap4PecZ8XyBSPNyQpEoWbq9ttj2McMjPx+GE q9AIK87o2AIbsaPw1HGAzqqestFYQt2h6aDhiCDMhpRHJ+tVfdKn8FniBS9DMIIOA1tc8RZpJuK cTxo+P+SwJ31MWtwosdLUpM6OgE62Jo1aifv+kBesT8matRdIBHTWSXMy/IxW9TS6A8kGf+cjME Ozz/oTMQQEdwrQBmeVNlNWck8RDd0xW/sZazkKoobPb28v5OZjFl+UIqD31E6uTPWst0D5jQyjm wmTBpwaf2yqNkLsUJP03okgrPs7HavOFW2eutHYTxABy3X5qxCc/H3RydvTy43ItlFk4bIT2gfr 0BsPe4USrm8jp/1L0l1AfPQPnW8g6 X-Google-Smtp-Source: AGHT+IHHTlEXTDQ1RW6t++87xO4Ngrtj3p/9/GbmB0jrn4DQB7ty75wneSEfjD7S8EbAILSyM3637w== X-Received: by 2002:a05:6a20:72a6:b0:263:b547:d0c3 with SMTP id adf61e73a8af0-2cff4d9234bmr1602620637.36.1758595164745; Mon, 22 Sep 2025 19:39:24 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Pierrick Bouvier , =?UTF-8?q?Alex=20Benn=C3=A9e?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v2 01/12] gdbstub: Remove tb_flush uses Date: Mon, 22 Sep 2025 19:39:05 -0700 Message-ID: <20250923023922.3102471-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250923023922.3102471-1-richard.henderson@linaro.org> References: <20250923023922.3102471-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::430; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x430.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, T_SPF_TEMPERROR=0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1758595388896116600 This hasn't been needed since d828b92b8a6 ("accel/tcg: Introduce CF_BP_PAGE"). Reviewed-by: Pierrick Bouvier Signed-off-by: Richard Henderson --- Cc: Alex Benn=C3=A9e Cc: Philippe Mathieu-Daud=C3=A9 --- gdbstub/system.c | 4 ---- gdbstub/user.c | 3 --- 2 files changed, 7 deletions(-) diff --git a/gdbstub/system.c b/gdbstub/system.c index 5be0d3c58c..df3514dc74 100644 --- a/gdbstub/system.c +++ b/gdbstub/system.c @@ -18,7 +18,6 @@ #include "gdbstub/syscalls.h" #include "gdbstub/commands.h" #include "exec/hwaddr.h" -#include "exec/tb-flush.h" #include "accel/accel-ops.h" #include "accel/accel-cpu-ops.h" #include "system/cpus.h" @@ -174,9 +173,6 @@ static void gdb_vm_state_change(void *opaque, bool runn= ing, RunState state) } else { trace_gdbstub_hit_break(); } - if (tcg_enabled()) { - tb_flush(cpu); - } ret =3D GDB_SIGNAL_TRAP; break; case RUN_STATE_PAUSED: diff --git a/gdbstub/user.c b/gdbstub/user.c index 67403e5a25..2e14ded3f0 100644 --- a/gdbstub/user.c +++ b/gdbstub/user.c @@ -15,7 +15,6 @@ #include "qemu/sockets.h" #include "qapi/error.h" #include "exec/hwaddr.h" -#include "exec/tb-flush.h" #include "exec/gdbstub.h" #include "gdbstub/commands.h" #include "gdbstub/syscalls.h" @@ -220,7 +219,6 @@ int gdb_handlesig(CPUState *cpu, int sig, const char *r= eason, void *siginfo, =20 /* disable single step if it was enabled */ cpu_single_step(cpu, 0); - tb_flush(cpu); =20 if (sig !=3D 0) { gdb_set_stop_cpu(cpu); @@ -539,7 +537,6 @@ static void disable_gdbstub(CPUState *thread_cpu) /* no cpu_watchpoint_remove_all for user-mode */ cpu_single_step(cpu, 0); } - tb_flush(thread_cpu); } =20 void gdbserver_fork_end(CPUState *cpu, pid_t pid) --=20 2.43.0 From nobody Sun Sep 28 16:28:03 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1758595320; cv=none; d=zohomail.com; s=zohoarc; b=fPCWjF41Wt7dY9TXqR+X2g7z7BvX8tYzA08an4cxJn4UX4UP3SlHOGQ5xV4OPZxfcLB7SYzhyzp14/Pvleb14YRpCQ/uYAeYIZ6ZaWKKNElTza7JiUYlgxu3zrKaB5RwzAqMghiTsy7xHwtxBv1mf7a8BKzGhUX6vS7/rL1/i4M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1758595320; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=hlRPEyr6JX0DFMZok14KKZ2onuzUr1d8B5RA0kC17uw=; b=Wkq9fl4fDkTZGki7lvTVlUvp6vmaB75B4KIufPM3ru11jAzbvcIkiwsVvYndJraqbYL0ilBhODn2A8pzGWtrxZarJpwjCDWQ9aUAAZ6t+pYJPVbjz6hZC9L+1FJXh2tFn9BVNZuultfmCfd9rTOIDg04e3+WWkbAitoj8SRK4lE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1758595320105302.4649705937194; Mon, 22 Sep 2025 19:42:00 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1v0swY-0004HF-2f; Mon, 22 Sep 2025 22:39:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1v0swR-0004GK-M6 for qemu-devel@nongnu.org; Mon, 22 Sep 2025 22:39:44 -0400 Received: from mail-pf1-x436.google.com ([2607:f8b0:4864:20::436]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1v0swG-0003go-Im for qemu-devel@nongnu.org; Mon, 22 Sep 2025 22:39:43 -0400 Received: by mail-pf1-x436.google.com with SMTP id d2e1a72fcca58-77e6495c999so3620568b3a.3 for ; Mon, 22 Sep 2025 19:39:28 -0700 (PDT) Received: from stoup.. ([71.212.157.132]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-77f0da43089sm9899622b3a.90.2025.09.22.19.39.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Sep 2025 19:39:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1758595165; x=1759199965; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=hlRPEyr6JX0DFMZok14KKZ2onuzUr1d8B5RA0kC17uw=; b=NzMguD1L4PW4TSePmSa32beLkfLd0xc006aohfzgxXKRJL1llJAU5C18aVOVlSh7Gs 4Q2WStlhmWtwv7W6V+2NSI7pQEVFzzNq/GbGagbQ4W6z6RiT8WWnfOxa/F7uxkAVETYc r2OSbz1IhgjDvkhQhouTHzoVB7YBpvqW2SqHXkFCF5RbYmgOETFzhDhR10zrMr2C0bjk 5SHkWgjOkk+WlMFyJKLKj+luJ72hft/GUUHHZniAKsjGsUSaFsr/qFiP3/Fn345CK4xa 1Sfo57NOQD9ZsVjc0hIw2TypZ7F71jRDcwjdc4MLPutafo/ED9j9XAw9I1D16zXlMWWM EqMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1758595165; x=1759199965; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=hlRPEyr6JX0DFMZok14KKZ2onuzUr1d8B5RA0kC17uw=; b=OAMKOPmAWmc63OOH5BRp0ncVmBsmyLNwDgUbQr6Thu+IXwhZHyGmbs4iUHSLSKIUU3 Qzezsx8T/gvJWR9Z6Nk07FaYMgr18Ef8qVkinKcPIpkaidNCWuNHaDIYzc/s9m47eJAS RVsu9XknFbkSJ9fkcomL2rmzGE/Y6sAZ8aDN6AN13H7t4SrIqS/QeqmCITKtwj5h2wWC f118/nFmaHAwWV70BWi+MmM2roe03C5ymIdNKesH2X8gBe9PMDZJ2UPog27PNsmRMkP9 P0joDxHCQPkfVFh5tyTpNURalYD7q8gDv8SBygJoF9gyfGr3fUWiAjEO580QvcXQNDSx MI+w== X-Gm-Message-State: AOJu0YyweWCmyKNwdRU/6mPQ//tFy/gQHUmWX+SytWJ3DdspRghleWyg y+UddrsJBbB3NRJ3WbYukc34gO9Zg8nJudU/1+oayOkzTiBRIzGVe7NAYsLv2XLz64m3ytPvovt n1AAJ X-Gm-Gg: ASbGnct60N25OvDITsqGX3N9uE7Wbp+AEgk51ggFIaVOxvstQUXZa1TZck6NcRnt7c1 iSAh9Oc4J517p03KE/Ac4lPwilY+0oVoONU9sTIuTQMZ/hIhpwiotrgY/SCe175VncbZTfW9LBt Nykg4CR5w1yOIVlUMpsiHdEJSew5sz1jf8OXguCdG4JLgB79Egpt4XEeXvH3r4jkpT5i6agJgtp /tda6TBz/6SwMEkwv3mBPpblC1iCdYepe75lD9NCvNAfvkRfZTRVmozeZ6OXrsxULAuG+k53Jmc H2ojSQacSkVtiKNAK1lWX1UIgzvGNjBikN2vJ1P3W3M1orEgg5vzF0aQMXHuxOy9u5ps2VBm6vg rLx3esxUpTzsFYzo+ose3vSOrutyvm/2/F1JsPhE= X-Google-Smtp-Source: AGHT+IGw5XfCFFqL/6knWB2DMFx0ReMia4ARx93zwc1N7Lj1aocwAnmYBKVFCYB7osnl8m63oL/spg== X-Received: by 2002:a05:6a00:b8f:b0:76b:42e5:fa84 with SMTP id d2e1a72fcca58-77f5389806amr1092111b3a.7.1758595165378; Mon, 22 Sep 2025 19:39:25 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Pierrick Bouvier Subject: [PATCH v2 02/12] accel/tcg: Split out tb_flush__exclusive Date: Mon, 22 Sep 2025 19:39:06 -0700 Message-ID: <20250923023922.3102471-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250923023922.3102471-1-richard.henderson@linaro.org> References: <20250923023922.3102471-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::436; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x436.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_PASS=-0.001, T_SPF_HELO_TEMPERROR=0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1758595321741116600 Content-Type: text/plain; charset="utf-8" Expose a routine to be called when no cpus are running. Simplify the do_tb_flush run_on_cpu callback, because that is explicitly called with start_exclusive; there is no need for the mmap_lock as well. Reviewed-by: Pierrick Bouvier Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Philippe Mathieu-Daud=C3=A9 --- include/exec/tb-flush.h | 13 +++++++++++++ accel/tcg/tb-maint.c | 33 ++++++++++++++++++++------------- 2 files changed, 33 insertions(+), 13 deletions(-) diff --git a/include/exec/tb-flush.h b/include/exec/tb-flush.h index 142c240d94..5076b13bbd 100644 --- a/include/exec/tb-flush.h +++ b/include/exec/tb-flush.h @@ -8,6 +8,19 @@ #ifndef _TB_FLUSH_H_ #define _TB_FLUSH_H_ =20 +/** + * tb_flush__exclusive() - flush all translation blocks + * + * Used to flush all the translation blocks in the system. + * Sometimes it is simpler to flush everything than work out which + * individual translations are now invalid and ensure they are + * not called anymore. + * + * Must be called from an exclusive context, e.g. start_exclusive + * or vm_stop. + */ +void tb_flush__exclusive(void); + /** * tb_flush() - flush all translation blocks * @cs: CPUState (must be valid, but treated as anonymous pointer) diff --git a/accel/tcg/tb-maint.c b/accel/tcg/tb-maint.c index 0048316f99..71216fa75e 100644 --- a/accel/tcg/tb-maint.c +++ b/accel/tcg/tb-maint.c @@ -36,6 +36,9 @@ #include "internal-common.h" #ifdef CONFIG_USER_ONLY #include "user/page-protection.h" +#define runstate_is_running() true +#else +#include "system/runstate.h" #endif =20 =20 @@ -756,17 +759,18 @@ static void tb_remove(TranslationBlock *tb) } #endif /* CONFIG_USER_ONLY */ =20 -/* flush all the translation blocks */ -static void do_tb_flush(CPUState *cpu, run_on_cpu_data tb_flush_count) +/* + * Flush all the translation blocks. + * Must be called from a context in which no cpus are running, + * e.g. start_exclusive() or vm_stop(). + */ +void tb_flush__exclusive(void) { - bool did_flush =3D false; + CPUState *cpu; =20 - mmap_lock(); - /* If it is already been done on request of another CPU, just retry. */ - if (tb_ctx.tb_flush_count !=3D tb_flush_count.host_int) { - goto done; - } - did_flush =3D true; + assert(tcg_enabled()); + assert(!runstate_is_running() || + (current_cpu && cpu_in_serial_context(current_cpu))); =20 CPU_FOREACH(cpu) { tcg_flush_jmp_cache(cpu); @@ -778,11 +782,14 @@ static void do_tb_flush(CPUState *cpu, run_on_cpu_dat= a tb_flush_count) tcg_region_reset_all(); /* XXX: flush processor icache at this point if cache flush is expensi= ve */ qatomic_inc(&tb_ctx.tb_flush_count); + qemu_plugin_flush_cb(); +} =20 -done: - mmap_unlock(); - if (did_flush) { - qemu_plugin_flush_cb(); +static void do_tb_flush(CPUState *cpu, run_on_cpu_data tb_flush_count) +{ + /* If it is already been done on request of another CPU, just retry. */ + if (tb_ctx.tb_flush_count =3D=3D tb_flush_count.host_int) { + tb_flush__exclusive(); } } =20 --=20 2.43.0 From nobody Sun Sep 28 16:28:03 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1758595401; cv=none; d=zohomail.com; s=zohoarc; b=Ep1gU58oDhmP9CXUsdzldmQRbYT3mK8zlG02DohmXmknRxyYtP90HIbKlYqX5BODIKXSTSNoTZ+LUUz8yhVicTIRbZ2JzjEG6yk3bBwZMw8QgpoD6QvGkDev5Cz0v1pGsz38OypqNtqZ1BLWV1iQMV+L8W3oZfTLsxBCIB9TAes= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1758595401; h=Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=I7FMx8ch25mi1HM2iSzOFbjlu0abcZfgeYT8ylr/T9c=; b=i/HsH1J3DudVIRrbH95JQEjtjr9Q69/4r/JFGWMJoyEwHW/mHY8c8rJnlOAXDyvMKyGolaoHMZZEtqj+6vBqTUkfvLt+3fTeT+vyRzjmK9XEulNWq8RDbxq3o3bIm0YmqmVdDTNJF8zQ1F6P5zrClY5M7VNX8WlGnISPLQKtlc8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1758595401130935.4715922413234; Mon, 22 Sep 2025 19:43:21 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1v0swN-0004EL-Su; Mon, 22 Sep 2025 22:39:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1v0swM-0004E8-AY for qemu-devel@nongnu.org; Mon, 22 Sep 2025 22:39:38 -0400 Received: from mail-pf1-x431.google.com ([2607:f8b0:4864:20::431]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1v0swE-0003gr-JJ for qemu-devel@nongnu.org; Mon, 22 Sep 2025 22:39:37 -0400 Received: by mail-pf1-x431.google.com with SMTP id d2e1a72fcca58-77f2e621ef8so2107641b3a.0 for ; Mon, 22 Sep 2025 19:39:28 -0700 (PDT) Received: from stoup.. ([71.212.157.132]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-77f0da43089sm9899622b3a.90.2025.09.22.19.39.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Sep 2025 19:39:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1758595166; x=1759199966; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=I7FMx8ch25mi1HM2iSzOFbjlu0abcZfgeYT8ylr/T9c=; b=DgiaA+16cdKkQCxBaEevtLabbaUykaiwHvoBuA2mIE5kSHv5m1eraeWj3cLUZy++86 T8UBfqJXauzQ9gCZjtdlxkn3SlC6RVb6JeSd4l3Z+ikca95502ZyCZR7Ppm6K6Tu3ud8 L+zo+l+Z2diVxxHn4yt2X+E5cu4YUh458v/LxSk1AVqeqsB7UrLQ2sSB29MaU9bmZ1bt CnPJgPaZ44BPJBbJuw1uv2OSoePEzzF7Pdxxsh4PmxyN9xj2krkx9WqQkEMOtVDtFTs/ lzTgb9lYfCbyNodmwCT7QNPFJfOxjZ4RjIb+LGvmT5kktkSovCPj9mJfXuxoGoIJyMNH Ysbg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1758595166; x=1759199966; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=I7FMx8ch25mi1HM2iSzOFbjlu0abcZfgeYT8ylr/T9c=; b=NuUYDnX9/3VvFD3fFUPHRoHO7CHpVq1nDSHpA1EW2W2WGM8yxlZL4RZtip1ZUPBT9C iMrYdzgi1K6J399GzeMIJLDFfS3gVyHYY2lyWpeyceN9GwFbCcZwdOlXTHNuc8v+77nA 32mtyITo48eKfTG/WDPJXi2bYaurY/31UfJKKnyRbNRYLfpaU9xTUTHRH1YkTXaZsulh EMQvF3VI8r3KYjyUyqN4sDax3cxDeyDrTMqRk2fSivfce2wDnZDmA9xClRzzy5wOQ3Hh WWVWQYvojzPNJdHZMNziOC4cuA0iPR4J2FbeZvFc4eD2cWN5fWviRzHB8pF02vMnKZzF YnSQ== X-Gm-Message-State: AOJu0Yy0mN23x9jFMamOLdIggSspfGzYxQu9t5FupA0MHIDza6zEshQn d+2dTJRG5NPxChQzwVEkiPK0fr4imbMioCI/1GciRu165vL6qUpmKMonELV+93NIedmUNlYe5Cd AKznp X-Gm-Gg: ASbGncv0rQeCMdPAEvgh3biFUaULg1IYEs0q8ehbBL34PJLcJV4e2kRI/OVS9WynPM8 EHHef4B6y0UG3oL1b4TdZ2Fea1KDdNcVku6aLPkNvvQjtYt3dyQajIZJQ6GW1RRYIYY27fAg1xX bezDnEzaxDMwiVSNHuQYspyzL/3iL5Gvetmy/b2+UzitsBet1zRV6C0vtFvkkSSZHthRWsCydyK rHswvk00n6ayFvJGDYLqrFs0e25GhzY3q9CyxWHnDw64zpCA9TeRfdy0rkVSTaB97nFpcoB1qxh REXdMtikH2ZJ0Um0MArlSfDFaiw2++vm5DRReX4IqP5R4fikQ51k3hJy41epRecvFf/elzRjTzV ElhEMQ8oTmKdqViZFkhVXHgMZ/gOv X-Google-Smtp-Source: AGHT+IEicq4MIqnZXV1Dwrod3IW6O3/D0dOoMSoc/ubULa18kIa+bAPZkTRLO/siljOYHjyUmJ/WgQ== X-Received: by 2002:a05:6a00:1825:b0:772:4b05:78b0 with SMTP id d2e1a72fcca58-77f53887f3emr1124770b3a.7.1758595166094; Mon, 22 Sep 2025 19:39:26 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 03/12] target/alpha: Simplify call_pal implementation Date: Mon, 22 Sep 2025 19:39:07 -0700 Message-ID: <20250923023922.3102471-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250923023922.3102471-1-richard.henderson@linaro.org> References: <20250923023922.3102471-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::431; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x431.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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1758595402547116600 Content-Type: text/plain; charset="utf-8" Since 288a5fe980f, we don't link translation blocks directly to palcode entry points. If we load palbr from env instead of encoding the constant, we avoid all need for tb_flush(). Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- target/alpha/helper.h | 1 - target/alpha/sys_helper.c | 6 ------ target/alpha/translate.c | 21 ++++++--------------- 3 files changed, 6 insertions(+), 22 deletions(-) diff --git a/target/alpha/helper.h b/target/alpha/helper.h index d60f208703..788d2fbf28 100644 --- a/target/alpha/helper.h +++ b/target/alpha/helper.h @@ -90,7 +90,6 @@ DEF_HELPER_FLAGS_2(ieee_input_s, TCG_CALL_NO_WG, void, en= v, i64) #if !defined (CONFIG_USER_ONLY) DEF_HELPER_FLAGS_1(tbia, TCG_CALL_NO_RWG, void, env) DEF_HELPER_FLAGS_2(tbis, TCG_CALL_NO_RWG, void, env, i64) -DEF_HELPER_FLAGS_1(tb_flush, TCG_CALL_NO_RWG, void, env) =20 DEF_HELPER_1(halt, void, i64) =20 diff --git a/target/alpha/sys_helper.c b/target/alpha/sys_helper.c index 51e3254428..87e37605c1 100644 --- a/target/alpha/sys_helper.c +++ b/target/alpha/sys_helper.c @@ -20,7 +20,6 @@ #include "qemu/osdep.h" #include "cpu.h" #include "exec/cputlb.h" -#include "exec/tb-flush.h" #include "exec/helper-proto.h" #include "system/runstate.h" #include "system/system.h" @@ -38,11 +37,6 @@ void helper_tbis(CPUAlphaState *env, uint64_t p) tlb_flush_page(env_cpu(env), p); } =20 -void helper_tb_flush(CPUAlphaState *env) -{ - tb_flush(env_cpu(env)); -} - void helper_halt(uint64_t restart) { if (restart) { diff --git a/target/alpha/translate.c b/target/alpha/translate.c index cebab0318c..f11b382438 100644 --- a/target/alpha/translate.c +++ b/target/alpha/translate.c @@ -48,8 +48,6 @@ struct DisasContext { =20 #ifdef CONFIG_USER_ONLY MemOp unalign; -#else - uint64_t palbr; #endif uint32_t tbflags; int mem_idx; @@ -1155,7 +1153,6 @@ static DisasJumpType gen_call_pal(DisasContext *ctx, = int palcode) #else { TCGv tmp =3D tcg_temp_new(); - uint64_t entry; =20 gen_pc_disp(ctx, tmp, 0); if (ctx->tbflags & ENV_FLAG_PAL_MODE) { @@ -1165,12 +1162,11 @@ static DisasJumpType gen_call_pal(DisasContext *ctx= , int palcode) } tcg_gen_st_i64(tmp, tcg_env, offsetof(CPUAlphaState, exc_addr)); =20 - entry =3D ctx->palbr; - entry +=3D (palcode & 0x80 - ? 0x2000 + (palcode - 0x80) * 64 - : 0x1000 + palcode * 64); - - tcg_gen_movi_i64(cpu_pc, entry); + tcg_gen_ld_i64(cpu_pc, tcg_env, offsetof(CPUAlphaState, palbr)); + tcg_gen_addi_i64(cpu_pc, cpu_pc, + palcode & 0x80 + ? 0x2000 + (palcode - 0x80) * 64 + : 0x1000 + palcode * 64); return DISAS_PC_UPDATED; } #endif @@ -1292,11 +1288,7 @@ static DisasJumpType gen_mtpr(DisasContext *ctx, TCG= v vb, int regno) case 7: /* PALBR */ tcg_gen_st_i64(vb, tcg_env, offsetof(CPUAlphaState, palbr)); - /* Changing the PAL base register implies un-chaining all of the T= Bs - that ended with a CALL_PAL. Since the base register usually on= ly - changes during boot, flushing everything works well. */ - gen_helper_tb_flush(tcg_env); - return DISAS_PC_STALE; + break; =20 case 32 ... 39: /* Accessing the "non-shadow" general registers. */ @@ -2874,7 +2866,6 @@ static void alpha_tr_init_disas_context(DisasContextB= ase *dcbase, CPUState *cpu) ctx->ir =3D cpu_std_ir; ctx->unalign =3D (ctx->tbflags & TB_FLAG_UNALIGN ? MO_UNALN : MO_ALIGN= ); #else - ctx->palbr =3D env->palbr; ctx->ir =3D (ctx->tbflags & ENV_FLAG_PAL_MODE ? cpu_pal_ir : cpu_std_i= r); #endif =20 --=20 2.43.0 From nobody Sun Sep 28 16:28:03 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1758595394; cv=none; d=zohomail.com; s=zohoarc; b=CK412oRkmXpIStNZSxVanLfmxmaMANT69+YsCZp2X75VRGdBaFN/0OBv/eGVL+AhdrSyAP2YE4Zplv2qBv9G6z29kFBNDR/5Jdf1gp5yx5B4g3gnpXDqwmMQXKtw9XoR7+GCuSeENUaeuHKxl8LZQGEzzFwfuw2Ri3EyU8evfPw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1758595394; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=WtS+tUcTZk2GBqf6yxqhjiU0irGyIDNvqIFdhqaZrSY=; b=SxJ2MxASK2rENL+7jZqJMwfUKCDZ+KBBwhCh6gRQIYym+YyJQD18bcYvZisaKgRhh8j+8EX4zGESBOQOIiXw/Dxaw9goQRvGktqkCNHs+qMlLPH+ZQBIhbxV25bQVSewIz1aSmBbW0uV0SRXhVbakGLVZoZeLOOPUyslpp8Zqq0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1758595394562576.4737969378825; Mon, 22 Sep 2025 19:43:14 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1v0swN-0004EK-Ss; Mon, 22 Sep 2025 22:39:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1v0swK-0004Ds-O3 for qemu-devel@nongnu.org; Mon, 22 Sep 2025 22:39:36 -0400 Received: from mail-pg1-x535.google.com ([2607:f8b0:4864:20::535]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1v0swE-0003gx-JD for qemu-devel@nongnu.org; Mon, 22 Sep 2025 22:39:36 -0400 Received: by mail-pg1-x535.google.com with SMTP id 41be03b00d2f7-b553412a19bso1637846a12.1 for ; Mon, 22 Sep 2025 19:39:29 -0700 (PDT) Received: from stoup.. ([71.212.157.132]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-77f0da43089sm9899622b3a.90.2025.09.22.19.39.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Sep 2025 19:39:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1758595167; x=1759199967; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=WtS+tUcTZk2GBqf6yxqhjiU0irGyIDNvqIFdhqaZrSY=; b=wwyDa6JkLfuLYwBHIc8zEiL39+DMOFgA8u6f9Y7p/++TqfwKw20od+LOsdtvKh/cOV gQp/eSIAGhu8Ssm3+TIwVRKs90Vm05o8Js58buuuAedvLy60LdysavT6l5+5wtTzSIXW HlsG4RWAh3hVBfZIYn7VgdnUB8c1xa0wOcwXx3ac0+CtYnzTtkiB2pTZUPIFPHwgrahR GOyRuohSFDzpvwGUJG0RQnpEza4L1VWiFIJBuU6ZfcYq9pKhZHoKycesSsBqd+oWGRGW OoEljtf4QotrMxOEzonSjKy1Xu4DwEyimbv0QrH2s5G+NoyIDZb+uIGkUPMgjPILc4eK u0ew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1758595167; x=1759199967; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=WtS+tUcTZk2GBqf6yxqhjiU0irGyIDNvqIFdhqaZrSY=; b=PqZjBp/y+A+857FpjiyJYnP6T0zjnNFBVnGaT+0GAMeMvuO+hahNPnPcgIKWWDShHO KD8OGwaNCR/2xmeybiA2tASLeAh9nixlZxrWfP75kO0GoTC1t2siicGjRtF+FrW418bX vNoe44UsKp8Yozgoc3wL6KlyZ+YZSaxuP8WLFRpgHazMqCKlNo9+4n6I4VLzs8M98+1a XDgqVqz+l4UFhIgOa2xxlwxFVd2lNCBpxWQkN43yKbzByt1yz8ShdqbkYZv8GgbkjiWU 2/puOfHqwboviohtXD9kcaB2QCiNqVDyo6uQ2FMvhQkoB5SeYz5m0JyW3Pg1LnzGM64K koyw== X-Gm-Message-State: AOJu0YwBzq5ITgTldVpmlM8T3dTgN8QcaNywhaIQKkShexm0iptMuXtk Et/OaTUGvCJl/bW8PDEcBxzkB0lS1XB9hvy4NlId6GHTH0gPaUiaEjnASWRpsX767WA775YQy3n FtfYS X-Gm-Gg: ASbGncsfctYEk+wgVUVu0rUroYfDEjwIPl1kd6sQymFdBjzj1Ipg8Slhxm+ojT3rmbx sZ2nDkkLTThksxDWvH+jzoyJuGtxc+cAzJNR3+4VECDClanueJOTsbw04emNskksKLd1f3uEqWV UnmsG3kA7HUrXIR4k6oSmQOYuC/hH88wwgXPnxmIdHQzSPYh+qVA4qVQfEqLOP0qJVqO7TLw6iB sFtYE1I3ejPnb4M+IEXZ9ayHy/7VATxhel66Z1/8t+3jTn2MBVkzzwNIm01q2jx9gnWKKzAcamr ezubfyBXPQdSI+M+N3bmDxqbViRjacDiIRkslb7wpGUTXq7dTLfrc7iInmTeG9FaKcR7YdPxt9a dy8DYuUUTYfEK8fqu1SdKAfkOP/45 X-Google-Smtp-Source: AGHT+IFhdkBYZJ64ekLETcR0+kLRvIW8hmVQeZ3JUqgpSGj4LuHeM+ubYQVBCmKgaFBEgQRM79KwiQ== X-Received: by 2002:a17:902:ef4c:b0:26e:62c9:1cc4 with SMTP id d9443c01a7336-27cc1197880mr10617925ad.4.1758595166932; Mon, 22 Sep 2025 19:39:26 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Pierrick Bouvier , Alistair Francis , Weiwei Li , Daniel Henrique Barboza , Liu Zhiwei , qemu-riscv@nongnu.org Subject: [PATCH v2 04/12] target/riscv: Record misa_ext in TCGTBCPUState.cs_base Date: Mon, 22 Sep 2025 19:39:08 -0700 Message-ID: <20250923023922.3102471-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250923023922.3102471-1-richard.henderson@linaro.org> References: <20250923023922.3102471-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::535; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x535.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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1758595396658116600 Content-Type: text/plain; charset="utf-8" The tb_flush within write_misa was incorrect. It assumed that we could adjust the ISA of the current processor and discard all TB and all would be well. But MISA is per vcpu, so globally flushing TB does not mean that the TB matches the MISA of any given vcpu. By recording misa in the tb state, we ensure that the code generated matches the vcpu. Reviewed-by: Pierrick Bouvier Signed-off-by: Richard Henderson Reviewed-by: Daniel Henrique Barboza Reviewed-by: LIU Zhiwei --- Cc: Alistair Francis Cc: Weiwei Li Cc: Daniel Henrique Barboza Cc: Liu Zhiwei Cc: qemu-riscv@nongnu.org --- target/riscv/csr.c | 3 --- target/riscv/tcg/tcg-cpu.c | 3 ++- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/target/riscv/csr.c b/target/riscv/csr.c index 8842e07a73..3c8989f522 100644 --- a/target/riscv/csr.c +++ b/target/riscv/csr.c @@ -25,7 +25,6 @@ #include "pmu.h" #include "time_helper.h" #include "exec/cputlb.h" -#include "exec/tb-flush.h" #include "exec/icount.h" #include "accel/tcg/getpc.h" #include "qemu/guest-random.h" @@ -2173,8 +2172,6 @@ static RISCVException write_misa(CPURISCVState *env, = int csrno, env->mstatus &=3D ~MSTATUS_FS; } =20 - /* flush translation cache */ - tb_flush(env_cpu(env)); env->xl =3D riscv_cpu_mxl(env); return RISCV_EXCP_NONE; } diff --git a/target/riscv/tcg/tcg-cpu.c b/target/riscv/tcg/tcg-cpu.c index 78fb279184..143ab079d4 100644 --- a/target/riscv/tcg/tcg-cpu.c +++ b/target/riscv/tcg/tcg-cpu.c @@ -191,7 +191,8 @@ static TCGTBCPUState riscv_get_tb_cpu_state(CPUState *c= s) =20 return (TCGTBCPUState){ .pc =3D env->xl =3D=3D MXL_RV32 ? env->pc & UINT32_MAX : env->pc, - .flags =3D flags + .flags =3D flags, + .cs_base =3D env->misa_ext, }; } =20 --=20 2.43.0 From nobody Sun Sep 28 16:28:03 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1758595302; cv=none; d=zohomail.com; s=zohoarc; b=M7zF6lvZiRFIaoTLcjwNFQ3A7cexUWkC6gA7lrLfSBv3pMY7h2ufc857552WaUBHctjSucyUj9rmKy56+/3TdKio0HBj04HA1J70jTDpCzpPC/NBUeizbnGo7FX8XiRIjkIId+wBi5STSaXEiuBfKC7IS0cNKLOFuwpj418L+Q8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1758595302; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=n6OMk5ACCeNuXf8eKcDPF9+TwMN9mapKYv0wPDXsO4I=; b=Y34Beh9nxyjzlwuzyr7IvQQ618hHat1DZqsWyhV6d2I70QpCMAelYbRBSQFPF7iGcPaBvMzaRx8m5rKlZOP9rKrz4Ebhcou4EWh7z9pUFckGEoAvKf+UXcWW7mqiuCm9OMJwmDnlcAouYCYqDdZatqo+LyDcFEXe2ilVKgPmGMk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1758595302899654.266172622131; Mon, 22 Sep 2025 19:41:42 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1v0swe-0004KB-AV; Mon, 22 Sep 2025 22:39:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1v0swR-0004GP-Us for qemu-devel@nongnu.org; Mon, 22 Sep 2025 22:39:44 -0400 Received: from mail-pj1-x102a.google.com ([2607:f8b0:4864:20::102a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1v0swG-0003gz-IQ for qemu-devel@nongnu.org; Mon, 22 Sep 2025 22:39:43 -0400 Received: by mail-pj1-x102a.google.com with SMTP id 98e67ed59e1d1-3322e6360bbso2276744a91.0 for ; Mon, 22 Sep 2025 19:39:29 -0700 (PDT) Received: from stoup.. ([71.212.157.132]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-77f0da43089sm9899622b3a.90.2025.09.22.19.39.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Sep 2025 19:39:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1758595167; x=1759199967; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=n6OMk5ACCeNuXf8eKcDPF9+TwMN9mapKYv0wPDXsO4I=; b=FnbYQTwzmFbRmA9F3gWb/pv/rqwPVwwJOWn0ozbbRlK0Q+1hvWkB3oIXlU2gcASkGO hdV9/SlGmZKg0wsDa9LNkhDOg6/KdITvn0ZVXm7yvbo3K08QRhEFJd9H0A6LyJojihfp +qqsAbbwndeOCxbt8TIzjqqHZfSa2XfIsW3BmTcaPlmF4/h7DIRkOtHCVkvavaq83SLV tczAAyJdVVFqEdHLHobi7PmgePJ5jfecH4Po8Fp2U0HdfsU5fbF+CeqEr20DpACSAD8c MwmxmYP5MtwLxptfLWUjkWWEfKMsUcSuQUSDMKemL8TpdaiQWfYxFYT9032elCjWZD3L LGxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1758595167; x=1759199967; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=n6OMk5ACCeNuXf8eKcDPF9+TwMN9mapKYv0wPDXsO4I=; b=f8kLNL81c9dv1D4O8WEnAm/jSAvfflQCfS0jWh/aUtEM9yMOorMwCBuQsr5KAOk25j +UJfaiPu7LB9gMCl9zK5O8/FrG6AotIvgRfzXOlX49Y/kFjybL54eBMhExZP+HqAdTJg N8Mhwlok8xPMfLHs83SLcRUXrby8Vd3cufkON5pZFuS0CbvC3Zseq0vVxaUcZHcY5EWc LcoQ9M4WY7gEBOotuySIr7w3GgYJ908oHQdINddy4OrW4Ey5eFWfpp28n7hf32GWEPIQ qlLvz0Q7vQ+jzXu8Q4Y1jOToH3O8SSokPj/5mCTT1ycsStatE7mm5tOkSUD8wsb5azTo LZDg== X-Gm-Message-State: AOJu0YyaGoz0O8rkqNX7WQJikbJ9S1jISTZtYZDfWAfbdD5tN/ddqs4N C83szPnJg835f3w/FVK29Ln6AYCrSrAnhiTZzZwqHiI1eN9OOtoDuYK2hXNIA/Ky5QvzsGcY/sg 9hx2f X-Gm-Gg: ASbGncsS/hXcBpFRv9Uhs62kX6IBhbXsIlbm0k4zVK7FfgLItA7JO/yxS9l6UmacMVX WU31pz8kvy5/FrWbKwQASa9Ohwc41uUMk2h4gZXiUENzmthknd4c2ZKYipjlCcMEGVgU6AMnq3c zqbzg2UzlK0aVn4GkIqj/eUxcFnkS3CMIUs3lYfl7dhWW6M1G6EUx6cT2hB79pZ/z+fuV0WPQUR Tsg43OAzmns10I7RFqNs/H9xB2V3x5opg9RMgkDRkAjWR569ewNOwjstIU1D7x9HFFjvVDpSA7l zlIAiyeigKya0MrmWmx421M4fDuJuiyzrRKPXgPqyU0xrV4WicN27Sea9HpMp8UtMVTWjuXe5uY sOGWdXHkK7gHprZSpUKbrESQgf1Cv X-Google-Smtp-Source: AGHT+IFghoo6+gWcrYmlQsslGgXlGMxcfqMJmFmnJGcvtjHP/qjZwDBopV9ltsSJKYt9PvQthlUckw== X-Received: by 2002:a17:90b:528e:b0:32d:601d:f718 with SMTP id 98e67ed59e1d1-332a96fd5d0mr1210655a91.31.1758595167630; Mon, 22 Sep 2025 19:39:27 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Pierrick Bouvier , Peter Xu Subject: [PATCH v2 05/12] accel/tcg: Move post-load tb_flush to vm_change_state hook Date: Mon, 22 Sep 2025 19:39:09 -0700 Message-ID: <20250923023922.3102471-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250923023922.3102471-1-richard.henderson@linaro.org> References: <20250923023922.3102471-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1758595303607116600 Content-Type: text/plain; charset="utf-8" We need not call tb_flush once per cpu, only once per vmload. By moving the call from cpu_common_post_load to a tcg-specific vm_change_state_handler, we do even better than that: we only flush when called from HMP triggered loadvm, when we had old state to flush. Reviewed-by: Pierrick Bouvier Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- Cc: Peter Xu --- accel/tcg/tcg-all.c | 21 +++++++++++++++++++++ hw/core/cpu-system.c | 8 -------- 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/accel/tcg/tcg-all.c b/accel/tcg/tcg-all.c index 5125e1a4e2..a0bc0e58c7 100644 --- a/accel/tcg/tcg-all.c +++ b/accel/tcg/tcg-all.c @@ -38,6 +38,8 @@ #include "qemu/target-info.h" #ifndef CONFIG_USER_ONLY #include "hw/boards.h" +#include "exec/tb-flush.h" +#include "system/runstate.h" #endif #include "accel/accel-ops.h" #include "accel/accel-cpu-ops.h" @@ -82,6 +84,23 @@ static void tcg_accel_instance_init(Object *obj) =20 bool one_insn_per_tb; =20 +#ifndef CONFIG_USER_ONLY +static void tcg_vm_change_state(void *opaque, bool running, RunState state) +{ + if (state =3D=3D RUN_STATE_RESTORE_VM) { + /* + * loadvm will update the content of RAM, bypassing the usual + * mechanisms that ensure we flush TBs for writes to memory + * we've translated code from, so we must flush all TBs. + * + * vm_stop() has just stopped all cpus, so we are exclusive. + */ + assert(!running); + tb_flush__exclusive(); + } +} +#endif + static int tcg_init_machine(AccelState *as, MachineState *ms) { TCGState *s =3D TCG_STATE(as); @@ -124,6 +143,8 @@ static int tcg_init_machine(AccelState *as, MachineStat= e *ms) default: g_assert_not_reached(); } + + qemu_add_vm_change_state_handler(tcg_vm_change_state, NULL); #endif =20 tcg_allowed =3D true; diff --git a/hw/core/cpu-system.c b/hw/core/cpu-system.c index 09c928c1f9..1fd9571017 100644 --- a/hw/core/cpu-system.c +++ b/hw/core/cpu-system.c @@ -207,14 +207,6 @@ static int cpu_common_post_load(void *opaque, int vers= ion_id) cpu_reset_interrupt(cpu, 0x01); =20 tlb_flush(cpu); - - /* - * loadvm has just updated the content of RAM, bypassing the - * usual mechanisms that ensure we flush TBs for writes to - * memory we've translated code from. So we must flush all TBs, - * which will now be stale. - */ - tb_flush(cpu); } =20 return 0; --=20 2.43.0 From nobody Sun Sep 28 16:28:03 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1758595260; cv=none; d=zohomail.com; s=zohoarc; b=JfzK/dZdjpPhkZQAwqaaJGygskpkpFcsTJeLNhkfeojRQCo2qIKWG0fHT1mdyn5I/63MCHtLbGpjR/GoV9TQmJ/qyeyJdjcx761hglVbxqklkXpKDgVSpaLysZOLB4QE+RXBjABt85eqWeprpl8/2gB+og7wpH/KatHi2LFHlVI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1758595260; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=tkiiaZ/I0kCUxEv1YuYFr7w89DooS5qqrLfJGIO7KtE=; b=HmVcc5me1Ldis7GVupcRzLDRsXUN7ik0rsky6KZAJO5/Q4D0MFLmFZLTHeabK9uu8RRhXoWKo0FJ6E8Z1/0q1qVzvVmG89RSl9rvmWHPIf0v8+fvdriP6S89/dZ/vjAfE76ByzWnKoRRmfB4xUk608k3GchM4ENGnDOwEs9oX68= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1758595260788578.7856787076166; Mon, 22 Sep 2025 19:41:00 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1v0swd-0004Jd-BQ; Mon, 22 Sep 2025 22:39:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1v0swR-0004GO-S8 for qemu-devel@nongnu.org; Mon, 22 Sep 2025 22:39:44 -0400 Received: from mail-pf1-x429.google.com ([2607:f8b0:4864:20::429]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1v0swF-0003h8-P8 for qemu-devel@nongnu.org; Mon, 22 Sep 2025 22:39:43 -0400 Received: by mail-pf1-x429.google.com with SMTP id d2e1a72fcca58-77ee6e252e5so3235892b3a.2 for ; Mon, 22 Sep 2025 19:39:30 -0700 (PDT) Received: from stoup.. ([71.212.157.132]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-77f0da43089sm9899622b3a.90.2025.09.22.19.39.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Sep 2025 19:39:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1758595168; x=1759199968; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=tkiiaZ/I0kCUxEv1YuYFr7w89DooS5qqrLfJGIO7KtE=; b=LC7Gblweeg0S1xRCKppNhoYn7ozf0sYipigeyoV6Gmv0QnrEPeklJg0q4lHIOzKZ6e G0ALfnRwr/b9osVJNiiu9Zuufo04KtHDKml/IRyEW0iFaSuznIvVH3OrYB8xOKF/+i8d NR6DouFj+ZKH55fEy85LGEFCtYQms5y4m8MZfks0Px4kpzQXi4dYiN1FuRgNEXGTNhhR i3LBtuRwxQcjJGyW+6ZNMZPmAvoDOgXSis9UlmG0jlCbaj2RK3wyftUWljXLMnY0zAyv byx4R0Yiok4OeOlCN3Oxsf31UDtSlWJ+WNAJRAPoXHJg467yeEgyviUgizktXEXUjsaL OV/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1758595168; x=1759199968; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=tkiiaZ/I0kCUxEv1YuYFr7w89DooS5qqrLfJGIO7KtE=; b=kWCBKxq9lqoeq/ceyQ9aBLQTWqkskFY4Bx3kcdo+eXF9lulecfh6ylg9IFwRc/NSUC ZVxPLdg0GEULO4h8B7b5+pCKr1VVkFubGkeJbGe1BIcEvakQ44b/8KavjJJOdhd7TWnv 2U3i5rvkJr1OB6n409JIZNWps2QMJWIuirb8kt2eLd+uRwykQiD9TznFhqSqLaXRXSuk khiypcs+CJSr68Qhle+JZKsi5vY2A0s1xNPCLoaWgUFWoiuLIpfCWPqAgio+ZjW1XmKW hTECXF0InlT5kBZ9l9icGx9a5S/Gjrpg7MuazKKv+Cjl5rNwYazZj0yHAEivJYY/Ov4A 4yrw== X-Gm-Message-State: AOJu0YxnyzsFMy+YZrglrmhNr82aBUMNzUsFTAvGbSZG6uMJjoXfIt8P 47576t1XJHmSuklqFakDiSDHUmA/4qQyOz9HC0lT1MUZabb96xp9OY1E/ky/Kcy8wtmWzSk+X7h YTl3D X-Gm-Gg: ASbGnctmpyMU5faO+xqVhSJ/BqVDGtl9cun3OIuPe2m8AY6rt4ibFzHv3XVgrzwFFFS 8BwuV2TNRVKwSm40GarflXAtD6CiNRN1H5h03zU0oyBceYwGQNAdX1tXj3jf+Gj9g5cnMQmLA48 Nzq6rClLyMGTcpQbPpbtAYCAJ5MO3g8ABc4Mu4yOr4NWf8+osxgfNmg9ng29JQshBFA59htR39O VoHtPHXY1uw1y+tQjHI7a38hAdBfvT4bMziVkXw1yQrabEfaS7NccTNwpqogAObSaTwecFA5+jd d4DZ3SWwo72HBy0Vwz3Mqm2tJJzutBmLsU45WKY+ATKfaQCNeKfYTdA2+Pm6cDe5Ypn3d2pm8nN ooyciLncFucke8U7ekY/k+obMP22m X-Google-Smtp-Source: AGHT+IHKMVMp3APayk1JjMJxSPmPTqAkEmmzM3hi5fTyha+r0zmvy4EH9e4oNBzdMQjC4nC6Ku6DMw== X-Received: by 2002:a05:6a00:3904:b0:77f:1ef8:8acb with SMTP id d2e1a72fcca58-77f538ffa10mr1444422b3a.13.1758595168286; Mon, 22 Sep 2025 19:39:28 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Nicholas Piggin , Harsh Prateek Bora , qemu-ppc@nongnu.org Subject: [PATCH v2 06/12] hw/ppc/spapr: Use tb_invalidate_phys_range in h_page_init Date: Mon, 22 Sep 2025 19:39:10 -0700 Message-ID: <20250923023922.3102471-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250923023922.3102471-1-richard.henderson@linaro.org> References: <20250923023922.3102471-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1758595263370116600 Content-Type: text/plain; charset="utf-8" We only need invalidate tbs from a single page, not flush all translations. Signed-off-by: Richard Henderson Reviewed-by: Harsh Prateek Bora --- Cc: Nicholas Piggin Cc: Harsh Prateek Bora Cc: qemu-ppc@nongnu.org --- hw/ppc/spapr_hcall.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/ppc/spapr_hcall.c b/hw/ppc/spapr_hcall.c index c594d4b916..feb31d5dd8 100644 --- a/hw/ppc/spapr_hcall.c +++ b/hw/ppc/spapr_hcall.c @@ -8,7 +8,7 @@ #include "qemu/main-loop.h" #include "qemu/module.h" #include "qemu/error-report.h" -#include "exec/tb-flush.h" +#include "exec/translation-block.h" #include "exec/target_page.h" #include "helper_regs.h" #include "hw/ppc/ppc.h" @@ -301,7 +301,7 @@ static target_ulong h_page_init(PowerPCCPU *cpu, SpaprM= achineState *spapr, if (kvm_enabled()) { kvmppc_icbi_range(cpu, pdst, len); } else if (tcg_enabled()) { - tb_flush(CPU(cpu)); + tb_invalidate_phys_range(CPU(cpu), dst, len); } else { g_assert_not_reached(); } --=20 2.43.0 From nobody Sun Sep 28 16:28:03 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1758595327; cv=none; d=zohomail.com; s=zohoarc; b=ByqNY8J8+8ku/GqyJRbLOitzDyTOoj5sYMivUZG6+pQF4jlsREPJl0i14JqHCduarQG2JTUB7ad6QP37OODuX2suNo79eY/SFyzHJJn8ruqptquBhgNfSjqspYUDBHDWnciNiA9XowpSYvhP9mIFPzVRUUNwj0D6hCDDU+GPqYM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1758595327; h=Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=tqfT+leZhy7Rg922mo2u8oPpLUYve9eJPBZJd2GWVis=; b=IoOdFTpIhMO2TLLCFLlmZtlwwFEMYkc8ZNVnuESPIGl7tOB+R76I8gU+IbZeDNQrllfJG0OQw+Q65Q33aWO/fGVneU0YhD8EzRJgr4LnbkXUKkzAtln5Ot8j8M3jUahpFAQfV4+J9WGq23vUIoQQzg0Oin1NDGXkAw/JinQigUk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1758595327956757.6611413923648; Mon, 22 Sep 2025 19:42:07 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1v0swk-0004Qs-BW; Mon, 22 Sep 2025 22:40:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1v0swZ-0004IF-CK for qemu-devel@nongnu.org; Mon, 22 Sep 2025 22:39:51 -0400 Received: from mail-pf1-x42a.google.com ([2607:f8b0:4864:20::42a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1v0swI-0003hF-RH for qemu-devel@nongnu.org; Mon, 22 Sep 2025 22:39:50 -0400 Received: by mail-pf1-x42a.google.com with SMTP id d2e1a72fcca58-77d94c6562fso5075577b3a.2 for ; Mon, 22 Sep 2025 19:39:32 -0700 (PDT) Received: from stoup.. ([71.212.157.132]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-77f0da43089sm9899622b3a.90.2025.09.22.19.39.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Sep 2025 19:39:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1758595169; x=1759199969; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=tqfT+leZhy7Rg922mo2u8oPpLUYve9eJPBZJd2GWVis=; b=I3M2/Dmhwi4M106iH8BPZhLk+HEJvn6Z4zCWzwT7xDdQuoIMxgZzx65eZTNwsaxMBs 4l9a51La/Sr2hz5BB8NUkE+aRuJhLZDFngJgig+4KS4+RYTuqcWE0bb6CuN4Q3r4tm7+ RV/yc8w3Nu7b8Kv/3BH+n6I0jwzlbs8lIKe7REDyFU8lE9H1lPzW9LKEIUoXskD6sIdR b+Z1OKYd3co+F4VhNojWJ/arKvoK1xSunXzLL2V6Or7YRZvg5lij0gqyil8kB6a0vG2S A0ySRObbiMjVSFtIBW/bqnjxKsUi2klqdk7ilwCXvotn06GYE4IBdovzhFbPxoQ+eNjZ gBcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1758595169; x=1759199969; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=tqfT+leZhy7Rg922mo2u8oPpLUYve9eJPBZJd2GWVis=; b=iCS5meeHhQR8asYjQk6HWuXzTF4Ygi/D9TD2HO5FLnlvR+4JB2IIu6TLBIB9eTOJVL fVic6pdhzHEKaeFmi/Zc9KbN2ylj2Mbjm1bPpzZGhAvPQkBxKcqKgoLm6JnnRxTTkVUE myQFH6LEzX4Q9N3ulAbmCDEIvuFC6GMHADOAVH1zaaBlZPvkz7+CqlUyXvQxNermHwYT BQYfgeFxmez3ImGiatvEzk/yVCTKQ7x2dk5p29q4tTHv6Z6uedGIialzUCGCTdBAlmWo 9KCX216vbD6D6Pyf9DLCFMUHbk6nR/uc6auQUdD+va/oNt2AkYC3tt221Cwl1PzBROeJ Bckg== X-Gm-Message-State: AOJu0YzfLiKlclC/nJt3OpOJ518PA5mu0ux3mLetxQsLQtTz3alaHOhq csgp2Pw8pEfSoCcwKUU+3O6E/ZmNUX/NNnYPdiE3ATxzoJxHxr+en3wzRV8CYhBHXdvFmLXKYbJ JsCsx X-Gm-Gg: ASbGncsSv2Sich3O1VG2QEVgeZZBAvR2zg19egZ5T2AV9iwTz3lO9TlGC0cj93Yr060 /Wl92cO/nLLU0mRtDqLVdVdoHr1n5URBX9fdY1ohmZ9qAmidmeexXwV4jQ126TNzUeDle8xPd51 RVdmUy5zlIIcxhAoAC+MDvrUL8+WQyhLdq+VUHlqrbEapvz2xRlGjyz+DZrd1O/EfQlcScTetoY RgRplh8Ek1lroX++QVNu5nLsJf5Y8jv5XRY6G7PmYmPJUyuxD0588B2OsgqnPFraAgwM67HjfI7 eqFYJokJyA0uI1TqN2iDF/mxQ9eDpCPI7xvxxKrP41etH1Ofzb5ndQLuas43d7mtwclIDhreDpe IBGodJUCku8JPJBdiZvQxYdnFoE5At8keomH7zfE= X-Google-Smtp-Source: AGHT+IErno92lfG+bJ1b4AjLPNa+us69nGKrvhN9BIwPqCk9C/+OIn0I3J2Bi71XpwCNL9PhpsWnWA== X-Received: by 2002:a05:6a00:b91:b0:77c:6621:6168 with SMTP id d2e1a72fcca58-77f53ae6f76mr976584b3a.30.1758595169079; Mon, 22 Sep 2025 19:39:29 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 07/12] linux-user: Use tb_flush_exclusive to start second thread Date: Mon, 22 Sep 2025 19:39:11 -0700 Message-ID: <20250923023922.3102471-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250923023922.3102471-1-richard.henderson@linaro.org> References: <20250923023922.3102471-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::42a; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42a.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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1758595329931116600 Content-Type: text/plain; charset="utf-8" When we start the second thread, we discard all translations so that we can re-do them with CF_PARALLEL. Since there is as yet only one cpu, and we are processing a syscall, there are no live translation blocks and we have exclusivity. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- linux-user/mmap.c | 4 ++-- linux-user/syscall.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/linux-user/mmap.c b/linux-user/mmap.c index 002e1e668e..bd2bbaf1f4 100644 --- a/linux-user/mmap.c +++ b/linux-user/mmap.c @@ -1010,7 +1010,7 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, = int target_prot, CPUState *cpu =3D thread_cpu; if (!tcg_cflags_has(cpu, CF_PARALLEL)) { tcg_cflags_set(cpu, CF_PARALLEL); - tb_flush(cpu); + tb_flush__exclusive(); } } =20 @@ -1450,7 +1450,7 @@ abi_ulong target_shmat(CPUArchState *cpu_env, int shm= id, */ if (!tcg_cflags_has(cpu, CF_PARALLEL)) { tcg_cflags_set(cpu, CF_PARALLEL); - tb_flush(cpu); + tb_flush__exclusive(); } =20 if (qemu_loglevel_mask(CPU_LOG_PAGE)) { diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 91360a072c..d9c394856f 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -6633,7 +6633,7 @@ static int do_fork(CPUArchState *env, unsigned int fl= ags, abi_ulong newsp, */ if (!tcg_cflags_has(cpu, CF_PARALLEL)) { tcg_cflags_set(cpu, CF_PARALLEL); - tb_flush(cpu); + tb_flush__exclusive(); } =20 /* we create a new CPU instance. */ --=20 2.43.0 From nobody Sun Sep 28 16:28:04 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1758595318; cv=none; d=zohomail.com; s=zohoarc; b=EcK5Kw0h5ZdRo56xjMNYq0L9UGW0u2zqjcJ6Ob4t14IhfL8pjoDNjkk3d2VqkeU9wbDY9J4rx57CaaBoGM4IXIOf0XdsUeGK9H6h3LKlVOKQ4eu8zW5OWIXzHZu9RbxvEB6NdYcV5MZQ3DcaDDwh9Covw29ZHkh5GVJ05b903LM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1758595318; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=qS0fPDEjjEFNBj0a5/ZuFmBU5kXyQi82F4E0DRl2Q9k=; b=Rl3LLdBgNPHE3cyrtnTq4IjWQtUqA4J6D6Jvp5oJ6AD6xGH1xx4bT32S0WS0zRd8de09Npa10IvrF6gsycg0SaPVnZ2HeKw+Q4jDehp8PY0/DcaN3P5+yaYlxwSZVmC0xMm+0+6JCS7YhgklTy83aoEvisFAS1vJkIPKR89KMO4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1758595318940833.8639471672484; Mon, 22 Sep 2025 19:41:58 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1v0swi-0004Ps-AX; Mon, 22 Sep 2025 22:40:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1v0swY-0004Hr-BE for qemu-devel@nongnu.org; Mon, 22 Sep 2025 22:39:50 -0400 Received: from mail-pf1-x42c.google.com ([2607:f8b0:4864:20::42c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1v0swI-0003hL-3u for qemu-devel@nongnu.org; Mon, 22 Sep 2025 22:39:49 -0400 Received: by mail-pf1-x42c.google.com with SMTP id d2e1a72fcca58-77ee6e252e5so3235900b3a.2 for ; Mon, 22 Sep 2025 19:39:32 -0700 (PDT) Received: from stoup.. ([71.212.157.132]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-77f0da43089sm9899622b3a.90.2025.09.22.19.39.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Sep 2025 19:39:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1758595170; x=1759199970; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=qS0fPDEjjEFNBj0a5/ZuFmBU5kXyQi82F4E0DRl2Q9k=; b=N8zxI9zQKdDLynZXPermtYgFcou6PQTSKogS8Ts+kXcRd5A0caKBDQ3VV+h/mbYVjb k35QnF+ceU/hzSY9qSqeLOIkhGPwej6fCulUqvX0vko+tG0B/IwtbOTAuA5fbIZ4RNQj JHNuXMLyMoQTrUzbs6MQOF6iaxwUS7jlgipnDt2DIpzL7ZaJKsFvZmtMcvFAb2KHzmUl UtbjBl3zFf2KPpc4vPzEHLeiDFJPUJCVENQqT8UHTo8WMwTh6uJs1E8ZcAbnTdDRMOyu Ho2wIQkqgX8oSkUd+Lk9JLU+LhYGPK3wmNYX/1q6OUJSDNBVr7eS3NGlGJ2mc6zn/tqs vp6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1758595170; x=1759199970; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=qS0fPDEjjEFNBj0a5/ZuFmBU5kXyQi82F4E0DRl2Q9k=; b=E4SKtX41M1MOA1ScdIPuhDV9ayd76gZxr31l1SMLHkyprEd/HKGe8logLiJplTSoJi AKPN2iIZXqiJhaohIlHmv6mE+lxs2ilOJM0J8R6ZqaprOmbV59Y0IRlXi43boi01QF8g fyn18Ek8pEoDe4e19IFb0axiNlmI1g7ktV4jkKHntL1rH/uiNHjnoJktm3YiGfyS5piA vdIue/0oEf0h0t4RPSirNzM2wlI7ZBkWmy8RCNELl049JlY19J/vWtvezksR2DQSIq7z oJVY8gA6HIGqSlW36ao6dNugH9oeXi+d8ui7c8lmHQNg5vY5Za7vGmKTwQ686keasZBQ w8zg== X-Gm-Message-State: AOJu0YzsU15q2X1LNXv+uExoyfP3lV5nPXhK7a7b1M/gCqdlDdptIMbQ MrqnbXgPVvfwWtt+AcxsN4lXkR1in2Ril89LI9DhXnJPgxkQk70Hzad9bMKsbSt2nMV2Z4cLQBI Nz3MO X-Gm-Gg: ASbGncswcEGBaRUPdNVyYW8lj4e5PTNetPFqRZT8BmDMmVBnCgs5tzWSGo7gAy6lzc6 AGBUlFL5USPJKZ8GsMfuqTH5uwPePK94VuBCcRIrVpGC4vlaPLTYK+zpp8WhWy21VJu4mKmce/g Xpiek3BXzh+0fmm1R8ULCoUeu5yXp04lyfAmeomUeFT/brgPbQTz5xXN0/fAtNBd5AUnYfere1t ufdAbAG/E+yRo5nr7QGFzGib/MriZOlL/8L3DQQC2adcCTMomq9CriRPK5kidAslBnIxwQImSvJ 80NrBM3hDcQUTppjtdnlmEcP8vIRfWWuCuVKPA4afIznvMe30/jlxCiX3/wpqrJjWxt4QbvqnaU H7qJOfW6uMnb7rfDO/W5z3FK2CHEH X-Google-Smtp-Source: AGHT+IEjHWeduhO57cwwSSsxxTgBXRA4AhkTTRrnAFnzyAEeMLV3d47mcO5/d7DFR1c+iBFo4nqD2g== X-Received: by 2002:a05:6a00:1790:b0:776:1de0:4617 with SMTP id d2e1a72fcca58-77f538b5d05mr1060677b3a.11.1758595169898; Mon, 22 Sep 2025 19:39:29 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Alexandre Iooss , Mahmoud Mandour , Pierrick Bouvier Subject: [PATCH v2 08/12] plugins: Use tb_flush__exclusive Date: Mon, 22 Sep 2025 19:39:12 -0700 Message-ID: <20250923023922.3102471-9-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250923023922.3102471-1-richard.henderson@linaro.org> References: <20250923023922.3102471-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::42c; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42c.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, T_SPF_TEMPERROR=0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1758595319857116600 In all cases, we are already within start_exclusive. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- Cc: Alex Benn=C3=A9e" Cc: Alexandre Iooss Cc: Mahmoud Mandour Cc: Pierrick Bouvier --- plugins/core.c | 6 ++---- plugins/loader.c | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/plugins/core.c b/plugins/core.c index c6e9ef1478..4ae1a6ae17 100644 --- a/plugins/core.c +++ b/plugins/core.c @@ -248,7 +248,7 @@ static void plugin_grow_scoreboards__locked(CPUState *c= pu) } plugin.scoreboard_alloc_size =3D scoreboard_size; /* force all tb to be flushed, as scoreboard pointers were changed= . */ - tb_flush(cpu); + tb_flush__exclusive(); } end_exclusive(); } @@ -684,8 +684,6 @@ void qemu_plugin_user_exit(void) * with the one in fork_start(). That is: * - start_exclusive(), which acquires qemu_cpu_list_lock, * must be called before acquiring plugin.lock. - * - tb_flush(), which acquires mmap_lock(), must be called - * while plugin.lock is not held. */ start_exclusive(); =20 @@ -705,7 +703,7 @@ void qemu_plugin_user_exit(void) } qemu_rec_mutex_unlock(&plugin.lock); =20 - tb_flush(current_cpu); + tb_flush__exclusive(); end_exclusive(); =20 /* now it's safe to handle the exit case */ diff --git a/plugins/loader.c b/plugins/loader.c index 8f0d75c904..6849e1c518 100644 --- a/plugins/loader.c +++ b/plugins/loader.c @@ -378,7 +378,7 @@ static void plugin_flush_destroy(CPUState *cpu, run_on_= cpu_data arg) struct qemu_plugin_reset_data *data =3D arg.host_ptr; =20 g_assert(cpu_in_exclusive_context(cpu)); - tb_flush(cpu); + tb_flush__exclusive(); plugin_reset_destroy(data); } =20 --=20 2.43.0 From nobody Sun Sep 28 16:28:04 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1758595294; cv=none; d=zohomail.com; s=zohoarc; b=f/bXgxRio15TFqsxA0RjClT139r5d+vd7IRMY8s+1vUW6bXx4n1Ja2ASpIjV0agm4rrQZ5o5ISkQNlcL9xaYsiz9TqVUaN//twJ1cUUV/FFvLTCEaGojRkNYh2+pOJclFzDjVb6nMYI8WS0U8SfRSSRWPf2p/JHvZqsyibdIv/U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1758595294; h=Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=sgJ3IGwq4F2k433MR4NI0L072AVq2BNbSERXyUDZjqw=; b=GVHgoMam+I6ZdJwZNiRUFHJUMzArrpSTEz3BvjuxVDY53r0eOAbbRtbnwZexStV6brX19sHTx+sNrccGZs9BWxZz+IcOlW/hf9R7W+6ENMI0Aw0ylLjtActVjiEMI9RpIeqkL4wE57AT5NJzD2/KaCb6SK1FtGm5OGpZfRzx7lI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1758595294233421.60468319237714; Mon, 22 Sep 2025 19:41:34 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1v0swY-0004HP-3J; Mon, 22 Sep 2025 22:39:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1v0swQ-0004Fg-39 for qemu-devel@nongnu.org; Mon, 22 Sep 2025 22:39:42 -0400 Received: from mail-pf1-x42f.google.com ([2607:f8b0:4864:20::42f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1v0swG-0003hR-VA for qemu-devel@nongnu.org; Mon, 22 Sep 2025 22:39:41 -0400 Received: by mail-pf1-x42f.google.com with SMTP id d2e1a72fcca58-77f38a9de0bso1581424b3a.0 for ; Mon, 22 Sep 2025 19:39:32 -0700 (PDT) Received: from stoup.. ([71.212.157.132]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-77f0da43089sm9899622b3a.90.2025.09.22.19.39.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Sep 2025 19:39:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1758595170; x=1759199970; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=sgJ3IGwq4F2k433MR4NI0L072AVq2BNbSERXyUDZjqw=; b=gWN7lcudpOm1yLm/bOrFpZRKDYHE4q3Js1nOxvrEUfwglMx+yjcCEl8+CYiOG3e9Z6 kKOw2rxqpNx+or0iVPLsldso1pUDjWjnHbPdKIKXMLZZ0k6mEhQEZAJHXovxevKLVHZr uzFIbHO1wBElwF82TJwv1GM7ymbQgC68l8scyWc1xQ2p9tYnwKZeN+mhnleL8+IfE/ff sqMY8HT2m7eeC1g/bPLACG4RPQ0Ww+sH3U+vBT5kP8a9QAxXPZWkExx4zmp772GI7uFm o1gq/XwV6bkIoU40h7l/ssVe+9cytPJ8ZeZFmJ6hIF/LpFt2ArfJJQ/CNjnLOOEoWYUn T1KA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1758595170; x=1759199970; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=sgJ3IGwq4F2k433MR4NI0L072AVq2BNbSERXyUDZjqw=; b=cPziP15QWa85aYfO5NIuP3NuTKqrJR+PfoL2VlehwaIPn0mhUUT5x5Efi5PtKkqHQ5 nbqgMHQf11o9GzaI03d9uKZnetmWuua25iO+agK2GcL4dR+d+gktaIaEAHglCnt5g6PM 32O64QsPOsrDdNIVvB2PGlH+p9q51ANORz7PdzDfvK0JWk9jdwUk77AiASYz3CPdzITN GgBinLGrza+ZDxVtQQcizd2N3GYJ7H9dyi4ZFNazu9234Vz1wbs+ZGs5xkjIEU0jqZa7 oNBP/wG3aSRSFatbwrUw2GQiojHIeK3/Ho2J39Ymw3rqR1+43yCeUGf3vW2AzcakyKxP lZdA== X-Gm-Message-State: AOJu0Yxn7Nx1B/91wx3iBxa4IgZik1vbuOW8X/jwGacYiuBnHpsOcSRd SwG1hc1yp3IjYH2f4qPihrXk/TOtxWdWV0gshMKvUsYdkt+ewhjVshj/33cRDa3umzRGB4AVEog gSAG/ X-Gm-Gg: ASbGncvBpa9q8+913svXqaQf6qgym0C77uJ0sL7MXKzK4fNszIw4z42Gp6kKL7AfeWC OsGiennEobQCygvmblgps9HzqtPCCIPmQ6jpaEQKbsUURsq0a1d0SDSs3rTvUJrPO/anW+vf/Gi jXOfjSSEJIgvuZUtDilZOGBHak0wLB3dvzLghkSZnxfFHnAPhY3wndRLHtTCH+zf9+/56it3NP/ CidMMc1FDVwKPgMg47gIWDcBwNHu7xEyCTP7MkHLZqY8Nb6Kt2Oc2MvJ4Y24w5yp8ANoITgaJBd Qpke0SASjwhlIfkbSg8l+LklLsLaKqxkRals8+654GvbkGPeQOv6omE51USqmrueK38NHbCO0lE GGO/HpQb4djdohivkGBX4titQiJ1+ X-Google-Smtp-Source: AGHT+IGlWRt3R7MuZDf0Y1TgwwXHQ3cPI3PoT+xmPltl/YbmHt1Dro0Li52bGdcSbccS0MsChFIYlg== X-Received: by 2002:a05:6a00:1142:b0:777:73a6:edb5 with SMTP id d2e1a72fcca58-77f53ac2e8bmr1046050b3a.23.1758595170505; Mon, 22 Sep 2025 19:39:30 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 09/12] accel/tcg: Introduce EXCP_TB_FLUSH Date: Mon, 22 Sep 2025 19:39:13 -0700 Message-ID: <20250923023922.3102471-10-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250923023922.3102471-1-richard.henderson@linaro.org> References: <20250923023922.3102471-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::42f; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42f.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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1758595295627116600 Content-Type: text/plain; charset="utf-8" We are going to disallow tb_flush from within the context of a running cpu. Introduce a tcg-internal exception to return out of the cpu run loop and perform the flush there. Signed-off-by: Richard Henderson --- include/exec/cpu-common.h | 1 + accel/tcg/tcg-accel-ops-mttcg.c | 7 +++++++ accel/tcg/tcg-accel-ops-rr.c | 9 +++++++-- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/include/exec/cpu-common.h b/include/exec/cpu-common.h index 9b658a3f48..ce9f116ac3 100644 --- a/include/exec/cpu-common.h +++ b/include/exec/cpu-common.h @@ -20,6 +20,7 @@ #define EXCP_HALTED 0x10003 /* cpu is halted (waiting for external eve= nt) */ #define EXCP_YIELD 0x10004 /* cpu wants to yield timeslice to another= */ #define EXCP_ATOMIC 0x10005 /* stop-the-world and emulate atomic */ +#define EXCP_TB_FLUSH 0x10006 /* stop-the-world and flush all tb */ =20 void cpu_exec_init_all(void); void cpu_exec_step_atomic(CPUState *cpu); diff --git a/accel/tcg/tcg-accel-ops-mttcg.c b/accel/tcg/tcg-accel-ops-mttc= g.c index cf1ee7ac25..c7b8e8a713 100644 --- a/accel/tcg/tcg-accel-ops-mttcg.c +++ b/accel/tcg/tcg-accel-ops-mttcg.c @@ -27,6 +27,7 @@ #include "system/tcg.h" #include "system/replay.h" #include "exec/icount.h" +#include "exec/tb-flush.h" #include "qemu/main-loop.h" #include "qemu/notify.h" #include "qemu/guest-random.h" @@ -106,6 +107,12 @@ static void *mttcg_cpu_thread_fn(void *arg) bql_unlock(); cpu_exec_step_atomic(cpu); bql_lock(); + break; + case EXCP_TB_FLUSH: + start_exclusive(); + tb_flush__exclusive(); + end_exclusive(); + break; default: /* Ignore everything else? */ break; diff --git a/accel/tcg/tcg-accel-ops-rr.c b/accel/tcg/tcg-accel-ops-rr.c index 2fb4643997..85dade50a8 100644 --- a/accel/tcg/tcg-accel-ops-rr.c +++ b/accel/tcg/tcg-accel-ops-rr.c @@ -32,6 +32,7 @@ #include "qemu/notify.h" #include "qemu/guest-random.h" #include "exec/cpu-common.h" +#include "exec/tb-flush.h" #include "tcg/startup.h" #include "tcg-accel-ops.h" #include "tcg-accel-ops-rr.h" @@ -288,14 +289,18 @@ static void *rr_cpu_thread_fn(void *arg) } bql_lock(); =20 - if (r =3D=3D EXCP_DEBUG) { + switch (r) { + case EXCP_DEBUG: cpu_handle_guest_debug(cpu); break; - } else if (r =3D=3D EXCP_ATOMIC) { + case EXCP_ATOMIC: bql_unlock(); cpu_exec_step_atomic(cpu); bql_lock(); break; + case EXCP_TB_FLUSH: + tb_flush__exclusive(); + break; } } else if (cpu->stop) { if (cpu->unplug) { --=20 2.43.0 From nobody Sun Sep 28 16:28:04 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1758595404; cv=none; d=zohomail.com; s=zohoarc; b=fJItfoJrGU9ZQjMOFB0rMfRuhZCFH4QD3R+zCxGHeAi5kLkNGA4plFH3ovxA+TXKy+Hst2St3Jbqb/adhcU+wub/OJAjKACGHCNBJBfG0GxYFXP8xjDNDtcuYr+jBRm0bjqbnk9PRnCwoOTaF/g+w+iXLln6azcn2vDT8cf12B4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1758595404; h=Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=39nNiJA/IKE7T/FfjUB4iuqZYKXZFDWxmUchhyElphg=; b=dBK3T/cl1cHdqnJt/bdcq4lQ8B+Kxbdryo87uRE7Qm6ObnCMhfPSBhtZHfzNNDMCf3NDfJi1sHnvqL6nVILX3BrZ/QkYsWLaqHxeB6lgRCBSbaj15TPV3zD91rZKHsArVQBz+oDx67xrJrrDjvtSKyqNKHefMCSTdS1PV3aHdh4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1758595404237525.0593083945589; Mon, 22 Sep 2025 19:43:24 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1v0swh-0004Pg-PO; Mon, 22 Sep 2025 22:39:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1v0swY-0004Hq-BE for qemu-devel@nongnu.org; Mon, 22 Sep 2025 22:39:50 -0400 Received: from mail-pf1-x42f.google.com ([2607:f8b0:4864:20::42f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1v0swL-0003hT-DG for qemu-devel@nongnu.org; Mon, 22 Sep 2025 22:39:49 -0400 Received: by mail-pf1-x42f.google.com with SMTP id d2e1a72fcca58-76e6cbb991aso4173033b3a.1 for ; Mon, 22 Sep 2025 19:39:33 -0700 (PDT) Received: from stoup.. ([71.212.157.132]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-77f0da43089sm9899622b3a.90.2025.09.22.19.39.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Sep 2025 19:39:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1758595171; x=1759199971; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=39nNiJA/IKE7T/FfjUB4iuqZYKXZFDWxmUchhyElphg=; b=hMmX0bIDwo2UK07xb7K3quqntSvsQqhz5Ba3KNzcPDQn2fZ51O2+b46Q8OMZwpM1dy FN9BNmnmJBvfcA+vAdnPryq9uAxXLIfLbVphLn9jcC1hvRjcG8oX/cwSx9GIWzOBZ7aW VenhZ5mSBwW9xCzTOLtZABJTsTo8HQFz8A3Ay9j3AiVfI/WtXHGc8YG8wjNjp90SZYcZ BG3sM9/Iof7Ayyc1WIolpSQi7/xGUklpXGJC8nxpfAiI3qbNMCA6WwNAJ3vgWEfx/JkY sYYJOvS7BdC7WEfQtJzUR+lioEKhITSHGUA31r/XmSB2lh2Zl6EevByY0xLcCP7judfE fVng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1758595171; x=1759199971; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=39nNiJA/IKE7T/FfjUB4iuqZYKXZFDWxmUchhyElphg=; b=SMByEHRbe8HVMOaapbZgvPx+V1s4jo3fdmpOIYLI8/o8ddy4pWnhg/Z/D/5VZPEy9R ep3+4rWuBYE9W0xQjqiIIxD1B3xrC6rIoTcEUV2NHmRlC0FLWIlg8dIy5P2g6C75wuId KHWIxQ6SgQq+e9RSiOkS46DZvJ70x1pgaXn5Og5W0efMb+XpgV2NbIzfknLn2im/t0lo b6wCRLAmmxpp+DzxiLpiTd12t5vmxnxy/QM3B8uHq4Dg8U8dBoY4B0sl4xGliATgb1RG SE1++yntDs70BSW4T/RLFirE+j8qhSpxB5bZ8MeYq+aNyR5IqUSWR5MtCP2ahFyBeJ7q j/wQ== X-Gm-Message-State: AOJu0YzUf1dA2OqAHoyJMp5L0CIIKdCtT8mX0VuH81IoveGVbIpXMHR0 l9V/a3eim0l2e0yWNAZltrVabrOL7rnKBkVRpLoYHbmgnWxkjTNa85qqcIX+DfEP8wffnct4Zw6 BRBZs X-Gm-Gg: ASbGncvqVN6PDx2Hm8j7fnToZiK3J6QvEpdh47/w6+rzWhxqPutd4Yg9Ln9FM6D6+wk uoFXsdqtXOi1bJDTWwP10j6BZtnAQQEMKNfRDQt9rnTd/1CJv0Ggb37JPaQmjYl7GRFb1UKrXE8 sDGbPxcFww+T1xgLnrhNa6b+1vh8dm06fiwN2i3cEkxvHoMthI5j0jUEx0ZxUvkx5iXp2/8thi4 KL61Qe/5Yr5i8XPLWbnbd9U3pcFVkyjrpz/XO/0bWCmtefJmSmhoz6QQWWRrXKMwygVxtCHF2Ss 2omYZnAm5E+vRwhMHbL02PmhR8h+okvFk39c0OszhV6DAMTgwdhv2m4L7oHtOBzWQ04I70Cqg5c u+UchuXGE2FMJ/3knKBgSnjjjJIQL X-Google-Smtp-Source: AGHT+IFqL908kSwQXCKStyPKrdopq3GTS4fKCTDkUZHLUIWN5lmJB2Nj7dQP/CyCSX52SF6oMm8Now== X-Received: by 2002:a05:6a00:3904:b0:77f:1ef8:8acb with SMTP id d2e1a72fcca58-77f538ffa10mr1444568b3a.13.1758595171130; Mon, 22 Sep 2025 19:39:31 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 10/12] accel/tcg: Use EXCP_TB_FLUSH in tb_gen_code Date: Mon, 22 Sep 2025 19:39:14 -0700 Message-ID: <20250923023922.3102471-11-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250923023922.3102471-1-richard.henderson@linaro.org> References: <20250923023922.3102471-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::42f; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42f.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, T_SPF_TEMPERROR=0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1758595404575116600 Content-Type: text/plain; charset="utf-8" Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Philippe Mathieu-Daud=C3=A9 --- accel/tcg/translate-all.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c index d468667b0d..d7cc346414 100644 --- a/accel/tcg/translate-all.c +++ b/accel/tcg/translate-all.c @@ -288,11 +288,8 @@ TranslationBlock *tb_gen_code(CPUState *cpu, TCGTBCPUS= tate s) assert_no_pages_locked(); tb =3D tcg_tb_alloc(tcg_ctx); if (unlikely(!tb)) { - /* flush must be done */ - tb_flush(cpu); mmap_unlock(); - /* Make the execution loop process the flush as soon as possible. = */ - cpu->exception_index =3D EXCP_INTERRUPT; + cpu->exception_index =3D EXCP_TB_FLUSH; cpu_loop_exit(cpu); } =20 --=20 2.43.0 From nobody Sun Sep 28 16:28:04 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1758595355; cv=none; d=zohomail.com; s=zohoarc; b=Mn1z8MTp4ATtbdmuokiGzW09y0VkHJzKpTXhCwqKEpULXCq2sCYD/1EDuJRnCmPD79gUwPAxX2wgbj8NNkdeH9GLatWZZ7HKrzwIHPy6ojDL+pXqO7sIvpAYJSWodAgHFo3wmhMYDUJmN0Y1kH5JL93VU+GYdCjjZdt6YSvBwDY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1758595355; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=+Wx1IpKJt7P9pYpYwnZlwVnkoKrnXLfmcCjmrbQwDAg=; b=djfRgrGrY0hjTAaR+Tzl+yjk37dEBYEWR4xsjtwNAsnUOi6xwNXnvM7XSZIQsikjByO6/RFLFlyOpKl2Cd4QQXf5tgA6J23BifnN0g1kOuOjGSCNTUsw628nhM8d4oUq9gwUcV7u/lUSX+zmClZO1CwigNPRPIct8QMP28uaYUo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1758595355978412.6920442540594; Mon, 22 Sep 2025 19:42:35 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1v0swh-0004Oq-CV; Mon, 22 Sep 2025 22:39:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1v0swb-0004Jy-Ex for qemu-devel@nongnu.org; Mon, 22 Sep 2025 22:39:54 -0400 Received: from mail-pf1-x434.google.com ([2607:f8b0:4864:20::434]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1v0swL-0003hY-F0 for qemu-devel@nongnu.org; Mon, 22 Sep 2025 22:39:52 -0400 Received: by mail-pf1-x434.google.com with SMTP id d2e1a72fcca58-77f35113821so1498296b3a.0 for ; Mon, 22 Sep 2025 19:39:33 -0700 (PDT) Received: from stoup.. ([71.212.157.132]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-77f0da43089sm9899622b3a.90.2025.09.22.19.39.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Sep 2025 19:39:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1758595172; x=1759199972; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=+Wx1IpKJt7P9pYpYwnZlwVnkoKrnXLfmcCjmrbQwDAg=; b=DKV6GTRQmX4IUK3EHUixc5b/5xs/NR3MzgQb1xDh91iknFDWt/ImAReP0FfQz7f+yv 0//LkMhzRu74NrAHNm9MqCoCKjTfS3h8qPd/9FDHj0EYvAELxEgqG+96QGKdw1k7QyWo dLVLFbmefRTFA+L4bAXbqIrwirAEeo0KLIHUYmHbHX7hjO+AKKxl+iYgK/FAKIFGWVqq 4MEWkJ1h28CKoFJtlEhqiZRgPw55dlzD2w+i1uVyQp/6v2rNCXzCImB1RoiBn20pTqV2 +kVGaEIo6ABzNknBBAW3GsAZAoy/7k/HA1pAiinYxL1m3aZf9gkqVwQMUN2On1cJOSaL iE9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1758595172; x=1759199972; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+Wx1IpKJt7P9pYpYwnZlwVnkoKrnXLfmcCjmrbQwDAg=; b=J2Tsjlg4B5Ze1xytkVKv+PdDegY9ZS8pN9fIieEmG2M+TI4tjhIZP/S2K6EYPMrGer cwpv8qeinOpNIAsdZMx60/hrwVaJCUpAeXtIIdNucwcfm2tLUi6SEab/+2AMbwnjJn1Z da6bkWnu443uybeufyF1ttj0uwnNp2DfDfDRdob7Zde9X1a61E8N/FB5q3RSLPlL1XpL g64U/uU8odFSGAe05XnoS+pb1Z0CB1AON9w91/oEu43T+/r0o+rmq6zrTRAvXwiPWGPK z8W3J17e4sMH+cm8vN8bjNK6bgN6JUofG2bUoqFm2H1KutJdC8QtEnxt1TyZxNOU+0/+ Rejg== X-Gm-Message-State: AOJu0YyOciNNcpF9XTZH5OZonM7XGOsPzf2ZvZwl7y/8rqMAdLNcp8i+ T9+fWGyPWPJZ3J2LxjPTihIOSmy1hKiPh9HBV3WEA7vb+0mdhDhVSiGOoa5i7mhklbeoxUSp4HO Jzaqc X-Gm-Gg: ASbGncueOY6/mU5ZfGd/TI7rPs3a9mc+GUSuCQdhqUs1SAFOVUvIZiLZcAnblgxOljg YpSOsFOJcyZLu17NloKf7VEOB2gd578bE4yR/Pws701hnDnHSyusG2yqNf+WfMlyuKzRRO70HxR zLlLGh+FryCzAKniRrXx3tMXmr/gBIFplllveSRdREtSQ7sBFznwTqHfi9avM5IxyGtgBdTA+K+ PqBuZRRvAyBImYNDWE3Bei7owTT5dhbNP48yAJgc/vd/3rGHCmmx4hpdXcW8nu2YQueJc69JAiS fg64p2iwTTOY18Tr7MW5EYQ9L38DtzkCJgrgiREewGUSt+7BVAAtZKT9l75dk0UvvsTrGZTMRs1 gvOB15GLuufkrmEIGi6Ijwa2hygYOP4qQhEck6XE= X-Google-Smtp-Source: AGHT+IFk0Ol0fUOi6mk3Hx34RNQSNa6E5BJWKc4agxTq1oAoj+deIa5Accqy6iwcXO1+DmmvQG6RcA== X-Received: by 2002:a05:6a20:3d08:b0:2ca:1b5:9d4d with SMTP id adf61e73a8af0-2cfd4836d5cmr1645685637.2.1758595171830; Mon, 22 Sep 2025 19:39:31 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Pierrick Bouvier Subject: [PATCH v2 11/12] accel/tcg: Remove tb_flush Date: Mon, 22 Sep 2025 19:39:15 -0700 Message-ID: <20250923023922.3102471-12-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250923023922.3102471-1-richard.henderson@linaro.org> References: <20250923023922.3102471-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1758595362176116600 Content-Type: text/plain; charset="utf-8" All uses have been replaced with tb_flush__exclusive. Reviewed-by: Pierrick Bouvier Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Philippe Mathieu-Daud=C3=A9 --- include/exec/tb-flush.h | 15 --------------- accel/tcg/tb-maint.c | 22 ---------------------- 2 files changed, 37 deletions(-) diff --git a/include/exec/tb-flush.h b/include/exec/tb-flush.h index 5076b13bbd..d6586b9d5f 100644 --- a/include/exec/tb-flush.h +++ b/include/exec/tb-flush.h @@ -21,21 +21,6 @@ */ void tb_flush__exclusive(void); =20 -/** - * tb_flush() - flush all translation blocks - * @cs: CPUState (must be valid, but treated as anonymous pointer) - * - * Used to flush all the translation blocks in the system. Sometimes - * it is simpler to flush everything than work out which individual - * translations are now invalid and ensure they are not called - * anymore. - * - * tb_flush() takes care of running the flush in an exclusive context - * if it is not already running in one. This means no guest code will - * run until this complete. - */ -void tb_flush(CPUState *cs); - void tcg_flush_jmp_cache(CPUState *cs); =20 #endif /* _TB_FLUSH_H_ */ diff --git a/accel/tcg/tb-maint.c b/accel/tcg/tb-maint.c index 71216fa75e..879ed12442 100644 --- a/accel/tcg/tb-maint.c +++ b/accel/tcg/tb-maint.c @@ -785,28 +785,6 @@ void tb_flush__exclusive(void) qemu_plugin_flush_cb(); } =20 -static void do_tb_flush(CPUState *cpu, run_on_cpu_data tb_flush_count) -{ - /* If it is already been done on request of another CPU, just retry. */ - if (tb_ctx.tb_flush_count =3D=3D tb_flush_count.host_int) { - tb_flush__exclusive(); - } -} - -void tb_flush(CPUState *cpu) -{ - if (tcg_enabled()) { - unsigned tb_flush_count =3D qatomic_read(&tb_ctx.tb_flush_count); - - if (cpu_in_serial_context(cpu)) { - do_tb_flush(cpu, RUN_ON_CPU_HOST_INT(tb_flush_count)); - } else { - async_safe_run_on_cpu(cpu, do_tb_flush, - RUN_ON_CPU_HOST_INT(tb_flush_count)); - } - } -} - /* remove @orig from its @n_orig-th jump list */ static inline void tb_remove_from_jmp_list(TranslationBlock *orig, int n_o= rig) { --=20 2.43.0 From nobody Sun Sep 28 16:28:04 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1758595385; cv=none; d=zohomail.com; s=zohoarc; b=h3CGiOHWMkJGwEkmpoxd1AgGvX/EEAIGQl8H6WnhHWh8KM3HQDCHvQH7keeFgDGt6eFHKVI7UEmlsx0YfYxhPpct/yBIHnWKVQSKLuhjaSX3UJVfFqMQahPdMYrJMilMLBjytszMJu0ss1n49VkEdeLccG7FgR+2HPXcRy1jx9k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1758595385; h=Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=9c9CwLpLhaHtQKrXnaX1zcy9qSt57CBpOe3eqvDcA1Y=; b=CQXi2EN6ckWPiMt1jrcTk67FTYBKRXsQeI8DLn9+8XnwINga/+Z8VRdnV+LX32GuIlzf+JHMRInKUMZn4v6e+MwDOnZzkWWqSvL6nJGqnaSl66R2XhvYHypRg4yyxWoyjWIMYv7cLHYG9rw3pwoRUVi7gt8i1o0+4f8CNbBXPB4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1758595385753729.7755592403371; Mon, 22 Sep 2025 19:43:05 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1v0swi-0004Pv-EA; Mon, 22 Sep 2025 22:40:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1v0swV-0004HK-IZ for qemu-devel@nongnu.org; Mon, 22 Sep 2025 22:39:47 -0400 Received: from mail-pf1-x431.google.com ([2607:f8b0:4864:20::431]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1v0swJ-0003he-Dt for qemu-devel@nongnu.org; Mon, 22 Sep 2025 22:39:46 -0400 Received: by mail-pf1-x431.google.com with SMTP id d2e1a72fcca58-77f1f29a551so2566423b3a.3 for ; Mon, 22 Sep 2025 19:39:34 -0700 (PDT) Received: from stoup.. ([71.212.157.132]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-77f0da43089sm9899622b3a.90.2025.09.22.19.39.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Sep 2025 19:39:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1758595172; x=1759199972; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=9c9CwLpLhaHtQKrXnaX1zcy9qSt57CBpOe3eqvDcA1Y=; b=ZepRR60j1ESKPELgGnOadC6l16nnScjbdQz+IkzW674CBkIFebn3XLp8aWNDFbV5+g aROcEPmkr7Bp5+2nB8+Q3DU23Z50FDEK+szNuqpQH3aBnSzgtHxFrnppmHbuYpG/1kyv /NPLURKpyxVcZzD1gOv8BKzqQbIikSXgYtzjCe0DaKdEIl1raU6ocvW6I6pbVkId8GKo qqnimbuSAf/HdQwZ9mzzuKcw9DnHvDHFjUhaa5XREvACrf6/eD3Vzm/dwUdyVQ+8Fl4O +73OxFtasIUCJrnmWOZP7J0mu8TW+CKl1rsXin8ldqt7UPX5zVe3ZY/b3M6yE+JrNncI 4o7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1758595172; x=1759199972; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9c9CwLpLhaHtQKrXnaX1zcy9qSt57CBpOe3eqvDcA1Y=; b=pFoIU7mboLXTjJs94FM0rSEbfbR4gM1TPa50ixfwWFStR5CSQygDUhDZpvidf+MeYo bNpASLi2jy+Z9HqcrN3nn1ILcFo2PZZx1pGAM8HNfygM636vXxgpzwQZRK4nNPWP0hy3 AhsdgNGTyS1am7Xf7iKHvVTS58a4B3XOerx1IIJbDxEkgGueiKS+QwZIzsC5m+J+KspJ i3uoxYZcHFJlccqexMnH0vNdHfdbZGl49l4FZiWbbsEyx08DyKs1aq+2ifxBh+2X6DlU JNKqu7jqYJn7d6kfW8s/M8TmhC8OYyciH6BJowryUImFpu9qNUcAFYRhFhj9Cu2eDx5q MVVw== X-Gm-Message-State: AOJu0Yw1uVljlhEGR3Dbkew0veKK+6qubXi58CeKdyVCdGod4WtfAEv5 FMaXpdg+Fxx+Y0Fjw9P1pKfPY0ZAxvmlJMxxHIRIJB+5qQejiV0c7EBlZL3HWxh95/5wZmOJIbn 7FR21 X-Gm-Gg: ASbGncuQ71qzL6v4sDRWhlFi9L1TqlAvk08dg3M410wbsiWq27UZEnqHnaq923LFQ8d B99GfrWQG9mA03MTHxDYYuuNA3KrHAFFn6hmgWMT9MBTwkem7CvvodrKypEmeNRnm8/d05kzrxL /A+w/vcTDoUVDVaEGlsAI1lC5g6WazHcDsGNV/VtOTVlJRIP+R31RMwbAEBMamwFNBOpr7xGwzQ bzKLqcrqXFIlvlWqsQmZjDJnQvFbMhPXRMf3UlEXCjXnrPwbX9YvdNLDJFFP1I/Exy5ExDRAHBJ UCfbWfaIBkXrjtRomP7x13YQhBeEtQpY0y5oQ363Vdx7lpUdICSb/NL640vRcXnkPaL9boTseUP +Dm9a6XagLSlUKlrJj5ZQ7o+XC2gd X-Google-Smtp-Source: AGHT+IF5g2zmWDxP2h77YJN9xtoMUSxKuXMdeszPKAqDpP6ME/pR9qMp4qdEy3LyZFUJuTSjm4OoBg== X-Received: by 2002:a05:6a00:cc5:b0:77f:5358:b43d with SMTP id d2e1a72fcca58-77f53847a3fmr1403162b3a.6.1758595172562; Mon, 22 Sep 2025 19:39:32 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 12/12] accel/tcg: Tighten assert in tb_flush__exclusive Date: Mon, 22 Sep 2025 19:39:16 -0700 Message-ID: <20250923023922.3102471-13-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250923023922.3102471-1-richard.henderson@linaro.org> References: <20250923023922.3102471-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::431; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x431.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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1758595386435116600 Content-Type: text/plain; charset="utf-8" Now that tb_flush is gone, with its cpu_in_serial_context check, we can tighten to cpu_in_exclusive_context. Signed-off-by: Richard Henderson --- accel/tcg/tb-maint.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/accel/tcg/tb-maint.c b/accel/tcg/tb-maint.c index 879ed12442..81e8ec14d4 100644 --- a/accel/tcg/tb-maint.c +++ b/accel/tcg/tb-maint.c @@ -770,7 +770,7 @@ void tb_flush__exclusive(void) =20 assert(tcg_enabled()); assert(!runstate_is_running() || - (current_cpu && cpu_in_serial_context(current_cpu))); + (current_cpu && cpu_in_exclusive_context(current_cpu))); =20 CPU_FOREACH(cpu) { tcg_flush_jmp_cache(cpu); --=20 2.43.0