Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752673AbbKKT0x (ORCPT ); Wed, 11 Nov 2015 14:26:53 -0500 Received: from shards.monkeyblade.net ([149.20.54.216]:50451 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751048AbbKKT0w convert rfc822-to-8bit (ORCPT ); Wed, 11 Nov 2015 14:26:52 -0500 Date: Wed, 11 Nov 2015 14:26:50 -0500 (EST) Message-Id: <20151111.142650.1297832998846138251.davem@davemloft.net> To: mans@mansr.com Cc: romieu@fr.zoreil.com, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, slash.tmp@free.fr Subject: Re: [PATCH v5] net: ethernet: add driver for Aurora VLSI NB8800 Ethernet controller From: David Miller In-Reply-To: References: <20151111.141956.1056130800039910138.davem@davemloft.net> X-Mailer: Mew version 6.6 on Emacs 24.5 / Mule 6.0 (HANACHIRUSATO) Mime-Version: 1.0 Content-Type: Text/Plain; charset=iso-8859-1 Content-Transfer-Encoding: 8BIT X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.12 (shards.monkeyblade.net [149.20.54.216]); Wed, 11 Nov 2015 11:26:51 -0800 (PST) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2095 Lines: 54 From: M?ns Rullg?rd Date: Wed, 11 Nov 2015 19:25:46 +0000 > David Miller writes: > >> From: M?ns Rullg?rd >> Date: Wed, 11 Nov 2015 19:17:07 +0000 >> >>> David Miller writes: >>> >>>> From: M?ns Rullg?rd >>>> Date: Wed, 11 Nov 2015 19:09:19 +0000 >>>> >>>>> David Miller writes: >>>>> >>>>>> From: M?ns Rullg?rd >>>>>> Date: Wed, 11 Nov 2015 18:25:05 +0000 >>>>>> >>>>>>> If the TX DMA channel is idle when start_xmit is called, it can be >>>>>>> started immediately. Checking the DMA status and starting it if >>>>>>> idle has to be done atomically somehow. >>>>>> >>>>>> ->ndo_start_xmit() is guaranteed to be invoked atomically, protected >>>>>> by the TX queue spinlock. >>>>> >>>>> Yes, but the DMA needs to be restarted from some other context if it was >>>>> busy when start_xmit checked. >>>> >>>> Then you can probably use the TXQ lock in the interrupt handler just for >>>> that. >>> >>> That seems a bit heavy-handed when the critical section for this is only >>> a tiny part of the start_xmit function. >> >> Then what synchornization primitive other than spin locks are you going >> to use for this? >> >> My point is that there is a spinlock the core code is _already_ taking, >> unconditionally, when ->ndo_start_xmit() executes. And you can therefore >> take advantage of that rather than using another lock of your own. > > I get that. But that remains locked for the duration of ndo_start_xmit() > whereas the part that needs to be synchronised with the DMA completion > IRQ handler is tiny. Having the IRQ handler spin for the duration of > ndo_start_xmit() seemed silly to me. I don't think it's silly at all. And unless you can measure it making a difference, don't knock the idea. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/