From: Marc Zyngier <maz@kernel.org>
To: Justin He <Justin.He@arm.com>
Cc: Oliver Upton <oupton@kernel.org>,
Fuad Tabba <fuad.tabba@linux.dev>,
Joey Gouly <Joey.Gouly@arm.com>,
Steffen Eiden <seiden@linux.ibm.com>,
Suzuki Poulose <Suzuki.Poulose@arm.com>,
Zenghui Yu <yuzenghui@huawei.com>,
Catalin Marinas <Catalin.Marinas@arm.com>,
Will Deacon <will@kernel.org>,
Mark Rutland <Mark.Rutland@arm.com>,
Paolo Bonzini <pbonzini@redhat.com>,
Sean Christopherson <seanjc@google.com>,
Shuah Khan <shuah@kernel.org>,
Sascha Bischoff <Sascha.Bischoff@arm.com>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
"kvmarm@lists.linux.dev" <kvmarm@lists.linux.dev>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
"linux-kselftest@vger.kernel.org"
<linux-kselftest@vger.kernel.org>,
Lorenzo Stoakes <ljs@kernel.org>
Subject: Re: [PATCH 1/3] KVM: arm64: Don't load hardware vCPU state before first run
Date: Tue, 24 Nov 2026 13:28:59 +0000 [thread overview]
Message-ID: <865wxmz7c4.wl-maz@kernel.org> (raw)
In-Reply-To: <AS2PR08MB97865A914C46DA0CE54F9197F7442@AS2PR08MB9786.eurprd08.prod.outlook.com>
On Tue, 24 Nov 2026 09:06:32 +0000,
Justin He <Justin.He@arm.com> wrote:
>
>
>
> > -----Original Message-----
> [...]
> > On Mon, 23 Nov 2026 15:09:15 +0000,
> > Jia He <justin.he@arm.com> wrote:
> > >
> > > KVM_PRE_FAULT_MEMORY calls vcpu_load() as soon as
> > KVM_ARM_VCPU_INIT has
> > > completed. On arm64, however, kvm->arch.sysreg_masks, the trap
> > > configuration, vncr_tlb and nested vGIC state are only set up on the
> > > first KVM_RUN in kvm_arch_vcpu_run_pid_change().
> >
> > I think I'm going to queue a patch disabling prefaulting immediately,
> > and then we can fix this crap.
>
> I can still reproduce the same vncr_tlb NULL dereference with prefaulting
> disabled. On kvmarm/fixes, commit 5651590be08a ("KVM: arm64: Load the vcpu
> in KVM_SET_VCPU_EVENTS") added a vcpu_load() call to KVM_SET_VCPU_EVENTS.
> A single KVM_SET_VCPU_EVENTS with an all-zero struct kvm_vcpu_events,
> issued before the first KVM_RUN, is enough to trigger it.
> For v2, I'll build on your patch and use vcpu_has_run_once() to gate the
> arch load/put paths for both ioctls.
Ah, you spotted that one already. I should have checked the full
thread before replying...
M.
--
Without deviation from the norm, progress is not possible.
next prev parent reply other threads:[~2026-11-24 13:29 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-23 15:09 [PATCH 0/3] KVM: arm64: Fix pre-first-run KVM_PRE_FAULT_MEMORY vcpu_load() issues Jia He
2026-11-23 15:09 ` [PATCH 1/3] KVM: arm64: Don't load hardware vCPU state before first run Jia He
2026-11-23 17:20 ` Marc Zyngier
2026-11-23 17:50 ` Lorenzo Stoakes (ARM)
2026-11-24 1:39 ` Justin He
2026-11-24 12:50 ` Marc Zyngier
2026-11-24 13:18 ` Justin He
2026-11-24 9:06 ` Justin He
2026-11-24 13:28 ` Marc Zyngier [this message]
2026-11-23 15:09 ` [PATCH 2/3] KVM: arm64: nv: Don't request or attempt L1 VNCR mapping without vncr_tlb Jia He
2026-11-23 17:36 ` Marc Zyngier
2026-11-24 1:42 ` Justin He
2026-11-23 15:09 ` [PATCH 3/3] KVM: selftests: arm64: Test KVM_PRE_FAULT_MEMORY before first KVM_RUN Jia He
2026-11-24 7:11 ` Yao Yuan
2026-11-24 8:12 ` Justin He
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=865wxmz7c4.wl-maz@kernel.org \
--to=maz@kernel.org \
--cc=Catalin.Marinas@arm.com \
--cc=Joey.Gouly@arm.com \
--cc=Justin.He@arm.com \
--cc=Mark.Rutland@arm.com \
--cc=Sascha.Bischoff@arm.com \
--cc=Suzuki.Poulose@arm.com \
--cc=fuad.tabba@linux.dev \
--cc=kvm@vger.kernel.org \
--cc=kvmarm@lists.linux.dev \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=ljs@kernel.org \
--cc=oupton@kernel.org \
--cc=pbonzini@redhat.com \
--cc=seanjc@google.com \
--cc=seiden@linux.ibm.com \
--cc=shuah@kernel.org \
--cc=will@kernel.org \
--cc=yuzenghui@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox