From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sabrina Dubroca Subject: Re: [PATCH] e1000: Avoid that e1000_netpoll() triggers a kernel warning Date: Thu, 9 Apr 2015 21:18:45 +0200 Message-ID: <20150409191845.GA1712@kria> References: <55266885.6010905@sandisk.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Cc: "David S. Miller" , Thomas Gleixner , Peter Zijlstra , netdev@vger.kernel.org To: Bart Van Assche Return-path: Received: from smtp3-g21.free.fr ([212.27.42.3]:49357 "EHLO smtp3-g21.free.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933058AbbDITSz (ORCPT ); Thu, 9 Apr 2015 15:18:55 -0400 Content-Disposition: inline In-Reply-To: <55266885.6010905@sandisk.com> Sender: netdev-owner@vger.kernel.org List-ID: 2015-04-09, 13:54:45 +0200, Bart Van Assche wrote: > console_cont_flush(), which is called by console_unlock(), calls > call_console_drivers() and hence also the netconsole function > write_msg() with local interrupts disabled. This means that it is > not allowed to call disable_irq() from inside a netpoll callback > function. Hence eliminate the disable_irq() / enable_irq() pair > from the e1000 netpoll function. This patch avoids that the e1000 > networking driver triggers the following complaint: > > BUG: sleeping function called from invalid context at kernel/irq/manage.c:104 > > Call Trace: > [] dump_stack+0x4c/0x65 > [] ___might_sleep+0x175/0x230 > [] __might_sleep+0x3a/0xa0 > [] synchronize_irq+0x38/0xa0 > [] disable_irq+0x20/0x30 > [] e1000_netpoll+0x102/0x130 [e1000e] > [] netpoll_poll_dev+0x72/0x350 > [] netpoll_send_skb_on_dev+0x1b9/0x2b0 > [] netpoll_send_udp+0x2c2/0x430 > [] write_msg+0xcf/0x120 [netconsole] > [] call_console_drivers.constprop.25+0xc2/0x250 > [] console_unlock+0x328/0x4c0 > [] vprintk_emit+0x2d0/0x570 > [] vprintk_default+0x1f/0x30 > [] printk+0x46/0x48 > > See also "[RFC PATCH net-next 00/11] net: remove disable_irq() from > ->ndo_poll_controller" (http://thread.gmane.org/gmane.linux.network/342096). That approach was NACKed by David Miller is this exact thread. Peter Zijlstra added disable_hardirq in commit 02cea3958664 ("genirq: Provide disable_hardirq()") and I have prepared patches that use this function in drivers/net, but this commit is not in David Miller's trees yet. Or use Alex's suggestion. -- Sabrina