All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
To: Laszlo Ersek <lersek@redhat.com>
Cc: Kevin Wolf <kwolf@redhat.com>,
	qemu-block@nongnu.org,
	Stefano Stabellini <stefano.stabellini@eu.citrix.com>,
	"Jordan Justen (Intel address)" <jordan.l.justen@intel.com>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
	"xen-devel@lists.xen.org" <xen-devel@lists.xen.org>,
	Fabio Fantoni <fabio.fantoni@m2r.biz>,
	Samuel Thibault <samuel.thibault@eu.citrix.com>,
	Anthony PERARD <anthony.perard@citrix.com>,
	John Snow <jsnow@redhat.com>,
	Paul Durrant <paul.durrant@citrix.com>
Subject: Re: [Qemu-devel] Question about xen disk unplug support for ahci missed in qemu
Date: Tue, 20 Oct 2015 15:52:43 +0100	[thread overview]
Message-ID: <alpine.DEB.2.02.1510201402550.27957@kaball.uk.xensource.com> (raw)
In-Reply-To: <56263785.6060906@redhat.com>

On Tue, 20 Oct 2015, Laszlo Ersek wrote:
> On 10/20/15 13:59, Stefano Stabellini wrote:
> > On Mon, 19 Oct 2015, Laszlo Ersek wrote:
> >> Could that be related to the issue you are experiencing with OVMF?
> >> Because, OVMF implies HVM (or PV-on-HVM), and your report ("empty
> >> paravirt CD-ROM" or some such -- sorry, the report remains unclear)
> >> appears to match the above message.
> >>
> >> Given that this is guest code, shouldn't the same logic be mirrored in
> >> the OVMF guest driver?
> >>
> >> /* do not create a PV cdrom device if we are an HVM guest */
> >>
> >> In other words, given that OVMF implies HVM, shouldn't OVMF too forego
> >> driving a paravirt CD-ROM entirely?
> > 
> > In the case of OVMF I think we can use the PV block interface to access
> > the cdrom, the problem is just that it cannot handle empty cdrom drives
> > at the moment and XenPvBlockFrontInitialization simply returns an error.
> 
> (*)
> 
> > A simple patch like this one should prevent OVMF from getting stuck with
> > an error when an empty cdrom is found:
> > 
> > diff --git a/OvmfPkg/XenPvBlkDxe/BlockFront.c b/OvmfPkg/XenPvBlkDxe/BlockFront.c
> > index 256ac55..ae7cab9 100644
> > --- a/OvmfPkg/XenPvBlkDxe/BlockFront.c
> > +++ b/OvmfPkg/XenPvBlkDxe/BlockFront.c
> > @@ -186,6 +186,10 @@ XenPvBlockFrontInitialization (
> >    }
> >    FreePool (DeviceType);
> >  
> > +  Status = XenBusReadUint64 (XenBusIo, "sectors", TRUE, &Value);
> > +  if (Dev->MediaInfo.CdRom && Status != XENSTORE_STATUS_SUCCESS)
> > +     return EFI_NO_MEDIA;
> > +
> >    Status = XenBusReadUint64 (XenBusIo, "backend-id", FALSE, &Value);
> >    if (Status != XENSTORE_STATUS_SUCCESS || Value > MAX_UINT16) {
> >      DEBUG ((EFI_D_ERROR, "XenPvBlk: Failed to get backend-id (%d)\n",
> 
> (1) Directly returning at that point will leak "Dev". I think you should
> set Status, and then goto Error. XenPvBlockFree() under that label will
> free Dev.

Good idea


> (2) I agree that returning an error code here will propagate through
> XenPvBlkDxeDriverBindingStart() to the caller, and ultimately prevent
> the binding. That's probably the right thing to do.
> 
> But, how does it differ from what you wrote above (*):
>
> > [...] the problem is just that it cannot handle empty cdrom drives
> > at the moment and XenPvBlockFrontInitialization simply returns an
> > error.
> 
> If XenPvBlockFrontInitialization() simply returned an error right now,
> then that would achieve the exact same thing as your proposal -- the
> driver wouldn't bind the device. So either your idea wouldn't make a
> difference, or your analysis that XenPvBlockFrontInitialization()
> currently fails is incorrect.
> 
> I think it's the latter though, and that this patch should be tested.

The patch works, but you are right, the analysis of the problem was
wrong: it gets stuck in XenPvBlkWaitForBackendState, rather than
returning an error.


> If it works in your testing, please submit it to
> <edk2-devel@lists.01.org>. (You have to be subscribed to post, sorry
> about that.) Please fix the leak (1), and add the following line to the
> commit message just before your signoff:
> 
> Contributed-under: TianoCore Contribution Agreement 1.0
> 
> What it means is explained in "OvmfPkg/Contributions.txt".

I'll rework the patch and send it to the list.
Thanks,

Stefano

  parent reply	other threads:[~2015-10-20 14:53 UTC|newest]

Thread overview: 95+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-13 15:55 [Qemu-devel] Question about xen disk unplug support for ahci missed in qemu Fabio Fantoni
2015-10-13 15:55 ` Fabio Fantoni
2015-10-13 16:45 ` [Qemu-devel] " John Snow
2015-10-13 16:45 ` John Snow
2015-10-13 17:10   ` Stefano Stabellini
2015-10-14  9:47     ` Kevin Wolf
2015-10-14 11:06       ` Stefano Stabellini
2015-10-14 11:27         ` [Qemu-devel] [Xen-devel] " Ian Campbell
2015-10-14 11:27           ` [Qemu-devel] " Ian Campbell
2015-10-15 23:10           ` Laszlo Ersek
2015-10-15 23:10           ` [Qemu-devel] [Xen-devel] " Laszlo Ersek
2015-10-16  2:38             ` [Qemu-devel] " Kevin O'Connor
2015-10-16  2:38             ` [Qemu-devel] [Xen-devel] " Kevin O'Connor
2015-10-16  9:06               ` Stefano Stabellini
2015-10-16  9:06                 ` [Qemu-devel] " Stefano Stabellini
2015-10-16  9:21                 ` [Qemu-devel] [Xen-devel] " Laszlo Ersek
2015-10-16  9:21                   ` [Qemu-devel] " Laszlo Ersek
2015-10-16  9:33                   ` [Qemu-devel] [Xen-devel] " Stefano Stabellini
2015-10-16  9:33                   ` [Qemu-devel] " Stefano Stabellini
2015-10-16  9:34                 ` [Qemu-devel] [Xen-devel] " Ian Campbell
2015-10-16  9:34                   ` [Qemu-devel] " Ian Campbell
2015-10-16 13:03                 ` [Qemu-devel] [Xen-devel] " Kevin O'Connor
2015-10-16 13:03                 ` [Qemu-devel] " Kevin O'Connor
2015-10-16  9:13               ` [Qemu-devel] [Xen-devel] " Laszlo Ersek
2015-10-16  9:13                 ` [Qemu-devel] " Laszlo Ersek
2015-10-14 11:32         ` Kevin Wolf
2015-10-14 11:44           ` Stefano Stabellini
2015-10-15 16:27         ` Fabio Fantoni
2015-10-15 16:27           ` Fabio Fantoni
2015-10-15 18:02           ` Anthony PERARD
2015-10-15 18:02           ` Anthony PERARD
2015-10-16  8:32             ` Fabio Fantoni
2015-10-16  8:32             ` Fabio Fantoni
2015-10-16 10:13               ` Anthony PERARD
2015-10-16 10:23                 ` Fabio Fantoni
2015-10-16 10:47                   ` Stefano Stabellini
2015-10-16 10:47                   ` Stefano Stabellini
2015-10-16 11:34                     ` Fabio Fantoni
2015-10-16 11:34                     ` Fabio Fantoni
2015-10-16 19:09                       ` Laszlo Ersek
2015-10-16 19:09                       ` Laszlo Ersek
2015-10-19 20:32                         ` Laszlo Ersek
2015-10-20 11:59                           ` Stefano Stabellini
2015-10-20 11:59                           ` Stefano Stabellini
2015-10-20 12:45                             ` Laszlo Ersek
2015-10-20 12:45                             ` Laszlo Ersek
2015-10-20 14:52                               ` Stefano Stabellini
2015-10-20 14:52                               ` Stefano Stabellini [this message]
2015-10-19 20:32                         ` Laszlo Ersek
2015-10-16 10:23                 ` Fabio Fantoni
2015-10-14 11:11       ` Fabio Fantoni
2015-10-14 12:48         ` Paul Durrant
2015-10-15 23:35           ` Laszlo Ersek
2015-10-15 23:35           ` Laszlo Ersek
2015-10-16 14:04           ` Kevin Wolf
2015-10-16 14:24             ` Paul Durrant
2015-10-16 15:02               ` Kevin Wolf
2015-10-16 15:10                 ` Paul Durrant
2015-10-16 16:11                   ` Kevin Wolf
2015-10-16 16:11                   ` Kevin Wolf
2015-10-16 16:20                     ` Paul Durrant
2015-10-16 16:42                       ` Kevin Wolf
2015-10-16 16:42                       ` Kevin Wolf
2015-10-16 16:53                         ` Paul Durrant
2015-10-16 17:03                           ` Kevin Wolf
2015-10-16 17:03                           ` Kevin Wolf
2015-10-19 13:42                           ` Fabio Fantoni
2015-10-19 13:42                           ` Fabio Fantoni
2015-10-16 16:53                         ` Paul Durrant
2015-10-16 16:53                       ` Eric Blake
2015-10-16 16:53                       ` Eric Blake
2015-10-16 16:20                     ` Paul Durrant
2015-10-16 15:02               ` Kevin Wolf
2015-10-16 14:24             ` Paul Durrant
2015-10-16 14:04           ` Kevin Wolf
2015-10-16 20:40     ` John Snow
2015-10-16 20:40     ` John Snow
2015-10-19 10:18       ` Stefano Stabellini
2015-10-19 10:18       ` Stefano Stabellini
2015-10-19 11:27         ` Gerd Hoffmann
2015-10-19 11:27         ` Gerd Hoffmann
2015-10-19 11:44           ` Stefano Stabellini
2015-10-19 11:44           ` Stefano Stabellini
2015-10-19 16:54             ` John Snow
2015-10-19 16:57               ` Stefano Stabellini
2015-10-19 18:29                 ` Fabio Fantoni
2015-10-19 18:29                 ` Fabio Fantoni
2015-10-19 19:55                   ` Laszlo Ersek
2015-10-19 19:55                   ` Laszlo Ersek
2015-10-19 16:57               ` Stefano Stabellini
2015-10-19 16:54             ` John Snow
2015-10-19 14:17         ` Fabio Fantoni
2015-10-19 14:17         ` Fabio Fantoni
2015-10-19 14:57           ` Stefano Stabellini
2015-10-19 14:57           ` Stefano Stabellini

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=alpine.DEB.2.02.1510201402550.27957@kaball.uk.xensource.com \
    --to=stefano.stabellini@eu.citrix.com \
    --cc=anthony.perard@citrix.com \
    --cc=fabio.fantoni@m2r.biz \
    --cc=jordan.l.justen@intel.com \
    --cc=jsnow@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=lersek@redhat.com \
    --cc=paul.durrant@citrix.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=samuel.thibault@eu.citrix.com \
    --cc=xen-devel@lists.xen.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.