public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@kernel.org>
To: Juergen Gross <jgross@suse.com>
Cc: Mikulas Patocka <mpatocka@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>, Matthew Wilcox <matthew@wil.cx>,
	linux-kernel@vger.kernel.org,
	Thomas Gleixner <tglx@linutronix.de>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>
Subject: Re: [PATCH] semaphore: use raw_spin_lock_irq instead of raw_spin_lock_irqsave
Date: Thu, 21 Jun 2018 16:28:34 +0200	[thread overview]
Message-ID: <20180621142834.GA13940@gmail.com> (raw)
In-Reply-To: <dd98938f-7ddc-f4c5-ad88-8562f3d001d5@suse.com>


* Juergen Gross <jgross@suse.com> wrote:

> On 21/06/18 16:02, Ingo Molnar wrote:
> > 
> > * Ingo Molnar <mingo@kernel.org> wrote:
> > 
> >>
> >> * Mikulas Patocka <mpatocka@redhat.com> wrote:
> >>
> >>> The sleeping functions down, down_interruptible, down_killable and
> >>> down_timeout can't be called with interrupts disabled, so we don't have to
> >>> save and restore interrupt flag.
> >>>
> >>> This patch avoids the costly pushf and popf instructions on the semaphore
> >>> path.
> >>>
> >>> Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
> >>>
> >>> ---
> >>>  kernel/locking/semaphore.c |   21 ++++++++-------------
> >>>  1 file changed, 8 insertions(+), 13 deletions(-)
> >>
> >> I've applied this to the locking tree, I suspect we can do this on the condition 
> >> that it doesn't explode in early boot code (which has irqs disabled) and doesn't 
> >> generate early boot lockdep splats either.
> > 
> > Hm, this blew up pretty quick on a pretty regular x86-64 PC white-box, during 
> > early bootup:
> > 
> >   PANIC: early exception 0x08 IP 246:10 error ffffffff811537b2 cr2 0xffff88000240cff8
> > 
> > and I think it's due to your patch - verifying that now.
> 
> I guess local_irq_enable() being called by raw_spin_unlock_irq() makes
> its usage in early boot code undesirable.
> 
> Maybe it would be possible to use alternatives for that case? They are
> applied after enabling interrupts, so pushf and popf instructions could
> be patched away.

Or we could just leave the code as-is: the performance difference between CLI/STI 
and PUSHF/POPF shouldn't be significant, plus the semaphore APIs are obsolete and 
should not be used.

Thanks,

	Ingo

      reply	other threads:[~2018-06-21 14:28 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-30 15:24 [PATCH] semaphore: use raw_spin_lock_irq instead of raw_spin_lock_irqsave Mikulas Patocka
2018-06-21 13:50 ` Ingo Molnar
2018-06-21 14:02   ` Ingo Molnar
2018-06-21 14:17     ` Ingo Molnar
2018-06-21 14:20     ` Juergen Gross
2018-06-21 14:28       ` Ingo Molnar [this message]

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=20180621142834.GA13940@gmail.com \
    --to=mingo@kernel.org \
    --cc=a.p.zijlstra@chello.nl \
    --cc=jgross@suse.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matthew@wil.cx \
    --cc=mingo@redhat.com \
    --cc=mpatocka@redhat.com \
    --cc=peterz@infradead.org \
    --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