From: Jeremy Fitzhardinge <jeremy@goop.org>
To: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Cc: Ian Campbell <Ian.Campbell@eu.citrix.com>,
"xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>
Subject: Re: Re: [PATCH 1/3] xen: pvhvm: allow user to request no emulated device unplug
Date: Thu, 19 Aug 2010 09:10:39 -0700 [thread overview]
Message-ID: <4C6D577F.6020607@goop.org> (raw)
In-Reply-To: <alpine.DEB.2.00.1008191153300.2545@kaball-desktop>
On 08/19/2010 03:54 AM, Stefano Stabellini wrote:
> On Thu, 19 Aug 2010, Ian Campbell wrote:
>> On Thu, 2010-08-19 at 11:50 +0100, Ian Campbell wrote:
>>> On Thu, 2010-08-19 at 11:37 +0100, Stefano Stabellini wrote:
>>>> On Thu, 19 Aug 2010, Ian Campbell wrote:
>>>>> if (r && !(r == XEN_PLATFORM_ERR_MAGIC &&
>>>>> + (xen_emul_unplug != -1) &&
>>>>> (xen_emul_unplug & XEN_UNPLUG_IGNORE)))
>>>> I wouldn't add xen_emul_unplug != -1 because it should be clear that
>>>> xen_emul_unplug & XEN_UNPLUG_IGNORE always implies xen_emul_unplug != -1.
>>> That's not correct since -1 is all 1s. So you can get a false positive
>>> for "xen_emul_unplug & XEN_UNPLUG_IGNORE" if xen_emul_unplug == -1.
>> IOW if we were to rewrite the test to use less boolean logic the patch
>> might look like:
>>
>> if (r) {
>> if (r != XEN_PLATFORM_ERR_MAGIC)
>> return;
>> + if (xen_emul_unplug == -1)
>> + return;
>> if (!(xen_emul_unplug & XEN_UNPLUG_IGNORE))
>> return;
>> }
>>
>> Perhaps this refactoring is worthwhile in any case? It certainly makes
>> my head hurt less ;-)
>>
>
> Yeah, it is probably worth it anyway :)
Treating a variable as an integer and a bitfield seems like a bad idea.
J
next prev parent reply other threads:[~2010-08-19 16:10 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-19 9:58 [GIT/PATCH 0/3] pvhvm emul unplug fixes Ian Campbell
2010-08-19 9:59 ` [PATCH 1/3] xen: pvhvm: allow user to request no emulated device unplug Ian Campbell
2010-08-19 10:37 ` Stefano Stabellini
2010-08-19 10:50 ` Ian Campbell
2010-08-19 10:52 ` Ian Campbell
2010-08-19 10:54 ` Stefano Stabellini
2010-08-19 16:10 ` Jeremy Fitzhardinge [this message]
2010-08-19 16:34 ` Gianni Tedesco
2010-08-19 16:44 ` Jeremy Fitzhardinge
2010-08-19 16:52 ` Ian Campbell
2010-08-20 8:13 ` [GIT/PATCH v2 0/3] pvhvm emul unplug fixes Ian Campbell
2010-08-20 8:14 ` [PATCH 1/3] xen: pvhvm: allow user to request no emulated device unplug Ian Campbell
2010-08-20 8:14 ` [PATCH 2/3] xen: pvhvm: rename xen_emul_unplug=ignore to =unnnecessary Ian Campbell
2010-08-20 8:14 ` [PATCH 3/3] xen: pvhvm: make it clearer that XEN_UNPLUG_* define bits in a bitfield Ian Campbell
2010-08-20 11:10 ` [GIT/PATCH v2 0/3] pvhvm emul unplug fixes Stefano Stabellini
2010-08-20 16:41 ` Jeremy Fitzhardinge
2010-08-19 9:59 ` [PATCH 2/3] xen: pvhvm: rename xen_emul_unplug=ignore to =unnnecessary Ian Campbell
2010-08-19 9:59 ` [PATCH 3/3] xen: pvhvm: make it clearer that XEN_UNPLUG_* individual bits Ian Campbell
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=4C6D577F.6020607@goop.org \
--to=jeremy@goop.org \
--cc=Ian.Campbell@eu.citrix.com \
--cc=stefano.stabellini@eu.citrix.com \
--cc=xen-devel@lists.xensource.com \
/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.