From: Andrew Lunn <andrew@lunn.ch>
To: David Jander <david@protonic.nl>
Cc: linux-spi@vger.kernel.org, Mark Brown <broonie@kernel.org>,
Marc Kleine-Budde <mkl@pengutronix.de>,
Oleksij Rempel <ore@pengutronix.de>
Subject: Re: [RFC] A new SPI API for fast, low-latency regmap peripheral access
Date: Fri, 13 May 2022 14:10:32 +0200 [thread overview]
Message-ID: <Yn5KuOF7aH6xEAH0@lunn.ch> (raw)
In-Reply-To: <20220512163445.6dcca126@erd992>
> 6.1. Accounting spinlocks:
>
> Spinlocks are supposed to be fast, especially for the case that they are not
> contested, but in such critical paths their impact shouldn't be neglected.
>
> SPI_STATISTICS_ADD_TO_FIELD: This macro defined in spi.h has a spinlock, and
> it is used 4 times directly in __spi_sync(). It is also used in
> spi_transfer_one_message() which is called from there. Removing the spinlocks
> (thus introducing races) makes the code measurably faster (several us).
>
> spi_statistics_add_transfer_stats(): Called twice from
> spi_transfer_one_message(), and also contains a spinlock. Removing these again
> has a measurable impact of several us.
Maybe something from the network stack can be learnt here:
https://www.kernel.org/doc/html/latest/locking/seqlock.html
https://elixir.bootlin.com/linux/v5.18-rc6/source/include/linux/u64_stats_sync.h
Andrew
prev parent reply other threads:[~2022-05-13 12:10 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-12 14:34 [RFC] A new SPI API for fast, low-latency regmap peripheral access David Jander
2022-05-12 20:37 ` Mark Brown
2022-05-12 22:12 ` Mark Brown
2022-05-13 12:46 ` David Jander
2022-05-13 19:36 ` Mark Brown
2022-05-16 16:28 ` Marc Kleine-Budde
2022-05-16 17:46 ` Mark Brown
2022-05-17 10:24 ` David Jander
2022-05-17 11:57 ` Mark Brown
2022-05-17 13:09 ` David Jander
2022-05-17 13:43 ` Mark Brown
2022-05-17 15:16 ` David Jander
2022-05-17 18:17 ` Mark Brown
2022-05-19 8:12 ` David Jander
2022-05-19 8:24 ` Marc Kleine-Budde
2022-05-19 12:14 ` Andrew Lunn
2022-05-19 14:33 ` David Jander
2022-05-19 15:21 ` Andrew Lunn
2022-05-20 15:22 ` Mark Brown
2022-05-23 14:48 ` David Jander
2022-05-23 14:59 ` Marc Kleine-Budde
2022-05-24 11:30 ` David Jander
2022-05-24 19:46 ` Mark Brown
2022-05-25 14:39 ` David Jander
2022-05-13 12:10 ` Andrew Lunn [this message]
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=Yn5KuOF7aH6xEAH0@lunn.ch \
--to=andrew@lunn.ch \
--cc=broonie@kernel.org \
--cc=david@protonic.nl \
--cc=linux-spi@vger.kernel.org \
--cc=mkl@pengutronix.de \
--cc=ore@pengutronix.de \
/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).