WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

RE: [Xen-devel] RE: [PATCH][DOM0] Expose physical CPU information in dom

To: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
Subject: RE: [Xen-devel] RE: [PATCH][DOM0] Expose physical CPU information in dom0
From: "Jiang, Yunhong" <yunhong.jiang@xxxxxxxxx>
Date: Fri, 13 Nov 2009 00:08:26 +0800
Accept-language: en-US
Acceptlanguage: en-US
Cc: Jeremy Fitzhardinge <jeremy@xxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Thu, 12 Nov 2009 08:08:52 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <20091112154658.GA32409@xxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <E2263E4A5B2284449EEBD0AAB751098418E4775B9B@xxxxxxxxxxxxxxxxxxxxxxxxxxxx> <E2263E4A5B2284449EEBD0AAB751098418E55575DA@xxxxxxxxxxxxxxxxxxxxxxxxxxxx> <20091112154658.GA32409@xxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Thread-index: Acpjr2yioj/bRjsjTA2Wfrn78MocqAAAgQgA
Thread-topic: [Xen-devel] RE: [PATCH][DOM0] Expose physical CPU information in dom0

Konrad Rzeszutek Wilk wrote:
> Some little comments..
> 
> .. snip ..
> 
>> +    if (info->flags & XEN_PCPU_FLAGS_INVALID) {
>> +            /* The pcpu has been removed */
>> +            *result = 0;
> 
> You use #defines for the other cases. Should there be one for 0? Is 0
> PCPU_REMOVED? 

0 means no changes, < 0 means something wrong (like hypercall failure, or 
memory allocation failed).
The defined macro is for state changed (i.e. >0). Yes, we can define 0 as 
PCPU_NO_CHANGE.
For the code above, if the pcpu does not exist before in kernel, it is 0, means 
no change, otherwise it will be set as PCPU_REMOVED.

> 
>> +            if (pcpu) {
>> +                    raw_notifier_call_chain(&xen_pcpu_chain,
>> +                      XEN_PCPU_REMOVE,
>> +                      (void *)(long)pcpu->xen_id);
>> +                    xen_pcpu_free(pcpu);
>> +                    *result = PCPU_REMOVED;
>> +            }
>> +            return NULL;
>> +    }
>> +
>> +
>> +    if (!pcpu) {
>> +            *result = PCPU_ADDED;
>> +            pcpu = init_pcpu(info);
>> +            if (pcpu == NULL) {
>> +                    printk(KERN_WARNING "Failed to init pcpu %x\n", +       
>>                  
>> info->xen_cpuid); +                    *result = -1;
> 
> How about #define PCPU_BAD -1?

-1 means something wrong, not PCPU bad.

> 
> .. snip..
>> +/*
>> + * type: 0 add, 1 remove
>> + */
> 
> Why not make this an enum?
> 
>> +int xen_pcpu_hotplug(int type, uint32_t apic_id)

In fact, there is macro for it already. I give the value here to make it more 
clean.

    if (!found && (type == HOTPLUG_TYPE_ADD))
        printk(KERN_WARNING "The cpu is not added into Xen HV?\n");

    if (found && (type == HOTPLUG_TYPE_REMOVE))
        printk(KERN_WARNING "The cpu still exits in Xen HV?\n");
    return 0;
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel