Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3120862pxk; Mon, 21 Sep 2020 05:55:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyh3A2SURgRbBlCQx2eal3OE4ViXshFnpyXbXLsPByw2MDh2mt3rOMS95Z0/i/XKsWByiMj X-Received: by 2002:a05:6402:304f:: with SMTP id bu15mr52921561edb.201.1600692924488; Mon, 21 Sep 2020 05:55:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600692924; cv=none; d=google.com; s=arc-20160816; b=ucMEnuXBAUxVUQ8F+uIiu9r5FVbWzHMY2Ue7Vdzv018jpbv7XJQanc7OXPAJ1Jrl+V 5gaQacLKRLCrOGi2wynxJjPTzs8dLg/imY+Ut7xVIkkQRVuVfpAm7qFpmuTZBY1u1y+/ vFYwTEYokMam46U+/z/8qmXBegve1eLLU4TRRIMhUSTHM4nk/bXaundk0XN44chyv2Yt UhUmDn+yDLePU0fIyqpPBOFO0qnTOHjscIDh4ANij0blf295vehA6mQciKs3Zn76+Xa0 pz0iFkJu9JgItSDpNw8zImwitaJvhTRQenb2rTwOfZkHs+h/OMuUEj7Cc6M4rPW3pb3M S5mQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=lCipQGqQ4A+/SH7bGJCk74LF90pNCAhVS/HQ73NnhmY=; b=xYKgO2PrUg9hLQS62XJa0FheTyVPBMxdCNNjH/KuUkXv9vmA1ufOFEuMKKAuKOub7s /RSUCcmr/3pL6rmECuHlbIfSCaybSvYU6DE7F/IU6a0kNhayoIKRc9JQRFbcF4SeSiuH HSqQJoNACIwbvc9rsK/02zMiUlFBABklMazk/QqS8PT6EVFkPyq82FERGorzr6Vit9Zl LxJ7cizEwZEmazSUNo2bNSi+Fe+tUq6DuCm2hqvCJkZgFulwQCQEFY1I3stcCnbMtdCn WQNL7MP2ZM/mcGGOTuFSMAcj6Cg74/4QnaUdbXtkcS9ipEWPnAs2FqYmy/M2x3HGmHj2 rDrw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f17si7984746edq.587.2020.09.21.05.55.01; Mon, 21 Sep 2020 05:55:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726696AbgIUMwk (ORCPT + 99 others); Mon, 21 Sep 2020 08:52:40 -0400 Received: from jabberwock.ucw.cz ([46.255.230.98]:47126 "EHLO jabberwock.ucw.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726395AbgIUMwk (ORCPT ); Mon, 21 Sep 2020 08:52:40 -0400 Received: by jabberwock.ucw.cz (Postfix, from userid 1017) id A60241C0B81; Mon, 21 Sep 2020 14:52:37 +0200 (CEST) Date: Mon, 21 Sep 2020 14:52:37 +0200 From: Pavel Machek To: Oliver Neukum Cc: Pavel Machek , gregkh@linuxfoundation.org, stern@rowland.harvard.edu, johan@kernel.org, gustavoars@kernel.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] usb: yurex: Rearrange code not to need GFP_ATOMIC Message-ID: <20200921125237.GA24776@duo.ucw.cz> References: <20200920084452.GA2257@amd> <1600691092.2424.85.camel@suse.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="FL5UXtIhxfXey3p5" Content-Disposition: inline In-Reply-To: <1600691092.2424.85.camel@suse.com> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --FL5UXtIhxfXey3p5 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi! > > Move prepare to wait around, so that normal GFP_KERNEL allocation can > > be used. > >=20 > > Signed-off-by: Pavel Machek (CIP) > > Acked-by: Alan Stern >=20 > Ehm. Please recheck. Sorry about that. > > +++ b/drivers/usb/misc/yurex.c > > @@ -489,10 +489,10 @@ static ssize_t yurex_write(struct file *file, con= st char __user *user_buffer, > > } > > =20 > > /* send the data as the control msg */ > > - prepare_to_wait(&dev->waitq, &wait, TASK_INTERRUPTIBLE); > > dev_dbg(&dev->interface->dev, "%s - submit %c\n", __func__, > > dev->cntl_buffer[0]); > > - retval =3D usb_submit_urb(dev->cntl_urb, GFP_ATOMIC); > > + retval =3D usb_submit_urb(dev->cntl_urb, GFP_KERNEL); >=20 > URB completes here. wake_up() returns the task to RUNNING. >=20 > > + prepare_to_wait(&dev->waitq, &wait, TASK_INTERRUPTIBLE); >=20 > Task goes to TASK_INTERRUPTIBLE >=20 > > if (retval >=3D 0) > > timeout =3D schedule_timeout(YUREX_WRITE_TIMEOUT); >=20 > Task turns into Sleeping Beauty until timeout Is there way to do the allocations for submit_urb before the prepare_to_wait? GFP_ATOMIC would be nice to avoid... and doing GFP_ATOMIC from normal process context just because of task_state seems ... wrong. Pavel --=20 DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany --FL5UXtIhxfXey3p5 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABECAB0WIQRPfPO7r0eAhk010v0w5/Bqldv68gUCX2iiFQAKCRAw5/Bqldv6 8tnrAJ4yv71+Q+P6ArjsrTPlDQ7nQ+QIrQCdHjymlZ8hQ7EqYgentvBFzwxh0s0= =RmqP -----END PGP SIGNATURE----- --FL5UXtIhxfXey3p5--