The attached patch fixes some bugs in usbfront. Signed-off-by: K. Y. Srinivasan <ksrinivasan@novell.com> _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
On Fri, Mar 12, 2010 at 11:25:21AM -0700, Ky Srinivasan wrote:> The attached patch fixes some bugs in usbfront. >What kernel version is this patch against? linux-2.6.18-xen? -- Pasi> Signed-off-by: K. Y. Srinivasan <ksrinivasan@novell.com> > > > >> Bug#584218: Fix a scheduling race in usbfront. Create the thread only after we > are connected. The current code schedules the thread at a point where the > communication rings are not initialized yet. > > Signed-off-by: K. Y. Srinivasan <ksrinivasan@novell.com> > > Index: linux/drivers/xen/usbfront/xenbus.c > ==================================================================> --- linux.orig/drivers/xen/usbfront/xenbus.c 2010-03-10 12:10:58.000000000 -0700 > +++ linux/drivers/xen/usbfront/xenbus.c 2010-03-10 12:17:24.000000000 -0700 > @@ -192,11 +192,23 @@ static int connect(struct xenbus_device > usbif_conn_request_t *req; > int i, idx, err; > int notify; > + char name[TASK_COMM_LEN]; > + struct usb_hcd *hcd; > + > + hcd = info_to_hcd(info); > + snprintf(name, TASK_COMM_LEN, "xenhcd.%d", hcd->self.busnum); > > err = talk_to_backend(dev, info); > if (err) > return err; > > + info->kthread = kthread_run(xenhcd_schedule, info, name); > + if (IS_ERR(info->kthread)) { > + err = PTR_ERR(info->kthread); > + info->kthread = NULL; > + xenbus_dev_fatal(dev, err, "Error creating thread"); > + return err; > + } > /* prepare ring for hotplug notification */ > for (idx = 0, i = 0; i < USB_CONN_RING_SIZE; i++) { > req = RING_GET_REQUEST(&info->conn_ring, idx); > @@ -274,7 +286,6 @@ static int usbfront_probe(struct xenbus_ > int err; > struct usb_hcd *hcd; > struct usbfront_info *info; > - char name[TASK_COMM_LEN]; > > if (usb_disabled()) > return -ENODEV; > @@ -298,13 +309,6 @@ static int usbfront_probe(struct xenbus_ > } > > init_waitqueue_head(&info->wq); > - snprintf(name, TASK_COMM_LEN, "xenhcd.%d", hcd->self.busnum); > - info->kthread = kthread_run(xenhcd_schedule, info, name); > - if (IS_ERR(info->kthread)) { > - err = PTR_ERR(info->kthread); > - info->kthread = NULL; > - goto fail; > - } > > return 0; > > @@ -343,8 +347,8 @@ static void backend_changed(struct xenbu > case XenbusStateInitWait: > if (dev->state != XenbusStateInitialising) > break; > - connect(dev); > - xenbus_switch_state(dev, XenbusStateConnected); > + if (!connect(dev)) > + xenbus_switch_state(dev, XenbusStateConnected); > break; > > case XenbusStateClosing:> _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xensource.com > http://lists.xensource.com/xen-devel_______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
>>> On 3/12/2010 at 5:30 PM, in message <20100312223035.GM1878@reaktio.net>, PasiKärkkäinen<pasik@iki.fi> wrote:> On Fri, Mar 12, 2010 at 11:25:21AM -0700, Ky Srinivasan wrote: >> The attached patch fixes some bugs in usbfront. >> > > What kernel version is this patch against? linux-2.6.18-xen?Once again this patch is against 2.6.32 kernel (sles11 sp1). Sorry for not making this clear in the patch. Regards, K. Y> -- Pasi > >> Signed-off-by: K. Y. Srinivasan <ksrinivasan@novell.com> >> >> >> >> > >> Bug#584218: Fix a scheduling race in usbfront. Create the thread only after > we >> are connected. The current code schedules the thread at a point where the >> communication rings are not initialized yet. >> >> Signed-off-by: K. Y. Srinivasan <ksrinivasan@novell.com> >> >> Index: linux/drivers/xen/usbfront/xenbus.c >> ==================================================================>> --- linux.orig/drivers/xen/usbfront/xenbus.c 2010-03-10 12:10:58.000000000 -0700 >> +++ linux/drivers/xen/usbfront/xenbus.c 2010-03-10 12:17:24.000000000 -0700 >> @@ -192,11 +192,23 @@ static int connect(struct xenbus_device >> usbif_conn_request_t *req; >> int i, idx, err; >> int notify; >> + char name[TASK_COMM_LEN]; >> + struct usb_hcd *hcd; >> + >> + hcd = info_to_hcd(info); >> + snprintf(name, TASK_COMM_LEN, "xenhcd.%d", hcd->self.busnum); >> >> err = talk_to_backend(dev, info); >> if (err) >> return err; >> >> + info->kthread = kthread_run(xenhcd_schedule, info, name); >> + if (IS_ERR(info->kthread)) { >> + err = PTR_ERR(info->kthread); >> + info->kthread = NULL; >> + xenbus_dev_fatal(dev, err, "Error creating thread"); >> + return err; >> + } >> /* prepare ring for hotplug notification */ >> for (idx = 0, i = 0; i < USB_CONN_RING_SIZE; i++) { >> req = RING_GET_REQUEST(&info->conn_ring, idx); >> @@ -274,7 +286,6 @@ static int usbfront_probe(struct xenbus_ >> int err; >> struct usb_hcd *hcd; >> struct usbfront_info *info; >> - char name[TASK_COMM_LEN]; >> >> if (usb_disabled()) >> return -ENODEV; >> @@ -298,13 +309,6 @@ static int usbfront_probe(struct xenbus_ >> } >> >> init_waitqueue_head(&info->wq); >> - snprintf(name, TASK_COMM_LEN, "xenhcd.%d", hcd->self.busnum); >> - info->kthread = kthread_run(xenhcd_schedule, info, name); >> - if (IS_ERR(info->kthread)) { >> - err = PTR_ERR(info->kthread); >> - info->kthread = NULL; >> - goto fail; >> - } >> >> return 0; >> >> @@ -343,8 +347,8 @@ static void backend_changed(struct xenbu >> case XenbusStateInitWait: >> if (dev->state != XenbusStateInitialising) >> break; >> - connect(dev); >> - xenbus_switch_state(dev, XenbusStateConnected); >> + if (!connect(dev)) >> + xenbus_switch_state(dev, XenbusStateConnected); >> break; >> >> case XenbusStateClosing: > >> _______________________________________________ >> Xen-devel mailing list >> Xen-devel@lists.xensource.com >> http://lists.xensource.com/xen-devel_______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
On Fri, Mar 12, 2010 at 03:34:00PM -0700, Ky Srinivasan wrote:> > > >>> On 3/12/2010 at 5:30 PM, in message <20100312223035.GM1878@reaktio.net>, Pasi > Kärkkäinen<pasik@iki.fi> wrote: > > On Fri, Mar 12, 2010 at 11:25:21AM -0700, Ky Srinivasan wrote: > >> The attached patch fixes some bugs in usbfront. > >> > > > > What kernel version is this patch against? linux-2.6.18-xen? > > Once again this patch is against 2.6.32 kernel (sles11 sp1). > Sorry for not making this clear in the patch.Ok. Does the SLES11 2.6.27 kernel-xen have usbback/usbfront? How about the opensuse kernel-xen versions? I can add the info to: http://wiki.xensource.com/xenwiki/XenUSBPassthrough -- Pasi> > Regards, > K. Y > > -- Pasi > > > >> Signed-off-by: K. Y. Srinivasan <ksrinivasan@novell.com> > >> > >> > >> > >> > > > >> Bug#584218: Fix a scheduling race in usbfront. Create the thread only after > > we > >> are connected. The current code schedules the thread at a point where the > >> communication rings are not initialized yet. > >> > >> Signed-off-by: K. Y. Srinivasan <ksrinivasan@novell.com> > >> > >> Index: linux/drivers/xen/usbfront/xenbus.c > >> ==================================================================> >> --- linux.orig/drivers/xen/usbfront/xenbus.c 2010-03-10 12:10:58.000000000 -0700 > >> +++ linux/drivers/xen/usbfront/xenbus.c 2010-03-10 12:17:24.000000000 -0700 > >> @@ -192,11 +192,23 @@ static int connect(struct xenbus_device > >> usbif_conn_request_t *req; > >> int i, idx, err; > >> int notify; > >> + char name[TASK_COMM_LEN]; > >> + struct usb_hcd *hcd; > >> + > >> + hcd = info_to_hcd(info); > >> + snprintf(name, TASK_COMM_LEN, "xenhcd.%d", hcd->self.busnum); > >> > >> err = talk_to_backend(dev, info); > >> if (err) > >> return err; > >> > >> + info->kthread = kthread_run(xenhcd_schedule, info, name); > >> + if (IS_ERR(info->kthread)) { > >> + err = PTR_ERR(info->kthread); > >> + info->kthread = NULL; > >> + xenbus_dev_fatal(dev, err, "Error creating thread"); > >> + return err; > >> + } > >> /* prepare ring for hotplug notification */ > >> for (idx = 0, i = 0; i < USB_CONN_RING_SIZE; i++) { > >> req = RING_GET_REQUEST(&info->conn_ring, idx); > >> @@ -274,7 +286,6 @@ static int usbfront_probe(struct xenbus_ > >> int err; > >> struct usb_hcd *hcd; > >> struct usbfront_info *info; > >> - char name[TASK_COMM_LEN]; > >> > >> if (usb_disabled()) > >> return -ENODEV; > >> @@ -298,13 +309,6 @@ static int usbfront_probe(struct xenbus_ > >> } > >> > >> init_waitqueue_head(&info->wq); > >> - snprintf(name, TASK_COMM_LEN, "xenhcd.%d", hcd->self.busnum); > >> - info->kthread = kthread_run(xenhcd_schedule, info, name); > >> - if (IS_ERR(info->kthread)) { > >> - err = PTR_ERR(info->kthread); > >> - info->kthread = NULL; > >> - goto fail; > >> - } > >> > >> return 0; > >> > >> @@ -343,8 +347,8 @@ static void backend_changed(struct xenbu > >> case XenbusStateInitWait: > >> if (dev->state != XenbusStateInitialising) > >> break; > >> - connect(dev); > >> - xenbus_switch_state(dev, XenbusStateConnected); > >> + if (!connect(dev)) > >> + xenbus_switch_state(dev, XenbusStateConnected); > >> break; > >> > >> case XenbusStateClosing: > > > >> _______________________________________________ > >> Xen-devel mailing list > >> Xen-devel@lists.xensource.com > >> http://lists.xensource.com/xen-devel >_______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
>>> On 3/12/2010 at 5:42 PM, in message <20100312224201.GN1878@reaktio.net>, PasiKärkkäinen<pasik@iki.fi> wrote:> On Fri, Mar 12, 2010 at 03:34:00PM -0700, Ky Srinivasan wrote: >> >> >> >>> On 3/12/2010 at 5:30 PM, in message <20100312223035.GM1878@reaktio.net>, > Pasi >> Kärkkäinen<pasik@iki.fi> wrote: >> > On Fri, Mar 12, 2010 at 11:25:21AM -0700, Ky Srinivasan wrote: >> >> The attached patch fixes some bugs in usbfront. >> >> >> > >> > What kernel version is this patch against? linux-2.6.18-xen? >> >> Once again this patch is against 2.6.32 kernel (sles11 sp1). >> Sorry for not making this clear in the patch. > > Ok. > > Does the SLES11 2.6.27 kernel-xen have usbback/usbfront? > How about the opensuse kernel-xen versions?Well, PV USB will be supported in sles11 sp1. I am not sure what the plans are for other versions.> > I can add the info to: > http://wiki.xensource.com/xenwiki/XenUSBPassthroughThat will be good. Thanks, K. Y> > -- Pasi > >> >> Regards, >> K. Y >> > -- Pasi >> > >> >> Signed-off-by: K. Y. Srinivasan <ksrinivasan@novell.com> >> >> >> >> >> >> >> >> >> > >> >> Bug#584218: Fix a scheduling race in usbfront. Create the thread only > after >> > we >> >> are connected. The current code schedules the thread at a point where the >> >> communication rings are not initialized yet. >> >> >> >> Signed-off-by: K. Y. Srinivasan <ksrinivasan@novell.com> >> >> >> >> Index: linux/drivers/xen/usbfront/xenbus.c >> >> ==================================================================>> >> --- linux.orig/drivers/xen/usbfront/xenbus.c 2010-03-10 12:10:58.000000000 -0700 >> >> +++ linux/drivers/xen/usbfront/xenbus.c 2010-03-10 12:17:24.000000000 -0700 >> >> @@ -192,11 +192,23 @@ static int connect(struct xenbus_device >> >> usbif_conn_request_t *req; >> >> int i, idx, err; >> >> int notify; >> >> + char name[TASK_COMM_LEN]; >> >> + struct usb_hcd *hcd; >> >> + >> >> + hcd = info_to_hcd(info); >> >> + snprintf(name, TASK_COMM_LEN, "xenhcd.%d", hcd->self.busnum); >> >> >> >> err = talk_to_backend(dev, info); >> >> if (err) >> >> return err; >> >> >> >> + info->kthread = kthread_run(xenhcd_schedule, info, name); >> >> + if (IS_ERR(info->kthread)) { >> >> + err = PTR_ERR(info->kthread); >> >> + info->kthread = NULL; >> >> + xenbus_dev_fatal(dev, err, "Error creating thread"); >> >> + return err; >> >> + } >> >> /* prepare ring for hotplug notification */ >> >> for (idx = 0, i = 0; i < USB_CONN_RING_SIZE; i++) { >> >> req = RING_GET_REQUEST(&info->conn_ring, idx); >> >> @@ -274,7 +286,6 @@ static int usbfront_probe(struct xenbus_ >> >> int err; >> >> struct usb_hcd *hcd; >> >> struct usbfront_info *info; >> >> - char name[TASK_COMM_LEN]; >> >> >> >> if (usb_disabled()) >> >> return -ENODEV; >> >> @@ -298,13 +309,6 @@ static int usbfront_probe(struct xenbus_ >> >> } >> >> >> >> init_waitqueue_head(&info->wq); >> >> - snprintf(name, TASK_COMM_LEN, "xenhcd.%d", hcd->self.busnum); >> >> - info->kthread = kthread_run(xenhcd_schedule, info, name); >> >> - if (IS_ERR(info->kthread)) { >> >> - err = PTR_ERR(info->kthread); >> >> - info->kthread = NULL; >> >> - goto fail; >> >> - } >> >> >> >> return 0; >> >> >> >> @@ -343,8 +347,8 @@ static void backend_changed(struct xenbu >> >> case XenbusStateInitWait: >> >> if (dev->state != XenbusStateInitialising) >> >> break; >> >> - connect(dev); >> >> - xenbus_switch_state(dev, XenbusStateConnected); >> >> + if (!connect(dev)) >> >> + xenbus_switch_state(dev, XenbusStateConnected); >> >> break; >> >> >> >> case XenbusStateClosing: >> > >> >> _______________________________________________ >> >> Xen-devel mailing list >> >> Xen-devel@lists.xensource.com >> >> http://lists.xensource.com/xen-devel >>_______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel