linux-can.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Wolfgang Grandegger <wg@grandegger.com>
To: s.grosjean@peak-system.com
Cc: Oliver Hartkopp <socketcan@hartkopp.net>,
	Sebastian Haas <dev@sebastianhaas.info>,
	"linux-can@vger.kernel.org" <linux-can@vger.kernel.org>
Subject: Re: About PCAN-USB issues
Date: Wed, 25 Jan 2012 11:25:31 +0100	[thread overview]
Message-ID: <4F1FD89B.8090401@grandegger.com> (raw)
In-Reply-To: <4F1EE678.2050604@peak-system.com>

Hi Stephane,

On 01/24/2012 06:12 PM, Stephane Grosjean wrote:
> Hello all,
> 
> I'm finally back to the linux-can... I'm currently working on several
> projects so the peak_usb did progress slowly these last days...
> 
> Back to the issue: I changed the way the can state is handled in the
> peak_usb driver and finally get an easy tesbed to create bus-off
> events... Now, the driver puts the candev into that state only once, no
> more periodic error-warnings or else. I'm looking now to how the restart
> mechanism works.
> 
> 1st: since the restart can be automatic, the related do_set_mode
> callback is called from a timer context, in which you're not allowed to
> sleep. So I suppose this is the reason of some Kernel hangs you (Oliver)
> detected last week: the peak_usb driver (tries to) reset the device by
> sending an usb message, using usb_bulk_msg(), which usage is not allowed
> in such a context! To confirm, is someone able to do the same with the
> ems_usb driver, please? It seems that this driver acts as the peak_usb
> does.

The timer handler is called from softirq context, which is not valid for
usb_bulk_msg().

> 
> Moreover, it seems that the "manual" restart is also called from such a
> timer context, so the consequences are the same...

Yes, it uses the timer as well, see:

  http://lxr.linux.no/#linux+v3.2.1/drivers/net/can/dev.c#L406

Otherwise it would be called from the process context, which causes
other problems.

> I'll have to change the way that reset is done into full asynchronous mode.

You will find some comments here:

  http://lxr.linux.no/#linux+v3.2.1/drivers/usb/core/message.c#L192

Wolfgang.

  reply	other threads:[~2012-01-25 10:25 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1567213.2GCzMlGyKY@lisa>
2012-01-24 12:01 ` increase buffer size Oliver Hartkopp
2012-01-24 15:42   ` [Socketcan-users] " Steffen Rose
2012-01-24 16:17     ` Oliver Hartkopp
2012-01-24 17:12   ` About PCAN-USB issues Stephane Grosjean
2012-01-25 10:25     ` Wolfgang Grandegger [this message]
2012-01-31 17:58     ` 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=4F1FD89B.8090401@grandegger.com \
    --to=wg@grandegger.com \
    --cc=dev@sebastianhaas.info \
    --cc=linux-can@vger.kernel.org \
    --cc=s.grosjean@peak-system.com \
    --cc=socketcan@hartkopp.net \
    /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).