On Fri, Aug 02, 2024, Steve Rutherford wrote: > On Fri, Aug 2, 2024 at 1:01 PM Sean Christopherson <seanjc@xxxxxxxxxx> wrote: > > @@ -4178,9 +4181,9 @@ static int vcpu_get_pid(void *data, u64 *val) > > { > > struct kvm_vcpu *vcpu = data; > > > > - rcu_read_lock(); > > - *val = pid_nr(rcu_dereference(vcpu->pid)); > > - rcu_read_unlock(); > > + read_lock(&vcpu->pid_lock); > > + *val = pid_nr(vcpu->pid); > > + read_unlock(&vcpu->pid_lock); > > return 0; > > } > > > > @@ -4466,7 +4469,7 @@ static long kvm_vcpu_ioctl(struct file *filp, > > r = -EINVAL; > > if (arg) > > goto out; > > - oldpid = rcu_access_pointer(vcpu->pid); > > + oldpid = vcpu->pid; > > Overall this patch looks correct, but this spot took me a moment, and > I want to confirm. This skips the reader lock since writing only > happens just below, under the vcpu lock, and we've already taken that > lock? Yep, exactly.