linux-can.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andri Yngvason <andri.yngvason@marel.com>
To: Viktor Babrian <babrian.viktor@renyi.mta.hu>,
	Tom Evans <tom_usenet@optusnet.com.au>
Cc: linux-can@vger.kernel.org
Subject: Re: c_can: (newbie) high system load when frame not acked?
Date: Tue, 13 Jan 2015 15:32:43 +0000	[thread overview]
Message-ID: <20150113153243.26859.47218@shannon> (raw)
In-Reply-To: <alpine.DEB.2.02.1501131523290.12789@login>

Quoting Viktor Babrian (2015-01-13 15:10:29)
> > Maybe you can turn the error interrupts off and still have it function. Maybe 
> > it won't (may be required for bus off recovery).
> 
> Thanks for the detailed answer. I read the pages and took a look into the 
> code.
> 
> Regarding state-change behavior, DCAN controller is similar to the one in 
> i.MX6. (It has explicit interrupt source for Act->Warn and Pass->BOFF 
> transitions).
> Although as I understand CAN, you have to have a successful RX or TX event 
> to have the counters decrease. That  means that you will have an immediate 
> report (i.e. interrupt) on Warn->Active, Pass->Warn and BOFF->Active. As 
> far as I see, this latter is explicitly handled by upper layers so driver 
> will have to know it anyway.
Correct.
> This means that if I turn off bus error monitoring, the only event I will 
> not get immediate report of is Warn->Pass. (Pass->Warn can be reported on 
> successful message events if the driver is implemented accordingly. 
Also correct.
> Currently it isn't). However it could be reported later upon the first 
> successful message event. I beleive missing an accurate report of 
> active->passive state change is far better than having a non-responding 
> system in the field in scenarios that do happen.
I agree.

Note: The FlexCAN driver does actually respect berr-reporting for i.MX6.
However, it does not respect it for some older chips.

> 
> Anyway I modified the code so that state change interrupt is not 
> enabled when user sets berr-reporting off (as you kindly suggested). It 
> solves the load issue. Bus-off recovery behavior did not change (I made a 
> few tests only). Btw the driver disables all interrupts in bus off so I 
> guess it does not matter what exact flags were set.
Perhaps, you would like to post your patch? Turning off the interrupts when
berr-reporting is off is definitely correct behaviour. Not turning them off
seems rather pointless to me. AFAIK the whole point of this flag is to suppress
ack-error flood.
> 
> > The consequence (depending on the CPU and Linux build options) is 10%-100% 
> > CPU utilisation when there's nothing to ACK the packet, and a higher figure 
> > again when the bus isn't terminated.
> >
> > CAN is meant to be used in cars or factories. Running with only one node or a 
> > disconnected bus is not a "normal" condition, so the hardware and drivers 
> > don't handle those conditions well.
> Well error states are defined by the spec so they ARE normal. What is not 
> normal is to bring down system performace when they happen.
> 
> 
> I alose added a line to put the controller in init mode in 
> c_can_stop() so that bringing the bus down will actually cause the 
> controller stop transmitting. I hope it's the way to do this, it would be 
> nice if some expert could verify this.
> 
Put this in a separate patch if you post this change.

Best regards,
Andri Yngvason


  parent reply	other threads:[~2015-01-13 15:48 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-03 17:54 [PATCH v5 3/5] can: mscan: Consolidate and unify state change handling Andri Yngvason
2015-01-12 17:18 ` c_can: (newbie) high system load when frame not acked? Viktor Babrian
     [not found]   ` <1735533.0yOonAfCy1@heinz>
2015-01-12 18:50     ` Viktor Babrian
2015-01-13  1:19       ` Tom Evans
2015-01-13 15:10         ` Viktor Babrian
2015-01-13 15:16           ` Marc Kleine-Budde
2015-01-13 15:54             ` Viktor Babrian
2015-01-13 15:55               ` Marc Kleine-Budde
2015-01-13 15:32           ` Andri Yngvason [this message]
2015-01-14  1:35             ` Tom Evans
2015-01-14  9:55               ` Andri Yngvason
2015-01-15  0:29                 ` Tom Evans
2015-01-18 18:30             ` [PATCH 3.19-rc3] c_can: SIE disabled when berr-reporting is off to reduce irq flood Viktor Babrian
2015-01-18 18:34               ` Marc Kleine-Budde
2015-01-18 18:52                 ` Viktor Babrian
2015-01-18 18:56                   ` Marc Kleine-Budde
2015-01-19 11:32                     ` Viktor Babrian
2015-01-19 22:35                 ` Tom Evans
2015-01-18 19:01               ` [PATCH 3.19-rc3] c_can: end transmission on network stop Viktor Babrian
2015-01-20 14:39                 ` Marc Kleine-Budde

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=20150113153243.26859.47218@shannon \
    --to=andri.yngvason@marel.com \
    --cc=babrian.viktor@renyi.mta.hu \
    --cc=linux-can@vger.kernel.org \
    --cc=tom_usenet@optusnet.com.au \
    /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).