All of lore.kernel.org
 help / color / mirror / Atom feed
* PROBLEM: tcan4x5x nINT stays asserted under high RX/TX interrupt load
@ 2022-04-01 13:23 Wouter van Herpen
  2022-04-03 10:57 ` Marc Kleine-Budde
  0 siblings, 1 reply; 7+ messages in thread
From: Wouter van Herpen @ 2022-04-01 13:23 UTC (permalink / raw)
  To: mkl; +Cc: linux-can

When using the tcan4x5x under high load of both RX/TX interrupts, at some point the nINT signal stays asserted, causing the socket to block in user space.

This reproduces very reliably (in my system) when both reading/writing at 1ms intervals at CAN bus speed 1Mbps.
When it occurs, M_CAN_IR is set to 0x580d and never recovers (causing nINT to stay asserted).
The problem does not occur when only reading or only writing.

After checking the m_can_isr() function from drivers/net/can/m_can/m_can.c, I noticed that MCAN interrupts are disabled while processing the IR_RF0N flag, but not while processing IR_TEFN.
I'm not sure why, aren't both handlers running from the same interrupt context and communicating to MRAM via SPI?

I'm running kernel version 5.4.24 but I can see that in e.g. 5.17.0 this still applies.
When I disable interrupts during IR_TEFN handling, the blocking socket / nINT issue is gone.

Met vriendelijke groet / Kind regards,

Wouter van Herpen 
Designer

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: PROBLEM: tcan4x5x nINT stays asserted under high RX/TX interrupt load
  2022-04-01 13:23 PROBLEM: tcan4x5x nINT stays asserted under high RX/TX interrupt load Wouter van Herpen
@ 2022-04-03 10:57 ` Marc Kleine-Budde
  2022-04-05 12:02   ` Wouter van Herpen
  0 siblings, 1 reply; 7+ messages in thread
From: Marc Kleine-Budde @ 2022-04-03 10:57 UTC (permalink / raw)
  To: Wouter van Herpen; +Cc: linux-can

[-- Attachment #1: Type: text/plain, Size: 1336 bytes --]

Hello Wouter,

On 01.04.2022 13:23:43, Wouter van Herpen wrote:
> When using the tcan4x5x under high load of both RX/TX interrupts, at
> some point the nINT signal stays asserted, causing the socket to block
> in user space.
> 
> This reproduces very reliably (in my system) when both reading/writing
> at 1ms intervals at CAN bus speed 1Mbps. When it occurs, M_CAN_IR is
> set to 0x580d and never recovers (causing nINT to stay asserted). The
> problem does not occur when only reading or only writing.
> 
> After checking the m_can_isr() function from
> drivers/net/can/m_can/m_can.c, I noticed that MCAN interrupts are
> disabled while processing the IR_RF0N flag, but not while processing
> IR_TEFN. I'm not sure why, aren't both handlers running from the same
> interrupt context and communicating to MRAM via SPI?

Thanks for your analysis. Without looking deeper into it, that sounds
reasonable.

> I'm running kernel version 5.4.24 but I can see that in e.g. 5.17.0
> this still applies. When I disable interrupts during IR_TEFN handling,
> the blocking socket / nINT issue is gone.

Can you send a patch fixing the problem? Please include a patch
description and your Signed-off-by:

https://elixir.bootlin.com/linux/v5.12/source/Documentation/process/submitting-patches.rst#L356

regards,
Marc

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: PROBLEM: tcan4x5x nINT stays asserted under high RX/TX interrupt load
  2022-04-03 10:57 ` Marc Kleine-Budde
@ 2022-04-05 12:02   ` Wouter van Herpen
  2022-04-05 12:09     ` Marc Kleine-Budde
  0 siblings, 1 reply; 7+ messages in thread
From: Wouter van Herpen @ 2022-04-05 12:02 UTC (permalink / raw)
  To: Marc Kleine-Budde; +Cc: linux-can

Hello Marc,

