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

Re: [Xen-devel] [PATCH v18 11/16] x86/VPMU: Handle PMU interrupts for PV guests



On 17/02/15 17:41, Boris Ostrovsky wrote:
> On 02/17/2015 10:44 AM, Andrew Cooper wrote:
>> On 16/02/15 22:26, Boris Ostrovsky wrote:
>>> diff --git a/xen/arch/x86/hvm/vpmu.c b/xen/arch/x86/hvm/vpmu.c
>>> index 1d5ae8d..cf4c70b 100644
>>> --- a/xen/arch/x86/hvm/vpmu.c
>>> +++ b/xen/arch/x86/hvm/vpmu.c
>>>
>>> +static struct vcpu *choose_hwdom_vcpu(void)
>>> +{
>>> +    unsigned idx = smp_processor_id() % hardware_domain->max_vcpus;
>>> +
>>> +    if ( hardware_domain->vcpu == NULL )
>>> +        return NULL;
>> If d->vcpu is NULL, d->max_vcpus was 0 and you have already died with
>> a #DE
>>
>> You can guarentee that if max_vcpus > 0, d->vcpu is not NULL.
>
> IIRC Jan asked for d->vcpu tests at some point. This particular one is
> probably indeed pointless since hardware_domain better have this as
> non-NULL.

You should sanity check max_vcpus > 0 before doing the % (although I
would really hope that this codepath would never trigger ahead of dom0
being set up), at which point d->vcpu[idx] is well formed.

~Andrew

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

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