From: "Jan Beulich" <jbeulich@novell.com>
To: Juergen Gross <juergen.gross@fujitsu-siemens.com>
Cc: "xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>
Subject: Re: [Patch] don't spin with irq disabled
Date: Fri, 27 Mar 2009 07:41:03 +0000 [thread overview]
Message-ID: <49CC911F.76E4.0078.0@novell.com> (raw)
In-Reply-To: <49CB76B5.3040902@fujitsu-siemens.com>
>>> Juergen Gross <juergen.gross@fujitsu-siemens.com> 26.03.09 13:36 >>>
>Jan Beulich wrote:
>>>>> Juergen Gross <juergen.gross@fujitsu-siemens.com> 26.03.09 10:00 >>>
>>> Attached patch reduces interrupt latency in lock handling.
>>> spin_lock_irq and spin_lock_irqsave used to turn off IRQs and then tried to
>>> get the lock. If the lock was already held, waiting for the lock was done with
>>> IRQs still off.
>>> The patch reenables IRQs during the wait loop.
>>
>> This is wrong - you must not enable interrupts if they weren't enabled upon
>> entry to these two functions.
>
>spin_lock_irq disables always IRQs. spin_unlock_irq enables always IRQs. They
>are always used in pairs, so IRQs should always be enabled on entry of
>spin_lock_irq.
No, I wouldn't suggest making an assumption like this - some code could allow
interrupts to be disabled when acquiring the lock, but intentionally enabling
them when releasing it. (Personally, I think there shouldn't be any users of
this function pair in the first place, as I don't think forcibly enabling interrupts
is a correct thing to do in all but *very* few cases.)
>I'm not enabling IRQs unconditionally in spin_lock_irqsave, of course, but use
>the flags value saved before...
Oh, sorry, I blindly implied the second function to use the same methods as
the first one. And really I'd think it's cheaper to use local_irq_disable() here
(but of course retain local_irq_restore()).
Btw., why do you think the issue is more important to address in Xen than
in Linux (where not to long ago the opposite move happened, since re-
enabling interrupts with ticket locks is much trickier and hence wasn't
considered worthwhile afair.
Jan
next prev parent reply other threads:[~2009-03-27 7:41 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-26 9:00 [Patch] don't spin with irq disabled Juergen Gross
2009-03-26 12:23 ` Jan Beulich
2009-03-26 12:36 ` Juergen Gross
2009-03-27 7:41 ` Jan Beulich [this message]
2009-03-27 9:09 ` Keir Fraser
2009-03-27 17:00 ` spinlock requests (was RE: [Patch] don't spin with irq disabled) Dan Magenheimer
2009-03-27 17:46 ` Keir Fraser
2009-03-27 18:00 ` Dan Magenheimer
2009-03-27 18:12 ` Keir Fraser
2009-04-02 23:08 ` Dan Magenheimer
2009-04-03 7:17 ` Keir Fraser
2009-03-30 6:11 ` Juergen Gross
2009-03-31 13:12 ` Dan Magenheimer
2009-03-31 13:40 ` Juergen Gross
2009-03-31 13:48 ` Keir Fraser
2009-03-31 19:00 ` Jeremy Fitzhardinge
2009-03-31 20:57 ` Keir Fraser
2009-03-31 21:16 ` Jeremy Fitzhardinge
2009-03-26 14:27 ` [Patch] don't spin with irq disabled Keir Fraser
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=49CC911F.76E4.0078.0@novell.com \
--to=jbeulich@novell.com \
--cc=juergen.gross@fujitsu-siemens.com \
--cc=xen-devel@lists.xensource.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.