From mboxrd@z Thu Jan 1 00:00:00 1970 From: Neil Horman Subject: Re: [PATCH RFC] spinlock: split out debugging check from spin_lock_mutex Date: Thu, 11 Apr 2013 12:56:30 -0400 Message-ID: <20130411165630.GD8986@neilslaptop.think-freely.org> References: <5166BDAA.3000603@acm.org> <1365693486-6315-1-git-send-email-nhorman@tuxdriver.com> <1365695821.3887.167.camel@edumazet-glaptop> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Bart Van Assche , David Miller , netdev@vger.kernel.org To: Eric Dumazet Return-path: Received: from charlotte.tuxdriver.com ([70.61.120.58]:56917 "EHLO smtp.tuxdriver.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935226Ab3DKQ4q (ORCPT ); Thu, 11 Apr 2013 12:56:46 -0400 Content-Disposition: inline In-Reply-To: <1365695821.3887.167.camel@edumazet-glaptop> Sender: netdev-owner@vger.kernel.org List-ID: On Thu, Apr 11, 2013 at 08:57:01AM -0700, Eric Dumazet wrote: > On Thu, 2013-04-11 at 11:18 -0400, Neil Horman wrote: > > Bart, this patch should fix your problem. Could you please test it and confirm? > > > > Bart Van Assche recently reported a warning to me: > > > > [] warn_slowpath_common+0x7f/0xc0 > > [] warn_slowpath_null+0x1a/0x20 > > [] mutex_trylock+0x16d/0x180 > > [] netpoll_poll_dev+0x49/0xc30 > > [] ? __alloc_skb+0x82/0x2a0 > > [] netpoll_send_skb_on_dev+0x265/0x410 > > [] netpoll_send_udp+0x28a/0x3a0 > > [] ? write_msg+0x53/0x110 [netconsole] > > [] write_msg+0xcf/0x110 [netconsole] > > [] call_console_drivers.constprop.17+0xa1/0x1c0 > > [] console_unlock+0x2d6/0x450 > > [] vprintk_emit+0x1ee/0x510 > > [] printk+0x4d/0x4f > > [] scsi_print_command+0x7d/0xe0 [scsi_mod] > > > > This resulted from my commit ca99ca14c which introduced a mutex_trylock > > operation in a path that could execute in interrupt context. When mutex > > debugging is enabled, the above warns the user when we are in fact exectuting in > > interrupt context. > > > > I think this is a false positive however. The check is intended to catch users > > who might be issuing sleeping calls in irq context, but the use of mutex_trylock > > here is guaranteed not to sleep. > > > > We could fix this by replacing the DEBUG_LOCK_WARN_ON check in spin_lock_mutex > > with a __might_sleep call in the appropriate parent mutex operations, but for > > the sake of effiency (which It seems is why the check was put in the spin lock > > code only when debug is enabled), lets split the spin_lock_mutex call into two > > components, where the outer component does the debug checking. Then > > mutex_trylock can just call the inner part as its callable from irq context > > safely. > > > > Signed-off-by: Neil Horman > > Reported-by: Bart Van Assche > > CC: Bart Van Assche > > CC: David Miller > > CC: netdev@vger.kernel.org > > Please post your patch to lkml ? > I will, I just wanted Bart to test it first, and CCed everyone that he sent his origional note too. Thanks Neil > Thanks ! > > >