Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754621Ab3EMPEV (ORCPT ); Mon, 13 May 2013 11:04:21 -0400 Received: from cantor2.suse.de ([195.135.220.15]:54471 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751697Ab3EMPET (ORCPT ); Mon, 13 May 2013 11:04:19 -0400 Date: Mon, 13 May 2013 17:04:15 +0200 Message-ID: From: Takashi Iwai To: Ming Lei Cc: linux-kernel@vger.kernel.org, Greg Kroah-Hartman Subject: Re: [PATCH 1/3] firmware: Avoid superfluous usermodehelper lock In-Reply-To: References: <1367996197-32748-1-git-send-email-tiwai@suse.de> <1367996197-32748-2-git-send-email-tiwai@suse.de> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 Emacs/24.2 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2333 Lines: 63 At Sun, 12 May 2013 21:59:51 +0800, Ming Lei wrote: > > On Thu, May 9, 2013 at 1:51 AM, Takashi Iwai wrote: > > > > --- > > From: Takashi Iwai > > Subject: [PATCH v2] firmware: Avoid deadlock of usermodehelper lock at shutdown > > > > When a system goes to reboot/shutdown, it tries to disable the > > usermode helper via usermodehelper_disable(). This might be blocked > > when a driver tries to load a firmware beforehand and it's stuck by > > some reason. > > > > In this patch, the firmware class driver registers a reboot notifier > > so that it can abort all pending f/w bufs. Also enable a flag for > > avoiding the call of usermodehelper after the reboot/shutdown starts. > > > > Signed-off-by: Takashi Iwai > > --- > > drivers/base/firmware_class.c | 40 +++++++++++++++++++++++++++++++++------- > > 1 file changed, 33 insertions(+), 7 deletions(-) > > > > diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c > > index 4b1f926..972e535 100644 > > --- a/drivers/base/firmware_class.c > > +++ b/drivers/base/firmware_class.c > > @@ -27,6 +27,7 @@ > > #include > > #include > > #include > > +#include > > > > #include > > > > @@ -171,6 +172,7 @@ static struct firmware_buf *__allocate_fw_buf(const char *fw_name, > > strcpy(buf->fw_id, fw_name); > > buf->fwc = fwc; > > init_completion(&buf->completion); > > + INIT_LIST_HEAD(&buf->list); > > You should introduce one extra field(such as, 'list_abort') in > 'struct firmware_buf' and the field of 'list' is for firmware caching now. Yeah, the current code messes it up. Sorry for not resending the right version. I thought it won't conflict but it seems it doesn't work as is. (At least, list_add() would need to be replaced with list_move()). > Also, INIT_LIST_HEAD isn't needed here. Well, I'd recommend to avoid such a mini optimization unless it's really a hot path. It may bite you in the end... thanks, Takashi -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/