From: Pasi =?iso-8859-1?Q?K=E4rkk=E4inen?= Subject: Re: [PATCH]: Fix some bugs in usbfront Date: Sat, 13 Mar 2010 00:42:01 +0200 Message-ID: <20100312224201.GN1878@reaktio.net> References: <4B9A24A1020000300008129C@sinclair.provo.novell.com> <20100312223035.GM1878@reaktio.net> <4B9A5EE80200003000081303@sinclair.provo.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Return-path: Content-Disposition: inline In-Reply-To: <4B9A5EE80200003000081303@sinclair.provo.novell.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Ky Srinivasan Cc: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org On Fri, Mar 12, 2010 at 03:34:00PM -0700, Ky Srinivasan wrote: >=20 >=20 > >>> On 3/12/2010 at 5:30 PM, in message <20100312223035.GM1878@reaktio= .net>, Pasi > K=E4rkk=E4inen wrote:=20 > > On Fri, Mar 12, 2010 at 11:25:21AM -0700, Ky Srinivasan wrote: > >> The attached patch fixes some bugs in usbfront. > >>=20 > >=20 > > What kernel version is this patch against? linux-2.6.18-xen?=20 >=20 > Once again this patch is against 2.6.32 kernel (sles11 sp1).=20 > Sorry for not making this clear in the patch. Ok.=20 Does the SLES11 2.6.27 kernel-xen have usbback/usbfront?=20 How about the opensuse kernel-xen versions?=20 I can add the info to: http://wiki.xensource.com/xenwiki/XenUSBPassthrough -- Pasi >=20 > Regards, > K. Y > > -- Pasi > >=20 > >> Signed-off-by: K. Y. Srinivasan > >>=20 > >>=20 > >>=20 > >>=20 > >=20 > >> Bug#584218: Fix a scheduling race in usbfront. Create the thread on= ly after=20 > > we=20 > >> are connected. The current code schedules the thread at a point wher= e the=20 > >> communication rings are not initialized yet. > >>=20 > >> Signed-off-by: K. Y. Srinivasan > >>=20 > >> Index: linux/drivers/xen/usbfront/xenbus.c > >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > >> --- linux.orig/drivers/xen/usbfront/xenbus.c 2010-03-10 12:10:58.000= 000000 -0700 > >> +++ linux/drivers/xen/usbfront/xenbus.c 2010-03-10 12:17:24.00000000= 0 -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 =3D info_to_hcd(info); > >> + snprintf(name, TASK_COMM_LEN, "xenhcd.%d", hcd->self.busnum); > >> =20 > >> err =3D talk_to_backend(dev, info); > >> if (err) > >> return err; > >> =20 > >> + info->kthread =3D kthread_run(xenhcd_schedule, info, name); > >> + if (IS_ERR(info->kthread)) { > >> + err =3D PTR_ERR(info->kthread); > >> + info->kthread =3D NULL; > >> + xenbus_dev_fatal(dev, err, "Error creating thread"); > >> + return err; > >> + } > >> /* prepare ring for hotplug notification */ > >> for (idx =3D 0, i =3D 0; i < USB_CONN_RING_SIZE; i++) { > >> req =3D 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]; > >> =20 > >> if (usb_disabled()) > >> return -ENODEV; > >> @@ -298,13 +309,6 @@ static int usbfront_probe(struct xenbus_ > >> } > >> =20 > >> init_waitqueue_head(&info->wq); > >> - snprintf(name, TASK_COMM_LEN, "xenhcd.%d", hcd->self.busnum); > >> - info->kthread =3D kthread_run(xenhcd_schedule, info, name); > >> - if (IS_ERR(info->kthread)) { > >> - err =3D PTR_ERR(info->kthread); > >> - info->kthread =3D NULL; > >> - goto fail; > >> - } > >> =20 > >> return 0; > >> =20 > >> @@ -343,8 +347,8 @@ static void backend_changed(struct xenbu > >> case XenbusStateInitWait: > >> if (dev->state !=3D XenbusStateInitialising) > >> break; > >> - connect(dev); > >> - xenbus_switch_state(dev, XenbusStateConnected); > >> + if (!connect(dev)) > >> + xenbus_switch_state(dev, XenbusStateConnected); > >> break; > >> =20 > >> case XenbusStateClosing: > >=20 > >> _______________________________________________ > >> Xen-devel mailing list > >> Xen-devel@lists.xensource.com > >> http://lists.xensource.com/xen-devel >=20