public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Gautham R Shenoy <ego@in.ibm.com>
To: Ingo Molnar <mingo@elte.hu>
Cc: Gautham R Shenoy <ego@in.ibm.com>,
	akpm@osdl.org, linux-kernel@vger.kernel.org, torvalds@osdl.org,
	davej@redhat.com, dipankar@in.ibm.com, vatsa@in.ibm.com,
	paulmck@us.ibm.com
Subject: Re: CPUFREQ-CPUHOTPLUG: Possible circular locking dependency
Date: Thu, 30 Nov 2006 17:49:01 +0530	[thread overview]
Message-ID: <20061130121901.GA25439@in.ibm.com> (raw)
In-Reply-To: <20061130115327.GB2324@elte.hu>

On Thu, Nov 30, 2006 at 12:53:27PM +0100, Ingo Molnar wrote:
> 
> * Gautham R Shenoy <ego@in.ibm.com> wrote:
> 
> > This is what is currently being done by cpufreq:
> 
> ok!
> 
> > a) get_some_cpu_hotplug_protection() [use either some global mechanism
> > 					or a persubsystem mutex]
> 
> this bit is wrong i think. Any reason why it's not a per-CPU (but
> otherwise global) array of mutexes that controls CPU hotplug - as per my
> previous mail?
> 
> that would flatten the whole locking. Only one kind of lock taken,
> recursive and scalable.

I had posted one such recursive scalable version which can be found here
http://lkml.org/lkml/2006/10/26/73

I remember cc'ing you.

Yeah, it looks complicated and big, but then I did not want to add
another field to the task struct as one such attempt had already been
frowned upon ( I think long back Ashok posted it)

So I ended up writing the whole read/write lock/unlock code myself.

It's a RCU based lock, extremely light on the read side, but costly for the
writers since it does a synchronize_sched.

And yeah, it's partial towards the readers but with an additional field
in the task struct we can have a fair implementation.

Besides, an unfair cpu_hotplug_lock won't work since a process doing a
sched_getaffinity in a forever_while loop can prevent any hotplug from
happening.

> 
> Then the mechanism that changes CPU frequency should take all these
> hotplug locks on all (online) CPUs, and then first stop all processing
> on all CPUs, and then do the frequency change, atomically. This is with
> interrupts disabled everywhere /first/, and /without any additional
> locking/. That would prevent any sort of interaction from other CPUs -
> they'd all be sitting still with interrupts disabled.
> 

Yup.

> 	Ingo

regards
gautham.
-- 
Gautham R Shenoy
Linux Technology Center
IBM India.
"Freedom comes with a price tag of responsibility, which is still a bargain,
because Freedom is priceless!"

  reply	other threads:[~2006-11-30 12:31 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-29 15:24 CPUFREQ-CPUHOTPLUG: Possible circular locking dependency Gautham R Shenoy
2006-11-29 21:05 ` Andrew Morton
2006-11-30  4:28   ` Gautham R Shenoy
2006-11-30  6:35     ` Gautham R Shenoy
2006-11-30  8:29       ` Ingo Molnar
2006-11-30  8:52         ` Gautham R Shenoy
2006-12-01  1:43         ` Gautham R Shenoy
2006-12-01  8:55           ` Ingo Molnar
2006-11-30  8:31 ` Ingo Molnar
2006-11-30 10:24   ` Gautham R Shenoy
2006-11-30 11:03     ` Ingo Molnar
2006-11-30 11:19       ` Andrew Morton
2006-11-30 11:46         ` Ingo Molnar
2006-11-30 12:44           ` Gautham R Shenoy
2006-11-30 14:35             ` Ingo Molnar
2006-11-30 19:40           ` Andrew Morton
2006-11-30 20:24             ` Ingo Molnar
2006-11-30 11:43       ` Gautham R Shenoy
2006-11-30 11:53         ` Ingo Molnar
2006-11-30 12:19           ` Gautham R Shenoy [this message]
  -- strict thread matches above, loose matches on Subject: below --
2006-12-06 18:27 Pallipadi, Venkatesh
2006-12-07  7:06 ` Gautham R Shenoy
2006-12-07 12:50 Pallipadi, Venkatesh

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=20061130121901.GA25439@in.ibm.com \
    --to=ego@in.ibm.com \
    --cc=akpm@osdl.org \
    --cc=davej@redhat.com \
    --cc=dipankar@in.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=paulmck@us.ibm.com \
    --cc=torvalds@osdl.org \
    --cc=vatsa@in.ibm.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox