From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933778AbcLGXPp (ORCPT ); Wed, 7 Dec 2016 18:15:45 -0500 Received: from violet.fr.zoreil.com ([92.243.8.30]:34176 "EHLO violet.fr.zoreil.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932141AbcLGXPn (ORCPT ); Wed, 7 Dec 2016 18:15:43 -0500 Date: Thu, 8 Dec 2016 00:15:34 +0100 From: Francois Romieu To: Lino Sanfilippo Cc: bh74.an@samsung.com, ks.giri@samsung.com, vipul.pandya@samsung.com, peppe.cavallaro@st.com, alexandre.torgue@st.com, pavel@ucw.cz, davem@davemloft.net, linux-kernel@vger.kernel.org, netdev@vger.kernel.org Subject: Re: [PATCH 1/2] net: ethernet: sxgbe: remove private tx queue lock Message-ID: <20161207231534.GB5889@electric-eye.fr.zoreil.com> References: <1481141138-19466-1-git-send-email-LinoSanfilippo@gmx.de> <1481141138-19466-2-git-send-email-LinoSanfilippo@gmx.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1481141138-19466-2-git-send-email-LinoSanfilippo@gmx.de> X-Organisation: Land of Sunshine Inc. User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Lino Sanfilippo : > The driver uses a private lock for synchronization between the xmit > function and the xmit completion handler, but since the NETIF_F_LLTX flag > is not set, the xmit function is also called with the xmit_lock held. > > On the other hand the xmit completion handler first takes the private lock > and (in case that the tx queue has been stopped) the xmit_lock, leading > to a reverse locking order and the potential danger of a deadlock. netif_tx_stop_queue is used by: 1. xmit function before releasing lock and returning. 2. sxgbe_restart_tx_queue() <- sxgbe_tx_interrupt <- sxgbe_reset_all_tx_queues() <- sxgbe_tx_timeout() Given xmit won't be called again until tx queue is enabled, it's not clear how a deadlock could happen due to #1. Regardless of deadlocks anywhere else, #2 has some serious problem due to the lack of exclusion between the tx queue restart handler and the xmit handler. -- Ueimor