All of lore.kernel.org
 help / color / mirror / Atom feed
From: Robin Murphy <robin.murphy@arm.com>
To: broonie@kernel.org, nsaenzjulienne@suse.de, f.fainelli@gmail.com,
	rjui@broadcom.com, sbranden@broadcom.com
Cc: bcm-kernel-feedback-list@broadcom.com, linux-spi@vger.kernel.org,
	linux-rpi-kernel@lists.infradead.org,
	linux-arm-kernel@lists.infradead.org, kernel@martin.sperl.org,
	lukas@wunner.de, linux-kernel@vger.kernel.org
Subject: [PATCH 0/3] spi: bcm2835: Interrupt-handling optimisations
Date: Tue, 16 Jun 2020 01:09:26 +0100	[thread overview]
Message-ID: <cover.1592261248.git.robin.murphy@arm.com> (raw)

Hi all,

Although Florian was concerned about a trivial inline check to deal with
shared IRQs adding overhead, the reality is that it would be so small as
to not be worth even thinking about unless the driver was already tuned
to squeeze out every last cycle. And a brief look over the code shows
that that clearly isn't the case.

This is an example of some of the easy low-hanging fruit that jumps out
just from code inspection. Based on disassembly and ARM1176 cycle
timings, patch #2 should save the equivalent of 2-3 shared interrupt
checks off the critical path in all cases, and patch #3 possibly up to
about 100x more. I don't have any means to test these patches, let alone
measure performance, so they're only backed by the principle that less
code - and in particular fewer memory accesses - is almost always
better.

There is almost certainly a *lot* more to be had from careful use of
relaxed I/O accessors, not doing a read-modify-write of CS at every
reset, tweaking the loops further to avoid unnecessary writebacks to
variables, and so on. However since I'm not invested in this personally
I'm not going to pursue it any further; I'm throwing these patches out
as more of a demonstration to back up my original drive-by review
comments, so if anyone want to pick them up and run with them then
please do so.

Robin.


Robin Murphy (3):
  spi: bcm3835: Tidy up bcm2835_spi_reset_hw()
  spi: bcm2835: Micro-optimise IRQ handler
  spi: bcm2835: Micro-optimise FIFO loops

 drivers/spi/spi-bcm2835.c | 45 +++++++++++++++++++--------------------
 1 file changed, 22 insertions(+), 23 deletions(-)

-- 
2.23.0.dirty


WARNING: multiple messages have this Message-ID (diff)
From: Robin Murphy <robin.murphy@arm.com>
To: broonie@kernel.org, nsaenzjulienne@suse.de, f.fainelli@gmail.com,
	rjui@broadcom.com, sbranden@broadcom.com
Cc: linux-kernel@vger.kernel.org, linux-spi@vger.kernel.org,
	lukas@wunner.de, bcm-kernel-feedback-list@broadcom.com,
	linux-rpi-kernel@lists.infradead.org, kernel@martin.sperl.org,
	linux-arm-kernel@lists.infradead.org
Subject: [PATCH 0/3] spi: bcm2835: Interrupt-handling optimisations
Date: Tue, 16 Jun 2020 01:09:26 +0100	[thread overview]
Message-ID: <cover.1592261248.git.robin.murphy@arm.com> (raw)

Hi all,

Although Florian was concerned about a trivial inline check to deal with
shared IRQs adding overhead, the reality is that it would be so small as
to not be worth even thinking about unless the driver was already tuned
to squeeze out every last cycle. And a brief look over the code shows
that that clearly isn't the case.

This is an example of some of the easy low-hanging fruit that jumps out
just from code inspection. Based on disassembly and ARM1176 cycle
timings, patch #2 should save the equivalent of 2-3 shared interrupt
checks off the critical path in all cases, and patch #3 possibly up to
about 100x more. I don't have any means to test these patches, let alone
measure performance, so they're only backed by the principle that less
code - and in particular fewer memory accesses - is almost always
better.

There is almost certainly a *lot* more to be had from careful use of
relaxed I/O accessors, not doing a read-modify-write of CS at every
reset, tweaking the loops further to avoid unnecessary writebacks to
variables, and so on. However since I'm not invested in this personally
I'm not going to pursue it any further; I'm throwing these patches out
as more of a demonstration to back up my original drive-by review
comments, so if anyone want to pick them up and run with them then
please do so.

Robin.


Robin Murphy (3):
  spi: bcm3835: Tidy up bcm2835_spi_reset_hw()
  spi: bcm2835: Micro-optimise IRQ handler
  spi: bcm2835: Micro-optimise FIFO loops

 drivers/spi/spi-bcm2835.c | 45 +++++++++++++++++++--------------------
 1 file changed, 22 insertions(+), 23 deletions(-)

-- 
2.23.0.dirty


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

             reply	other threads:[~2020-06-16  0:09 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-16  0:09 Robin Murphy [this message]
2020-06-16  0:09 ` [PATCH 0/3] spi: bcm2835: Interrupt-handling optimisations Robin Murphy
2020-06-16  0:09 ` [PATCH 1/3] spi: bcm3835: Tidy up bcm2835_spi_reset_hw() Robin Murphy
2020-06-16  0:09   ` Robin Murphy
2020-06-16  0:09 ` [PATCH 2/3] spi: bcm2835: Micro-optimise IRQ handler Robin Murphy
2020-06-16  0:09   ` Robin Murphy
2020-06-16  0:09 ` [PATCH 3/3] spi: bcm2835: Micro-optimise FIFO loops Robin Murphy
2020-06-16  0:09   ` Robin Murphy
2020-07-01 22:24 ` [PATCH 0/3] spi: bcm2835: Interrupt-handling optimisations Mark Brown
2020-07-01 22:24   ` Mark Brown

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=cover.1592261248.git.robin.murphy@arm.com \
    --to=robin.murphy@arm.com \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=broonie@kernel.org \
    --cc=f.fainelli@gmail.com \
    --cc=kernel@martin.sperl.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rpi-kernel@lists.infradead.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=lukas@wunner.de \
    --cc=nsaenzjulienne@suse.de \
    --cc=rjui@broadcom.com \
    --cc=sbranden@broadcom.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.