On Wed, May 04, 2022 at 03:38:47PM +0200, Juergen Gross wrote: > On 04.05.22 11:45, Will Deacon wrote: > > On Thu, Apr 28, 2022 at 11:35:36AM -0700, Elliot Berman wrote: > > > diff --git a/arch/arm64/kernel/paravirt.c b/arch/arm64/kernel/paravirt.c > > > index 75fed4460407..e724ea3d86f0 100644 > > > --- a/arch/arm64/kernel/paravirt.c > > > +++ b/arch/arm64/kernel/paravirt.c > > > @@ -52,7 +52,9 @@ early_param("no-steal-acc", parse_no_stealacc); > > > /* return stolen time in ns by asking the hypervisor */ > > > static u64 para_steal_clock(int cpu) > > > { > > > + struct pvclock_vcpu_stolen_time *kaddr = NULL; > > > struct pv_time_stolen_time_region *reg; > > > + u64 ret = 0; > > > reg = per_cpu_ptr(&stolen_time_region, cpu); > > > @@ -61,28 +63,38 @@ static u64 para_steal_clock(int cpu) > > > * online notification callback runs. Until the callback > > > * has run we just return zero. > > > */ > > > - if (!reg->kaddr) > > > + rcu_read_lock(); > > > + kaddr = rcu_dereference(reg->kaddr); > > > + if (!kaddr) { > > > + rcu_read_unlock(); > > > return 0; > > > + } > > > - return le64_to_cpu(READ_ONCE(reg->kaddr->stolen_time)); > > > + ret = le64_to_cpu(READ_ONCE(kaddr->stolen_time)); > > > > Is this READ_ONCE() still required now? > > Yes, as it might be called for another cpu than the current one. > stolen_time might just be updated, so you want to avoid load tearing. Ah yes, thanks. The lifetime of the structure is one thing, but the stolen time field is updated much more regularly than the kaddr pointer. So: Acked-by: Will Deacon <will@xxxxxxxxxx> Cheers, Will _______________________________________________ Virtualization mailing list Virtualization@xxxxxxxxxxxxxxxxxxxxxxxxxx https://lists.linuxfoundation.org/mailman/listinfo/virtualization