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

Re: [Xen-devel] [PATCH] Avoid panic when adjusting sedf parameters


  • To: Keir Fraser <keir.xen@xxxxxxxxx>
  • From: Juergen Gross <juergen.gross@xxxxxxxxxxxxxx>
  • Date: Thu, 17 Nov 2011 15:04:57 +0100
  • Cc: xen-devel@xxxxxxxxxxxxxxxxxxx, Jan Beulich <JBeulich@xxxxxxxx>
  • Delivery-date: Thu, 17 Nov 2011 14:08:40 +0000
  • Domainkey-signature: s=s1536a; d=ts.fujitsu.com; c=nofws; q=dns; h=X-SBRSScore:X-IronPort-AV:Received:X-IronPort-AV: Received:Received:Message-ID:Date:From:Organization: User-Agent:MIME-Version:To:CC:Subject:References: In-Reply-To:Content-Type:Content-Transfer-Encoding; b=LAw6C2Thz3VP8H+WlEc9KkV550SDzEoOzjmAhfN3vOYPZpAK8oDz10di FkTyzgl+K8w/3epzyZu320b58LeXqWPKz1PLYZIqROTnbdYyRcAIiAQnD vqi+ISNkY0AlGoG0SHPfvovY0cvVhl+GkKum1gvyRb0ihVpkMobTJvFWj rzxL4UJqnHdKqrpwHKkkpqdMa2YrNviNckFoxLolm7TighOFbiYAqrBfM m0rc8cUbEZnzXkBgsSVAj6PEo3tR5;
  • List-id: Xen developer discussion <xen-devel.lists.xensource.com>

On 11/17/2011 02:52 PM, Keir Fraser wrote:
On 17/11/2011 13:30, "Jan Beulich"<JBeulich@xxxxxxxx>  wrote:

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.
Given the gcc ({}) construction, you could do a double-loop:
  for ( (_d) = rcu_dereference(domain_list);     \
        (_d) != NULL;                            \
        ({ while ((_d) = rcu_dereference((_d)->next_in_list != NULL)
              if ((_d)->cpupool == (_c)) break;
           (_d); }) )

A bit ugly. ;-) And I still worry about cpupool locking...

What about:

static inline struct domain *next_domain_in_cpupool(
    struct domain *d, struct cpupool *c)
{
    for (d = rcu_dereference(d->next_in_list); d && d->cpupool != c;
         d = rcu_dereference(d->next_in_list));
    return d;
}

#define for_each_domain_in_cpupool(_d,_c)       \
 for ( (_d) = rcu_dereference(domain_list);     \
       (_d) != NULL;                            \
       (_d) = next_domain_in_cpupool((_d), (_c)))


Juergen

--
Juergen Gross                 Principal Developer Operating Systems
PDG ES&S SWE OS6                       Telephone: +49 (0) 89 3222 2967
Fujitsu Technology Solutions              e-mail: juergen.gross@xxxxxxxxxxxxxx
Domagkstr. 28                           Internet: ts.fujitsu.com
D-80807 Muenchen                 Company details: ts.fujitsu.com/imprint.html


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


 


Rackspace

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