From patchwork Fri Jan 17 13:42:41 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 858179 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:cc8:b0:385:e875:8a9e with SMTP id dq8csp704881wrb; Fri, 17 Jan 2025 05:44:39 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXQhbQ6DwgFe5IYfng+yZUnSOIrGklozN+gC/TFpuI924RR0OW4IuCtb471IULeWqJ/zrdSFA==@linaro.org X-Google-Smtp-Source: AGHT+IGl51O2L9foTmlDALXdn5qENdDxV3LLtElOqebfRphfxMZicHcUWyg8JJ+01ejrYZphVXZo X-Received: by 2002:ac8:5f95:0:b0:46c:82dd:9a69 with SMTP id d75a77b69052e-46df578de9amr180123181cf.19.1737121479124; Fri, 17 Jan 2025 05:44:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1737121479; cv=none; d=google.com; s=arc-20240605; b=QLyINBLwG/nkj8l100M4kFmMVNSTmADo+9avpm7WdflfS1mQtasyGJAvniw8drRhvQ NKh3QDfimbapkw8B6oZTCsKL2J7bpHhCx3NYQPuV+HAx6mb9sg0DvTH7tpPQTCUJ41YJ XNQnQk/35UGZ+FC5gtlJ3AMtZPYniLtZmdQIzl2rxsKouSB/KFuGBtfimlatdWU6HIWo xiINlNlS5TRcWODJx3kG0A2siANs7CSGB7kJ/Yca6AneJw7IGB4wmM8ZCh1ZeJAlDSzU tEnTqOqjkG/qt9jJAQrOYwocFH1GBoxnjoHktwW0hEaT9itUiN84dZP4cv5y6UyiWtT1 KTzw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=z0X1Y4uYNu2Kk1P4je8Zch9rD7a4QSWs3eQqhNJ9Els=; fh=epVqkck4K3VtXGxLmKtXp5iIhVlI3Qxrt9/7kn/nd7g=; b=e4QyR5fbnTyUyFCxpbxXstvKjwe4ic+/TRmaZqiYZ3x3MzMvPsCrmoCQdpXOZhuIfU COEXkhq1Lwjat3ComT0Vn3ZZP/DGrcQrZOiYXZ4whOweJJ4m0jtIwvAq9M9hppNfXSXu FEVFh1Dzpg+YV1pX5UrEcQSWUlYrtJxB+pFB5oVWZgPEA4XRwZ2mGq4zw8hzS4c1YWJi HWkskdqKvl1NLbxERpW3UL2oS1B1phS5WmOByxXe9d6GIIw1hd20hmqwAD+UYzJgu9J7 HLY5dVgu4sHHaUDfKiZd47MY0p9ssEEiIO9F/qDFIX9sEu8UY3Cz5Ni99/GV75dqPvbA 7hKQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WSXGy6rK; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-46e104bca5bsi23608511cf.662.2025.01.17.05.44.38 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 17 Jan 2025 05:44:39 -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=WSXGy6rK; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tYmdq-0001lV-FM; Fri, 17 Jan 2025 08:44:07 -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 1tYmcz-00011Q-Fv for qemu-devel@nongnu.org; Fri, 17 Jan 2025 08:43:14 -0500 Received: from mail-ej1-x634.google.com ([2a00:1450:4864:20::634]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tYmcw-0002Fk-MS for qemu-devel@nongnu.org; Fri, 17 Jan 2025 08:43:13 -0500 Received: by mail-ej1-x634.google.com with SMTP id a640c23a62f3a-aab6fa3e20eso399602966b.2 for ; Fri, 17 Jan 2025 05:43:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737121389; x=1737726189; 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=z0X1Y4uYNu2Kk1P4je8Zch9rD7a4QSWs3eQqhNJ9Els=; b=WSXGy6rKTuQg8jBOZr8u4xFDqX/sr8RI77MdPZAS1jJ+FH0i6SVeWRXAj04fn6CO9o QHCI7JXskUKqmjwQVNfbKIHCAr5KPOZfbtAClIRXaUOJKs7cAOe15lPGgeQ/yfJF0aGy sghKEXHk/i20y2T8kaqiOh7VGC2NRDxAsiui+sZNflLfRZykVny4QRPkydSAgE1FGjXI rpVKjN31MZe58hg7sUt6WnESMcG+CUVEfYnIDP38UuDauvFONZkuufN9FZIGZJM0ES4h LJQzrJ71beoHDze1aBB4jySEHO2DYnbF4FG/5+UsfwIwZjNhkwNNp87yWu/JzTCInFhD oBbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737121389; x=1737726189; 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=z0X1Y4uYNu2Kk1P4je8Zch9rD7a4QSWs3eQqhNJ9Els=; b=IfflOKRSqEncFolydzx54hPG176sik/SX2mCLNV2WEyzpisA7sSwIOynnUYnVnQxzM b1yLJucMLICZr06Tmxrfd45P3PJd39m2j4tK7tD+/ar3ScY5Ft5J1mQgxo8W2NcrB0Aa yAGu7euSLJ2AndPVwep41UiXgA9pDpbghbBkAVSVoHkeW3tCxjHQUZyG3msxlK05Dv2N SsK4lpdZdW3u0WKZ/j1lgUJwy3fJmRTda6oc7aUNzwcz6DeRO5WqGiLIOWQApcgyphgm DYFFmTG6k3A5vPhT/9akt+UFi32bNMSrXIkIEWp00fICo0ECp4RaLWfp9kRobMZrjiwC LTAA== X-Gm-Message-State: AOJu0YyC+udU8hliViC0EM6oNv0JLxqIeEJlDUvChr+uq4YKEnCqSQjx x1HT0mV+Esrv9a8S5OsYSRhel70tvoYK94Y/aWm8wAFX+ojllZPxb/TV/GACfoI= X-Gm-Gg: ASbGncsBFKlJk9Z6JqSCvTTyyCPzvsDkHmHrrcjGAI8YMMDJ7YZwDV9bdJMR+ZQRaAF xuRd8kQcpeCZ+2o0C7Oc733BrqrC4DtaOUmCeAw8m0H/+CzSzanRg7Z6Sd7n7gzsnsA536fsMp0 i/11wQeZ5soCdcoFXGcC5hQaOS5BGsJQKfas+fLGIgYe0IRbnMRgcDK9ZBVcXPdeg0h5J/JsYJa Ku5Q5vcQy7SFolF9l/aXeMeOEsxAPo7IF7+ONnK2B7kN+3tECYgoJk= X-Received: by 2002:a17:907:86a3:b0:ab2:db7b:5db3 with SMTP id a640c23a62f3a-ab38b4c8520mr323435866b.54.1737121389093; Fri, 17 Jan 2025 05:43:09 -0800 (PST) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ab384c75283sm173209666b.8.2025.01.17.05.43.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Jan 2025 05:43:07 -0800 (PST) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id F114660858; Fri, 17 Jan 2025 13:42:58 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Alex_Benn=C3=A9e?= , Pierrick Bouvier , Julian Ganz , Richard Henderson , Paolo Bonzini Subject: [PULL 22/37] accel/tcg: also suppress asynchronous IRQs for cpu_io_recompile Date: Fri, 17 Jan 2025 13:42:41 +0000 Message-Id: <20250117134256.2079356-23-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250117134256.2079356-1-alex.bennee@linaro.org> References: <20250117134256.2079356-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::634; envelope-from=alex.bennee@linaro.org; helo=mail-ej1-x634.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 While it would be technically correct to allow an IRQ to happen (as the offending instruction never really completed) it messes up instrumentation. We already take care to only use memory instrumentation on the block, we should also suppress IRQs. Reviewed-by: Pierrick Bouvier Reviewed-by: Julian Ganz Reviewed-by: Richard Henderson Signed-off-by: Alex Bennée Message-Id: <20250116160306.1709518-23-alex.bennee@linaro.org> diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c index 453eb20ec9..d56ca13cdd 100644 --- a/accel/tcg/translate-all.c +++ b/accel/tcg/translate-all.c @@ -633,9 +633,10 @@ void cpu_io_recompile(CPUState *cpu, uintptr_t retaddr) * Exit the loop and potentially generate a new TB executing the * just the I/O insns. We also limit instrumentation to memory * operations only (which execute after completion) so we don't - * double instrument the instruction. + * double instrument the instruction. Also don't let an IRQ sneak + * in before we execute it. */ - cpu->cflags_next_tb = curr_cflags(cpu) | CF_MEMI_ONLY | n; + cpu->cflags_next_tb = curr_cflags(cpu) | CF_MEMI_ONLY | CF_NOIRQ | n; if (qemu_loglevel_mask(CPU_LOG_EXEC)) { vaddr pc = cpu->cc->get_pc(cpu);