Date: Tue, 14 Jan 2014 16:49:22 +0000 From: Julien Grall <julien.grall@linaro.org> To: =?UTF-8?B?Um9nZXIgUGF1IE1vbm7DqQ==?= <roger.pau@citrix.com> Cc: xen-devel@lists.xen.org, Julien Grall <julien.grall@citrix.com>, freebsd-xen@freebsd.org, freebsd-current@freebsd.org, kib@freebsd.org, gibbs@freebsd.org Subject: Re: [PATCH v10 14/20] xen: introduce xenpv bus and a dummy pvcpu device Message-ID: <52D56A92.4070100@linaro.org> In-Reply-To: <52D563DE.1020207@citrix.com> References: <1389711582-66908-1-git-send-email-roger.pau@citrix.com> <1389711582-66908-15-git-send-email-roger.pau@citrix.com> <52D55AB4.4010504@linaro.org> <52D560EB.8040108@citrix.com> <52D5625D.7030702@citrix.com> <52D563DE.1020207@citrix.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On 01/14/2014 04:20 PM, Roger Pau Monné wrote: > On 14/01/14 17:14, Julien Grall wrote: >> On 01/14/2014 04:08 PM, Roger Pau Monné wrote: >>> On 14/01/14 16:41, Julien Grall wrote: >>>> On 01/14/2014 02:59 PM, Roger Pau Monne wrote: >>>>> +static int >>>>> +xenpv_attach(device_t dev) >>>>> +{ >>>>> + device_t child; >>>>> + >>>>> + if (xen_hvm_domain()) { >>>>> + device_t xenpci; >>>>> + devclass_t dc; >>>>> + >>>>> + /* Make sure xenpci has been attached */ >>>>> + dc = devclass_find("xenpci"); >>>>> + if (dc == NULL) >>>>> + panic("unable to find xenpci devclass"); >>>>> + >>>>> + xenpci = devclass_get_device(dc, 0); >>>>> + if (xenpci == NULL) >>>>> + panic("unable to find xenpci device"); >>>>> + >>>>> + if (!device_is_attached(xenpci)) >>>>> + panic("trying to attach xenpv before xenpci"); >>>>> + } >>>> >>>> Can you use the identify method to add the xenpci device? >>> >>> I don't think so, xenpci is a pci device, it is detected and plugged by >>> the pci bus code. >> >> Oups, I though you are trying to add the device. In this case, the check >> seems pointless. In which case the xenpci couldn't exist? > > It's just a "belt and suspenders", if we attach the xenpv bus without > xenpci being attached first a bunch of things are going to fail, I > though it might be best to print a clear error message about what went > wrong in order to help debug it. I only see one place which could failed, and we are already protected. It's when we are trying to allocate space from grant-table via xenpci_alloc_space. I think this error should be enough to understand the problem. At the same time, it's the same things with xenstore. If grant-table initialization has failed, an error message is just printed and FreeBSD will likely failed later when it will try to initialized the PV disk. -- Julien Grall
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?52D56A92.4070100>