From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Cc: Steven Noonan <snoonan@amazon.com>,
Ian Campbell <Ian.Campbell@citrix.com>,
Matt Wilson <msw@linux.com>,
xen-devel@lists.xen.org,
Sander Eikelenboom <linux@eikelenboom.it>,
astarta@rat.ru, David Vrabel <david.vrabel@citrix.com>,
Matt Wilson <msw@amazon.com>
Subject: Re: [BUG] Xen vm kernel crash in get_free_entries.
Date: Thu, 28 Nov 2013 22:26:13 -0500 [thread overview]
Message-ID: <20131129032612.GD9322@pegasus.dumpdata.com> (raw)
In-Reply-To: <alpine.DEB.2.02.1311281441480.3198@kaball.uk.xensource.com>
On Thu, Nov 28, 2013 at 02:56:53PM +0000, Stefano Stabellini wrote:
> On Tue, 26 Nov 2013, Konrad Rzeszutek Wilk wrote:
> > On Wed, Nov 13, 2013 at 09:40:58AM +0000, Ian Campbell wrote:
> > > On Tue, 2013-11-12 at 10:56 -0500, Konrad Rzeszutek Wilk wrote:
> > > > On Thu, Nov 07, 2013 at 01:47:03PM +0000, Ian Campbell wrote:
> > > > > On Thu, 2013-11-07 at 09:20 +0400, Astarta wrote:
> > > > > > Hello,
> > > > > >
> > > > > > Let me bring some new life to this discussion.
> > > > > >
> > > > > > I've investigated a bit and found another way to make kernels starting
> > > > > > from 3.8.x to boot on the VMs with platform device_id 0002.
> > > > > > Reverting of xen-grant-table-correctly-initialize-grant-table-version-1
> > > > > > patch is not necessary.
> > > > > >
> > > > > > We can simply modify struct pci_device_id platform_pci_tbl[] (in
> > > > > > drivers/xen/platform-pci.c) to respect 0002 and 0000 device ids.
> > > > > > That makes the kernel (3.8.x and 3.11.6) to boot correctly, disks and
> > > > > > network are also recognized.
> > > > >
> > > > > I think this is just working around the problem, by avoiding the
> > > > > situation where the error occurs. You could just as well switch to
> > > > > platform device id < 2.
> > > >
> > > > I am bit late to this discussion - but shouldn't there be something
> > > > in the kernel to deal with this?
> > >
> > > Well, ideally the kernel wouldn't crash ;-)
> >
> > This patch should solve that (untested, but at least compile tested):
> > Please test it.
> >
> > >From f7d3581aa19a35ea3ff10b965b2b08843e923635 Mon Sep 17 00:00:00 2001
> > From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> > Date: Tue, 26 Nov 2013 15:05:40 -0500
> > Subject: [PATCH] xen/pvhvm: If xen_platform_pci=0 is set don't blow up.
> >
> > *TODO*
> >
> > Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> > ---
> > drivers/block/xen-blkfront.c | 2 +-
> > drivers/input/misc/xen-kbdfront.c | 4 ++++
> > drivers/net/xen-netfront.c | 2 +-
> > drivers/xen/xenbus/xenbus_probe_frontend.c | 2 +-
> > include/xen/platform_pci.h | 13 +++++++++++++
> > 5 files changed, 20 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c
> > index 432db1b..bcbaf0b 100644
> > --- a/drivers/block/xen-blkfront.c
> > +++ b/drivers/block/xen-blkfront.c
> > @@ -2074,7 +2074,7 @@ static int __init xlblk_init(void)
> > if (!xen_domain())
> > return -ENODEV;
> >
> > - if (xen_hvm_domain() && !xen_platform_pci_unplug)
> > + if (xen_err_out())
> > return -ENODEV;
> >
> > if (register_blkdev(XENVBD_MAJOR, DEV_NAME)) {
> > diff --git a/drivers/input/misc/xen-kbdfront.c b/drivers/input/misc/xen-kbdfront.c
> > index e21c181..9d250cf 100644
> > --- a/drivers/input/misc/xen-kbdfront.c
> > +++ b/drivers/input/misc/xen-kbdfront.c
> > @@ -29,6 +29,7 @@
> > #include <xen/interface/io/fbif.h>
> > #include <xen/interface/io/kbdif.h>
> > #include <xen/xenbus.h>
> > +#include <xen/platform_pci.h>
> >
> > struct xenkbd_info {
> > struct input_dev *kbd;
> > @@ -380,6 +381,9 @@ static int __init xenkbd_init(void)
> > if (xen_initial_domain())
> > return -ENODEV;
> >
> > + if (xen_err_out())
> > + return -ENODEV;
>
> Why do we error out here? There is nothing to unplug in this case.
B/c otherwise the driver blows up when it acts on the XenBus and tries
to setup a grant. But the grant is initialized by the xen-platform-pci
which is not run.
>
>
> > return xenbus_register_frontend(&xenkbd_driver);
> > }
> >
> > diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c
> > index e59acb1..be2744b 100644
> > --- a/drivers/net/xen-netfront.c
> > +++ b/drivers/net/xen-netfront.c
> > @@ -2115,7 +2115,7 @@ static int __init netif_init(void)
> > if (!xen_domain())
> > return -ENODEV;
> >
> > - if (xen_hvm_domain() && !xen_platform_pci_unplug)
> > + if (xen_err_out())
> > return -ENODEV;
> >
> > pr_info("Initialising Xen virtual ethernet driver\n");
> > diff --git a/drivers/xen/xenbus/xenbus_probe_frontend.c b/drivers/xen/xenbus/xenbus_probe_frontend.c
> > index 129bf84..b1c0f2a 100644
> > --- a/drivers/xen/xenbus/xenbus_probe_frontend.c
> > +++ b/drivers/xen/xenbus/xenbus_probe_frontend.c
> > @@ -496,7 +496,7 @@ subsys_initcall(xenbus_probe_frontend_init);
> > #ifndef MODULE
> > static int __init boot_wait_for_devices(void)
> > {
> > - if (xen_hvm_domain() && !xen_platform_pci_unplug)
> > + if (xen_err_out())
> > return -ENODEV;
> >
> > ready_to_wait_for_devices = 1;
> > diff --git a/include/xen/platform_pci.h b/include/xen/platform_pci.h
> > index 438c256..a5bbd0b 100644
> > --- a/include/xen/platform_pci.h
> > +++ b/include/xen/platform_pci.h
> > @@ -47,5 +47,18 @@ static inline int xen_must_unplug_disks(void) {
> > }
> >
> > extern int xen_platform_pci_unplug;
> > +static bool xen_err_out(void)
> > +{
>
> static inline
>
>
> > + if (!xen_domain())
> > + return true;
> > +
> > + if (xen_hvm_domain()) {
> > + if (xen_platform_pci_unplug & (XEN_UNPLUG_UNNECESSARY | XEN_UNPLUG_NEVER))
>
> This check wasn't present before and I don't think should be present
> now: xen_platform_pci_unplug cannot be set to XEN_UNPLUG_NEVER, see the
> beginning of xen_unplug_emulated_devices. Also XEN_UNPLUG_UNNECESSARY is
> meant to say that the user knows what she is doing and no unplug is
> necessary to safely use PV drivers, see the commit message of
> 1dc7ce99b091a11cce0f34456c1ffcb928f17edd.
>
>
> > + return true;
> > + if (xen_platform_pci_unplug == 0)
> > + return true;
> > + }
> > + return false;
> > +}
> > #endif /* _XEN_PLATFORM_PCI_H */
>
next prev parent reply other threads:[~2013-11-29 3:26 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-16 6:28 [BUG] Xen vm kernel crash in get_free_entries Astarta
2013-10-16 13:29 ` David Vrabel
2013-10-16 14:17 ` Pasi Kärkkäinen
2013-10-17 8:55 ` Astarta
2013-10-17 19:04 ` Astarta
2013-10-17 19:28 ` Pasi Kärkkäinen
2013-10-18 9:31 ` David Vrabel
2013-10-18 9:46 ` Ian Campbell
2013-10-18 10:31 ` Astarta
2013-10-18 11:34 ` Paul Durrant
2013-10-18 11:06 ` Paul Durrant
2013-10-18 11:08 ` Astarta
2013-10-18 11:27 ` Sander Eikelenboom
2013-10-18 11:33 ` Paul Durrant
2013-10-18 14:15 ` Pasi Kärkkäinen
2013-10-18 14:19 ` Ian Campbell
2013-10-18 14:27 ` Pasi Kärkkäinen
2013-10-18 23:14 ` Sander Eikelenboom
2013-10-19 10:51 ` Astarta
2013-10-19 11:03 ` Ian Campbell
2013-10-19 11:58 ` Sander Eikelenboom
2013-10-21 10:55 ` Matt Wilson
2013-11-07 5:20 ` Astarta
2013-11-07 13:47 ` Ian Campbell
2013-11-12 15:56 ` Konrad Rzeszutek Wilk
2013-11-13 9:40 ` Ian Campbell
2013-11-13 12:39 ` Ian Campbell
2013-11-26 20:08 ` Konrad Rzeszutek Wilk
2013-11-26 22:00 ` Sander Eikelenboom
2013-11-26 22:15 ` Sander Eikelenboom
2013-11-26 22:55 ` Sander Eikelenboom
2013-11-26 23:05 ` Konrad Rzeszutek Wilk
2013-11-26 23:14 ` Sander Eikelenboom
2013-11-27 9:36 ` Ian Campbell
2013-11-27 14:24 ` Konrad Rzeszutek Wilk
2013-11-27 15:58 ` Ian Campbell
2013-11-27 16:40 ` Konrad Rzeszutek Wilk
2013-11-28 14:56 ` Stefano Stabellini
2013-11-29 3:26 ` Konrad Rzeszutek Wilk [this message]
2013-11-29 11:54 ` Stefano Stabellini
2013-12-09 12:57 ` Sander Eikelenboom
2013-12-10 15:07 ` Konrad Rzeszutek Wilk
2013-10-21 10:29 ` Matt Wilson
2013-10-21 10:46 ` David Vrabel
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=20131129032612.GD9322@pegasus.dumpdata.com \
--to=konrad.wilk@oracle.com \
--cc=Ian.Campbell@citrix.com \
--cc=astarta@rat.ru \
--cc=david.vrabel@citrix.com \
--cc=linux@eikelenboom.it \
--cc=msw@amazon.com \
--cc=msw@linux.com \
--cc=snoonan@amazon.com \
--cc=stefano.stabellini@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 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).