From: "Ky Srinivasan" Subject: Re: [PATCH]: Fix some bugs in usbfront Date: Fri, 12 Mar 2010 15:51:09 -0700 Message-ID: <4B9A62ED0200003000081308@sinclair.provo.novell.com> References: <4B9A24A1020000300008129C@sinclair.provo.novell.com> <20100312223035.GM1878@reaktio.net> <4B9A5EE80200003000081303@sinclair.provo.novell.com> <20100312224201.GN1878@reaktio.net> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Return-path: In-Reply-To: <20100312224201.GN1878@reaktio.net> Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: =?UTF-8?B?UGFzaSBLw6Rya2vDpGluZW4=?= Cc: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org >>> On 3/12/2010 at 5:42 PM, in message <20100312224201.GN1878@reaktio.n= et>, Pasi K=C3=A4rkk=C3=A4inen wrote:=20 > 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@reakti= o.net>,=20 > Pasi >> K=C3=A4rkk=C3=A4inen 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. >=20 > Ok.=20 >=20 > Does the SLES11 2.6.27 kernel-xen have usbback/usbfront?=20 > How about the opensuse kernel-xen versions?=20 Well, PV USB will be supported in sles11 sp1. I am not sure what the plan= s are for other versions. >=20 > I can add the info to: > http://wiki.xensource.com/xenwiki/XenUSBPassthrough That will be good.=20 Thanks, K. Y >=20 > -- Pasi >=20 >>=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 o= nly=20 > after=20 >> > we=20 >> >> are connected. The current code schedules the thread at a point whe= re 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.00= 0000000 -0700 >> >> +++ linux/drivers/xen/usbfront/xenbus.c 2010-03-10 12:17:24.0000000= 00 -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