lkml.org 
[lkml]   [2008]   [Oct]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 6/7] work_on_cpu: use on x86/kernel/cpu/intel_cacheinfo.c
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.



\
 
 \ /
  Last update: 2008-10-23 11:49    [W:0.057 / U:0.248 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site