From nobody Mon Sep 16 18:49:49 2024 Delivered-To: importer2@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+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1662454862; cv=none; d=zohomail.com; s=zohoarc; b=bYB1vUGza3JS/T4K0ciCFK0nH6D29nV/w3gZZZG4cdkFOjNbPFbvvWD8WD5tnnKuwpDUS/VLlKoX2sVHrrPS3hlhNpc3PVnAKrZTl8VgXSuDMD/o/uP2K7B6hOHl7fo2UKGP6NC4M3v8PXLuV0x7Zg6I6znjCaAclYd9JN8D56c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1662454862; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=w1ES14kbaqz1aOCbKXN9PfcL6E/pNAFDrn35F0KK2iE=; b=X8lbKqNZ+eW3cuFieokF6Df4xkJ9oWBCHymRoG6Cu7BhxIj9Bk5m80sSIytvjXfC7sm1TmnhECblcFygUC6D/oPrk78aaL2s+CDcj0ie9xurLZl86fwhpwJVoLyjTNvQki1SZyX72INdbPMFUejGYMXzISTbfoqFv1NvRp0fmbY= 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+importer2=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 1662454862433493.3429235926943; Tue, 6 Sep 2022 02:01:02 -0700 (PDT) Received: from localhost ([::1]:59864 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oVUS5-0006UJ-B8 for importer2@patchew.org; Tue, 06 Sep 2022 05:01:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35404) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oVU6P-0002lU-Ii for qemu-devel@nongnu.org; Tue, 06 Sep 2022 04:38:37 -0400 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]:42750) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oVU6M-0005YU-Oo for qemu-devel@nongnu.org; Tue, 06 Sep 2022 04:38:36 -0400 Received: by mail-wm1-x332.google.com with SMTP id d12-20020a05600c34cc00b003a83d20812fso7001876wmq.1 for ; Tue, 06 Sep 2022 01:38:34 -0700 (PDT) Received: from localhost.localdomain ([2a02:8084:a5c0:5a80:ba98:3a71:8524:e0b1]) by smtp.gmail.com with ESMTPSA id g26-20020a7bc4da000000b003a54f49c1c8sm13421859wmk.12.2022.09.06.01.38.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Sep 2022 01:38:32 -0700 (PDT) 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; bh=w1ES14kbaqz1aOCbKXN9PfcL6E/pNAFDrn35F0KK2iE=; b=N5sQY1pWRY8owwFdPYBrC/62I2osS14erujcW1Qo6jfvz8mwMF6AOekVliHsr8Ula+ ZqDuKlGQnO2zLznj35NU+3s3XT203hARb+8fWdnWDmzPgRnzcP3XSD/ayKdWeBu0iVun nwhsphe5IDkmKkImXm+EwyNU9DYlma3NM1MpPmWhAOai9Zm/7cp0Gu2mbOfgi3f3j+Oh rdkUiicheZW0wl44TP8iCJvTjukZNsLQPa7H3zK3RDWgv+l24YuLBc05PQr/t9klN9xC O2a3zzZy3OrsVRVV6ZmPteJgAYLVUpqOtE0JxjHh5JkUeOPL8JDIrJp6qFMhaSBgQR02 m57g== 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; bh=w1ES14kbaqz1aOCbKXN9PfcL6E/pNAFDrn35F0KK2iE=; b=XXi8amKFGZOjrNNY2DSswxWuTYgILR/8T3a+IMgB+IiIFh4vlieC4Uy7N30bj0THII 4cAMO1IAAv5SySwrvRKeYOUF5FHyBeqixBOMm2oy3RFMbSTSKDEztSIfUPAC6m2qksRm GGtZh5KTXHv/0IhvfLiWDMa0qwyD7KFTkRm3D+ckc3rRMHItUy2Ir3ag524xQznYftVG MbkcVIyvbsWTZKpmbYew3KWC7pWOgewnGrNBQ+UZpnYBJy7tzMNMBctSJWaAkNZOFHk9 it2LLZNOUoNEJsfAJUBMnaoLiaPmXzdbimdrp1sTGRXh3bXT0iNYlLaBlyVbwwm+wOW7 JcOw== X-Gm-Message-State: ACgBeo2AiH6/WUh+N3LMQWVfY7mGDC6fnx24zWZtdDwFZBkdOUATGyCo UmBVE624uOF4LSu86W2m7l0de3+CUhOBbJTF X-Google-Smtp-Source: AA6agR5NWnDJSTwUNNTY3sPrEYxq7M+kNZF+rA6S+TkeG7QDOsAWNO8YIn4mee2GPQ7DbHJeY5FOeQ== X-Received: by 2002:a05:600c:1d14:b0:3a5:e8ba:f394 with SMTP id l20-20020a05600c1d1400b003a5e8baf394mr12966136wms.137.1662453512931; Tue, 06 Sep 2022 01:38:32 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: stefanha@gmail.com, Ilya Leoshkevich Subject: [PULL v3 13/20] accel/tcg: Document the faulting lookup in tb_lookup_cmp Date: Tue, 6 Sep 2022 09:38:08 +0100 Message-Id: <20220906083815.252478-14-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220906083815.252478-1-richard.henderson@linaro.org> References: <20220906083815.252478-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+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::332; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x332.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, 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+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1662454863897100001 Content-Type: text/plain; charset="utf-8" It was non-obvious to me why we can raise an exception in the middle of a comparison function, but it works. While nearby, use TARGET_PAGE_ALIGN instead of open-coding. Acked-by: Ilya Leoshkevich Signed-off-by: Richard Henderson --- accel/tcg/cpu-exec.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c index 7887af6f45..5f43b9769a 100644 --- a/accel/tcg/cpu-exec.c +++ b/accel/tcg/cpu-exec.c @@ -198,7 +198,16 @@ static bool tb_lookup_cmp(const void *p, const void *d) tb_page_addr_t phys_page2; target_ulong virt_page2; =20 - virt_page2 =3D (desc->pc & TARGET_PAGE_MASK) + TARGET_PAGE_SIZ= E; + /* + * We know that the first page matched, and an otherwise valid= TB + * encountered an incomplete instruction at the end of that pa= ge, + * therefore we know that generating a new TB from the current= PC + * must also require reading from the next page -- even if the + * second pages do not match, and therefore the resulting insn + * is different for the new TB. Therefore any exception raised + * here by the faulting lookup is not premature. + */ + virt_page2 =3D TARGET_PAGE_ALIGN(desc->pc); phys_page2 =3D get_page_addr_code(desc->env, virt_page2); if (tb->page_addr[1] =3D=3D phys_page2) { return true; --=20 2.34.1