Skip to content

Commit

Permalink
Merge branch 'acpi-processor'
Browse files Browse the repository at this point in the history
* acpi-processor:
  ACPI / processor: Acquire writer lock to update CPU maps
  ACPI / processor: Remove acpi_processor_get_limit_info()
  • Loading branch information
Rafael J. Wysocki committed Aug 26, 2013
2 parents 8462d9d + b9d10be commit 551f5c7
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 24 deletions.
21 changes: 16 additions & 5 deletions drivers/acpi/acpi_processor.c
Original file line number Diff line number Diff line change
Expand Up @@ -178,14 +178,17 @@ static int acpi_processor_hotadd_init(struct acpi_processor *pr)
if (ACPI_FAILURE(status) || !(sta & ACPI_STA_DEVICE_PRESENT))
return -ENODEV;

cpu_maps_update_begin();
cpu_hotplug_begin();

ret = acpi_map_lsapic(pr->handle, &pr->id);
if (ret)
return ret;
goto out;

ret = arch_register_cpu(pr->id);
if (ret) {
acpi_unmap_lsapic(pr->id);
return ret;
goto out;
}

/*
Expand All @@ -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->flags.need_hotplug_init = 1;
return 0;

out:
cpu_hotplug_done();
cpu_maps_update_done();
return ret;
}
#else
static inline int acpi_processor_hotadd_init(struct acpi_processor *pr)
Expand Down Expand Up @@ -452,11 +459,15 @@ static void acpi_processor_remove(struct acpi_device *device)
per_cpu(processor_device_array, pr->id) = NULL;
per_cpu(processors, pr->id) = NULL;

cpu_maps_update_begin();
cpu_hotplug_begin();

/* Remove the CPU. */
get_online_cpus();
arch_unregister_cpu(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));

Expand Down
4 changes: 3 additions & 1 deletion drivers/acpi/processor_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,9 @@ static int __acpi_processor_start(struct acpi_device *device)
acpi_processor_load_module(pr);
#endif
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)
acpi_processor_power_init(pr);
Expand Down
12 changes: 0 additions & 12 deletions drivers/acpi/processor_thermal.c
Original file line number Diff line number Diff line change
Expand Up @@ -186,18 +186,6 @@ static int cpufreq_set_cur_state(unsigned int cpu, int state)

#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 */
static int acpi_processor_max_state(struct acpi_processor *pr)
{
Expand Down
4 changes: 4 additions & 0 deletions include/linux/cpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,8 @@ extern struct bus_type cpu_subsys;
#ifdef CONFIG_HOTPLUG_CPU
/* 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 put_online_cpus(void);
extern void cpu_hotplug_disable(void);
Expand All @@ -197,6 +199,8 @@ static inline void cpu_hotplug_driver_unlock(void)

#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 put_online_cpus() do { } while (0)
#define cpu_hotplug_disable() do { } while (0)
Expand Down
9 changes: 3 additions & 6 deletions kernel/cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ EXPORT_SYMBOL_GPL(put_online_cpus);
* 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;

Expand All @@ -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;
mutex_unlock(&cpu_hotplug.lock);
Expand All @@ -154,10 +154,7 @@ void cpu_hotplug_enable(void)
cpu_maps_update_done();
}

#else /* #if CONFIG_HOTPLUG_CPU */
static void cpu_hotplug_begin(void) {}
static void cpu_hotplug_done(void) {}
#endif /* #else #if CONFIG_HOTPLUG_CPU */
#endif /* CONFIG_HOTPLUG_CPU */

/* Need to know about CPUs going up/down? */
int __ref register_cpu_notifier(struct notifier_block *nb)
Expand Down

0 comments on commit 551f5c7

Please sign in to comment.