All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@elte.hu>
To: Esben Nielsen <simlo@phys.au.dk>
Cc: Daniel Walker <dwalker@mvista.com>,
	linux-kernel@vger.kernel.org, sdietrich@mvista.com
Subject: Re: [PATCH] local_irq_disable removal
Date: Sat, 11 Jun 2005 15:46:09 +0200	[thread overview]
Message-ID: <20050611134609.GA31025@elte.hu> (raw)
In-Reply-To: <Pine.OSF.4.05.10506111455240.2917-100000@da410.phys.au.dk>


* Esben Nielsen <simlo@phys.au.dk> wrote:

> > Plus take into
> > account that the average interrupt disable section is very small .. I
> > also think it's possible to extend my version to allow those section to
> > be preemptible but keep the cost equally low.
> > 
> 
> The more I think about it the more dangerous I think it is. What does 
> local_irq_disable() protect against? All local threads as well as 
> irq-handlers. If these sections keeped mutual exclusive but preemtible 
> we will not have protected against a irq-handler.

one way to make it safe/reviewable is to runtime warn if 
local_irq_disable() is called from a !preempt_count() section. But this 
will uncover quite some code. There's some code in the VM, in the 
buffer-cache, in the RCU code - etc. that uses per-CPU data structures 
and assumes non-preemptability of local_irq_disable().

> I will start to play around with the following:
> 1) Make local_irq_disable() stop compiling to see how many we are really
> talking about.

there are roughly 100 places:

 $ objdump -d vmlinux | grep -w call |
      grep -wE 'local_irq_disable|local_irq_save' | wc -l
 116

the advantage of having such primitives as out-of-line function calls :)

> 2) Make local_cpu_lock, which on PREEMPT_RT is a rt_mutex and on
> !PREEMPT_RT turns into local_irq_disable()/enable() pairs. To introduce
> this will demand some code-analyzing for each case but I am afraid there
> is no general one-size solution to all the places.

I'm not sure we'd gain much from this. Lets assume we have a highprio RT 
task that is waiting for an external event. Will it be able to preempt 
the IRQ mutex?  Yes. Will it be able to make any progress: no, because 
it needs an IRQ thread to run to get the wakeup in the first place, and 
the IRQ thread needs to take the IRQ mutex => serialization.

what seems a better is to rewrite per-CPU-local-irq-disable users to 
make use of the DEFINE_PER_CPU_LOCKED/per_cpu_locked/get_cpu_lock 
primitives to use preemptible per-CPU data structures. In this case 
these sections would be truly preemptible. I've done this for a couple 
of cases already, where it was unavoidable for lock-dependency reasons.

	Ingo

  reply	other threads:[~2005-06-11 13:50 UTC|newest]

