From: Marek Vasut <marex@denx.de>
To: Andrew Lunn <andrew@lunn.ch>
Cc: netdev@vger.kernel.org, "David S . Miller" <davem@davemloft.net>,
Lukas Wunner <lukas@wunner.de>, Petr Stetiar <ynezz@true.cz>,
YueHaibing <yuehaibing@huawei.com>
Subject: Re: [PATCH V5 10/19] net: ks8851: Factor out bus lock handling
Date: Thu, 14 May 2020 03:37:49 +0200 [thread overview]
Message-ID: <64a1c7d9-db89-d4fa-a7bd-dc574d86a853@denx.de> (raw)
In-Reply-To: <20200514011957.GF527401@lunn.ch>
On 5/14/20 3:19 AM, Andrew Lunn wrote:
> On Thu, May 14, 2020 at 02:07:38AM +0200, Marek Vasut wrote:
>> Pull out bus access locking code into separate functions, this is done
>> in preparation for unifying the driver with the parallel bus one. The
>> parallel bus driver does not need heavy mutex locking of the bus and
>> works better with spinlocks, hence prepare these locking functions to
>> be overridden then.
>>
>> Signed-off-by: Marek Vasut <marex@denx.de>
>> Cc: David S. Miller <davem@davemloft.net>
>> Cc: Lukas Wunner <lukas@wunner.de>
>> Cc: Petr Stetiar <ynezz@true.cz>
>> Cc: YueHaibing <yuehaibing@huawei.com>
>
>
>> +/**
>> + * ks8851_lock - register access lock
>> + * @ks: The chip state
>> + * @flags: Spinlock flags
>> + *
>> + * Claim chip register access lock
>> + */
>> +static void ks8851_lock(struct ks8851_net *ks, unsigned long *flags)
>> +{
>> + mutex_lock(&ks->lock);
>> +}
>
> Do you actually need flags? It is for spin_lock_irqsave(). Which you
> use when you have a critical section inside an interrupt handler. But
> a mutex cannot protect against an interrupt handler. So there should
> be no need to use spin_lock_irqsave(), spin_lock() should be enough,
> and that does not need flags.
I do need it, the SPI variant of the device uses threaded interrupt
handler and does quite a few heavy operations there (like pumping TX
data across the SPI bus) so it needs the mutex, but the overhead of that
is too much for the parallel bus variant of the chip (which pumps the
data in the start_xmit handler directly) and so that one uses spinlock
both in ks8851_start_xmit_par() and in the IRQ handler.
I had to do it this way (spinlock + pumping data in start_xmit),
otherwise the overhead for the parallel bus option was too big (in the
20% ballpark).
next prev parent reply other threads:[~2020-05-14 1:51 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-14 0:07 [PATCH V5 00/19] net: ks8851: Unify KS8851 SPI and MLL drivers Marek Vasut
2020-05-14 0:07 ` [PATCH V5 01/19] net: ks8851: Factor out spi->dev in probe()/remove() Marek Vasut
2020-05-14 0:49 ` Andrew Lunn
2020-05-14 0:07 ` [PATCH V5 02/19] net: ks8851: Rename ndev to netdev in probe Marek Vasut
2020-05-14 0:50 ` Andrew Lunn
2020-05-14 0:07 ` [PATCH V5 03/19] net: ks8851: Replace dev_err() with netdev_err() in IRQ handler Marek Vasut
2020-05-14 0:07 ` [PATCH V5 04/19] net: ks8851: Pass device node into ks8851_init_mac() Marek Vasut
2020-05-14 0:51 ` Andrew Lunn
2020-05-14 0:07 ` [PATCH V5 05/19] net: ks8851: Use devm_alloc_etherdev() Marek Vasut
2020-05-14 0:07 ` [PATCH V5 06/19] net: ks8851: Use dev_{get,set}_drvdata() Marek Vasut
2020-05-14 0:54 ` Andrew Lunn
2020-05-14 0:07 ` [PATCH V5 07/19] net: ks8851: Remove ks8851_rdreg32() Marek Vasut
2020-05-14 0:07 ` [PATCH V5 08/19] net: ks8851: Use 16-bit writes to program MAC address Marek Vasut
2020-05-14 0:55 ` Andrew Lunn
2020-05-14 0:07 ` [PATCH V5 09/19] net: ks8851: Use 16-bit read of RXFC register Marek Vasut
2020-05-14 0:07 ` [PATCH V5 10/19] net: ks8851: Factor out bus lock handling Marek Vasut
2020-05-14 1:19 ` Andrew Lunn
2020-05-14 1:37 ` Marek Vasut [this message]
2020-05-14 2:07 ` Andrew Lunn
2020-05-14 0:07 ` [PATCH V5 11/19] net: ks8851: Factor out SKB receive function Marek Vasut
2020-05-14 0:07 ` [PATCH V5 12/19] net: ks8851: Split out SPI specific entries in struct ks8851_net Marek Vasut
2020-05-14 1:25 ` Andrew Lunn
2020-05-14 0:07 ` [PATCH V5 13/19] net: ks8851: Split out SPI specific code from probe() and remove() Marek Vasut
2020-05-14 1:31 ` Andrew Lunn
2020-05-14 1:34 ` Marek Vasut
2020-05-14 0:07 ` [PATCH V5 14/19] net: ks8851: Factor out TX work flush function Marek Vasut
2020-05-14 1:33 ` Andrew Lunn
2020-05-14 0:07 ` [PATCH V5 15/19] net: ks8851: Permit overridding interrupt enable register Marek Vasut
2020-05-14 1:35 ` Andrew Lunn
2020-05-14 0:07 ` [PATCH V5 16/19] net: ks8851: Implement register, FIFO, lock accessor callbacks Marek Vasut
2020-05-14 1:38 ` Andrew Lunn
2020-05-14 0:07 ` [PATCH V5 17/19] net: ks8851: Separate SPI operations into separate file Marek Vasut
2020-05-14 0:07 ` [PATCH V5 18/19] net: ks8851: Implement Parallel bus operations Marek Vasut
2020-05-14 1:57 ` Andrew Lunn
2020-05-14 2:26 ` Marek Vasut
2020-05-14 13:15 ` Andrew Lunn
2020-05-14 14:00 ` Marek Vasut
2020-05-14 14:07 ` Andrew Lunn
2020-05-14 14:14 ` Marek Vasut
2020-05-14 14:22 ` Andrew Lunn
2020-05-14 14:33 ` Marek Vasut
2020-05-14 0:07 ` [PATCH V5 19/19] net: ks8851: Remove ks8851_mll.c Marek Vasut
2020-05-14 1:48 ` [PATCH V5 00/19] net: ks8851: Unify KS8851 SPI and MLL drivers Jakub Kicinski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=64a1c7d9-db89-d4fa-a7bd-dc574d86a853@denx.de \
--to=marex@denx.de \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=lukas@wunner.de \
--cc=netdev@vger.kernel.org \
--cc=ynezz@true.cz \
--cc=yuehaibing@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).