From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=91.218.175.80 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795880576; b=X4R4ZdTpHvOddcjJoDjL4bKZXQIpf2415zZYjw+4O8FtYCYEaSB2EPJlWfqSeQxJgfJu 0qbLChRu11Ue4BMY1bi5yQo2g71nuDjlLiaT3LyrAC8q512JJESlTpQgwYfUNLgxEWdeb HAiNOqNufju1gndPZ9wYsuso8Rd0VFyNNcX+c8mj/caY1QhSEr1gyKhSpkk39WLgaXjFV EbLAvU7cqWoD4uheLVlmxqhglWBa3vm/Er8/Dh6ZwKBIEn/ivTo+i1MUheZ+K/X1sIt06 EwccbW4zCx4FDZrx4QAaBXVehJ/W7mT5iPwGgGw1fzICsN6fDihnqHznbpuz2wK9w3w== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795880576; h=DMARC-Filter:X-Envelope-To:DKIM-Signature:X-Envelope-To:Received: X-Mizu-Trace-ID:X-Migadu-Flow:From:To:Cc:Subject:Date:Message-ID: X-Mailer:In-Reply-To:References:MIME-Version: Content-Transfer-Encoding; bh=P8IO3vCtqvqx1aEvOuucdUp2bScFUsgMzMfZHQJjoVA=; b=cJHh2p3Szcwy9v2IEIRB6B5en4C2sJzUbgiNRYjOesoxnSTvty8kgIvi0av0xc9htT/V LE4hZj8C2v4mNHAiZ6OGAxJS+6sMRwZRHXUnhaHYo7BDJwH5236p5SLYfjXIyDnLbWv9n 5FqASnIMDG+q3oAVV5zrMeDV6g95WcbYLrbfxE0yQeibDmg+euI9dNvEz+WZ3RkWpymra bRa1QpK7eHVTIHPeybUrX7XyTRVCkE+b3fTW5X2fz3am3QrlsJYjuRzXAsY02Ks2vi3er MWM1YScoz20DDV6qFGXUQIcXLdh+PQLky+A7V6Fbtr9bEVV9L1Xh3ERBRDzMMPQaDUg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=EVzUFfcX; arc=none smtp.remote-ip=91.218.175.80 Received: from mta0.migadu.com (out-80.mta0.migadu.com [91.218.175.80]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2BD67606A31C for ; Sat, 28 Nov 2026 15:42:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 2BD67606A31C Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=EVzUFfcX X-Envelope-To: kvmarm@lists.linux.dev 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: kvmarm@lists.linux.dev 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-Mailing-List: kvmarm@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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