From: Doug Chapman <dchapman@redhat.com> Date: Fri, 11 Jan 2008 11:42:49 -0500 Subject: [cpufreq] booting with maxcpus=1 panics Message-id: 1200069769.22739.8.camel@deimos.americas.hpqcorp.net O-Subject: [RHEL5.2 PATCH] BZ 428331 - booting with maxcpus=1 panics when starting cpufreq service Bugzilla: 428331 Fix for BZ 428331 - booting with maxcpus=1 panics when starting cpufreq service Introduced by my patch for BZ 253416. The fix is to check if the cpu is inline cpufreq_remove_dev in the same way as it was already done in cpufreq_add_dev. This is a direct backport of: commit ec28297a562f2b022115b9eb82e4ea724d996240 Author: Venki Pallipadi <venkatesh.pallipadi@intel.com> Date: Mon Mar 26 12:03:19 2007 -0700 [PATCH] Fix maxcpus=1 trigerring BUG() in cpufreq Ingo reported it on lkml in the thread "2.6.21-rc5: maxcpus=1 crash in cpufreq: kernel BUG at drivers/cpufreq/cpufreq.c:82!" This check added to remove_dev is symmetric to one in add_dev and handles callbacks for offline cpus cleanly. Tested by myself and Dave Anderson. Acked-by: Dave Anderson <anderson@redhat.com> Acked-by: Prarit Bhargava <prarit@redhat.com> Acked-by: Neil Horman <nhorman@redhat.com> Acked-by: Brian Maly <bmaly@redhat.com> diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index b2356eb..7f39618 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -972,6 +972,10 @@ static int cpufreq_remove_dev (struct sys_device * sys_dev) { unsigned int cpu = sys_dev->id; int retval; + + if (cpu_is_offline(cpu)) + return 0; + if (unlikely(lock_policy_rwsem_write(cpu))) BUG();