From nobody Wed Feb 11 05:43:20 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=ilande.co.uk Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1688027154156505.85950692827123; Thu, 29 Jun 2023 01:25:54 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qEmyE-0000ra-Ph; Thu, 29 Jun 2023 04:25:42 -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 1qEmyB-0000pi-Aq for qemu-devel@nongnu.org; Thu, 29 Jun 2023 04:25:39 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qEmy9-0003uV-4S for qemu-devel@nongnu.org; Thu, 29 Jun 2023 04:25:38 -0400 Received: from host86-130-37-216.range86-130.btcentralplus.com ([86.130.37.216] helo=kentang.home) by mail.ilande.co.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qEmxs-000AaV-WE; Thu, 29 Jun 2023 09:25:25 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ilande.co.uk; s=20220518; h=Subject:Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:To:From:Sender:Reply-To:Cc: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=+PBx1IM+VwAvSsI6vsBRb75BGq9VK9/Wqng6jChjVOA=; b=d29lo1f7Z58WgvdrbzQr29dw3I DmekJkEzcpdCpSySYs8dlAoljIYh1ptYFdvPqtQbRbbeWPRbzdYulCewkVAgb4of+yf3yvP99yJo9 Skhu0VsJIdLOJ2PG66F4ZNRaFEJjzkqnDK9pjQAOjZEklEs3iXltoU/VEoUXRbc5WUgwcw7/iligV GdZQUMGp2IE01JVohpl2P2/m2MysPG/MKRfNZONm2nzrwlryEOFSuN0C2EwM+dZ7XtQJc1HShM9Nr BzqRUxr97Qu3JXiQLToLOCi3ZkBGFMoHOLYt/nyz2uS3Bh9KQvLExW5OHgDUdDnpIsczjs56p8rX3 w5ZtxBk+sS/akiG8WpU9mU5i0DSsqIKSLvkt/j2PX4ht0efShy/9hdQEwOqcKiihy2zKLUpdzwOZA +FJG2CuQjkX2FilDDxaWd39qNzsVGhICdYr/WfbRdOhhi83bBdTgPZ47vMsG0YEh1y2BMw4uWsPha tGm7CCoKEGgCqf7j5NhQ3MePbBasaKYh0ntE0ruLcMYQSlJaFhJ7dFSnxathC1y6xT9qSetwsuoHq P3WurQVzZcUzBjo5IUn+iOMP33deGo6nEkMwzicgljOFtjZA5JeJ3aLpnbXBl2s75kfdgK0V5GOgM LddepUYZTFtAqD471YvL0IrnnNFlV/1LSs0gcvvt4=; From: Mark Cave-Ayland To: richard.henderson@linaro.org, clegoate@redhat.com, hsp.cat7@gmail.com, qemu-devel@nongnu.org Date: Thu, 29 Jun 2023 09:25:21 +0100 Message-Id: <20230629082522.606219-2-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230629082522.606219-1-mark.cave-ayland@ilande.co.uk> References: <20230629082522.606219-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 86.130.37.216 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH 1/2] accel/tcg: fix start page passed to tb_invalidate_phys_page_range__locked() X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.ilande.co.uk) 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=2001:41c9:1:41f::167; envelope-from=mark.cave-ayland@ilande.co.uk; helo=mail.ilande.co.uk 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, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-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: fail (Header signature does not verify) X-ZM-MESSAGEID: 1688027156324100005 Content-Type: text/plain; charset="utf-8" Due to a copy-paste error in tb_invalidate_phys_range() the start address o= f the invalidation range was being passed to tb_invalidate_phys_page_range__locke= d() instead of the start address of the current page. Signed-off-by: Mark Cave-Ayland Fixes: e506ad6a05 ("accel/tcg: Pass last not end to tb_invalidate_phys_rang= e") --- accel/tcg/tb-maint.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/accel/tcg/tb-maint.c b/accel/tcg/tb-maint.c index 3541419845..33ea1aadd1 100644 --- a/accel/tcg/tb-maint.c +++ b/accel/tcg/tb-maint.c @@ -1182,15 +1182,17 @@ void tb_invalidate_phys_range(tb_page_addr_t start,= tb_page_addr_t last) index_last =3D last >> TARGET_PAGE_BITS; for (index =3D start >> TARGET_PAGE_BITS; index <=3D index_last; index= ++) { PageDesc *pd =3D page_find(index); - tb_page_addr_t bound; + tb_page_addr_t page_start, page_last; =20 if (pd =3D=3D NULL) { continue; } assert_page_locked(pd); - bound =3D (index << TARGET_PAGE_BITS) | ~TARGET_PAGE_MASK; - bound =3D MIN(bound, last); - tb_invalidate_phys_page_range__locked(pages, pd, start, bound, 0); + page_start =3D index << TARGET_PAGE_BITS; + page_last =3D page_start | ~TARGET_PAGE_MASK; + page_last =3D MIN(page_last, last); + tb_invalidate_phys_page_range__locked(pages, pd, + page_start, page_last, 0); } page_collection_unlock(pages); } --=20 2.30.2 From nobody Wed Feb 11 05:43:20 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=ilande.co.uk Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1688027174526668.2662843455194; Thu, 29 Jun 2023 01:26:14 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qEmyJ-0000zO-IF; Thu, 29 Jun 2023 04:25:47 -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 1qEmyF-0000sR-1W for qemu-devel@nongnu.org; Thu, 29 Jun 2023 04:25:43 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qEmyC-0003yL-MI for qemu-devel@nongnu.org; Thu, 29 Jun 2023 04:25:41 -0400 Received: from host86-130-37-216.range86-130.btcentralplus.com ([86.130.37.216] helo=kentang.home) by mail.ilande.co.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qEmxx-000AaV-8k; Thu, 29 Jun 2023 09:25:29 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ilande.co.uk; s=20220518; h=Subject:Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:To:From:Sender:Reply-To:Cc: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=z+1BEUmavoQO3HcH1kz8zqVdVEFpYdR3gpplJlnyaGk=; b=aEEfl3PCyu73Pfc1jSlJzgaIMg VLzdzV3Zt0MkMoX8Sv8pwPpjZW/ZFlUpqM8Hoy+O7zTYeppfrbqU7MqDgbyJNRm71VckdY80WWI8J hkn4ceOFEVHtUf5xYICXhrpayUqU4c9MM5iORa6Qsl7QgxNNXEEawKyyrTWyEr8Qf6uD1IMRQLEj3 9EZizUABTrZ7HL3NxWgkse5rAPAusOhcMaY+oFkNulN7lWyyb21p5FxD3k98wV/zJroxmy3HIYLH0 fEEBVL6Yu3A5vS3Cnb7b6Nw9+/khk/e9P0Nv8W2/s+ODjjYYoizbVg2zaNxC97QZepVXHqObvnn5m bRpCayBZOQRH9EgCVkxgqMXNtVdkv7bGVYm96It6xdVOT+GRd2a7jGP7uFT1pARRZEXVG7qyDfSRX +m7+1HyEUDgFBNa6gwrv7/DjyOdVD8pC8sAflwfbUTxsp+1bmiHSVSuv33dTx+csTRbMTF0dHQ1mU Sp6cFnkxcnnF5noNAKKLHcgMvb+nUPlcop3+9DrDy+8gaMSalAVcYxWP+jCqqh9ECCEJOlX4TLTzE ZxhQqYWJNnz15IKg9ueR5PsAyYXg57s5rFgO218e1I6uWO34K+OGzI4leC/u13CEvbtQI9EDi65rp s5yvobpuCcrisURfQQiNcMSlUNrdUQXCGgBMz55mc=; From: Mark Cave-Ayland To: richard.henderson@linaro.org, clegoate@redhat.com, hsp.cat7@gmail.com, qemu-devel@nongnu.org Date: Thu, 29 Jun 2023 09:25:22 +0100 Message-Id: <20230629082522.606219-3-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230629082522.606219-1-mark.cave-ayland@ilande.co.uk> References: <20230629082522.606219-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 86.130.37.216 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH 2/2] accel/tcg: add assert() check in tb_invalidate_phys_page_range__locked() X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.ilande.co.uk) 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=2001:41c9:1:41f::167; envelope-from=mark.cave-ayland@ilande.co.uk; helo=mail.ilande.co.uk 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, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-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: fail (Header signature does not verify) X-ZM-MESSAGEID: 1688027176656100003 Content-Type: text/plain; charset="utf-8" Add an assert() check in tb_invalidate_phys_page_range__locked() to ensure = that both the start and last addresses are within the same target page. Note that due to performance concerns the check is only enabled when QEMU is configur= ed with --enable-debug-tcg. Signed-off-by: Mark Cave-Ayland Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- accel/tcg/tb-maint.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/accel/tcg/tb-maint.c b/accel/tcg/tb-maint.c index 33ea1aadd1..8cd730dcb0 100644 --- a/accel/tcg/tb-maint.c +++ b/accel/tcg/tb-maint.c @@ -1092,6 +1092,10 @@ tb_invalidate_phys_page_range__locked(struct page_co= llection *pages, TranslationBlock *current_tb =3D retaddr ? tcg_tb_lookup(retaddr) : NU= LL; #endif /* TARGET_HAS_PRECISE_SMC */ =20 +#ifdef CONFIG_DEBUG_TCG + assert((last & TARGET_PAGE_MASK) =3D=3D (start & TARGET_PAGE_MASK)); +#endif + /* * We remove all the TBs in the range [start, last]. * XXX: see if in some cases it could be faster to invalidate all the = code --=20 2.30.2