From: Julien Grall <julien.grall@linaro.org>
To: George Dunlap <george.dunlap@eu.citrix.com>,
Jan Beulich <JBeulich@suse.com>
Cc: Juergen Gross <JGross@suse.com>, Keir Fraser <keir@xen.org>,
ian.campbell@citrix.com, tim@xen.org,
Ian Jackson <ian.jackson@eu.citrix.com>,
George Dunlap <george.dunlap@citrix.com>,
stefano.stabellini@citrix.com, xen-devel@lists.xenproject.org
Subject: Re: [PATCH] xen: domain_update_node_affinity: Correct the ASSERT
Date: Thu, 07 Aug 2014 16:04:27 +0100 [thread overview]
Message-ID: <53E3957B.7000902@linaro.org> (raw)
In-Reply-To: <53DF9DC7.2000207@eu.citrix.com>
On 08/04/2014 03:50 PM, George Dunlap wrote:
> On 08/01/2014 04:12 PM, Jan Beulich wrote:
>>>>> On 01.08.14 at 16:52, <julien.grall@linaro.org> wrote:
>>> --- a/xen/common/domain.c
>>> +++ b/xen/common/domain.c
>>> @@ -449,7 +449,7 @@ void domain_update_node_affinity(struct domain *d)
>>> }
>>> /* Filter out non-online cpus */
>>> cpumask_and(dom_cpumask, dom_cpumask, online);
>>> - ASSERT(!cpumask_empty(dom_cpumask));
>>> + ASSERT( !d->vcpu || !d->vcpu[0] ||
>>> !cpumask_empty(dom_cpumask));
>>> /* And compute the intersection between hard, online and
>>> soft */
>>> cpumask_and(dom_cpumask_soft, dom_cpumask_soft, dom_cpumask);
>>>
>>
>> Actually, with sched_move_domain() having
>>
>> /* Do we have vcpus already? If not, no need to update
>> node-affinity */
>> if ( d->vcpu )
>> domain_update_node_affinity(d);
>>
>> it should really just be _that_ if() condition to get extended, and the
>> ASSERT() left alone altogether. Or, if any other path can be proven
>> to possibly reach the function with no vCPU allocated (I just went
>> through them and didn't spot any), then it should really be an early
>> bail from the function rather than a pointlessly complicated ASSERT()
>> expression. (And for the record, your expression has a coding style
>> violation anyway in that it begins with a space.)
>
> I think changing the if() was what Julien started with; but overall I
> think that it makes more sense to update the assumption of the code in
> question than to require all the callers to be careful not to trip over it.
>
> Doing an early bail might make sense as well.
Ok. So which one should I choose? The early bail out?
Regards,
--
Julien Grall
next prev parent reply other threads:[~2014-08-07 15:04 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-01 14:52 [PATCH] xen: domain_update_node_affinity: Correct the ASSERT Julien Grall
2014-08-01 15:12 ` Jan Beulich
2014-08-04 14:50 ` George Dunlap
2014-08-07 15:04 ` Julien Grall [this message]
2014-08-07 15:53 ` Jan Beulich
-- strict thread matches above, loose matches on Subject: below --
2014-07-25 15:30 Julien Grall
2014-07-25 15:42 ` Jan Beulich
2014-07-25 15:44 ` Julien Grall
2014-07-25 15:59 ` Jan Beulich
2014-07-28 17:23 ` Dario Faggioli
2014-07-25 15:44 ` Andrew Cooper
2014-07-25 15:48 ` Julien Grall
2014-07-25 16:05 ` Andrew Cooper
2014-07-28 17:25 ` Dario Faggioli
2014-07-28 17:31 ` Julien Grall
2014-07-29 6:40 ` Jan Beulich
2014-07-29 10:46 ` Julien Grall
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=53E3957B.7000902@linaro.org \
--to=julien.grall@linaro.org \
--cc=JBeulich@suse.com \
--cc=JGross@suse.com \
--cc=george.dunlap@citrix.com \
--cc=george.dunlap@eu.citrix.com \
--cc=ian.campbell@citrix.com \
--cc=ian.jackson@eu.citrix.com \
--cc=keir@xen.org \
--cc=stefano.stabellini@citrix.com \
--cc=tim@xen.org \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.