Thread overview: 86+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-06-08  7:08 [PATCH] local_irq_disable removal Daniel Walker
2005-06-08 11:21 ` Ingo Molnar
2005-06-08 20:33   ` Daniel Walker
2005-06-09 11:56     ` Ingo Molnar
2005-06-10 23:37 ` Esben Nielsen
2005-06-11  0:20   ` Daniel Walker
2005-06-11 13:13     ` Esben Nielsen
2005-06-11 13:46       ` Ingo Molnar [this message]
2005-06-11 14:32         ` Esben Nielsen
2005-06-11 16:36           ` Daniel Walker
2005-06-11 17:26             ` Thomas Gleixner
2005-06-11 18:40               ` Sven-Thorsten Dietrich
2005-06-12  0:07                 ` Thomas Gleixner
2005-06-12  0:15                   ` Sven-Thorsten Dietrich
2005-06-12  0:22                     ` Thomas Gleixner
2005-06-12  0:24                       ` Sven-Thorsten Dietrich
2005-06-11 19:16             ` Ingo Molnar
2005-06-11 19:34               ` Esben Nielsen
2005-06-11 19:44                 ` Sven-Thorsten Dietrich
2005-06-11 19:53                   ` Daniel Walker
2005-06-11 20:23                   ` Esben Nielsen
2005-06-11 22:59                     ` Sven-Thorsten Dietrich
2005-06-13  5:22                       ` Steven Rostedt
2005-06-13  6:20                         ` Sven-Thorsten Dietrich
2005-06-13 12:28                           ` Steven Rostedt
2005-06-11 20:03                 ` Ingo Molnar
2005-06-11 20:51                   ` Daniel Walker
2005-06-11 23:44                     ` Thomas Gleixner
2005-06-11 23:50                       ` Daniel Walker
2005-06-12  0:01                         ` Thomas Gleixner
2005-06-12  0:09                       ` Sven-Thorsten Dietrich
2005-06-12  0:28                         ` Thomas Gleixner
2005-06-12  1:05                         ` Gene Heskett
2005-06-13 12:03                           ` Paulo Marques
2005-06-13 12:19                             ` Esben Nielsen
2005-06-12  4:50                       ` cutaway
2005-06-12  6:57                       ` Ingo Molnar
2005-06-12 11:15                         ` Esben Nielsen
2005-06-12 11:52                           ` Ingo Molnar
2005-06-13  7:01                           ` Sven-Thorsten Dietrich
2005-06-13  7:53                             ` Esben Nielsen
2005-06-13  8:05                               ` Sven-Thorsten Dietrich
2005-06-13  8:54                                 ` Esben Nielsen
2005-06-13  9:13                                   ` Ingo Molnar
2005-06-12 15:28                         ` Daniel Walker
2005-06-12  4:31                     ` Karim Yaghmour
2005-06-12  4:32                       ` Daniel Walker
2005-06-12  4:56                         ` Karim Yaghmour
2005-06-12  4:55                           ` Daniel Walker
2005-06-12  5:16                             ` Karim Yaghmour
2005-06-12  5:14                               ` Daniel Walker
2005-06-12  5:27                                 ` Karim Yaghmour
2005-06-12 15:27                     ` Zwane Mwaikambo
2005-06-12 15:46                       ` Daniel Walker
2005-06-12 19:02                       ` Ingo Molnar
2005-06-12 17:02                     ` Andi Kleen
2005-06-13  7:08                   ` Sven-Thorsten Dietrich
2005-06-13  7:44                     ` Esben Nielsen
2005-06-13  7:53                       ` Sven-Thorsten Dietrich
2005-06-13  7:56                         ` Ingo Molnar
2005-06-13  7:47                     ` Ingo Molnar
2005-06-11 16:41           ` Sven-Thorsten Dietrich
2005-06-11 17:16             ` Esben Nielsen
2005-06-11 19:29               ` Sven-Thorsten Dietrich
2005-06-11 20:02               ` Sven-Thorsten Dietrich
2005-06-11 16:19         ` Daniel Walker
2005-06-11 13:51       ` Ingo Molnar
2005-06-11 15:00         ` Mika Penttilä
2005-06-11 16:45           ` Sven-Thorsten Dietrich
2005-06-11 16:53             ` Mika Penttilä
2005-06-11 17:13               ` Daniel Walker
2005-06-11 17:22                 ` Mika Penttilä
2005-06-11 17:25                   ` Daniel Walker
2005-06-11 17:29                     ` Mika Penttilä
2005-06-11 17:30                       ` Daniel Walker
2005-06-11 17:55                         ` Mika Penttilä
2005-06-11 16:28         ` Daniel Walker
2005-06-11 16:46           ` Esben Nielsen
2005-06-11 16:09       ` Daniel Walker
2005-06-11 16:31         ` Esben Nielsen
2005-06-11 16:51 ` Christoph Hellwig
2005-06-11 22:44   ` Ed Tomlinson
2005-06-12  6:23   ` Ingo Molnar
2005-06-12  9:28     ` Christoph Hellwig
2005-06-13  4:39       ` [RT] " Steven Rostedt
2005-06-16  5:35       ` Lee Revell

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=20050611134609.GA31025@elte.hu \
    --to=mingo@elte.hu \
    --cc=dwalker@mvista.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sdietrich@mvista.com \
    --cc=simlo@phys.au.dk \
    /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.