From nobody Tue Nov 26 11:22:07 2024 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=1708634625; cv=none; d=zohomail.com; s=zohoarc; b=ehwoiG/AimACJSXsZc3f/4rQ8o5LGthJVY1Fd97LSSmTUPtE2pt+ycAIvZrCu5AAPlCkHCK0aYexNVRWBWG2pA5pOVKptu2RS4dWksXKLX7b4KcoASQimFdD0IhEgK3MphwFo+TxtGbuYM2RUZA2nGbKBSwAG2S5cCfxoZoiS54= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1708634625; 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=riDxx/Iexj1qjgzxqR/EG3iYXorkzbFxBXBzbTLKvNo=; b=YUtQYFtEeNGHLKPFa0McJlDI4PL0CSg8l5/xjKcOLJ4l57xp1IgADToRVTWrcs8o+4hmKiBN9+cQPbAFUPbenhcp7+v0s+AO+BLHoAMZsogZ+RbFCoQRqKY3Xfs3P/3mbt/tzxLY2h2kZUe5ZoZspda5vpQ+Be5LVfj8j+92Gzw= 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 1708634625130328.52797579706703; Thu, 22 Feb 2024 12:43:45 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rdFun-0006xS-L0; Thu, 22 Feb 2024 15:43:33 -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 1rdFum-0006vW-1R for qemu-devel@nongnu.org; Thu, 22 Feb 2024 15:43:32 -0500 Received: from mail-pl1-x62a.google.com ([2607:f8b0:4864:20::62a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rdFuk-0002Zm-89 for qemu-devel@nongnu.org; Thu, 22 Feb 2024 15:43:31 -0500 Received: by mail-pl1-x62a.google.com with SMTP id d9443c01a7336-1dbb47852cdso580245ad.1 for ; Thu, 22 Feb 2024 12:43:29 -0800 (PST) Received: from stoup.. (173-197-098-125.biz.spectrum.com. [173.197.98.125]) by smtp.gmail.com with ESMTPSA id l12-20020a170902d34c00b001d8f81ecebesm10275500plk.192.2024.02.22.12.43.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 12:43:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1708634609; x=1709239409; 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=yNhIpPPe2TUFEU4hQVPE79G4RZfzCeGPK6Im71PSFrGvJ2NiQ0cKmxAvosIPrsWCKt eGTenUqYkfNHfS1Mh+6AUauwtaSbI/iwxHDW2EhOdCsGFifyKBhigGZKtReN1jEBB/3d KSUj/uVe5zi1zMJVTZl/4CvC/lVvD+wjQMgzGOTG1G3+G/zJm6zsJG/WFkwuaukX0Nhe iX2uC2XIfXilRMe8Y32EVM8h26qNs2P2hTUCCK5rpqVrTOi9h/XBShuU11XvQSJpeY1K xxehCEX6xYnqF/T7KbGu8OcjrT4em4r/qUShxPDZWFn0AfJja4MdXeN8n/EXJ2tWDb0l zL2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708634609; x=1709239409; 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=YBx3eaa+uP7bQ+jtPaNcA1aFxwPN02MhMJGyAy9MBQNrfSkdQho7KyCL9kBvFxWzqe 8StFFDVcZw7/VXW4nTVA59SIw7QPPjItHGDXRGUrYAT0gEDD2/nuAGZs1Aecak6toi/5 Nttx9/TpX0T0tPH9Ef+ht1Ba3kCOWcheh2lx5oyJy0dWZb3kkFOnU8yvPFZgk8Dde3FO tZ+TTAen4jFpkX34nMdTY5ZveWXBtr0B1HeAodO+clYXIcoogQdQWrcC5PP5UZwqEhJo 13EpvQqKn6/r+ftaCfjjQ6/67IoSkXcDBAI2ZEp+XR8cklJTwpaZ2gK4L67ojCG3vPiP SzWQ== X-Gm-Message-State: AOJu0YxnztMCOOh/IahrTE/5mLfmWdJESeXnphdpN9Rpv8cr60rqlWTo BTcbmO6uA4XMtQyqBzayPmvBuq1qezM+Qxhgc5jOVamMeOUnBsS9IJgH5xeww8didwpHS4gx4PL + X-Google-Smtp-Source: AGHT+IFTayTEfEFMciAD+6EPaRRK5cfQpJ10W5TGmNtU6UiQyNrqCn5Czg/EGKkqUMDMUg5eI2DMpg== X-Received: by 2002:a17:902:ec8b:b0:1dc:11f:d954 with SMTP id x11-20020a170902ec8b00b001dc011fd954mr13067965plg.54.1708634608825; Thu, 22 Feb 2024 12:43:28 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Peter Maydell , Jonathan Cameron Subject: [PULL 02/39] accel/tcg: Set can_do_io at at start of lookup_tb_ptr helper Date: Thu, 22 Feb 2024 10:42:46 -1000 Message-Id: <20240222204323.268539-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240222204323.268539-1-richard.henderson@linaro.org> References: <20240222204323.268539-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::62a; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62a.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1708634625402100001 Content-Type: text/plain; charset="utf-8" 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=3DEpz3_+CheAT8Crsk9m= Ou894wbNW_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; =20 + /* + * 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 =3D true; cpu_get_tb_cpu_state(env, &pc, &cs_base, &flags); =20 cflags =3D curr_cflags(cpu); --=20 2.34.1