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=1796058184; b=cK3zju9J4B+l0+2sOFu8bEToYYC/KBMEGnup54u/nYBBvyJucwd4WE/EomLQBo8O71er zXxnBoiq9muKMk7wp5zPjGqL0l/RwLovMmwhU9x+duVff7QxAT+OcVLmTgF4+GNdgMySX qPfRFOnn50JovcbkjsfhmnT1fmBDCkhMoF/Thh9Fkne+Dk1ck8xS39G7qTBymbme/5Zp4 NA1lzNiRffM86RjSh0n/Ecs/ZXFKf40z2kJr/CjJsEC4GKwIZ8qLu5Izmunwof/FAQOqH 4xKff+oH5h7Pj/um3XSniOL/zAi3d7eo323VY2wxfZQu6Zwh94uCuEhMhQYvzhvaFAg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796058184; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=d+B04sqCTqEuZuCk6k5Ug2sh+iy35ooHx8nMFRIXxGI=; b=hIBs3np7tHSsdFfsHWToaGsCpf+8OcbJk3RNOAYz9DT0EB/UQnBufNiIUHkKoYQyTrCA OdA8XZ02IQDsJe0OTblLeV8kazE2iY810RRDZaP7+Qfj1gORuIBNa6ICyBrNej8MqPeie 4bMh9gVOg7RwUsIqKci4viPhBhiJI0WuDgQCqulozZzkJ8+zHaRlD5PCavMf/0rCmMUeo ltKx9zKfr4Fxvrc9KPWAwHdAzEvwHQqQI0pEUpHvFp03+44xW7kQ6BO7oeZx+ovzkk7zx WlBfIjjtcqDWD2x6ugfQ9XrijaSJdOAfEr2Irmc4FCKLRt4AikphMxRARLOxsGascqA== 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=aMjGFYVQ; 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 28215606A32A for ; Mon, 30 Nov 2026 17:03:04 +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=aMjGFYVQ Received: by smtp.kernel.org (Postfix) with ESMTPSA id C87FF1F00898; Mon, 30 Nov 2026 17:03:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796058184; bh=d+B04sqCTqEuZuCk6k5Ug2sh+iy35ooHx8nMFRIXxGI=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=aMjGFYVQTSud4PwSDKG5TWE0dqS9B2n3sAzlDjGhB9WeAwEn12M5gS43pqAgly9ts KIjyVUuteQ+lB6xP4endrdUUdwDjMbHQcKLne+8T0fTrKiJvddrLKK0NASp1kYqAe8 yxTCsHEKnAskKIbmJKRa4uaMLH4Z8YYBbzxxF3gOz8TMk8JCQONqTaHnv7IT5l1O8X Qs9NbxWSlZmLUARhVrOiNcxpVhXM0IgJw/RkuB+jvaTh0UdJVLWH9mSyWmix4t0rws 1qCcarYh21IhOPRTISY4/tNFWA2xHE2b1PXB1m7TyK5Ibz7mvnRdBKlUfQVyD8kdii wbS+Rgwj+VVaw== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v22 04/16] KVM: arm64: Ensure GCS memory effects are visible Reply-To: sashiko-reviews@lists.linux.dev To: "Mark Brown" Cc: kvmarm@lists.linux.dev, "Oliver Upton" , "Marc Zyngier" In-Reply-To: <20261130-arm64-gcs-v22-4-80454edf47ea@kernel.org> References: <20261130-arm64-gcs-v22-0-80454edf47ea@kernel.org> <20261130-arm64-gcs-v22-4-80454edf47ea@kernel.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Mon, 30 Nov 2026 17:03:03 +0000 X-Mailing-List: kvmarm@lists.linux.dev 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: arm64: missing gcsb_dsync() on vCPU load paths across migration -- commit fd91d0eaded40090a370f05ec0ab5e596e118250 Author: Mark Brown KVM: arm64: Ensure GCS memory effects are visible This commit adds gcsb_dsync() barriers when putting a vCPU in VHE, nVHE, and pKVM modes so that GCS memory effects from an outgoing vCPU are visible elsewhere. > diff --git a/arch/arm64/kvm/arm.c b/arch/arm64/kvm/arm.c > index a148e80d0aef7..2064cff8e92af 100644 > --- a/arch/arm64/kvm/arm.c > +++ b/arch/arm64/kvm/arm.c > @@ -826,6 +826,16 @@ static void vhe_vcpu_put(struct kvm_vcpu *vcpu) > if (vcpu_has_nv(vcpu)) > kvm_vcpu_put_hw_mmu(vcpu); > =20 > + /* > + * Ensure any GCS memory effects from the outgoing vCPU are > + * visible elsewhere, nested guests transitioning ELs do not > + * need this. > + */ > + if (kvm_has_gcs(vcpu->kvm) && > + !vcpu_get_flag(vcpu, IN_NESTED_ERET) && > + !vcpu_get_flag(vcpu, IN_NESTED_EXCEPTION)) > + gcsb_dsync(); > + > vcpu_put_mmu(vcpu); > } > =20 > @@ -836,6 +846,14 @@ static void nvhe_vcpu_put(struct kvm_vcpu *vcpu) > kvm_timer_vcpu_put(vcpu); > kvm_vgic_put(vcpu); > kvm_vcpu_pmu_restore_host(vcpu); > + > + /* > + * Ensure any GCS memory effects from the outgoing vCPU are > + * visible elsewhere. > + */ > + if (kvm_has_gcs(vcpu->kvm)) > + gcsb_dsync(); > + > vcpu_put_mmu(vcpu); > } > =20 > diff --git a/arch/arm64/kvm/hyp/nvhe/hyp-main.c b/arch/arm64/kvm/hyp/nvhe= /hyp-main.c > index 0c023ee0cf42a..18030dd0dc0af 100644 > --- a/arch/arm64/kvm/hyp/nvhe/hyp-main.c > +++ b/arch/arm64/kvm/hyp/nvhe/hyp-main.c > @@ -871,6 +871,13 @@ DEFINE_KVM_HOST_HCALL0(void, __pkvm_vcpu_put) > sync_hyp_vcpu_state(hyp_vcpu); > } > =20 > + /* > + * Ensure any GCS memory effects from the outgoing vCPU are > + * visible elsewhere even if the host skips syncing. > + */ > + if (kvm_has_gcs(hyp_vcpu->vcpu.kvm)) > + gcsb_dsync(); > + > pkvm_put_hyp_vcpu(hyp_vcpu); > } > } [Severity: Medium] Should vhe_vcpu_load(), nvhe_vcpu_load(), and __pkvm_vcpu_load() also issue gcsb_dsync() for incoming GCS-enabled vCPUs? As noted in gcs_thread_switch(), making GCS memory effects visible across PEs on migration requires gcsb_dsync() on both sides of the switch: on the outgoing PE to order prior GCS memory effects before release memory accesses, and on the incoming PE to order acquire memory accesses before subsequent GCS memory effects: arch/arm64/kernel/process.c:gcs_thread_switch() { /* * Ensure that GCS memory effects of the 'prev' thread are * ordered before other memory accesses with release semantics * (or preceded by a DMB) on the current PE. In addition, any * memory accesses with acquire semantics (or succeeded by a * DMB) are ordered before GCS memory effects of the 'next' * thread. This will ensure that the GCS memory effects are * visible to other PEs in case of migration. */ if (task_gcs_el0_enabled(current) || task_gcs_el0_enabled(next)) gcsb_dsync(); } Because the host VMM thread running the vCPU may not have host EL0 GCS enabled, migrating the vCPU thread to another PE will not trigger gcsb_dsync() in gcs_thread_switch() on the destination PE, leaving the migrated guest vCPU able to observe stale GCS memory. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261130-arm64-gcs-= v22-0-80454edf47ea@kernel.org?part=3D4