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] [PATCH] Only include online cpus in cpu_mask_to_apicid_f

To: Jan Beulich <JBeulich@xxxxxxxxxx>
Subject: Re: [Xen-devel] [PATCH] Only include online cpus in cpu_mask_to_apicid_flat
From: "Yang, Sheng" <sheng.yang@xxxxxxxxx>
Date: Wed, 1 Sep 2010 18:02:13 +0800
Cc: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>, Keir Fraser <keir.fraser@xxxxxxxxxxxxx>
Delivery-date: Wed, 01 Sep 2010 03:04:15 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <4C7E35AC0200007800013A65@xxxxxxxxxxxxxxxxxx>
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>
Organization: Intel Opensource Technology Center
References: <C8A29C14.21704%keir.fraser@xxxxxxxxxxxxx> <201009011139.47130.sheng.yang@xxxxxxxxx> <4C7E35AC0200007800013A65@xxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: KMail/1.13.2 (Linux/2.6.32-24-generic; KDE/4.4.2; x86_64; ; )
On Wednesday 01 September 2010 17:14:52 Jan Beulich wrote:
> >>> On 01.09.10 at 05:39, "Yang, Sheng" <sheng.yang@xxxxxxxxx> wrote:
> > Yes, here is the patch with modification of other variants.
> 
> If indeed an adjustment like this is needed, then this (and other similar
> instances)
> 
> >@@ -71,6 +72,11 @@
> >
> > unsigned int cpu_mask_to_apicid_phys(cpumask_t cpumask)
> > {
> >
> >+    int cpu;
> >
> >     /* As we are using single CPU as destination, pick only one CPU here */
> >
> >-    return cpu_physical_id(first_cpu(cpumask));
> >+    for_each_cpu_mask(cpu, cpumask) {
> >+            if (cpu_online(cpu))
> >+                    break;
> >+    }
> >+    return cpu_physical_id(cpu);
> >
> > }
> 
> is both insufficient: You need to handle the case where you don't
> find any online CPU in the mask (at least by adding a respective
> BUG_ON()).

Yes, BUG_ON() is needed.
> 
> But I tend to agree with Keir that this shouldn't be done here -
> these functions are simple accessors, which shouldn't enforce
> any policy. Higher level code, if it doesn't already, should be
> adjusted to never allow offline CPUs to slip through.

Well, I think it's acceptable to add a wrap function for it. So how about this 
one?

--
regards
Yang, Sheng

> 
> Jan

Attachment: dest_fix.patch
Description: Text Data

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>