Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ad90573f authored by Andi Kleen's avatar Andi Kleen Committed by Linus Torvalds
Browse files

[PATCH] x86_64: Initialize powernow_data[] for all siblings



I got an oops on a dual core system because the lost tick handler
called cpufreq_get() on core 1 and powernow tried to follow
a NULL powernow_data[] pointer there.

Initialize powernow_data for all cores of a CPU.

Cc: Jacob Shin <jacob.shin@amd.com>
Cc: Dave Jones <davej@redhat.com>
Signed-off-by: default avatarAndi Kleen <ak@suse.de>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 00859790
Loading
Loading
Loading
Loading
+4 −3
Original line number Original line Diff line number Diff line
@@ -54,7 +54,7 @@ static DECLARE_MUTEX(fidvid_sem);
static struct powernow_k8_data *powernow_data[NR_CPUS];
static struct powernow_k8_data *powernow_data[NR_CPUS];


#ifndef CONFIG_SMP
#ifndef CONFIG_SMP
static cpumask_t cpu_core_map[1];
static cpumask_t cpu_core_map[1] = { CPU_MASK_ALL };
#endif
#endif


/* Return a frequency in MHz, given an input fid */
/* Return a frequency in MHz, given an input fid */
@@ -976,7 +976,7 @@ static int __cpuinit powernowk8_cpu_init(struct cpufreq_policy *pol)
{
{
	struct powernow_k8_data *data;
	struct powernow_k8_data *data;
	cpumask_t oldmask = CPU_MASK_ALL;
	cpumask_t oldmask = CPU_MASK_ALL;
	int rc;
	int rc, i;


	if (!cpu_online(pol->cpu))
	if (!cpu_online(pol->cpu))
		return -ENODEV;
		return -ENODEV;
@@ -1062,7 +1062,8 @@ static int __cpuinit powernowk8_cpu_init(struct cpufreq_policy *pol)
	printk("cpu_init done, current fid 0x%x, vid 0x%x\n",
	printk("cpu_init done, current fid 0x%x, vid 0x%x\n",
	       data->currfid, data->currvid);
	       data->currfid, data->currvid);


	powernow_data[pol->cpu] = data;
	for_each_cpu_mask(i, cpu_core_map[pol->cpu])
		powernow_data[i] = data;


	return 0;
	return 0;