From: Doug Anderson <dianders@chromium.org>
To: Bjorn Andersson <bjorn.andersson@linaro.org>
Cc: Mark Brown <broonie@kernel.org>,
Akash Asthana <akashast@codeaurora.org>,
Stephen Boyd <swboyd@chromium.org>,
Andy Gross <agross@kernel.org>,
linux-arm-msm <linux-arm-msm@vger.kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
linux-spi <linux-spi@vger.kernel.org>
Subject: Re: [PATCH 3/3] spi: spi-geni-qcom: Slightly optimize setup of bidirectional xfters
Date: Sun, 13 Sep 2020 13:35:06 -0700 [thread overview]
Message-ID: <CAD=FV=WdxezP_cpuQjLdgOS8geOC=uW5n=TfRoZG7vJc=_aCbQ@mail.gmail.com> (raw)
In-Reply-To: <CAD=FV=V=in+-GL-9p1b6w8g8CJ0jdhGWhsZNAvap=W1MAPMEKQ@mail.gmail.com>
Hi,
On Sat, Sep 12, 2020 at 6:09 PM Doug Anderson <dianders@chromium.org> wrote:
>
> Hi,
>
> On Sat, Sep 12, 2020 at 3:54 PM Bjorn Andersson
> <bjorn.andersson@linaro.org> wrote:
> >
> > On Sat 12 Sep 16:08 CDT 2020, Douglas Anderson wrote:
> >
> > > When setting up a bidirectional transfer we need to program both the
> > > TX and RX lengths. We don't need a memory barrier between those two
> > > writes. Factor out the __iowmb() and use writel_relaxed(). This
> > > saves a fraction of a microsecond of setup overhead on bidirectional
> > > transfers.
> > >
> > > Signed-off-by: Douglas Anderson <dianders@chromium.org>
> > > ---
> > >
> > > drivers/spi/spi-geni-qcom.c | 13 ++++++++++---
> > > 1 file changed, 10 insertions(+), 3 deletions(-)
> > >
> > > diff --git a/drivers/spi/spi-geni-qcom.c b/drivers/spi/spi-geni-qcom.c
> > > index 92d88bf85a90..6c7e12b68bf0 100644
> > > --- a/drivers/spi/spi-geni-qcom.c
> > > +++ b/drivers/spi/spi-geni-qcom.c
> > > @@ -376,15 +376,22 @@ static void setup_fifo_xfer(struct spi_transfer *xfer,
> > > len &= TRANS_LEN_MSK;
> > >
> > > mas->cur_xfer = xfer;
> > > +
> > > + /*
> > > + * Factor out the __iowmb() so that we can use writel_relaxed() for
> > > + * both writes below and thus only incur the overhead once even if
> > > + * we execute both of them.
> > > + */
> >
> > How many passes through this function do we have to take before saving
> > the amount of time it took me to read this comment?
> >
> > Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
>
> Thanks for the review! Yeah, in Chrome OS we do a crazy amount of SPI
> transfers since our EC and security chip are connected over SPI and we
> seem to pile a whole lot of stuff into the EC. This means we keep
> coming back to the SPI controller again and again when profiling
> things. I'm hoping that we'll eventually be able to get DMA enabled
> here, but until then at least it's nice to make the FIFO transfers
> better...
Ugh. Given the problem that the kernel test robot found, I'm gonna
say just drop this patch but keep the others I sent. As per the CL
description, it's a pretty minor optimization and even though we do a
lot of SPI transfers it's probably more worth it to work towards DMA
mode than to try to find a cleaner solution for this one.
-Doug
next prev parent reply other threads:[~2020-09-13 20:35 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-12 21:07 [PATCH 1/3] spi: spi-geni-qcom: Use the FIFO even more Douglas Anderson
2020-09-12 21:08 ` [PATCH 2/3] spi: spi-geni-qcom: Don't program CS_TOGGLE again and again Douglas Anderson
2020-09-12 23:01 ` Bjorn Andersson
2020-09-15 10:40 ` Akash Asthana
2020-09-12 21:08 ` [PATCH 3/3] spi: spi-geni-qcom: Slightly optimize setup of bidirectional xfters Douglas Anderson
2020-09-12 22:54 ` Bjorn Andersson
2020-09-13 1:09 ` Doug Anderson
2020-09-13 20:35 ` Doug Anderson [this message]
2020-09-13 3:45 ` kernel test robot
2020-09-13 7:31 ` kernel test robot
2020-09-12 22:53 ` [PATCH 1/3] spi: spi-geni-qcom: Use the FIFO even more Bjorn Andersson
2020-09-13 1:11 ` Doug Anderson
2020-09-13 3:12 ` Bjorn Andersson
2020-09-14 14:52 ` Mark Brown
2020-09-15 7:30 ` Akash Asthana
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='CAD=FV=WdxezP_cpuQjLdgOS8geOC=uW5n=TfRoZG7vJc=_aCbQ@mail.gmail.com' \
--to=dianders@chromium.org \
--cc=agross@kernel.org \
--cc=akashast@codeaurora.org \
--cc=bjorn.andersson@linaro.org \
--cc=broonie@kernel.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-spi@vger.kernel.org \
--cc=swboyd@chromium.org \
/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).