I tested this on a (vendor specific) 5.4.24 kernel, where I know the patch is valid.
I won't be able to test it on the latest main-line kernel on short term, due to board bringup issues with this kernel base/revision change.
However, the patch itself is quite trivial. What do you advise? Do you prefer a tested patch for 5.4.24, an untested patch for 5.18, or otherwise?

Met vriendelijke groet / Kind regards,

Wouter van Herpen 

-----Original Message-----
From: Marc Kleine-Budde <mkl@blackshift.org> 
Sent: zondag 3 april 2022 12:58
To: Wouter van Herpen <wouter.van.herpen@prodrive-technologies.com>
Cc: linux-can@vger.kernel.org
Subject: Re: PROBLEM: tcan4x5x nINT stays asserted under high RX/TX interrupt load

Hello Wouter,

On 01.04.2022 13:23:43, Wouter van Herpen wrote:
> When using the tcan4x5x under high load of both RX/TX interrupts, at 
> some point the nINT signal stays asserted, causing the socket to block 
> in user space.
> 
> This reproduces very reliably (in my system) when both reading/writing 
> at 1ms intervals at CAN bus speed 1Mbps. When it occurs, M_CAN_IR is 
> set to 0x580d and never recovers (causing nINT to stay asserted). The 
> problem does not occur when only reading or only writing.
> 
> After checking the m_can_isr() function from 
> drivers/net/can/m_can/m_can.c, I noticed that MCAN interrupts are 
> disabled while processing the IR_RF0N flag, but not while processing 
> IR_TEFN. I'm not sure why, aren't both handlers running from the same 
> interrupt context and communicating to MRAM via SPI?

Thanks for your analysis. Without looking deeper into it, that sounds reasonable.

> I'm running kernel version 5.4.24 but I can see that in e.g. 5.17.0 
> this still applies. When I disable interrupts during IR_TEFN handling, 
> the blocking socket / nINT issue is gone.

Can you send a patch fixing the problem? Please include a patch description and your Signed-off-by:

https://elixir.bootlin.com/linux/v5.12/source/Documentation/process/submitting-patches.rst#L356

regards,
Marc

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: PROBLEM: tcan4x5x nINT stays asserted under high RX/TX interrupt load
  2022-04-05 12:02   ` Wouter van Herpen
@ 2022-04-05 12:09     ` Marc Kleine-Budde
  2022-04-08 10:29       ` Wouter van Herpen
  0 siblings, 1 reply; 7+ messages in thread
From: Marc Kleine-Budde @ 2022-04-05 12:09 UTC (permalink / raw)
  To: Wouter van Herpen; +Cc: Marc Kleine-Budde, linux-can

[-- Attachment #1: Type: text/plain, Size: 852 bytes --]

On 05.04.2022 12:02:09, Wouter van Herpen wrote:
> I tested this on a (vendor specific) 5.4.24 kernel, where I know the
> patch is valid.
> 
> I won't be able to test it on the latest main-line kernel on short
> term, due to board bringup issues with this kernel base/revision
> change.
> 
> However, the patch itself is quite trivial. What do you advise? Do you
> prefer a tested patch for 5.4.24, an untested patch for 5.18, or
> otherwise?

Feel free to send the patch against v5.4.24, please mention this in the
patch itself to avoid confusion.

regards,
Marc

-- 
Pengutronix e.K.                 | Marc Kleine-Budde           |
Embedded Linux                   | https://www.pengutronix.de  |
Vertretung West/Dortmund         | Phone: +49-231-2826-924     |
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917-5555 |

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: PROBLEM: tcan4x5x nINT stays asserted under high RX/TX interrupt load
  2022-04-05 12:09     ` Marc Kleine-Budde
@ 2022-04-08 10:29       ` Wouter van Herpen
  2022-04-08 10:41         ` Marc Kleine-Budde
  0 siblings, 1 reply; 7+ messages in thread
From: Wouter van Herpen @ 2022-04-08 10:29 UTC (permalink / raw)
  To: Marc Kleine-Budde; +Cc: Marc Kleine-Budde, linux-can

> Feel free to send the patch against v5.4.24, please mention this in the patch itself to avoid confusion.

