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] Avoid panic when adjusting sedf parameters

To: "Juergen Gross" <juergen.gross@xxxxxxxxxxxxxx>
Subject: Re: [Xen-devel] [PATCH] Avoid panic when adjusting sedf parameters
From: "Jan Beulich" <JBeulich@xxxxxxxx>
Date: Thu, 17 Nov 2011 13:30:37 +0000
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Thu, 17 Nov 2011 05:31:28 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <8eea2b53adb207b8ab92.1321535022@nehalem1>
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: <8eea2b53adb207b8ab92.1321535022@nehalem1>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
>>> On 17.11.11 at 14:03, Juergen Gross <juergen.gross@xxxxxxxxxxxxxx> wrote:
>--- a/xen/include/xen/sched.h  Wed Nov 16 18:21:14 2011 +0000
>+++ b/xen/include/xen/sched.h  Thu Nov 17 14:01:58 2011 +0100
>@@ -569,6 +569,12 @@ extern struct domain *domain_list;
>        (_d) != NULL;                            \
>        (_d) = rcu_dereference((_d)->next_in_list )) \
> 
>+#define for_each_domain_in_cpupool(_d,_c)       \
>+ for ( (_d) = rcu_dereference(domain_list);     \
>+       (_d) != NULL;                            \
>+       (_d) = rcu_dereference((_d)->next_in_list )) \

Wouldn't this, up to here, simply be for_each_domain()?

>+       if ((_d)->cpupool == (_c))

This is dangerous - consider code like

    if ( x )
        for_each_domain_in_cpupool ()
            function();
    else
        other_stuff;

which would now associate the else with the wrong (inner) if. One
possible solution that comes to mind would be

#define for_each_domain_in_cpupool(_d,_c) \
    for_each_domain_in_cpupool (_d) \
        if ((_d)->cpupool != (_c)) \
            continue; \
        else

but I think I had seen a more clever solution to this problem, but cannot
remember/locate it right now.

Jan

>+
> #define for_each_vcpu(_d,_v)                    \
>  for ( (_v) = (_d)->vcpu ? (_d)->vcpu[0] : NULL; \
>        (_v) != NULL;                            \


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