All of lore.kernel.org
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@tv-sign.ru>
To: Rusty Russell <rusty@rustcorp.com.au>
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: Thu, 23 Oct 2008 11:46:21 +0200	[thread overview]
Message-ID: <20081023094621.GA7995@redhat.com> (raw)
In-Reply-To: <20081023005750.D0A11DDEF9@ozlabs.org>

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.

Oleg.


  reply	other threads:[~2008-10-23  9:46 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 [this message]
2008-10-23 15:10   ` Rusty Russell
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=20081023094621.GA7995@redhat.com \
    --to=oleg@tv-sign.ru \
    --cc=ego@in.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=rusty@rustcorp.com.au \
    --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 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.