public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@elte.hu>
To: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Ryan Brown <some.nzguy@gmail.com>,
	linux-kernel@vger.kernel.org,
	Thomas Gleixner <tglx@linutronix.de>,
	"Paul E. McKenney" <paulmck@us.ibm.com>,
	Alan Stern <stern@rowland.harvard.edu>,
	Greg Kroah-Hartman <gregkh@suse.de>
Subject: Re: [patch] Real-Time Preemption, -RT-2.6.13-rc6-V0.7.53-11
Date: Tue, 16 Aug 2005 05:53:53 +0200	[thread overview]
Message-ID: <20050816035353.GA8411@elte.hu> (raw)
In-Reply-To: <1124138128.15180.7.camel@twins>


* Peter Zijlstra <a.p.zijlstra@chello.nl> wrote:

> --- linux-2.6.13-rc6-git7-RT-V0.7.53-11/drivers/usb/core/hcd.c~ 2005-08-15 21:23:45.000000000 +0200
> +++ linux-2.6.13-rc6-git7-RT-V0.7.53-11/drivers/usb/core/hcd.c  2005-08-15 22:03:33.000000000 +0200
> @@ -506,13 +506,11 @@ error:
>         }
> 
>         /* any errors get returned through the urb completion */
> -       local_irq_save (flags);
> +       local_irq_save_nort (flags);
>         spin_lock (&urb->lock);
>         if (urb->status == -EINPROGRESS)
>                 urb->status = status;
>         spin_unlock (&urb->lock);
>         usb_hcd_giveback_urb (hcd, urb, NULL);
> -       local_irq_restore (flags);
> +       local_irq_restore_nort (flags);
>         return 0;
>  }

i'm wondering whether we could/should also fix this upstream - and 
whether this [making the IRQ flags disabling a NOP on -RT] is the right 
fix. Why does the USB hcd.c code do this in the first place? Disabling 
interrupts during usb_hcd_giveback_urb() [but not holding the urb->lock] 
might serialize on UP, but it has no serialization effect on SMP and is 
hence potentially buggy. Is there something i'm missing about this code?

the normal way of using urb->lock would be spin_lock_irqsave() and 
spin_lock_irqrestore(), not the 'detached' method seen above.

> similar fix, completions need not have irqs disabled on PREEMPT_RT 
> right?

correct, PREEMPT_RT is very strict about the use of the interrupt flags.  
A fair portion of the now-illegal API uses are also SMP bugs on 
upstream, so these details are worth pursuing.

> --- linux-2.6.13-rc6-git7-RT-V0.7.53-11/drivers/usb/core/hcd.c~ 2005-08-15 22:03:33.000000000 +0200
> +++ linux-2.6.13-rc6-git7-RT-V0.7.53-11/drivers/usb/core/hcd.c  2005-08-15 22:32:54.000000000 +0200
> @@ -538,7 +538,7 @@ void usb_hcd_poll_rh_status(struct usb_h
>         if (length > 0) {
> 
>                 /* try to complete the status urb */
> -               local_irq_save (flags);
> +               local_irq_save_nort (flags);
>                 spin_lock(&hcd_root_hub_lock);
>                 urb = hcd->status_urb;
>                 if (urb) {
> @@ -562,7 +562,7 @@ void usb_hcd_poll_rh_status(struct usb_h
>                         usb_hcd_giveback_urb (hcd, urb, NULL);
>                 else
>                         hcd->poll_pending = 1;
> -               local_irq_restore (flags);
> +               local_irq_restore_nort (flags);

same question: why are interrupts being kept disabled longer, and why is 
usb_hcd_giveback_urb() called with interrupts disabled? (I tried to use 
spin_lock_irqsave/irqrestore() in earlier -RT versions, but people 
reported hangs and USB misbehavior, which might be related. I'm worried 
that your _nort patch could cause similar misbehavior.)

how about (naively) extending the urb->lock to cover 
usb_hcd_giveback_urb() calls too - does that cause a deadlock or is it 
unsafe in some other way?

	Ingo

  reply	other threads:[~2005-08-16  3:53 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-08-11 11:00 [patch] Real-Time Preemption, -RT-2.6.13-rc4-V0.7.53-01, High Resolution Timers & RCU-tasklist features Ingo Molnar
2005-08-12  3:07 ` Lee Revell
2005-08-12  3:19   ` Lee Revell
2005-08-12  7:03     ` Ingo Molnar
2005-08-12  7:48     ` Thomas Gleixner
2005-08-12  7:07   ` Ingo Molnar
2005-08-13  0:28 ` Ryan Brown
2005-08-13  0:32   ` Lee Revell
2005-08-13  0:57     ` George Anzinger
2005-08-14  2:12       ` Ingo Molnar
2005-08-15  6:29         ` Ingo Molnar
2005-08-15 23:39           ` George Anzinger
2005-08-16  6:36             ` Thomas Gleixner
2005-08-15 11:18   ` [patch] Real-Time Preemption, -RT-2.6.13-rc6-V0.7.53-11 Ingo Molnar
2005-08-15 20:35     ` Peter Zijlstra
2005-08-16  3:53       ` Ingo Molnar [this message]
2005-08-16 14:35         ` Alan Stern
2005-08-16 16:12           ` Ingo Molnar
2005-08-16 16:56             ` Alan Stern
2005-08-16 17:02               ` Ingo Molnar
2005-08-17  2:23               ` David Brownell
2005-08-17 14:10                 ` Alan Stern
2005-08-17 20:51                   ` David Brownell
2005-08-18  4:52                     ` Ingo Molnar
2005-08-18  6:37                       ` David Brownell
2005-08-18 14:43                         ` Alan Stern
2005-08-22 11:07                         ` Ingo Molnar
2005-08-17  6:31               ` Ingo Molnar
2005-08-16  8:41     ` 2.6.13-rc6-rt1 Ingo Molnar
2005-08-16 12:32       ` 2.6.13-rc6-rt1 Michal Schmidt
2005-08-27  1:15         ` 2.6.13-rc6-rt1 Matt Mackall
2005-08-29 22:36           ` 2.6.13-rc6-rt1 Esben Nielsen
2005-08-17  0:53 ` [patch] KGDB for Real-Time Preemption systems George Anzinger
2005-08-17  6:53   ` Ingo Molnar
2005-08-17 19:16     ` George Anzinger
2005-09-05 12:23   ` Serge Noiraud
2005-09-08  0:37     ` George Anzinger
2005-09-07  8:55   ` Serge Noiraud
2005-09-07 21:16     ` George Anzinger
2005-09-08  8:57       ` Serge Noiraud
2005-09-08 20:47         ` George Anzinger

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=20050816035353.GA8411@elte.hu \
    --to=mingo@elte.hu \
    --cc=a.p.zijlstra@chello.nl \
    --cc=gregkh@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paulmck@us.ibm.com \
    --cc=some.nzguy@gmail.com \
    --cc=stern@rowland.harvard.edu \
    --cc=tglx@linutronix.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox