From patchwork Wed Dec 28 12:49:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 637259 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp2432118pvb; Wed, 28 Dec 2022 04:55:24 -0800 (PST) X-Google-Smtp-Source: AMrXdXt99V+k5/ESdoD32dqAVwdC+I/wzndpCe+H/VQxlsgbCl74tjRWTy3QnBF57lkvVzouIF0f X-Received: by 2002:ac8:48c5:0:b0:3a7:e043:2d1b with SMTP id l5-20020ac848c5000000b003a7e0432d1bmr31054170qtr.14.1672232123823; Wed, 28 Dec 2022 04:55:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672232123; cv=none; d=google.com; s=arc-20160816; b=RjI4FqwB7TQR3z91pqgrLZnJ/qEIF0Gi/sJgjn9WOJfcQb6LHBwVFSZJvcYVCaKI7Z 85lB3fpZc/GTr/iif4MEuCQpu+Q4ruL7cY7+QDoL85jTcEtMef40UwTpUl3vdMfKbhFs n/CuuwApbZBrSZHlmwt3relXhAfv1lL1HaoditiFK9L1ds4fta4tQMxgLBEC2wFLq8eR EeVIPZmCoOKeVl+jsEq7xhvu46TGae/1BLTj5ke402zyK6cBAtVE4rI+EsMZOwOzpgSf GmxKoX+SXMccoxiuWX9jemx0v7H+ra7yYDQl0U1eNZjwaZ9ufB8oGEyGK5RqFBAVihLZ 0aiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=HhuI1L6u/vuSUSLMQUe52IWoEVBY52BZhysTXp5u8Bs=; b=CynB9duaptVqIQeaMn8K5XOAKr3fnU8kjOby33ZEt56PH64RYwWBuoadPz2yzq5sDG t7SU+SoVPLmNgcTsK4HQ0ll4Xh3txMtj+2M0hoFqUhTPBWaUJQvbjpPSEBMjARgaRht2 AczGVr+CBGWDTsom3J4zhg5sB+f846GSmTAHM1PrAoFBSVkasMh9xuZisT6u8pPtO691 txCUgWuH5OwFQ45AdKHVZn/aVArzEQXD8ubLNuhZZFX7YM/g1Qjv8lu7huYzphCoiTaR EFAW1EJid015fbesGMunNtavs2sfd46/gt7xj48iBhTJ7Nu+/33EpGcVTcgcWrgHgr4N pG3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="imPt/Bkq"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id h3-20020a37b703000000b006eeec00891esi6226797qkf.392.2022.12.28.04.55.23 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 28 Dec 2022 04:55:23 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="imPt/Bkq"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pAVsE-0000tC-Ce; Wed, 28 Dec 2022 07:49:34 -0500 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 1pAVs4-0000rV-MQ for qemu-devel@nongnu.org; Wed, 28 Dec 2022 07:49:24 -0500 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pAVs3-0002g4-2X for qemu-devel@nongnu.org; Wed, 28 Dec 2022 07:49:24 -0500 Received: by mail-wm1-x329.google.com with SMTP id fm16-20020a05600c0c1000b003d96fb976efso9023605wmb.3 for ; Wed, 28 Dec 2022 04:49:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=HhuI1L6u/vuSUSLMQUe52IWoEVBY52BZhysTXp5u8Bs=; b=imPt/BkqBhF5S4Gtu1GHFI0U3+wS+2ubDQ8cWOl6nDmV6juhEGYEmguUifu3dcfH9e uzK6E17RRqndxpQLsz5HKSICj4sVqquNgKyoREwc2Oa0v94w/x2NbTLsA98+SqJk/jXl UdKXwGD4aIH6dRtxNdWVUfFwKWLfua1z7pwi3tuJArn/G9ivCwi0W6NaUXyhiOnzpWhx X0rocmQzeLaZ3Bii6IQrGEOzh35on2o5zLSEo66TQJu59bdKA2BwdH7/dQ+gSzGeJ7Ww qF84UVXEjjTLLLBl6DPhjDp5BnbF1kHqMyPF+d/8O2DUWT7gx71NMlXUwvZwdiL0nl+C v0rw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=HhuI1L6u/vuSUSLMQUe52IWoEVBY52BZhysTXp5u8Bs=; b=zUPDWMKk0svr3CrZgzqYnR0vg+vvU2uKElr1DW8EuiQqcoBG2ZXHPmPZNA0N2CEc2c k6SnBs6/vhqcZCLvYI1vr3NVS0yv8wyzFzxPivS6SNWiTMmxkZOKywK4ne+5jZU78pfN xthEWHh/9EA62fKv2YiFWFYnjz+m3/TZmhPs3yazr9+MMDCWS6jCr2IOUvqTy5ON1Lew SkHj0PpcpavGsuH6ULrh43BksxC6cIUtwNfkDYnqKu0tnmjkkD8dyRAThIC6QMge6l6r NtNb2S+Fxw32KzEg8/2UM214meH1qqEC2eKgpN4UdEsI0OFqAWKSSG1jES1O/1NhERNe i7qA== X-Gm-Message-State: AFqh2krRJy2nTlC2syGpOfBZjtBwF/lvb/1KEt21i6kWVrzn84p/eTuK o5PGqhJQLXQ7ncPET1HdvsfTiI02fcM/sEkZ X-Received: by 2002:a05:600c:3845:b0:3d1:caf1:3f56 with SMTP id s5-20020a05600c384500b003d1caf13f56mr20943510wmr.9.1672231761092; Wed, 28 Dec 2022 04:49:21 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id j30-20020a05600c1c1e00b003c71358a42dsm33430642wms.18.2022.12.28.04.49.20 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 28 Dec 2022 04:49:20 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Ilya Leoshkevich , Richard Henderson , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH 1a/4] accel/tcg: Fix tb_invalidate_phys_page_unwind Date: Wed, 28 Dec 2022 13:49:17 +0100 Message-Id: <20221228124918.80011-1-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221224151821.464455-2-richard.henderson@linaro.org> References: <20221224151821.464455-2-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::329; envelope-from=philmd@linaro.org; helo=mail-wm1-x329.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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org When called from syscall(), we are not within a TB and pc == 0. We can skip the check for invalidating the current TB. Signed-off-by: Richard Henderson [PMD: Split patch in 2] Signed-off-by: Philippe Mathieu-Daudé --- accel/tcg/tb-maint.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/accel/tcg/tb-maint.c b/accel/tcg/tb-maint.c index 1b8e860647..c9b8d3c6c3 100644 --- a/accel/tcg/tb-maint.c +++ b/accel/tcg/tb-maint.c @@ -1024,8 +1024,18 @@ void tb_invalidate_phys_page(tb_page_addr_t addr) */ bool tb_invalidate_phys_page_unwind(tb_page_addr_t addr, uintptr_t pc) { - assert(pc != 0); -#ifdef TARGET_HAS_PRECISE_SMC + /* + * Without precise smc semantics, or when outside of a TB, + * we can skip to invalidate. + */ +#ifndef TARGET_HAS_PRECISE_SMC + pc = 0; +#endif + if (!pc) { + tb_invalidate_phys_page(addr); + return false; + } + assert_memory_lock(); { TranslationBlock *current_tb = tcg_tb_lookup(pc); @@ -1058,9 +1068,6 @@ bool tb_invalidate_phys_page_unwind(tb_page_addr_t addr, uintptr_t pc) return true; } } -#else - tb_invalidate_phys_page(addr); -#endif /* TARGET_HAS_PRECISE_SMC */ return false; } #else