Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933070AbcLGVnd (ORCPT ); Wed, 7 Dec 2016 16:43:33 -0500 Received: from mout.gmx.net ([212.227.17.21]:62219 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932423AbcLGVnb (ORCPT ); Wed, 7 Dec 2016 16:43:31 -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 22:43:10 +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: <20161207213757.GC2250@amd> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K0:VGxwaXTgfBl2UWpnoR5wUwNa4g11z9NGGBQvKSr+vbN+YLnNgme GGdRogMLI2NZml4AJ0FMMiVshxhihcVQKrX9LCHL0dnejU5vZjOs03sUR9wXIG8auNU+X45 ddtrhR7UnRcQMrCun1NUBU1bkGVqoWRyYVorpXE97Kj4bPozJHcblhoB+86xUAZT+6n6f7p sHSzrUVFPQhRRD9xqIwMw== X-UI-Out-Filterresults: notjunk:1;V01:K0:3Bv2Hatyds4=:AYdIHvpg/4ZcgQzke7Td/0 2BQKDh04y15TEHqddy2yfoOBwULKvip9mxNxjLlhq/VYBqCsc5hBsDe6f+Dz6/EbwskRXl8ee AWiRkPW1CHp+Ry1UK4fDDF4hs6XsJtriynZ+4B/VFWkR3W3W4N8qKnTKk1KM8K/O/U3b1LKwT b+9/C2Ar/segZ3aZXa4fRRFZOlBB8vrwlOp5r0t+Y7UCQ/48JuwRx+2q13qLSyOVmXbYQ/1bL B8NRFOnZ86Fpsw2LJ97WYNwexmv1sgpOcARXKz8laxq0BLRMTqwFB63/xJ0dwchbnduRawoVK ITVWt80WlQMFgPp1NfH6FVFX/FOSafDXvO/biJl0lAhpjuovY8XIVYwUJHne89S8kvFkqmfGZ 6pFak1wrGIfoN3PgRn+UU4mFmZHXNuCim6Q3xwEsTl8sZlAAXWNY73gJPWRe5plN6610QRzI5 o3sVbt3jsTlG6cQPF8WgqP9G7k7T04xB0mTbsrp6LKhMf/D+O+b0UdrcS4hGYeRJoH+Q5RfLI WXLBBAzVqYf7I+E2t9oyyMczpSPa7e3ZarkjjzxGcVp26tzCUDV7HVPLikPEu9mEHS4wIEBkg 2fGPf/LopwfylBNNeJg+F6rP3umEK1AgKc6a7nffqr7YdzZI06M9pwDDKYMeCOEUug8d5YLas m2xrAOhSDS3+mbbFaeLFVhPElNEeb83kq9tY6rLkQrrkb4bRqrwFsY6ypU9eh33xnsGfJxSxg 9WgPvnIhZ4igo9z0Xj4M4j1366WJMljiElAW6W4jJsWmpak4Y9mkNEJTgxLSxpjUgTTVZZwQ1 7OBpyNk Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1154 Lines: 29 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? Lino