From patchwork Fri Mar 1 23:05:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 777108 Delivered-To: patch@linaro.org Received: by 2002:adf:e94d:0:b0:33d:f458:43ce with SMTP id m13csp1603717wrn; Fri, 1 Mar 2024 15:16:26 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWjD6VJRjE59R9SFLblbJMoX7atSNYzHanUcXCL5TdxARj22PvTOJwymEaQpwd4p3wjojHl7+Qz0i9kpJCd+5vV X-Google-Smtp-Source: AGHT+IEYr9AnQ5XDgqbs9rv3Jri1GcFq4a0EFYTEbm9P7///ZX9rh3YespMc4WDuFaJRXQOJ4a9Z X-Received: by 2002:a05:6358:290b:b0:17b:f093:9156 with SMTP id y11-20020a056358290b00b0017bf0939156mr3434451rwb.26.1709334986252; Fri, 01 Mar 2024 15:16:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1709334986; cv=none; d=google.com; s=arc-20160816; b=ITLgNvKVtSZcUKfuJSvasze1BcO1xJVfBphanEFGb/kBzGtW6d0PYpxNhK+UxTxD+V wFu32vFif4AuBQ5Sr2a9qQB1L/sT4zu+TaGQiG+uw1zFlzWoLsDeeHquoXEoXcp7mlpP TKZOvSwf+6NVAAUckMwHi5x6r7YNNB9z6JThDIXjqm1vy96U45UlLvAjHh67pX/Zwmev 5Uu1jiPQZbzYrfRBxNpCcQPfPAk/uuG17jyLfy12lRYf7b1F5CD3DBu8+L/4fubJ/Q3R wtQ+ExwY1ic+b6CLGZZk+bR17rWmyFzdjry0YoLLDiYyZIWK1RcfT2Q5+nA6Hvon7ULo l0qQ== 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=riDxx/Iexj1qjgzxqR/EG3iYXorkzbFxBXBzbTLKvNo=; fh=b0BCSzBBCb15Qz0w2SaDYFXCQsyBHWooe1k9DSXIzPA=; b=kePy+0qv4S6TMCFiOnOt6mcuOwCrfby8ZIRuZEYcgEI4p/bNyaPoFiC51I4T8MjZ8Q /3pNHkzlKmq3C5j8ShLlO2Aumbku+ZOBJ0MgJtyldBjR3+EAYzb6ldcYnvZHsuQd2dMX z5rbmTha1cvYV4q71xQ0bmPRRyeGSsI6SSUQoNq1/vkNmc3EGRAL26+peWck6T53D+NT AuFXpkHpZBlMLQOODLqSMJnf9PF0M6W/CZZksslxOJ1hdyxGtrqLCRGkgGiDb3445CL7 JKXRDafgI3RR8kk+uvYWmrK+bHyGqrtWxzvh7OoQkS8P6M0jz/W1llnhhqnSLtC+39Hu 07Hw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=BdO5C0ha; 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 7-20020a0562140dc700b0068c3ca90f97si4852797qvt.564.2024.03.01.15.16.26 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 01 Mar 2024 15:16:26 -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=BdO5C0ha; 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 1rgBy0-00052d-TI; Fri, 01 Mar 2024 18:07:00 -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 1rgBxm-0004uF-Mx for qemu-devel@nongnu.org; Fri, 01 Mar 2024 18:06:47 -0500 Received: from mail-pl1-x629.google.com ([2607:f8b0:4864:20::629]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rgBxl-0004FT-5m for qemu-devel@nongnu.org; Fri, 01 Mar 2024 18:06:46 -0500 Received: by mail-pl1-x629.google.com with SMTP id d9443c01a7336-1dca160163dso26426515ad.3 for ; Fri, 01 Mar 2024 15:06:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709334403; x=1709939203; 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=riDxx/Iexj1qjgzxqR/EG3iYXorkzbFxBXBzbTLKvNo=; b=BdO5C0haalHKNv/F7gqAVDaA6VZeSDZh76aRZwYlqJadY1cZ6IVUsxXKZPhe+Nd+sy xdUDcDEdGv1JVqGuLjBlnxxzJtXQfa7NColVor0vVIFMxVXaADMl+2FMZWOu8C86yaJ0 zRXPzk6JOIbIlFtghb13U4lOp6/p47Uaw+VBCSEKrhVQGC3py5kroWDumkrs2SdRcV5E CUCXZda7v8zrQzZ6bGkOHwXmnNNAE5CXNSpMX4iXWm65Xot6o8BCx6s1yrXBXyUhozv1 bnsp59ELatjX3gHrsVqx2ThdYjPofgtqi/Tn0Vye4TJbmPqDBydM+Z2mv0HORuaa1Arq QtEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709334403; x=1709939203; 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=riDxx/Iexj1qjgzxqR/EG3iYXorkzbFxBXBzbTLKvNo=; b=ciVnJpwkwwvXQI1+Y5SF2FaNcDTDBPi0mcHrT9FBDjPITfBlN56Ztw8cssDr9Ftfff y5KNhFS6oUBYiqXsX6YHioCC7i3RUCkr+0l1tq7VICd6K2zD2cYFCt/TJ3NOltEXEqNE bp1ClOEtckWHoipRAW/YhyiHrHFQ26h16eDNTinfg69f90dBumCgEduYWaElKd3KNUG2 MtIg8XDjBJiLdZap/y57D/1lAiND0Gv34znFCQS1qIpgMyiaZi8SloSxFZRnBOwUnFZb ue6rvbZx6cbnxXAD0BuycUcOOGPX3CmyBdCMKzr0LANj5eMqxEaFjWClBRWDTSIbyyUY jKYw== X-Gm-Message-State: AOJu0YwDZ3W07SCTfYBf9v61SmD2aEByHQp6PSQ59Vvq4HQ6+sGICFem lftb9BPrwFPL33lOaFdQLHb8hZH/DD13bCoyeaMn2v46F99eQaAj2mfEEtgc66hCjj6ORmHEtYA E X-Received: by 2002:a17:903:2985:b0:1db:d586:b2d with SMTP id lm5-20020a170903298500b001dbd5860b2dmr3783082plb.18.1709334403273; Fri, 01 Mar 2024 15:06:43 -0800 (PST) Received: from stoup.. (098-147-055-211.res.spectrum.com. [98.147.55.211]) by smtp.gmail.com with ESMTPSA id lc11-20020a170902fa8b00b001dc668e145asm3988580plb.200.2024.03.01.15.06.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Mar 2024 15:06:42 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Peter Maydell , Jonathan Cameron Subject: [PATCH 16/60] accel/tcg: Set can_do_io at at start of lookup_tb_ptr helper Date: Fri, 1 Mar 2024 13:05:35 -1000 Message-Id: <20240301230619.661008-17-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240301230619.661008-1-richard.henderson@linaro.org> References: <20240301230619.661008-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::629; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x629.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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Peter Maydell If a page table is in IO memory and lookup_tb_ptr probes the TLB it can result in a page table walk for the instruction fetch. If this hits IO memory and io_prepare falsely assumes it needs to do a TLB recompile. Avoid that by setting can_do_io at the start of lookup_tb_ptr. Link: https://lore.kernel.org/qemu-devel/CAFEAcA_a_AyQ=Epz3_+CheAT8Crsk9mOu894wbNW_FywamkZiw@mail.gmail.com/#t Reviewed-by: Richard Henderson Signed-off-by: Peter Maydell Signed-off-by: Jonathan Cameron Message-Id: <20240219173153.12114-2-Jonathan.Cameron@huawei.com> Signed-off-by: Richard Henderson --- accel/tcg/cpu-exec.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c index 977576ca14..52239a441f 100644 --- a/accel/tcg/cpu-exec.c +++ b/accel/tcg/cpu-exec.c @@ -396,6 +396,14 @@ const void *HELPER(lookup_tb_ptr)(CPUArchState *env) uint64_t cs_base; uint32_t flags, cflags; + /* + * By definition we've just finished a TB, so I/O is OK. + * Avoid the possibility of calling cpu_io_recompile() if + * a page table walk triggered by tb_lookup() calling + * probe_access_internal() happens to touch an MMIO device. + * The next TB, if we chain to it, will clear the flag again. + */ + cpu->neg.can_do_io = true; cpu_get_tb_cpu_state(env, &pc, &cs_base, &flags); cflags = curr_cflags(cpu);