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: "Sheng Yang" <sheng.yang@xxxxxxxxx>
Subject: Re: [Xen-devel] [PATCH] Only include online cpus in cpu_mask_to_apicid_flat
From: "Jan Beulich" <JBeulich@xxxxxxxxxx>
Date: Wed, 01 Sep 2010 10:14:52 +0100
Cc: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>, Keir Fraser <keir.fraser@xxxxxxxxxxxxx>
Delivery-date: Wed, 01 Sep 2010 02:15:38 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <201009011139.47130.sheng.yang@xxxxxxxxx>
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: <C8A29C14.21704%keir.fraser@xxxxxxxxxxxxx> <201009011139.47130.sheng.yang@xxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
>>> 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()).

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.

Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>