From: David Jander <david@protonic.nl>
To: Marc Kleine-Budde <mkl@pengutronix.de>
Cc: Mark Brown <broonie@kernel.org>,
linux-spi@vger.kernel.org, Andrew Lunn <andrew@lunn.ch>,
ore@pengutronix.de, kernel@pengutronix.de
Subject: Re: [PATCH v2] drivers: spi: spi.c: Convert statistics to per-cpu u64_stats_t
Date: Thu, 9 Jun 2022 13:06:55 +0200 [thread overview]
Message-ID: <20220609130655.3912bf63@erd992> (raw)
In-Reply-To: <20220609093251.22l6farvsmggttz3@pengutronix.de>
On Thu, 9 Jun 2022 11:32:51 +0200
Marc Kleine-Budde <mkl@pengutronix.de> wrote:
> On 24.05.2022 11:18:08, David Jander wrote:
> > This change gives a dramatic performance improvement in the hot path,
> > since many costly spin_lock_irqsave() calls can be avoided.
> >
> > On an i.MX8MM system with a MCP2518FD CAN controller connected via SPI,
> > the time the driver takes to handle interrupts, or in other words the time
> > the IRQ line of the CAN controller stays low is mainly dominated by the
> > time it takes to do 3 relatively short sync SPI transfers. The effect of
> > this patch is a reduction of this time from 136us down to only 98us.
> >
> > Suggested-by: Andrew Lunn <andrew@lunn.ch>
> > Signed-off-by: David Jander <david@protonic.nl>
>
> This patch (cherry picked on top of v5.19-rc1) explodes on 32-bit SMP
> ARMv7 (imx6q) with:
>
> | [ 0.397493] BUG: using smp_processor_id() in preemptible [00000000] code: swapper/0/1
> | [ 0.397514] caller is debug_smp_processor_id+0x18/0x24
> | [ 0.397544] CPU: 1 PID: 1 Comm: swapper/0 Not tainted 5.19.0-rc1-00001-g6ae0aec8a366 #181
> | [ 0.397559] Hardware name: Freescale i.MX6 Quad/DualLite (Device Tree)
> | [ 0.397566] Backtrace:
> | [ 0.397576] dump_backtrace from show_stack+0x20/0x24
> | [ 0.397616] r7:81024ffd r6:00000000 r5:81024ffd r4:60000013
> | [ 0.397621] show_stack from dump_stack_lvl+0x60/0x78
> | [ 0.397644] dump_stack_lvl from dump_stack+0x14/0x1c
> | [ 0.397664] r7:81024ffd r6:80f652de r5:80bec180 r4:819a2500
> | [ 0.397669] dump_stack from check_preemption_disabled+0xc8/0xf0
> | [ 0.397690] check_preemption_disabled from debug_smp_processor_id+0x18/0x24
> | [ 0.397714] r8:8119b7e0 r7:81205534 r6:819f5c00 r5:819f4c00 r4:c083d724
> | [ 0.397719] debug_smp_processor_id from __spi_sync+0x78/0x220
> | [ 0.397746] __spi_sync from spi_sync+0x34/0x4c
> | [ 0.397772] r10:bb7bf4e0 r9:c083d724 r8:00000007 r7:81a068c0 r6:822a83c0 r5:c083d724
> | [ 0.397779] r4:819f4c00
> | [ 0.397784] spi_sync from spi_mem_exec_op+0x338/0x370
> | [ 0.397810] r5:000000b4 r4:c083d910
> | [ 0.397815] spi_mem_exec_op from spi_nor_read_id+0x98/0xdc
> | [ 0.397846] r10:bb7bf4e0 r9:00000000 r8:00000000 r7:00000000 r6:00000000 r5:82358040
> | [ 0.397852] r4:819f7c40
> | [ 0.397856] spi_nor_read_id from spi_nor_detect+0x38/0x114
> | [ 0.397878] r7:82358040 r6:00000000 r5:819f7c40 r4:819f7c40
> | [ 0.397883] spi_nor_detect from spi_nor_scan+0x11c/0xbec
> | [ 0.397910] r10:bb7bf4e0 r9:00000000 r8:00000000 r7:c083da4c r6:00000000 r5:00010101
> | [ 0.397916] r4:819f7c40
> | [ 0.397921] spi_nor_scan from spi_nor_probe+0x10c/0x2d0
> | [ 0.397946] r10:bb7bf4e0 r9:bb7bf4d0 r8:00000000 r7:819f4c00 r6:00000000 r5:00000000
> | [ 0.397952] r4:819f7c40
*ouch*. Thanks for reporting. Fix coming up asap... apparently I forgot to
get_cpu/put_cpu around the per-cpu operations :-(
Best regards,
--
David Jander
prev parent reply other threads:[~2022-06-09 11:07 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-24 9:18 [PATCH v2] drivers: spi: spi.c: Convert statistics to per-cpu u64_stats_t David Jander
2022-06-07 10:46 ` Mark Brown
2022-06-09 9:32 ` Marc Kleine-Budde
2022-06-09 11:06 ` David Jander [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=20220609130655.3912bf63@erd992 \
--to=david@protonic.nl \
--cc=andrew@lunn.ch \
--cc=broonie@kernel.org \
--cc=kernel@pengutronix.de \
--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 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.