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/
Home Products Support Community News


Re: [Xen-devel] [PATCH] [qemu] xen_be_init under stubdom

To: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
Subject: Re: [Xen-devel] [PATCH] [qemu] xen_be_init under stubdom
From: Kamala Narasimhan <kamala.narasimhan@xxxxxxxxx>
Date: Thu, 20 Jan 2011 13:29:27 -0500
Cc: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Thu, 20 Jan 2011 10:30:10 -0800
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=TJ5A25fROz2WIpX0wuxHs79jTaqfij4Q3gyK8A10QZ8=; b=HdWC4fmFD/TBNiCKOG0oNB/5pyDxO0VolcRVOfp+SAJ8VrZERyuPFbn52qzhAScnv1 /xdIOaZ47wbe3Azki75E9uzdNIaPANxwhO15HX9zuaVputGXa5GblPUZYyaNKR9QeQMA 6dH6MIy+1xCIzciq7PdeOAhlkQnt/qYHJUlKE=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=Y5kr5XDWHbPubprrAtBT1QwBov/qbs0VF19gThS0vhO5V8qmDQutuFUYJChhslhZHX EQfO42ktWoCsNxZdzjxlp1g4cJHKSvbjgMvaqqejOolplTCmBlohLBnOhdA+HAWx4xDa OFEthIJxO3cUjti8i169euhWrXo+Kuj+Qqvkg=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <19768.26290.259658.195870@xxxxxxxxxxxxxxxxxxxxxxxx>
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: <AANLkTikFbHCUmSceFR=byYRV+q5j9TnN8_bab6LKUSpe@xxxxxxxxxxxxxx> <19768.23796.309250.916556@xxxxxxxxxxxxxxxxxxxxxxxx> <AANLkTi=Xksk+DJ0oudq=rs=onAZ0XcArQWyqBFzTOzuK@xxxxxxxxxxxxxx> <19768.26290.259658.195870@xxxxxxxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
On Thu, Jan 20, 2011 at 11:45 AM, Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx> wrote:
> Kamala Narasimhan writes ("Re: [Xen-devel] [PATCH] [qemu] xen_be_init under 
> stubdom"):
>> I did call it inconsequential and wouldn't have sent it if it didn't
>> happen to be with a one liner that had functional impact that I wanted
>> changed :)
> What functional impact does it have ?

The cleanup code has no functional impact but the change in
xen_be_init in stubdom case does (which is what I meant above) and
here is how -

xen_be_init registers for a notification which it shouldn't have in
stubdom case and registering for that notification resulted in it
getting called and because it was getting called in an environment
where it wasn't suppose to, it ended up corrupting data structures and
stubdom-qemu seg faulting which is what I meant by functional impact.

We could fix the handler to gracefully fail but why execute the code
at all when not needed.

>> > There is nothing wrong with
>> > calling qemu_free(0) and IMO in general functions that "goto cleanup"
>> > are to be preferred to ones that "return".
>> You would rather check for null pointer and then go to cleanup code
>> whose sole purpose in this case is to free that pointer and all this
>> for free to realize that it has nothing to free and then return back!
> Yes.  That avoids having to reason whether there is other stuff that
> might need to be freed.  If more code is added later which allocates
> something else then the plain "return" may become buggy.

If more cleanup code is expected to be added and it was written with
that in mind, obviously I can't make a case for the change.

>> > Furthermore, even if this patch were good, it's not a bugfix so is not
>> > acceptable at this stage of the release.
>> No, it does get rid of an issue I encounter.  I was running into data
>> corruption as this code path was taken with stubdom in my
>> configuration and it was a pain to debug as with these kinds of
>> corruption issues the problem showed up elsewhere.
> Are you saying that in stubdom, this code path causes your code to
> crash ?  That is not the fault of the code path.

Yes, the notification that this code path registers for which is not
required in the environment in question is causing stubdom to crash
later.  We could fix the handler to gracefully fail but why register
for a handler that isn't needed?  And yes the fault is not in the init
code path but in the handler it registers for which it shouldn't.  The
choice is to fix the handler or simply not register for it and we
chose the latter.


Xen-devel mailing list