> regards,
> Marc

For completeness, I submitted a patch on 05-04-2022 with subject:
[PATCH] can: m_can: m_can_isr(): disable mcan interrupts during tefn handling

(I noticed the patch is not listed on the archive mirror and I'm not sure if this is because it needs processing or if I did not submit correctly)

Wouter van Herpen

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: PROBLEM: tcan4x5x nINT stays asserted under high RX/TX interrupt load
  2022-04-08 10:29       ` Wouter van Herpen
@ 2022-04-08 10:41         ` Marc Kleine-Budde
  2022-04-08 12:32           ` Marc Kleine-Budde
  0 siblings, 1 reply; 7+ messages in thread
From: Marc Kleine-Budde @ 2022-04-08 10:41 UTC (permalink / raw)
  To: Wouter van Herpen; +Cc: Marc Kleine-Budde, linux-can

[-- Attachment #1: Type: text/plain, Size: 834 bytes --]

On 08.04.2022 10:29:38, Wouter van Herpen wrote:
> > Feel free to send the patch against v5.4.24, please mention this in the patch itself to avoid confusion.
> 
> For completeness, I submitted a patch on 05-04-2022 with subject:
> [PATCH] can: m_can: m_can_isr(): disable mcan interrupts during tefn handling

What's the Message-ID?

> (I noticed the patch is not listed on the archive mirror and I'm not
> sure if this is because it needs processing or if I did not submit
> correctly)

Can you re-send the patch, adding me on Cc?

regards,
Marc

-- 
Pengutronix e.K.                 | Marc Kleine-Budde           |
Embedded Linux                   | https://www.pengutronix.de  |
Vertretung West/Dortmund         | Phone: +49-231-2826-924     |
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917-5555 |

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: PROBLEM: tcan4x5x nINT stays asserted under high RX/TX interrupt load
  2022-04-08 10:41         ` Marc Kleine-Budde
@ 2022-04-08 12:32           ` Marc Kleine-Budde
  0 siblings, 0 replies; 7+ messages in thread
From: Marc Kleine-Budde @ 2022-04-08 12:32 UTC (permalink / raw)
  To: Wouter van Herpen; +Cc: mkl, linux-can

[-- Attachment #1: Type: text/plain, Size: 1179 bytes --]

On 08.04.2022 12:41:39, Marc Kleine-Budde wrote:
> On 08.04.2022 10:29:38, Wouter van Herpen wrote:
> > > Feel free to send the patch against v5.4.24, please mention this in the patch itself to avoid confusion.
> > 
> > For completeness, I submitted a patch on 05-04-2022 with subject:
> > [PATCH] can: m_can: m_can_isr(): disable mcan interrupts during tefn handling
> 
> What's the Message-ID?
> 
> > (I noticed the patch is not listed on the archive mirror and I'm not
> > sure if this is because it needs processing or if I did not submit
> > correctly)
> 
> Can you re-send the patch, adding me on Cc?

Just got you mail directly, not via the mailing list yet.

Once it was processed by the mailing list, it should show up here, too:

| https://lore.kernel.org/all/fe3c7a7ae0f16db0bac87c72faa4e91d0041fda3.1649414934.git.wouter.van.herpen@prodrive-technologies.com

regards,
Marc

-- 
Pengutronix e.K.                 | Marc Kleine-Budde           |
Embedded Linux                   | https://www.pengutronix.de  |
Vertretung West/Dortmund         | Phone: +49-231-2826-924     |
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917-5555 |

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-04-08 12:32 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-01 13:23 PROBLEM: tcan4x5x nINT stays asserted under high RX/TX interrupt load Wouter van Herpen
2022-04-03 10:57 ` Marc Kleine-Budde
2022-04-05 12:02   ` Wouter van Herpen
2022-04-05 12:09     ` Marc Kleine-Budde
2022-04-08 10:29       ` Wouter van Herpen
2022-04-08 10:41         ` Marc Kleine-Budde
2022-04-08 12:32           ` Marc Kleine-Budde

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.