xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Gianni Tedesco <gianni.tedesco@citrix.com>
To: Jeremy Fitzhardinge <jeremy@goop.org>
Cc: Ian Campbell <Ian.Campbell@eu.citrix.com>,
	"xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>,
	Stefano Stabellini <Stefano.Stabellini@eu.citrix.com>
Subject: Re: Re: [PATCH 1/3] xen: pvhvm: allow user to request no emulated device unplug
Date: Thu, 19 Aug 2010 17:34:19 +0100	[thread overview]
Message-ID: <1282235659.3731.37.camel@qabil.uk.xensource.com> (raw)
In-Reply-To: <4C6D577F.6020607@goop.org>

On Thu, 2010-08-19 at 17:10 +0100, Jeremy Fitzhardinge wrote:
> 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.

Should be fine? I'd just #define XEN_UNPLUG_ALL_THE_BITS ~0U for the
sake of cosmetics...

  reply	other threads:[~2010-08-19 16:34 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
2010-08-19 16:34             ` Gianni Tedesco [this message]
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=1282235659.3731.37.camel@qabil.uk.xensource.com \
    --to=gianni.tedesco@citrix.com \
    --cc=Ian.Campbell@eu.citrix.com \
    --cc=Stefano.Stabellini@eu.citrix.com \
    --cc=jeremy@goop.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).