From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796223289; b=a82vvWMBLhxY1F9qd2Uv4BFnZuQf3zZTsDAIhcxLWi9MrjA83mVRBZ0pk6+mqjTXNHJQ CTXdlFzJtq7KJrBs1PuwvJ5NBm9Q+zcJNmQABIv1ty/x9SDs6dDeDVSDzBypqBQR5qOlu sDl0hfos4mpOiiOmmXL3w6JHPmCTEwTLxYrYx/Ckqtx+gufIHsGsCEzr+Jx4VPBUyiJM7 OyBFVG1EmENfj/9k9HX4kE7y1GjZ2r/gIVHfRV8cWeQBVkkc+FKcbvOinZIn6F54T8KID FL8YYHzOphp2dG2UZz1LZJQY7ymQqn81+OKNg1s5WkVFPvJp2dnXqfR7NcNbkugAcfw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796223289; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=dYlo2TLg39758rOtea4dhPrLLrnqmEad64GY3iSh0yM=; b=K2xnnvfRoQBN7OUqxv3lrhmaOvNiiqw4tgFp11hyDTIqtdj0BrFh4PazZikQYRN1BWFB GHCkiJ+qDf34TWzGstAx6gMSvLgIoTTVlHkgj+r2TFC+5HPAIedZrFYf2Jr3ICm7SDRZM tPdSbzijRsaJzrBeCxUFj6mMJvH5S+ZLnT/QdM0x2TRdzR+tz/pggj0dRDkZWkLsZ+D6p kTYH2ls7bI5Ck98CND6u6KBp1i9Hohwd206HSPeyIJvRLjJcSxMPxfBhuGiAHH8T+8BXe 4fS9LLe3pRnE4J5+8OC3UANHCHihwt9boQvLT5khlxluBTuAuDM4Cp2pobZdExsJsrQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Ui+F5eKT; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 06B05606A697; Wed, 2 Dec 2026 14:54:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Ui+F5eKT Received: by smtp.kernel.org (Postfix) with ESMTPSA id EAC2C1F00A21; Wed, 2 Dec 2026 14:54:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796223288; bh=dYlo2TLg39758rOtea4dhPrLLrnqmEad64GY3iSh0yM=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=Ui+F5eKTBc6ESnT2NpEtc5XhZytpM3kFSEw30/IGFLlW5mOle2zZXv/8V4KZeANqg VjvdcOTrFTx+3zGTFVgsrE0bJbs3DBsvCorfH2LHo08uTMXd/wIySvyvQpq0e51bBu i6DRx29Fs5W/Zyan9+5aDObYty5e08dqNhQQ8eJXbW8k1MgGOPHiIzd3e5ES4VO8Qd AUVgshFdRYnppbNPDdHGMAFj71ClBRPRQssI2IivXnJuw/FmiqIW2mIP/jxNiqEd8V BZUMCiguFeIHmEjDs+2LqzvvQjo9HPOlHj6QWqdba/iBB1Q0+liKi2BuLe5NTAlmqn s8vPkosEzWHFA== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH 12/12] KVM: s390: arm64: Add IRQ line Reply-To: sashiko-reviews@lists.linux.dev To: "Steffen Eiden" Cc: kvmarm@lists.linux.dev, kvm@vger.kernel.org, linux-s390@vger.kernel.org, "Oliver Upton" , "Marc Zyngier" , "Heiko Carstens" , "Vasily Gorbik" , "Alexander Gordeev" , "Christian Borntraeger" In-Reply-To: <20261202-smccc-v1-12-48340e2737b6@linux.ibm.com> References: <20261202-smccc-v1-0-48340e2737b6@linux.ibm.com> <20261202-smccc-v1-12-48340e2737b6@linux.ibm.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Wed, 02 Dec 2026 14:54:47 +0000 X-Mailing-List: kvm@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Medium] KVM: s390: arm64: non-atomic hcr_el2 RMW races with vcpu_interrupt_line() -- commit d464d208b63e74e278a80c66b1b80eba93db96f6 Author: Andreas Grapentin KVM: s390: arm64: Add IRQ line This commit implements KVM_IRQ_LINE support for arm64 guests on s390 with a userspace interrupt controller, exposing KVM_CAP_ARM_USER_IRQ, updating kvm_arch_vcpu_runnable(), and preserving HCR_EL2 interrupt lines across vCPU resets. > diff --git a/arch/s390/kvm/arm64/reset.c b/arch/s390/kvm/arm64/reset.c > index feec5009d2cbc..891fe4b4fc168 100644 > --- a/arch/s390/kvm/arm64/reset.c > +++ b/arch/s390/kvm/arm64/reset.c [ ... ] > @@ -105,12 +105,14 @@ void kvm_reset_vcpu(struct kvm_vcpu *vcpu) > kvm_timer_vcpu_reset(vcpu); > =20 > /* Reset special registers */ > - vcpu_reset_hcr(vcpu); > vcpu_reset_hcrx(vcpu); > vcpu_reset_cptr(vcpu); > vcpu_reset_cnthctl(vcpu); > vcpu_reset_icc(vcpu); > =20 > + /* Discard a pending SError */ > + vcpu->arch.hcr_el2 &=3D ~HCR_EL2_VSE; [Severity: Medium] Can this non-atomic read-modify-write on vcpu->arch.hcr_el2 race with vcpu_interrupt_line() and drop a concurrent HCR_EL2_VI or HCR_EL2_VF update? KVM_IRQ_LINE is a VM ioctl that runs without vcpu->mutex and updates HCR_EL2_VI and HCR_EL2_VF in vcpu->arch.hcr_el2 via test_and_set_bit() and test_and_clear_bit(). Both kvm_reset_vcpu() here and kvm_arch_vcpu_load() -> vcpu_set_pauth_traps() modify vcpu->arch.hcr_el2 with plain bitwise operations: arch/s390/kvm/arm64/arm.c:vcpu_set_pauth_traps() { if (vcpu_has_ptrauth(vcpu)) vcpu->arch.hcr_el2 |=3D (HCR_EL2_API | HCR_EL2_APK); } CPU0 CPU1 kvm_arch_vcpu_load() vcpu_set_pauth_traps() tmp =3D vcpu->arch.hcr_el2 kvm_vm_ioctl_irq_line() vcpu_interrupt_line() test_and_set_bit(..., hcr) vcpu->arch.hcr_el2 =3D tmp | HCR_EL2_API | ... <-- overwrites HCR_EL2_VI/VF When CPU0 writes back the stale value during vcpu_load() or a PSCI CPU_ON reset, the guest can miss an asserted interrupt (for example when waking from WFI) or keep a deasserted line asserted. Using atomic bit operations on vcpu_hcr(vcpu) (or setting static trap bits such as HCR_EL2_API | HCR_EL2_APK in vcpu_reset_hcr()) would avoid clobbering concurrent VI/VF updates. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261202-smccc-v1-0= -48340e2737b6@linux.ibm.com?part=3D12