Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1477649
| From | Sebastian Andrzej Siewior <bigeasy@linutronix.de> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 20/21] blk: mq: cpu-notif: Convert to hotplug state machine |
| Date | 2016-09-06 19:10 +0200 |
| Message-ID | <ses2J-4Ps-11@gated-at.bofh.it> (permalink) |
| References | <ses2J-4Ps-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Install the callbacks via the state machine. The only currently handled
callback is CPU_DEAD and this one is converted.
Cc: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
This patch against linux-next to take the block changes into account. It
depends on "blk: mq: reserve hotplug ID states for block"
block/blk-mq-cpu.c | 15 +++++++--------
block/blk-mq.c | 17 ++++-------------
block/blk-mq.h | 2 +-
include/linux/blk-mq.h | 2 +-
4 files changed, 13 insertions(+), 23 deletions(-)
--- a/block/blk-mq-cpu.c
+++ b/block/blk-mq-cpu.c
@@ -18,18 +18,16 @@
static LIST_HEAD(blk_mq_cpu_notify_list);
static DEFINE_RAW_SPINLOCK(blk_mq_cpu_notify_lock);
-static int blk_mq_main_cpu_notify(struct notifier_block *self,
- unsigned long action, void *hcpu)
+static int blk_mq_main_cpu_dead(unsigned int cpu)
{
- unsigned int cpu = (unsigned long) hcpu;
struct blk_mq_cpu_notifier *notify;
- int ret = NOTIFY_OK;
+ int ret;
raw_spin_lock(&blk_mq_cpu_notify_lock);
list_for_each_entry(notify, &blk_mq_cpu_notify_list, list) {
- ret = notify->notify(notify->data, action, cpu);
- if (ret != NOTIFY_OK)
+ ret = notify->notify(notify->data, cpu);
+ if (ret)
break;
}
@@ -54,7 +52,7 @@ void blk_mq_unregister_cpu_notifier(stru
}
void blk_mq_init_cpu_notifier(struct blk_mq_cpu_notifier *notifier,
- int (*fn)(void *, unsigned long, unsigned int),
+ int (*fn)(void *, unsigned int),
void *data)
{
notifier->notify = fn;
@@ -63,5 +61,6 @@ void blk_mq_init_cpu_notifier(struct blk
void __init blk_mq_cpu_init(void)
{
- hotcpu_notifier(blk_mq_main_cpu_notify, 0);
+ cpuhp_setup_state_nocalls(CPUHP_BLKMQ_DEAD, "block/mq:dead", NULL,
+ blk_mq_main_cpu_dead);
}
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -1649,7 +1649,7 @@ static int blk_mq_hctx_cpu_offline(struc
spin_unlock(&ctx->lock);
if (list_empty(&tmp))
- return NOTIFY_OK;
+ return 0;
ctx = blk_mq_get_ctx(q);
spin_lock(&ctx->lock);
@@ -1669,23 +1669,14 @@ static int blk_mq_hctx_cpu_offline(struc
blk_mq_run_hw_queue(hctx, true);
blk_mq_put_ctx(ctx);
- return NOTIFY_OK;
+ return 0;
}
-static int blk_mq_hctx_notify(void *data, unsigned long action,
- unsigned int cpu)
+static int blk_mq_hctx_notify(void *data, unsigned int cpu)
{
struct blk_mq_hw_ctx *hctx = data;
- if (action == CPU_DEAD || action == CPU_DEAD_FROZEN)
- return blk_mq_hctx_cpu_offline(hctx, cpu);
-
- /*
- * In case of CPU online, tags may be reallocated
- * in blk_mq_map_swqueue() after mapping is updated.
- */
-
- return NOTIFY_OK;
+ return blk_mq_hctx_cpu_offline(hctx, cpu);
}
/* hctx->ctxs will be freed in queue's release handler */
--- a/block/blk-mq.h
+++ b/block/blk-mq.h
@@ -36,7 +36,7 @@ void blk_mq_wake_waiters(struct request_
*/
struct blk_mq_cpu_notifier;
void blk_mq_init_cpu_notifier(struct blk_mq_cpu_notifier *notifier,
- int (*fn)(void *, unsigned long, unsigned int),
+ int (*fn)(void *, unsigned int),
void *data);
void blk_mq_register_cpu_notifier(struct blk_mq_cpu_notifier *notifier);
void blk_mq_unregister_cpu_notifier(struct blk_mq_cpu_notifier *notifier);
--- a/include/linux/blk-mq.h
+++ b/include/linux/blk-mq.h
@@ -9,7 +9,7 @@ struct blk_flush_queue;
struct blk_mq_cpu_notifier {
struct list_head list;
void *data;
- int (*notify)(void *data, unsigned long action, unsigned int cpu);
+ int (*notify)(void *data, unsigned int cpu);
};
struct blk_mq_ctxmap {
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
cpu hotplug: convert more drivers (batch #3) Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-09-06 19:10 +0200
[PATCH 20/21] blk: mq: cpu-notif: Convert to hotplug state machine Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-09-06 19:10 +0200
[PATCH 11/21] ACPI: processor: Convert to hotplug state machine Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-09-06 19:10 +0200
Re: [PATCH 11/21] ACPI: processor: Convert to hotplug state machine "Rafael J. Wysocki" <rafael@kernel.org> - 2016-09-06 23:10 +0200
Re: [PATCH 11/21] ACPI: processor: Convert to hotplug state machine Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-09-07 16:10 +0200
Re: [PATCH 11/21] ACPI: processor: Convert to hotplug state machine "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2016-09-07 18:00 +0200
[PATCH 21/21] blk: mq: Convert to hotplug state machine Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-09-06 19:10 +0200
[PATCH 03/21] ARM: OMAP: wakeupgen: Convert to hotplug state machine Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-09-06 19:10 +0200
[PATCH 15/21] mips: octeon: smp: Convert to hotplug state machine Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-09-06 19:10 +0200
Re: [PATCH 15/21] mips: octeon: smp: Convert to hotplug state machine Matt Redfearn <matt.redfearn@imgtec.com> - 2016-09-07 10:30 +0200
Re: [PATCH 15/21] mips: octeon: smp: Convert to hotplug state machine Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-09-07 16:30 +0200
Re: [PATCH 15/21] mips: octeon: smp: Convert to hotplug state machine Matt Redfearn <matt.redfearn@imgtec.com> - 2016-09-08 10:40 +0200
[PATCH 04/21] ia64: mca: Convert to hotplug state machine Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-09-06 19:10 +0200
[PATCH 08/21] block: softirq: Convert to hotplug state machine Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-09-06 19:10 +0200
[PATCH 06/21] x86: microcode: Convert to hotplug state machine Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-09-06 19:10 +0200
Re: [PATCH 06/21] x86: microcode: Convert to hotplug state machine Borislav Petkov <bp@alien8.de> - 2016-09-07 13:40 +0200
Re: [PATCH 06/21] x86: microcode: Convert to hotplug state machine Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-09-07 17:00 +0200
Re: [PATCH 06/21] x86: microcode: Convert to hotplug state machine Borislav Petkov <bp@alien8.de> - 2016-09-07 18:10 +0200
[PATCH 06/21 v2] x86: microcode: Convert to hotplug state machine Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-09-07 18:50 +0200
[PATCH 14/21] fault-injection: cpu: Convert to hotplug state machine Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-09-06 19:10 +0200
[PATCH 19/21] blk: mq: reserve hotplug ID states for block Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-09-06 19:10 +0200
[PATCH 13/21] padata: Convert to hotplug state machine Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-09-06 19:10 +0200
[PATCH 17/21] s390: mm: pfault: Convert to hotplug state machine Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-09-06 19:10 +0200
[PATCH 02/21] ARM: shmobile: Convert to hotplug state machine Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-09-06 19:10 +0200
Re: [PATCH 02/21] ARM: shmobile: Convert to hotplug state machine Geert Uytterhoeven <geert@linux-m68k.org> - 2016-09-06 20:10 +0200
Re: [PATCH 02/21] ARM: shmobile: Convert to hotplug state machine Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-09-07 16:00 +0200
[PATCH 16/21] mips: loongson: smp: Convert to hotplug state machine Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-09-06 19:10 +0200
[PATCH 12/21] cpufreq: Convert to hotplug state machine Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-09-06 19:10 +0200
Re: [PATCH 12/21] cpufreq: Convert to hotplug state machine "Rafael J. Wysocki" <rafael@kernel.org> - 2016-09-06 23:30 +0200
Re: [PATCH 12/21] cpufreq: Convert to hotplug state machine Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-09-07 16:20 +0200
Re: [PATCH 12/21] cpufreq: Convert to hotplug state machine "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2016-09-07 18:00 +0200
[PATCH 07/21] lib: irq_poll: Convert to hotplug state machine Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-09-06 19:10 +0200
[PATCH 01/21] arm64: FP/SIMD: Convert to hotplug state machine Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-09-06 19:10 +0200
Re: [PATCH 01/21] arm64: FP/SIMD: Convert to hotplug state machine Will Deacon <will.deacon@arm.com> - 2016-09-06 20:20 +0200
[PATCH 05/21] sh: SH-X3 SMP: Convert to hotplug state machine Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-09-06 19:10 +0200
[PATCH 10/21] virtio scsi: Convert to hotplug state machine Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-09-06 19:10 +0200
[PATCH 09/21] oprofile: timer: Convert to hotplug state machine Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-09-06 19:20 +0200
csiph-web