Merge branch 'acpi-processor'

* acpi-processor:
  ACPI / processor: Acquire writer lock to update CPU maps
  ACPI / processor: Remove acpi_processor_get_limit_info()
This commit is contained in:
Rafael J. Wysocki 2013-08-27 01:29:24 +02:00
commit 551f5c74e1
5 changed files with 26 additions and 24 deletions

View File

@ -178,14 +178,17 @@ static int acpi_processor_hotadd_init(struct acpi_processor *pr)
if (ACPI_FAILURE(status) || !(sta & ACPI_STA_DEVICE_PRESENT)) if (ACPI_FAILURE(status) || !(sta & ACPI_STA_DEVICE_PRESENT))
return -ENODEV; return -ENODEV;
cpu_maps_update_begin();
cpu_hotplug_begin();
ret = acpi_map_lsapic(pr->handle, &pr->id); ret = acpi_map_lsapic(pr->handle, &pr->id);
if (ret) if (ret)
return ret; goto out;
ret = arch_register_cpu(pr->id); ret = arch_register_cpu(pr->id);
if (ret) { if (ret) {
acpi_unmap_lsapic(pr->id); acpi_unmap_lsapic(pr->id);
return ret; goto out;
} }
/* /*
@ -195,7 +198,11 @@ static int acpi_processor_hotadd_init(struct acpi_processor *pr)
*/ */
pr_info("CPU%d has been hot-added\n", pr->id); pr_info("CPU%d has been hot-added\n", pr->id);
pr->flags.need_hotplug_init = 1; pr->flags.need_hotplug_init = 1;
return 0;
out:
cpu_hotplug_done();
cpu_maps_update_done();
return ret;
} }
#else #else
static inline int acpi_processor_hotadd_init(struct acpi_processor *pr) static inline int acpi_processor_hotadd_init(struct acpi_processor *pr)
@ -452,11 +459,15 @@ static void acpi_processor_remove(struct acpi_device *device)
per_cpu(processor_device_array, pr->id) = NULL; per_cpu(processor_device_array, pr->id) = NULL;
per_cpu(processors, pr->id) = NULL; per_cpu(processors, pr->id) = NULL;
cpu_maps_update_begin();
cpu_hotplug_begin();
/* Remove the CPU. */ /* Remove the CPU. */
get_online_cpus();
arch_unregister_cpu(pr->id); arch_unregister_cpu(pr->id);
acpi_unmap_lsapic(pr->id); acpi_unmap_lsapic(pr->id);
put_online_cpus();
cpu_hotplug_done();
cpu_maps_update_done();
try_offline_node(cpu_to_node(pr->id)); try_offline_node(cpu_to_node(pr->id));

View File

@ -175,7 +175,9 @@ static int __acpi_processor_start(struct acpi_device *device)
acpi_processor_load_module(pr); acpi_processor_load_module(pr);
#endif #endif
acpi_processor_get_throttling_info(pr); acpi_processor_get_throttling_info(pr);
acpi_processor_get_limit_info(pr);
if (pr->flags.throttling)
pr->flags.limit = 1;
if (!cpuidle_get_driver() || cpuidle_get_driver() == &acpi_idle_driver) if (!cpuidle_get_driver() || cpuidle_get_driver() == &acpi_idle_driver)
acpi_processor_power_init(pr); acpi_processor_power_init(pr);

View File

@ -186,18 +186,6 @@ static int cpufreq_set_cur_state(unsigned int cpu, int state)
#endif #endif
int acpi_processor_get_limit_info(struct acpi_processor *pr)
{
if (!pr)
return -EINVAL;
if (pr->flags.throttling)
pr->flags.limit = 1;
return 0;
}
/* thermal coolign device callbacks */ /* thermal coolign device callbacks */
static int acpi_processor_max_state(struct acpi_processor *pr) static int acpi_processor_max_state(struct acpi_processor *pr)
{ {

View File

@ -172,6 +172,8 @@ extern struct bus_type cpu_subsys;
#ifdef CONFIG_HOTPLUG_CPU #ifdef CONFIG_HOTPLUG_CPU
/* Stop CPUs going up and down. */ /* Stop CPUs going up and down. */
extern void cpu_hotplug_begin(void);
extern void cpu_hotplug_done(void);
extern void get_online_cpus(void); extern void get_online_cpus(void);
extern void put_online_cpus(void); extern void put_online_cpus(void);
extern void cpu_hotplug_disable(void); extern void cpu_hotplug_disable(void);
@ -197,6 +199,8 @@ static inline void cpu_hotplug_driver_unlock(void)
#else /* CONFIG_HOTPLUG_CPU */ #else /* CONFIG_HOTPLUG_CPU */
static inline void cpu_hotplug_begin(void) {}
static inline void cpu_hotplug_done(void) {}
#define get_online_cpus() do { } while (0) #define get_online_cpus() do { } while (0)
#define put_online_cpus() do { } while (0) #define put_online_cpus() do { } while (0)
#define cpu_hotplug_disable() do { } while (0) #define cpu_hotplug_disable() do { } while (0)

View File

@ -113,7 +113,7 @@ EXPORT_SYMBOL_GPL(put_online_cpus);
* get_online_cpus() not an api which is called all that often. * get_online_cpus() not an api which is called all that often.
* *
*/ */
static void cpu_hotplug_begin(void) void cpu_hotplug_begin(void)
{ {
cpu_hotplug.active_writer = current; cpu_hotplug.active_writer = current;
@ -127,7 +127,7 @@ static void cpu_hotplug_begin(void)
} }
} }
static void cpu_hotplug_done(void) void cpu_hotplug_done(void)
{ {
cpu_hotplug.active_writer = NULL; cpu_hotplug.active_writer = NULL;
mutex_unlock(&cpu_hotplug.lock); mutex_unlock(&cpu_hotplug.lock);
@ -154,10 +154,7 @@ void cpu_hotplug_enable(void)
cpu_maps_update_done(); cpu_maps_update_done();
} }
#else /* #if CONFIG_HOTPLUG_CPU */ #endif /* CONFIG_HOTPLUG_CPU */
static void cpu_hotplug_begin(void) {}
static void cpu_hotplug_done(void) {}
#endif /* #else #if CONFIG_HOTPLUG_CPU */
/* Need to know about CPUs going up/down? */ /* Need to know about CPUs going up/down? */
int __ref register_cpu_notifier(struct notifier_block *nb) int __ref register_cpu_notifier(struct notifier_block *nb)