All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marc Kleine-Budde <mkl@pengutronix.de>
To: Torin Cooper-Bennun <torin@maxiluxsystems.com>
Cc: linux-can@vger.kernel.org
Subject: Re: [PATCH can-next 5/5] can: tcan4x5x: implement handling of device interrupts
Date: Tue, 1 Jun 2021 10:19:42 +0200	[thread overview]
Message-ID: <20210601081942.pqzgtmkygwg2vpit@pengutronix.de> (raw)
In-Reply-To: <20210601075028.hubzfkhkfdcxtlq5@bigthink>

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

On 01.06.2021 08:50:28, Torin Cooper-Bennun wrote:
> On Wed, May 26, 2021 at 05:15:59PM +0200, Marc Kleine-Budde wrote:
> > On 26.05.2021 13:47:47, Torin Cooper-Bennun wrote:
> > > Handle power, transceiver and SPI failures by printing a useful error
> > > message (multiple simultaneous failures are not logged) and disabling
> >            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> > 
> > Is this a limitation of your code or the tcan core?
> 
> My code doesn't print an error message for every handled interrupt, only
> the first, because it's very rare to see more than one. Perhaps it's
> prudent to print a line for each handled interrupt just in case.

Yes, please make it so.

> > >  static irqreturn_t tcan4x5x_handle_dev_interrupts(struct m_can_classdev *cdev,
> > >  						  bool clear_only)
> > >  {
> > > -	tcan4x5x_clear_interrupts(cdev);
> > > +	struct tcan4x5x_priv *priv = cdev_to_priv(cdev);
> > > +	int err = 0;
> > > +	irqreturn_t handled = IRQ_NONE;
> > 
> > nitpick: please make "int err" the last.
> 
> ACK
> 
> > 
> > > +
> > > +	if (!clear_only) {
> > > +		u32 ir = 0;
> > > +		const char *fail_str = "";
> > 
> > nitpick: please make the u32 the last.
> 
> ACK
> 
> > > +		else if (ir & TCAN4X5X_CANDOM_INT_EN)
> > > +			fail_str = "CAN stuck dominant (CANDOM)";
> > 
> > The error message suggests, that this error can be triggered by messing
> > around with the CAN high/low wires. I'm not sure if it's a good idea to
> > shutdown the driver in this case.
> 
> ACK, but I need to test whether the device stays functional without CPU
> intervention after CANDOM is asserted.

- Does IRQ line stay asserted if the CAN lines are still stuck dominant?

If yes, this would result in an IRQ storm, which we don't want to have.
If you/we want to handle this in a "proper" way, send a CAN error frame [1],
mask this interrupt, setup a timer/workqueue/etc and unmask it after
some 100ms.
  
[1] But I'm not sure if we have proper values for stuck dominant yet.
    https://elixir.bootlin.com/linux/latest/source/include/uapi/linux/can/error.h#L110
  
- What happens if the stuck dominant condition is gone?

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 --]

  reply	other threads:[~2021-06-01  8:19 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-26 12:47 [PATCH can-next 0/5] m_can, tcan4x5x: device-specific interrupt handling Torin Cooper-Bennun
2021-05-26 12:47 ` [PATCH can-next 1/5] can: m_can: ops: clear_interrupts -> handle_dev_interrupts Torin Cooper-Bennun
2021-05-26 12:47 ` [PATCH can-next 2/5] can: m_can: m_can_isr(): handle device-specific interrupts Torin Cooper-Bennun
2021-05-26 15:07   ` Marc Kleine-Budde
2021-05-26 15:18     ` Marc Kleine-Budde
2021-06-01  8:23       ` Torin Cooper-Bennun
2021-06-01 10:25         ` Marc Kleine-Budde
2021-06-01  7:22     ` Torin Cooper-Bennun
2021-05-26 12:47 ` [PATCH can-next 3/5] can: tcan4x5x: tcan4x5x_clear_interrupts(): rm unnecessary reg clears Torin Cooper-Bennun
2021-05-26 12:47 ` [PATCH can-next 4/5] can: tcan4x5x: only enable useful device interrupts Torin Cooper-Bennun
2021-05-26 12:47 ` [PATCH can-next 5/5] can: tcan4x5x: implement handling of " Torin Cooper-Bennun
2021-05-26 15:15   ` Marc Kleine-Budde
2021-06-01  7:50     ` Torin Cooper-Bennun
2021-06-01  8:19       ` Marc Kleine-Budde [this message]
2021-05-26 15:20 ` [PATCH can-next 0/5] m_can, tcan4x5x: device-specific interrupt handling Marc Kleine-Budde
2021-06-01  8:21   ` Torin Cooper-Bennun
2021-06-01  9:18     ` Marc Kleine-Budde
2021-06-01 10:56       ` Torin Cooper-Bennun
2021-07-02  7:33 ` Torin Cooper-Bennun

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=20210601081942.pqzgtmkygwg2vpit@pengutronix.de \
    --to=mkl@pengutronix.de \
    --cc=linux-can@vger.kernel.org \
    --cc=torin@maxiluxsystems.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.