From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 87570606A31C for ; Sat, 28 Nov 2026 15:43:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=b3eF1et6; dkim=pass (1024-bit key, unprotected) header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=EVzUFfcX DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Unsubscribe-Post: List-Owner; bh=P8IO3vCtqvqx1aEvOuucdUp2bScFUsgMzMfZHQJjoVA=; b=b3eF1et6d2XqO8 6NedLjA+LdsfNNsXeG2SdQMpIN69ngp4/fY/Ks8Aog66EaWrwZ7wXrmG6ddAwv6XBPCayUXBCGXgD kz60nudEvuzRFh8Od+jsTw6VacLNqG/4rrcWfMd839z1/XG5rewJm9MTeB7gJ0xu13mxVxDJzy9S8 cnTZs7JFNfBIqFT6xeDPbwIPkUJRN8faklfeEs4iUIA0zlkRFfiETSCbYqYiuqHwjQfJrrZEZv3ma at6gXJtyCZskffSPD9qQn4fG83uQyAvkdkZfLukjC9zG9+w8FgdIS8TMeklh0uX8AjR5s4WPiusgz 2F61L4D/RmaYjHouLUUA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xXKZn-00000000vbk-49wi; Sat, 28 Nov 2026 15:43:00 +0000 Received: from out-41.mta1.migadu.com ([2001:41d0:203:375::29] helo=mta1.migadu.com) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xXKZl-00000000vbM-2NlC for linux-arm-kernel@lists.infradead.org; Sat, 28 Nov 2026 15:42:59 +0000 X-Envelope-To: linux-arm-kernel@lists.infradead.org DKIM-Signature: a=rsa-sha256; bh=Gc2MBCVr0cvJC0ixGH9EG0pqsnnL2S2e3AAX4gt4HeE=; c=simple/simple; d=linux.dev; h=from:to:subject:date:message-id:mime-version:content-type; s=key1; t=1795880573; v=1; x=1796485373; b=EVzUFfcXIStrgw2PuPBOpB2Wz7vBv9fMq/B32eKaFseuxBWJu+nnVCpXPaMJ3R5++5MEc9xF 2orHXpICWhnT4QbSwNwtslnn282SUR6O87pz+aF9ZRAnm5bNCBfM8SeSfPeH6wHZsSYO70+YeqL 5mfO7CsuqQx0R0bThFuyBpG0= X-Envelope-To: linux-arm-kernel@lists.infradead.org Received: by smtp.migadu.com with ESMTPS id 6482d69470591e88; Sat, 28 Nov 2026 15:42:53 +0000 X-Mizu-Trace-ID: 6482d69470591e88 X-Migadu-Flow: FLOW_OUT From: Fuad Tabba To: Dan Carpenter Cc: Marc Zyngier , Oliver Upton , Joey Gouly , Steffen Eiden , Suzuki K Poulose , Zenghui Yu , Catalin Marinas , Will Deacon , Mark Rutland , Karthik Bhargavan , =?UTF-8?q?Cl=C3=A9ment=20Blaudeau?= , linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, Fuad Tabba Subject: Re: [PATCH] KVM: arm64: Drop a pending MMIO access when injecting an unmasked SError Date: Sat, 28 Nov 2026 15:42:50 +0000 Message-ID: <20261128154250.3059937-1-fuad.tabba@linux.dev> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20261127-serror-drop-mmio-v2-v1-1-96bd01bef6d8@pereq.eu> References: <20261127-serror-drop-mmio-v2-v1-1-96bd01bef6d8@pereq.eu> X-Archived-By: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20261128_074257_752058_BE4AF0B0 X-CRM114-Status: GOOD ( 13.32 ) X-Spam-Score: -2.1 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" X-Spam-Status: No, score=-13.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 Hi Dan, On Fri, 27 Nov 2026 17:52:37 +0000, Dan Carpenter wrote: [...] > diff --git a/arch/arm64/kvm/inject_fault.c b/arch/arm64/kvm/inject_fault.c [...] > @@ -396,6 +396,13 @@ int kvm_inject_serror_esr(struct kvm_vcpu *vcpu, u64 esr) > return 1; > } > > + /* > + * Like the emulated entry above, an unmasked SError cancels the MMIO > + * access the vcpu exited on. > + */ > + if (!(*vcpu_cpsr(vcpu) & PSR_A_BIT)) > + vcpu->mmio_needed = false; This is the check I suggested on v1, but after taking a closer look I found an issue with the drop itself, which I missed then. With the access dropped, the vcpu runs the same instruction again with the vSError pending, and the instruction faults at stage 2 again. For the first instruction after an exception return, R_RBZYL in the ARM ARM states: If the first instruction after the Context synchronization event generates a synchronous exception, the architecture does not define whether the PE takes the asynchronous exception or the synchronous exception first. If the PE takes the abort first, the vcpu exits on the same access again and the next KVM_RUN completes it. The emulated entry isn't affected, since KVM emulates it before the vcpu runs. So I don't think the drop can be relied on, and I'd leave the code as it is. Could you instead make your selftest not depend on whether the access completes for a vcpu without EL2? Regarding Sashiko's finding, that isn't an issue, since NMEA doesn't affect a virtual SError. The description of SCTLR2_EL1.NMEA reads "This field has no effect on the masking of virtual and delegated SError interrupts." Cheers, /fuad