public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Rusty Russell <rusty@rustcorp.com.au>
To: Oleg Nesterov <oleg@tv-sign.ru>
Cc: linux-kernel@vger.kernel.org, travis@sgi.com,
	Ingo Molnar <mingo@elte.hu>, Gautham R Shenoy <ego@in.ibm.com>
Subject: Re: [PATCH 6/7] work_on_cpu: use on x86/kernel/cpu/intel_cacheinfo.c
Date: Fri, 24 Oct 2008 02:10:31 +1100	[thread overview]
Message-ID: <200810240210.31573.rusty@rustcorp.com.au> (raw)
In-Reply-To: <20081023094621.GA7995@redhat.com>

On Thursday 23 October 2008 20:46:21 Oleg Nesterov wrote:
> On 10/23, Rusty Russell wrote:
> > +static int __cpuinit detect_cache_attributes(unsigned int cpu)
> > +{
> > +	int			retval;
> > +
> > +	if (num_cache_leaves == 0)
> > +		return -ENOENT;
> > +
> > +	per_cpu(cpuid4_info, cpu) = kzalloc(
> > +	    sizeof(struct _cpuid4_info) * num_cache_leaves, GFP_KERNEL);
> > +	if (per_cpu(cpuid4_info, cpu) == NULL)
> > +		return -ENOMEM;
> > +
> > +	retval = work_on_cpu(cpu, get_cpu_leaves, NULL);
>
> This doesn't look right.
>
> cache_add_dev()->cpuid4_cache_sysfs_init()->detect_cache_attributes()
> is called by CPU_ONLINE under cpu_hotplug_begin(), this is deadlockable.
>
> Yes, the caller (cpu_hotplug.active_writer) can safely take
> get_online_cpus(), but if we have another pending work which needs
> get_online_cpus(), we have the deadlock.

Hi Oleg,

   Nice catch.  Can we use smp_call_function here instead?

Rusty.

>
> Oleg.





  reply	other threads:[~2008-10-23 15:11 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-23 16:55 [PATCH 6/7] work_on_cpu: use on x86/kernel/cpu/intel_cacheinfo.c Rusty Russell
2008-10-23  9:46 ` Oleg Nesterov
2008-10-23 15:10   ` Rusty Russell [this message]
2008-10-23 16:16     ` Oleg Nesterov

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=200810240210.31573.rusty@rustcorp.com.au \
    --to=rusty@rustcorp.com.au \
    --cc=ego@in.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=oleg@tv-sign.ru \
    --cc=travis@sgi.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