From: Andrew Lunn <andrew@lunn.ch>
To: Tristram.Ha@microchip.com
Cc: David.Laight@ACULAB.COM, muvarov@gmail.com, pavel@ucw.cz,
nathan.leigh.conrad@gmail.com,
vivien.didelot@savoirfairelinux.com, f.fainelli@gmail.com,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
Woojung.Huh@microchip.com
Subject: Re: [PATCH RFC 3/5] Add KSZ8795 switch driver
Date: Fri, 29 Sep 2017 22:39:26 +0200 [thread overview]
Message-ID: <20170929203926.GD17713@lunn.ch> (raw)
In-Reply-To: <93AF473E2DA327428DE3D46B72B1E9FD4112CC1D@CHN-SV-EXMX02.mchp-main.com>
On Fri, Sep 29, 2017 at 07:19:17PM +0000, Tristram.Ha@microchip.com wrote:
> > > My concern is if a task is already running with SPI access to a lot
> > > of registers like reading the 32 MIB counters in every port of the
> > > switch, another register access has to wait until they are finished.
> >
> > Why does it have to wait? Looking at the code in
> > ksz_get_ethtool_stats(), you don't take any mutex which will prevent
> > others from using the SPI bus. All there is is a mutex which prevents
> > two sets of ksz_get_ethtool_stats() at the same time.
> >
> > So a PTP read could happen in parallel, and will not be blocked by MIB
> > reads. They should get interleaved access to the SPI bus.
> >
>
> The MIB counters are read in the background. For multiple CPU cores 2
> tasks may run in the same time allowing SPI access one after another.
> For single core I am not sure an SPI access like coming from an interrupt
> routine can jump ahead from one in a background task.
The SPI subsystem has a mutex per controller. When starting a
transfer, it takes the mutex and release it once the transfer has
completed. There is also a reschedule point at the end of a
transfer. So even on your single core CPU, there can be multi tasking
going on.
Andrew
next prev parent reply other threads:[~2017-09-29 20:39 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-07 21:17 [PATCH RFC 3/5] Add KSZ8795 switch driver Tristram.Ha
2017-09-07 22:36 ` Andrew Lunn
2017-09-18 20:27 ` Tristram.Ha
2017-09-28 18:40 ` Pavel Machek
2017-09-28 18:45 ` Florian Fainelli
2017-09-29 18:56 ` Tristram.Ha
2017-09-28 19:34 ` Andrew Lunn
2017-09-29 9:14 ` David Laight
2017-09-29 12:12 ` Andrew Lunn
2017-09-29 18:24 ` Tristram.Ha
2017-09-29 18:53 ` Andrew Lunn
2017-09-29 19:19 ` Tristram.Ha
2017-09-29 20:39 ` Andrew Lunn [this message]
2017-09-08 9:18 ` Pavel Machek
2017-09-08 17:54 ` Tristram.Ha
2017-09-08 18:32 ` Andrew Lunn
2017-09-08 18:35 ` Woojung.Huh
2017-09-08 21:57 ` Pavel Machek
2017-09-09 1:44 ` Tristram.Ha
2017-09-09 15:45 ` Andrew Lunn
2017-09-28 15:24 ` Pavel Machek
2017-09-29 18:45 ` Tristram.Ha
2017-10-01 7:21 ` Pavel Machek
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=20170929203926.GD17713@lunn.ch \
--to=andrew@lunn.ch \
--cc=David.Laight@ACULAB.COM \
--cc=Tristram.Ha@microchip.com \
--cc=Woojung.Huh@microchip.com \
--cc=f.fainelli@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=muvarov@gmail.com \
--cc=nathan.leigh.conrad@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pavel@ucw.cz \
--cc=vivien.didelot@savoirfairelinux.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).