From ae77930060338226a4377d3b93580c43b5ec82ae Mon Sep 17 00:00:00 2001 From: Mel Gorman Date: Wed, 6 Aug 2014 14:19:18 +0100 Subject: cpuidle: menu: Use shifts when calculating averages where possible We use do_div even though the divisor will usually be a power-of-two unless there are unusual outliers. Use shifts where possible Signed-off-by: Mel Gorman Signed-off-by: Rafael J. Wysocki --- drivers/cpuidle/governors/menu.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'drivers') diff --git a/drivers/cpuidle/governors/menu.c b/drivers/cpuidle/governors/menu.c index c3732fa74f82..c36e1ea7ef08 100644 --- a/drivers/cpuidle/governors/menu.c +++ b/drivers/cpuidle/governors/menu.c @@ -31,7 +31,8 @@ * The default values do not overflow. */ #define BUCKETS 12 -#define INTERVALS 8 +#define INTERVAL_SHIFT 3 +#define INTERVALS (1UL << INTERVAL_SHIFT) #define RESOLUTION 1024 #define DECAY 8 #define MAX_INTERESTING 50000 @@ -227,7 +228,10 @@ again: max = value; } } - do_div(avg, divisor); + if (divisor == INTERVALS) + avg >>= INTERVAL_SHIFT; + else + do_div(avg, divisor); /* Then try to determine standard deviation */ stddev = 0; @@ -238,7 +242,11 @@ again: stddev += diff * diff; } } - do_div(stddev, divisor); + if (divisor == INTERVALS) + stddev >>= INTERVAL_SHIFT; + else + do_div(stddev, divisor); + /* * The typical interval is obtained when standard deviation is small * or standard deviation is small compared to the average interval. -- cgit v1.2.3-55-g7522 From 107d4f4601a1408d04a5b54ffba507c92c235f58 Mon Sep 17 00:00:00 2001 From: Mel Gorman Date: Wed, 6 Aug 2014 14:19:19 +0100 Subject: cpuidle: menu: Use ktime_to_us instead of reinventing the wheel The ktime_to_us implementation is slightly better than the one implemented in menu.c. Use it Signed-off-by: Mel Gorman Acked-by: Daniel Lezcano Signed-off-by: Rafael J. Wysocki --- drivers/cpuidle/governors/menu.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'drivers') diff --git a/drivers/cpuidle/governors/menu.c b/drivers/cpuidle/governors/menu.c index c36e1ea7ef08..ba6df6044fff 100644 --- a/drivers/cpuidle/governors/menu.c +++ b/drivers/cpuidle/governors/menu.c @@ -296,7 +296,6 @@ static int menu_select(struct cpuidle_driver *drv, struct cpuidle_device *dev) int latency_req = pm_qos_request(PM_QOS_CPU_DMA_LATENCY); int i; unsigned int interactivity_req; - struct timespec t; if (data->needs_update) { menu_update(drv, dev); @@ -310,9 +309,7 @@ static int menu_select(struct cpuidle_driver *drv, struct cpuidle_device *dev) return 0; /* determine the expected residency time, round up */ - t = ktime_to_timespec(tick_nohz_get_sleep_length()); - data->next_timer_us = - t.tv_sec * USEC_PER_SEC + t.tv_nsec / NSEC_PER_USEC; + data->next_timer_us = ktime_to_us(tick_nohz_get_sleep_length()); data->bucket = which_bucket(data->next_timer_us); -- cgit v1.2.3-55-g7522 From 64b4ca5cb6e1a9f577588db5765dc996ddf595e1 Mon Sep 17 00:00:00 2001 From: Mel Gorman Date: Wed, 6 Aug 2014 14:19:20 +0100 Subject: cpuidle: menu: Call nr_iowait_cpu less times menu_select() via inline functions calls nr_iowait_cpu() twice as much as necessary. Signed-off-by: Mel Gorman Signed-off-by: Rafael J. Wysocki --- drivers/cpuidle/governors/menu.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'drivers') diff --git a/drivers/cpuidle/governors/menu.c b/drivers/cpuidle/governors/menu.c index ba6df6044fff..f55d8260ec43 100644 --- a/drivers/cpuidle/governors/menu.c +++ b/drivers/cpuidle/governors/menu.c @@ -142,7 +142,7 @@ static int get_loadavg(void) return LOAD_INT(this) * 10 + LOAD_FRAC(this) / 10; } -static inline int which_bucket(unsigned int duration) +static inline int which_bucket(unsigned int duration, unsigned long nr_iowaiters) { int bucket = 0; @@ -152,7 +152,7 @@ static inline int which_bucket(unsigned int duration) * This allows us to calculate * E(duration)|iowait */ - if (nr_iowait_cpu(smp_processor_id())) + if (nr_iowaiters) bucket = BUCKETS/2; if (duration < 10) @@ -175,7 +175,7 @@ static inline int which_bucket(unsigned int duration) * to be, the higher this multiplier, and thus the higher * the barrier to go to an expensive C state. */ -static inline int performance_multiplier(void) +static inline int performance_multiplier(unsigned long nr_iowaiters) { int mult = 1; @@ -184,7 +184,7 @@ static inline int performance_multiplier(void) mult += 2 * get_loadavg(); /* for IO wait tasks (per cpu!) we add 5x each */ - mult += 10 * nr_iowait_cpu(smp_processor_id()); + mult += 10 * nr_iowaiters; return mult; } @@ -296,6 +296,7 @@ static int menu_select(struct cpuidle_driver *drv, struct cpuidle_device *dev) int latency_req = pm_qos_request(PM_QOS_CPU_DMA_LATENCY); int i; unsigned int interactivity_req; + unsigned long nr_iowaiters; if (data->needs_update) { menu_update(drv, dev); @@ -311,8 +312,8 @@ static int menu_select(struct cpuidle_driver *drv, struct cpuidle_device *dev) /* determine the expected residency time, round up */ data->next_timer_us = ktime_to_us(tick_nohz_get_sleep_length()); - - data->bucket = which_bucket(data->next_timer_us); + nr_iowaiters = nr_iowait_cpu(smp_processor_id()); + data->bucket = which_bucket(data->next_timer_us, nr_iowaiters); /* * Force the result of multiplication to be 64 bits even if both @@ -330,7 +331,7 @@ static int menu_select(struct cpuidle_driver *drv, struct cpuidle_device *dev) * duration / latency ratio. Adjust the latency limit if * necessary. */ - interactivity_req = data->predicted_us / performance_multiplier(); + interactivity_req = data->predicted_us / performance_multiplier(nr_iowaiters); if (latency_req > interactivity_req) latency_req = interactivity_req; -- cgit v1.2.3-55-g7522 From 372ba8cb46b271a7662b92cbefedee56725f6bd0 Mon Sep 17 00:00:00 2001 From: Mel Gorman Date: Wed, 6 Aug 2014 14:19:21 +0100 Subject: cpuidle: menu: Lookup CPU runqueues less The menu governer makes separate lookups of the CPU runqueue to get load and number of IO waiters but it can be done with a single lookup. Signed-off-by: Mel Gorman Signed-off-by: Rafael J. Wysocki --- drivers/cpuidle/governors/menu.c | 17 +++++++---------- include/linux/sched.h | 3 +-- kernel/sched/core.c | 7 +++++++ kernel/sched/proc.c | 7 ------- 4 files changed, 15 insertions(+), 19 deletions(-) (limited to 'drivers') diff --git a/drivers/cpuidle/governors/menu.c b/drivers/cpuidle/governors/menu.c index f55d8260ec43..27702742b319 100644 --- a/drivers/cpuidle/governors/menu.c +++ b/drivers/cpuidle/governors/menu.c @@ -134,12 +134,9 @@ struct menu_device { #define LOAD_INT(x) ((x) >> FSHIFT) #define LOAD_FRAC(x) LOAD_INT(((x) & (FIXED_1-1)) * 100) -static int get_loadavg(void) +static inline int get_loadavg(unsigned long load) { - unsigned long this = this_cpu_load(); - - - return LOAD_INT(this) * 10 + LOAD_FRAC(this) / 10; + return LOAD_INT(load) * 10 + LOAD_FRAC(load) / 10; } static inline int which_bucket(unsigned int duration, unsigned long nr_iowaiters) @@ -175,13 +172,13 @@ static inline int which_bucket(unsigned int duration, unsigned long nr_iowaiters * to be, the higher this multiplier, and thus the higher * the barrier to go to an expensive C state. */ -static inline int performance_multiplier(unsigned long nr_iowaiters) +static inline int performance_multiplier(unsigned long nr_iowaiters, unsigned long load) { int mult = 1; /* for higher loadavg, we are more reluctant */ - mult += 2 * get_loadavg(); + mult += 2 * get_loadavg(load); /* for IO wait tasks (per cpu!) we add 5x each */ mult += 10 * nr_iowaiters; @@ -296,7 +293,7 @@ static int menu_select(struct cpuidle_driver *drv, struct cpuidle_device *dev) int latency_req = pm_qos_request(PM_QOS_CPU_DMA_LATENCY); int i; unsigned int interactivity_req; - unsigned long nr_iowaiters; + unsigned long nr_iowaiters, cpu_load; if (data->needs_update) { menu_update(drv, dev); @@ -312,7 +309,7 @@ static int menu_select(struct cpuidle_driver *drv, struct cpuidle_device *dev) /* determine the expected residency time, round up */ data->next_timer_us = ktime_to_us(tick_nohz_get_sleep_length()); - nr_iowaiters = nr_iowait_cpu(smp_processor_id()); + get_iowait_load(&nr_iowaiters, &cpu_load); data->bucket = which_bucket(data->next_timer_us, nr_iowaiters); /* @@ -331,7 +328,7 @@ static int menu_select(struct cpuidle_driver *drv, struct cpuidle_device *dev) * duration / latency ratio. Adjust the latency limit if * necessary. */ - interactivity_req = data->predicted_us / performance_multiplier(nr_iowaiters); + interactivity_req = data->predicted_us / performance_multiplier(nr_iowaiters, cpu_load); if (latency_req > interactivity_req) latency_req = interactivity_req; diff --git a/include/linux/sched.h b/include/linux/sched.h index 306f4f0c987a..641bd954bb5d 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -168,8 +168,7 @@ extern int nr_processes(void); extern unsigned long nr_running(void); extern unsigned long nr_iowait(void); extern unsigned long nr_iowait_cpu(int cpu); -extern unsigned long this_cpu_load(void); - +extern void get_iowait_load(unsigned long *nr_waiters, unsigned long *load); extern void calc_global_load(unsigned long ticks); extern void update_cpu_load_nohz(void); diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 3bdf01b494fe..863ef1d19563 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -2385,6 +2385,13 @@ unsigned long nr_iowait_cpu(int cpu) return atomic_read(&this->nr_iowait); } +void get_iowait_load(unsigned long *nr_waiters, unsigned long *load) +{ + struct rq *this = this_rq(); + *nr_waiters = atomic_read(&this->nr_iowait); + *load = this->cpu_load[0]; +} + #ifdef CONFIG_SMP /* diff --git a/kernel/sched/proc.c b/kernel/sched/proc.c index 16f5a30f9c88..8ecd552fe4f2 100644 --- a/kernel/sched/proc.c +++ b/kernel/sched/proc.c @@ -8,13 +8,6 @@ #include "sched.h" -unsigned long this_cpu_load(void) -{ - struct rq *this = this_rq(); - return this->cpu_load[0]; -} - - /* * Global load-average calculations * -- cgit v1.2.3-55-g7522 From ea9c167d93e6e2f4697f5061756f26356793cd95 Mon Sep 17 00:00:00 2001 From: Lan Tianyu Date: Thu, 31 Jul 2014 22:28:50 +0800 Subject: ACPI / processor: Make acpi_cpu_soft_notify() process CPU FROZEN events CPU hotplug happens during S2RAM and CPU notify event will be CPU_XXX_FROZEN. acpi_cpu_soft_notify() ignores to check these events. This also may make acpi_cpu_soft_notify() fall into sleep during CPU_DYING/STARTING_FROZEN events which don't allow callbacks to sleep. This patch is to fix it. Signed-off-by: Lan Tianyu Signed-off-by: Rafael J. Wysocki --- drivers/acpi/processor_driver.c | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers') diff --git a/drivers/acpi/processor_driver.c b/drivers/acpi/processor_driver.c index 4fcbd670415c..d9f71581b79b 100644 --- a/drivers/acpi/processor_driver.c +++ b/drivers/acpi/processor_driver.c @@ -120,6 +120,7 @@ static int acpi_cpu_soft_notify(struct notifier_block *nfb, unsigned int cpu = (unsigned long)hcpu; struct acpi_processor *pr = per_cpu(processors, cpu); struct acpi_device *device; + action &= ~CPU_TASKS_FROZEN; /* * CPU_STARTING and CPU_DYING must not sleep. Return here since -- cgit v1.2.3-55-g7522 From 18360d6ed9877d81aa7b3ab811e7e14f3fb0ac61 Mon Sep 17 00:00:00 2001 From: Himangi Saraogi Date: Sun, 3 Aug 2014 15:45:40 +0530 Subject: cpufreq: integrator: Use set_cpus_allowed_ptr Several years ago there was an effort to convert all uses of set_cpus_allowed to use set_cpus_allowed_ptr with the goal of eventually removing the current definition of set_cpus_allowed and renaming set_cpus_allowed_ptr as set_cpus_allowed (https://lkml.org/lkml/2010/3/26/59). This is another step in this direction. The Coccinelle semantic patch that makes this change is as follows: // @@ expression E1,E2; @@ - set_cpus_allowed(E1, cpumask_of_cpu(E2)) + set_cpus_allowed_ptr(E1, cpumask_of(E2)) @@ expression E; identifier I; @@ - set_cpus_allowed(E, I) + set_cpus_allowed_ptr(E, &I) // Signed-off-by: Himangi Saraogi Acked-by: Julia Lawall Acked-by: Viresh Kumar Signed-off-by: Rafael J. Wysocki --- drivers/cpufreq/integrator-cpufreq.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'drivers') diff --git a/drivers/cpufreq/integrator-cpufreq.c b/drivers/cpufreq/integrator-cpufreq.c index e5122f1bfe78..c1320528b9d0 100644 --- a/drivers/cpufreq/integrator-cpufreq.c +++ b/drivers/cpufreq/integrator-cpufreq.c @@ -92,7 +92,7 @@ static int integrator_set_target(struct cpufreq_policy *policy, * Bind to the specified CPU. When this call returns, * we should be running on the right CPU. */ - set_cpus_allowed(current, cpumask_of_cpu(cpu)); + set_cpus_allowed_ptr(current, cpumask_of(cpu)); BUG_ON(cpu != smp_processor_id()); /* get current setting */ @@ -118,7 +118,7 @@ static int integrator_set_target(struct cpufreq_policy *policy, freqs.new = icst_hz(&cclk_params, vco) / 1000; if (freqs.old == freqs.new) { - set_cpus_allowed(current, cpus_allowed); + set_cpus_allowed_ptr(current, &cpus_allowed); return 0; } @@ -141,7 +141,7 @@ static int integrator_set_target(struct cpufreq_policy *policy, /* * Restore the CPUs allowed mask. */ - set_cpus_allowed(current, cpus_allowed); + set_cpus_allowed_ptr(current, &cpus_allowed); cpufreq_freq_transition_end(policy, &freqs, 0); @@ -157,7 +157,7 @@ static unsigned int integrator_get(unsigned int cpu) cpus_allowed = current->cpus_allowed; - set_cpus_allowed(current, cpumask_of_cpu(cpu)); + set_cpus_allowed_ptr(current, cpumask_of(cpu)); BUG_ON(cpu != smp_processor_id()); /* detect memory etc. */ @@ -173,7 +173,7 @@ static unsigned int integrator_get(unsigned int cpu) current_freq = icst_hz(&cclk_params, vco) / 1000; /* current freq */ - set_cpus_allowed(current, cpus_allowed); + set_cpus_allowed_ptr(current, &cpus_allowed); return current_freq; } -- cgit v1.2.3-55-g7522 From 713a3fa6b71578cae3af820be10dd9e0702f3280 Mon Sep 17 00:00:00 2001 From: Markus Pargmann Date: Mon, 4 Aug 2014 14:48:03 +0200 Subject: cpufreq: cpu0: Do not print error message when deferring -EPROBE_DEFER is no real error. We are just waiting unti the necessary components are ready. The driver core infrastructure will also print an appropriate info message. This patch changes the error message to a debug message. Signed-off-by: Markus Pargmann Acked-by: Viresh Kumar Signed-off-by: Rafael J. Wysocki --- drivers/cpufreq/cpufreq-cpu0.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers') diff --git a/drivers/cpufreq/cpufreq-cpu0.c b/drivers/cpufreq/cpufreq-cpu0.c index 86beda9f950b..0d2172b07765 100644 --- a/drivers/cpufreq/cpufreq-cpu0.c +++ b/drivers/cpufreq/cpufreq-cpu0.c @@ -137,7 +137,7 @@ static int cpu0_cpufreq_probe(struct platform_device *pdev) * not yet registered, we should try defering probe. */ if (PTR_ERR(cpu_reg) == -EPROBE_DEFER) { - dev_err(cpu_dev, "cpu0 regulator not ready, retry\n"); + dev_dbg(cpu_dev, "cpu0 regulator not ready, retry\n"); ret = -EPROBE_DEFER; goto out_put_node; } -- cgit v1.2.3-55-g7522 From 3c5445ce3a0c6d6935911212b735772af5115517 Mon Sep 17 00:00:00 2001 From: Stephen Boyd Date: Wed, 6 Aug 2014 22:04:58 +0200 Subject: cpufreq: OPP: Avoid sleeping while atomic We allocate the cpufreq table after calling rcu_read_lock(), which disables preemption. This causes scheduling while atomic warnings. Use GFP_ATOMIC instead of GFP_KERNEL and update for kcalloc while we're here. BUG: sleeping function called from invalid context at mm/slub.c:1246 in_atomic(): 0, irqs_disabled(): 0, pid: 80, name: modprobe 5 locks held by modprobe/80: #0: (&dev->mutex){......}, at: [] __driver_attach+0x48/0x98 #1: (&dev->mutex){......}, at: [] __driver_attach+0x58/0x98 #2: (subsys mutex#5){+.+.+.}, at: [] subsys_interface_register+0x38/0xc8 #3: (cpufreq_rwsem){.+.+.+}, at: [] __cpufreq_add_dev.isra.22+0x84/0x92c #4: (rcu_read_lock){......}, at: [] dev_pm_opp_init_cpufreq_table+0x18/0x10c Preemption disabled at:[< (null)>] (null) CPU: 2 PID: 80 Comm: modprobe Not tainted 3.16.0-rc3-next-20140701-00035-g286857f216aa-dirty #217 [] (unwind_backtrace) from [] (show_stack+0x10/0x14) [] (show_stack) from [] (dump_stack+0x70/0xbc) [] (dump_stack) from [] (__kmalloc+0x124/0x250) [] (__kmalloc) from [] (dev_pm_opp_init_cpufreq_table+0x3c/0x10c) [] (dev_pm_opp_init_cpufreq_table) from [] (cpufreq_init+0x48/0x378 [cpufreq_generic]) [] (cpufreq_init [cpufreq_generic]) from [] (__cpufreq_add_dev.isra.22+0x200/0x92c) [] (__cpufreq_add_dev.isra.22) from [] (subsys_interface_register+0x84/0xc8) [] (subsys_interface_register) from [] (cpufreq_register_driver+0x108/0x2d8) [] (cpufreq_register_driver) from [] (generic_cpufreq_probe+0x50/0x74 [cpufreq_generic]) [] (generic_cpufreq_probe [cpufreq_generic]) from [] (platform_drv_probe+0x18/0x48) [] (platform_drv_probe) from [] (driver_probe_device+0x128/0x370) [] (driver_probe_device) from [] (__driver_attach+0x94/0x98) [] (__driver_attach) from [] (bus_for_each_dev+0x54/0x88) [] (bus_for_each_dev) from [] (bus_add_driver+0xe8/0x204) [] (bus_add_driver) from [] (driver_register+0x78/0xf4) [] (driver_register) from [] (do_one_initcall+0xac/0x1d8) [] (do_one_initcall) from [] (load_module+0x190c/0x21e8) [] (load_module) from [] (SyS_init_module+0xa4/0x110) [] (SyS_init_module) from [] (ret_fast_syscall+0x0/0x48) Fixes: a0dd7b79657b (PM / OPP: Move cpufreq specific OPP functions out of generic OPP library) Signed-off-by: Stephen Boyd Acked-by: Viresh Kumar Cc: 3.16+ # 3.16+ Signed-off-by: Rafael J. Wysocki --- drivers/cpufreq/cpufreq_opp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers') diff --git a/drivers/cpufreq/cpufreq_opp.c b/drivers/cpufreq/cpufreq_opp.c index c0c6f4a4eccf..f7a32d2326c6 100644 --- a/drivers/cpufreq/cpufreq_opp.c +++ b/drivers/cpufreq/cpufreq_opp.c @@ -60,7 +60,7 @@ int dev_pm_opp_init_cpufreq_table(struct device *dev, goto out; } - freq_table = kzalloc(sizeof(*freq_table) * (max_opps + 1), GFP_KERNEL); + freq_table = kcalloc(sizeof(*freq_table), (max_opps + 1), GFP_ATOMIC); if (!freq_table) { ret = -ENOMEM; goto out; -- cgit v1.2.3-55-g7522 From dee1592638ab7ea35a32179b73f9284dead49c03 Mon Sep 17 00:00:00 2001 From: Tang Chen Date: Fri, 8 Aug 2014 10:30:45 +0800 Subject: ACPI / hotplug: Check scan handlers in acpi_scan_hot_remove() When ACPI_HOTPLUG_MEMORY is not configured, memory_device_handler.attach is not set. In acpi_scan_attach_handler(), the acpi_device->handler will not be initialized. In acpi_scan_hot_remove(), it doesn't check if acpi_device->handler is NULL. If we do memory hot-remove without ACPI_HOTPLUG_MEMORY configured, the kernel will panic. BUG: unable to handle kernel NULL pointer dereference at 0000000000000088 IP: [] acpi_device_hotplug+0x1d7/0x4c4 PGD 0 Oops: 0000 [#1] SMP Modules linked in: sd_mod(E) sr_mod(E) cdrom(E) crc_t10dif(E) crct10dif_common(E) ata_piix(E) libata(E) CPU: 0 PID: 41 Comm: kworker/u2:1 Tainted: G E 3.16.0-rc7--3.16-rc7-tangchen+ #20 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.7.5-0-ge51488c-20140602_164612-nilsson.home.kraxel.org 04/01/2014 Workqueue: kacpi_hotplug acpi_hotplug_work_fn task: ffff8800182436c0 ti: ffff880018254000 task.ti: ffff880018254000 RIP: 0010:[] [] acpi_device_hotplug+0x1d7/0x4c4 RSP: 0000:ffff880018257da8 EFLAGS: 00000246 RAX: 0000000000000000 RBX: ffff88001cd8d800 RCX: 0000000000000000 RDX: 0000000000000000 RSI: ffff88001e40e6f8 RDI: 0000000000000246 RBP: ffff880018257df0 R08: 0000000000000096 R09: 00000000000011a0 R10: 63735f6970636120 R11: 725f746f685f6e61 R12: 0000000000000003 R13: ffff88001cc1c400 R14: ffff88001e062028 R15: 0000000000000040 FS: 0000000000000000(0000) GS:ffff88001e400000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b CR2: 0000000000000088 CR3: 000000001a9a2000 CR4: 00000000000006f0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 0000000000000000 DR7: 0000000000000000 Stack: 00000000523cab58 ffff88001cd8d9f8 ffff88001852d480 00000000523cab58 ffff88001852d480 ffff880018221e40 ffff88001cc1c400 ffff88001cce2d00 0000000000000040 ffff880018257e08 ffffffff813dc31d ffff88001852d480 Call Trace: [] acpi_hotplug_work_fn+0x1e/0x29 [] process_one_work+0x17b/0x460 [] worker_thread+0x11d/0x5b0 [] ? rescuer_thread+0x3a0/0x3a0 [] kthread+0xe1/0x100 [] ? kthread_create_on_node+0x1a0/0x1a0 [] ret_from_fork+0x7c/0xb0 [] ? kthread_create_on_node+0x1a0/0x1a0 This patch fixes this problem by checking if acpi_device->handler is NULL in acpi_scan_hot_remove(). Fixes: d22ddcbc4fb7 (ACPI / hotplug: Add demand_offline hotplug profile flag) Signed-off-by: Tang Chen Cc: 3.14+ # 3.14+ [rjw: Subject] Signed-off-by: Rafael J. Wysocki --- drivers/acpi/scan.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'drivers') diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index 3ffc9306538b..9e4422bbe03d 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c @@ -353,7 +353,8 @@ static int acpi_scan_hot_remove(struct acpi_device *device) unsigned long long sta; acpi_status status; - if (device->handler->hotplug.demand_offline && !acpi_force_hot_remove) { + if (device->handler && device->handler->hotplug.demand_offline + && !acpi_force_hot_remove) { if (!acpi_scan_is_offline(device, true)) return -EBUSY; } else { -- cgit v1.2.3-55-g7522 From a5f30eba78969624ed8e86db81a8dd91736f79f3 Mon Sep 17 00:00:00 2001 From: Hans Wennborg Date: Wed, 6 Aug 2014 22:52:23 -0700 Subject: cpufreq: speedstep-smi: fix decimal printf specifiers The prefix suggests the number should be printed in hex, so use the %x specifier to do that. Also, these are 32-bit values, so drop the l characters. Signed-off-by: Hans Wennborg Signed-off-by: Rafael J. Wysocki --- drivers/cpufreq/speedstep-smi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers') diff --git a/drivers/cpufreq/speedstep-smi.c b/drivers/cpufreq/speedstep-smi.c index 8635eec96da5..5fc96d5d656b 100644 --- a/drivers/cpufreq/speedstep-smi.c +++ b/drivers/cpufreq/speedstep-smi.c @@ -324,8 +324,8 @@ static int __init speedstep_init(void) return -ENODEV; } - pr_debug("signature:0x%.8ulx, command:0x%.8ulx, " - "event:0x%.8ulx, perf_level:0x%.8ulx.\n", + pr_debug("signature:0x%.8x, command:0x%.8x, " + "event:0x%.8x, perf_level:0x%.8x.\n", ist_info.signature, ist_info.command, ist_info.event, ist_info.perf_level); -- cgit v1.2.3-55-g7522 From 39c8bbaf67b157017929703a5eea7e83525b147c Mon Sep 17 00:00:00 2001 From: Uwe Kleine-König Date: Fri, 8 Aug 2014 08:56:30 +0200 Subject: cpufreq: arm_big_little: fix module license spec Having no license specification in a module taints the kernel during load with: arm_big_little: module license 'unspecified' taints kernel. and also the linker doesn't allow it to make use of GPL-exported symbols which in this case also results in errors like: arm_big_little: Unknown symbol cpufreq_register_driver (err 0) . The header of the driver specifies a GPL v2 license, so note that accordingly. While at it also add a description and an author and fix the license in a companion file to explicit v2. Reported-by: Andreas Schwab Acked-by: Viresh Kumar Signed-off-by: Uwe Kleine-König Signed-off-by: Rafael J. Wysocki --- drivers/cpufreq/arm_big_little.c | 5 +++++ drivers/cpufreq/arm_big_little_dt.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'drivers') diff --git a/drivers/cpufreq/arm_big_little.c b/drivers/cpufreq/arm_big_little.c index 1f4d4e315057..a46c223c2506 100644 --- a/drivers/cpufreq/arm_big_little.c +++ b/drivers/cpufreq/arm_big_little.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -593,3 +594,7 @@ void bL_cpufreq_unregister(struct cpufreq_arm_bL_ops *ops) arm_bL_ops = NULL; } EXPORT_SYMBOL_GPL(bL_cpufreq_unregister); + +MODULE_AUTHOR("Viresh Kumar "); +MODULE_DESCRIPTION("Generic ARM big LITTLE cpufreq driver"); +MODULE_LICENSE("GPL v2"); diff --git a/drivers/cpufreq/arm_big_little_dt.c b/drivers/cpufreq/arm_big_little_dt.c index 8d9d59108906..4550f6976768 100644 --- a/drivers/cpufreq/arm_big_little_dt.c +++ b/drivers/cpufreq/arm_big_little_dt.c @@ -114,4 +114,4 @@ module_platform_driver(generic_bL_platdrv); MODULE_AUTHOR("Viresh Kumar "); MODULE_DESCRIPTION("Generic ARM big LITTLE cpufreq driver via DT"); -MODULE_LICENSE("GPL"); +MODULE_LICENSE("GPL v2"); -- cgit v1.2.3-55-g7522 From d719870b41e00baf64d028c2668ae1fc3eb50e79 Mon Sep 17 00:00:00 2001 From: Mariusz Ceier Date: Sat, 9 Aug 2014 11:43:31 +0200 Subject: ACPI / battery: Fix warning message in acpi_battery_get_state() capacity_now should be assigned after comparing it to design_capacity. Otherwise warning is printed even when capacity_now before assignment is equal to design_capacity, making the check useless and "current charge level" wrong (it should be higher than, not equal to, "maximum charge level", which is full_charge_capacity): "battery: reported current charge level (56410) is higher than reported maximum charge level (56410)." Fixes: 232de5143790 (ACPI / battery: fix wrong value of capacity_now reported when fully charged) Signed-off-by: Mariusz Ceier Cc: 3.16+ # 3.16+ [rjw: Subject] Signed-off-by: Rafael J. Wysocki --- drivers/acpi/battery.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers') diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c index 48bcf38a0ea8..1c162e7be045 100644 --- a/drivers/acpi/battery.c +++ b/drivers/acpi/battery.c @@ -540,12 +540,12 @@ static int acpi_battery_get_state(struct acpi_battery *battery) */ if (battery->capacity_now > battery->full_charge_capacity && battery->full_charge_capacity != ACPI_BATTERY_VALUE_UNKNOWN) { - battery->capacity_now = battery->full_charge_capacity; if (battery->capacity_now != battery->design_capacity) printk_once(KERN_WARNING FW_BUG "battery: reported current charge level (%d) " "is higher than reported maximum charge level (%d).\n", battery->capacity_now, battery->full_charge_capacity); + battery->capacity_now = battery->full_charge_capacity; } if (test_bit(ACPI_BATTERY_QUIRK_PERCENTAGE_CAPACITY, &battery->flags) -- cgit v1.2.3-55-g7522