Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933649AbcLGWen (ORCPT ); Wed, 7 Dec 2016 17:34:43 -0500 Received: from mout.gmx.net ([212.227.15.15]:51304 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932892AbcLGWek (ORCPT ); Wed, 7 Dec 2016 17:34:40 -0500 Subject: Re: [PATCH 2/2] net: ethernet: stmmac: remove private tx queue lock To: Pavel Machek References: <1481141138-19466-1-git-send-email-LinoSanfilippo@gmx.de> <1481141138-19466-3-git-send-email-LinoSanfilippo@gmx.de> <20161207213757.GC2250@amd> Cc: bh74.an@samsung.com, ks.giri@samsung.com, vipul.pandya@samsung.com, peppe.cavallaro@st.com, alexandre.torgue@st.com, davem@davemloft.net, linux-kernel@vger.kernel.org, netdev@vger.kernel.org From: Lino Sanfilippo Message-ID: Date: Wed, 7 Dec 2016 23:34:19 +0100 User-Agent: Mozilla/5.0 (X11; Linux i686; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K0:o9DudXSUEciEWdmz3vFcZx47BHRam/Q2FW7z3NrjRCUd8WTr/Bk so/Px1e5a+AtGKb38ZyVOvcHB68m42NeJ1u+PUfjVWFR02zXsiKTzHTgCd038eLpOAdHKUJ a2zWeOsrnb4HJb3FETgmCGWZgLEfB6ictUNVi7uWaZoZpYl45897tNH+TvsIiuUaXBAEz7M VPzmuY6zpxd8GADrsLcKw== X-UI-Out-Filterresults: notjunk:1;V01:K0:yu2jo2A+PWE=:4lciO0yjLMoKx1nRfPFBXZ bAFb9RsOfqJ6qYtaLv78XVC0UHapMsole2uVlc9uZXkmvMU5mr97fCbdLn9O9TIBgYhhbIYUg NV4QDS6ztVDc2LTobQoLnyL5lUU9T0PM1qnyCSwblPZ7yFQiRNf3UWwG2DylFeQUm8KSvXIw7 NQZKhaOdH+ovK7rB8KKZl9+osRgVe1JPeAKeNqZ5uRqVDi17Te3Lnk6GjVi/bB7PYpF3BGhLI enQRI0t133uX1Lp7ttd8/50u88j8W4EhEYT4JtXo6bqWf+OVD+EaGhxZoO8deVjtaDDlgV0N2 ohlCaoq5uJvVVpo/ONTDYz73eEK/M+F4jCP4Fo8swDQydZmYT6qNRL+DCnIw+wrtbAcpr79R4 OYtRl62J0Rr3cJCE5cSkm+hPFl3AnveEEJ3lkS1beC0UosWbUCYH2zzVC/xYISxpL2cLHlkcA kBtBK6EpRbIzhzm3E36i7lpxxZx+vWyEa2pomPa9kE3x+rsF3w1A6D5fRFIl6BMnROvlkhics +TSRiBPHnXlCbbFdg7LqtU1rqdlS4mSq4iAjQw2TxSTBWRj9fR8oLtwHhd0KLt2agj3HuvVVH mPV+PW7KFBwNlMeP1F5eUyT6N8BwcIJ8KeTBj/x21DU3DRN92V6CX/Al9afU/iPq7MdYd8+2r MKMjvyHz/PFCZGLzG4PL25AsafCZ9Fbv2S6NEqrThMJ9jK2nwYP9OBMeAfyAKBOI55fmSAQwX toG7BrP42a81lURkwJMdMVqV2GTeUNlRvMK3W1JW79PupT56VCzSVsOGdJE8ys6vZ+8LlFFVl ZAbq/x6 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1509 Lines: 34 On 07.12.2016 22:43, Lino Sanfilippo wrote: > Hi Pavel, > > On 07.12.2016 22:37, Pavel Machek wrote: >> On Wed 2016-12-07 21:05:38, Lino Sanfilippo wrote: >>> 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. >>> >>> Fix this by removing the private lock completely and synchronizing the xmit >>> function and completion handler solely by means of the xmit_lock. By doing >>> this remove also the now unnecessary double check for a stopped tx queue. >>> >> >> FYI, here's modified version. I believe _bh versions are needed, and >> I'm testing that version now. (Oh and I also ported it to net-next). >> >> It survived 30 minutes of testing so far... >> > > First off, thanks for testing. > Hmm. I dont understand why _bh would be needed. We call that function from > BH context only (napi poll and timer). > Any idea? > Could this once again be caused by irq coalescing? When the tx queue has been stopped the cleanup handler has to wakeup the queue within a certain time span, otherwise the watchdog will complain (as it happened in your test). Could you retest this with irq coalescing disabled?