[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v2] x86/vpmu: add cpu hot unplug notifier for vpmu

>>> On 18.05.17 at 15:06, <JBeulich@xxxxxxxx> wrote:
>>>> On 18.05.17 at 13:51, <luwei.kang@xxxxxxxxx> wrote:
>>     In vpmu_load(), remote call will guarded by VPMU_CONTEXT_LOADED flag 
> check. As for vpmu->last_pcpu, we can't use some random online one to produce 
> false.
>>     What is your opinion?
> I continue to think that it needs to be made sure last_pcpu is valid
> before using it for anything. Agreed, my previous suggestion of
> simply storing an invalid value was not very useful, as the
> questionable comparison is != (when making the suggestion I
> did wrongly rememeber it to be == ),

And I was wrong here and right originally:

int vpmu_load(struct vcpu *v, bool_t from_guest)
    /* First time this VCPU is running here */
    if ( vpmu->last_pcpu != pcpu )

If last_pcpu was NR_CPUS or nr_cpu_ids or any other always
invalid value, this condition would be true, which is exactly what
we want. Whereas if you leave the field alone, and another (or
the same) CPU comes (back) up with that number, we may
wrongly not enter the if() body.


Xen-devel mailing list



Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.