From: tip-bot for Sebastian Andrzej Siewior <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: will.deacon@arm.com, peterz@infradead.org, tglx@linutronix.de,
mingo@kernel.org, suzuki.poulose@arm.com, arnd@arndb.de,
bigeasy@linutronix.de, pawel.moll@arm.com, hpa@zytor.com,
mark.rutland@arm.com, linux-kernel@vger.kernel.org
Subject: [tip:smp/hotplug] bus/arm-ccn: Use cpu-hp's multi instance support instead custom list
Date: Fri, 2 Sep 2016 01:24:08 -0700 [thread overview]
Message-ID: <tip-ebade02256fd8a449445c7b27eacb093e22d7ee5@git.kernel.org> (raw)
In-Reply-To: <1471024183-12666-6-git-send-email-bigeasy@linutronix.de>
Commit-ID: ebade02256fd8a449445c7b27eacb093e22d7ee5
Gitweb: http://git.kernel.org/tip/ebade02256fd8a449445c7b27eacb093e22d7ee5
Author: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
AuthorDate: Fri, 12 Aug 2016 19:49:42 +0200
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitDate: Thu, 1 Sep 2016 18:38:29 +0200
bus/arm-ccn: Use cpu-hp's multi instance support instead custom list
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Pawel Moll <pawel.moll@arm.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Suzuki K Poulose <suzuki.poulose@arm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Will Deacon <will.deacon@arm.com>
Cc: rt@linutronix.de
Link: http://lkml.kernel.org/r/1471024183-12666-6-git-send-email-bigeasy@linutronix.de
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
drivers/bus/arm-ccn.c | 52 ++++++++++++++++++++-------------------------------
1 file changed, 20 insertions(+), 32 deletions(-)
diff --git a/drivers/bus/arm-ccn.c b/drivers/bus/arm-ccn.c
index 97a9185..fcf29f4 100644
--- a/drivers/bus/arm-ccn.c
+++ b/drivers/bus/arm-ccn.c
@@ -167,7 +167,7 @@ struct arm_ccn_dt {
struct hrtimer hrtimer;
cpumask_t cpu;
- struct list_head entry;
+ struct hlist_node node;
struct pmu pmu;
};
@@ -189,9 +189,6 @@ struct arm_ccn {
struct arm_ccn_dt dt;
};
-static DEFINE_MUTEX(arm_ccn_mutex);
-static LIST_HEAD(arm_ccn_list);
-
static int arm_ccn_node_to_xp(int node)
{
return node / CCN_NUM_XP_PORTS;
@@ -1173,30 +1170,24 @@ static enum hrtimer_restart arm_ccn_pmu_timer_handler(struct hrtimer *hrtimer)
}
-static int arm_ccn_pmu_offline_cpu(unsigned int cpu)
+static int arm_ccn_pmu_offline_cpu(unsigned int cpu, struct hlist_node *node)
{
- struct arm_ccn_dt *dt;
+ struct arm_ccn_dt *dt = hlist_entry_safe(node, struct arm_ccn_dt, node);
+ struct arm_ccn *ccn = container_of(dt, struct arm_ccn, dt);
unsigned int target;
- mutex_lock(&arm_ccn_mutex);
- list_for_each_entry(dt, &arm_ccn_list, entry) {
- struct arm_ccn *ccn = container_of(dt, struct arm_ccn, dt);
-
- if (!cpumask_test_and_clear_cpu(cpu, &dt->cpu))
- continue;
- target = cpumask_any_but(cpu_online_mask, cpu);
- if (target >= nr_cpu_ids)
- continue;
- perf_pmu_migrate_context(&dt->pmu, cpu, target);
- cpumask_set_cpu(target, &dt->cpu);
- if (ccn->irq)
- WARN_ON(irq_set_affinity_hint(ccn->irq, &dt->cpu) != 0);
- }
- mutex_unlock(&arm_ccn_mutex);
+ if (!cpumask_test_and_clear_cpu(cpu, &dt->cpu))
+ return 0;
+ target = cpumask_any_but(cpu_online_mask, cpu);
+ if (target >= nr_cpu_ids)
+ return 0;
+ perf_pmu_migrate_context(&dt->pmu, cpu, target);
+ cpumask_set_cpu(target, &dt->cpu);
+ if (ccn->irq)
+ WARN_ON(irq_set_affinity_hint(ccn->irq, &dt->cpu) != 0);
return 0;
}
-
static DEFINE_IDA(arm_ccn_pmu_ida);
static int arm_ccn_pmu_init(struct arm_ccn *ccn)
@@ -1278,9 +1269,8 @@ static int arm_ccn_pmu_init(struct arm_ccn *ccn)
if (err)
goto error_pmu_register;
- mutex_lock(&arm_ccn_mutex);
- list_add(&ccn->dt.entry, &arm_ccn_list);
- mutex_unlock(&arm_ccn_mutex);
+ cpuhp_state_add_instance_nocalls(CPUHP_AP_PERF_ARM_CCN_ONLINE,
+ &ccn->dt.node);
return 0;
error_pmu_register:
@@ -1296,10 +1286,8 @@ static void arm_ccn_pmu_cleanup(struct arm_ccn *ccn)
{
int i;
- mutex_lock(&arm_ccn_mutex);
- list_del(&ccn->dt.entry);
- mutex_unlock(&arm_ccn_mutex);
-
+ cpuhp_state_remove_instance_nocalls(CPUHP_AP_PERF_ARM_CCN_ONLINE,
+ &ccn->dt.node);
if (ccn->irq)
irq_set_affinity_hint(ccn->irq, NULL);
for (i = 0; i < ccn->num_xps; i++)
@@ -1527,9 +1515,9 @@ static int __init arm_ccn_init(void)
{
int i, ret;
- ret = cpuhp_setup_state_nocalls(CPUHP_AP_PERF_ARM_CCN_ONLINE,
- "AP_PERF_ARM_CCN_ONLINE", NULL,
- arm_ccn_pmu_offline_cpu);
+ ret = cpuhp_setup_state_multi(CPUHP_AP_PERF_ARM_CCN_ONLINE,
+ "AP_PERF_ARM_CCN_ONLINE", NULL,
+ arm_ccn_pmu_offline_cpu);
if (ret)
return ret;
next prev parent reply other threads:[~2016-09-02 8:24 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-12 17:49 cpu hotplug: add multi instance support Sebastian Andrzej Siewior
2016-08-12 17:49 ` [PATCH 1/6] cpu/hotplug: Rework callback invocation logic Sebastian Andrzej Siewior
2016-09-02 8:22 ` [tip:smp/hotplug] " tip-bot for Thomas Gleixner
2016-09-02 18:16 ` tip-bot for Thomas Gleixner
2016-08-12 17:49 ` [PATCH 2/6] cpu/hotplug: Add multi instance support Sebastian Andrzej Siewior
2016-09-02 8:22 ` [tip:smp/hotplug] " tip-bot for Thomas Gleixner
2016-09-02 18:16 ` tip-bot for Thomas Gleixner
2016-08-12 17:49 ` [PATCH 3/6] arm/perf: Use multi instance instead of custom list Sebastian Andrzej Siewior
2016-08-17 17:14 ` [PATCH v2 " Sebastian Andrzej Siewior
2016-08-22 15:07 ` Will Deacon
2016-08-22 19:04 ` Sebastian Andrzej Siewior
2016-09-02 8:23 ` [tip:smp/hotplug] " tip-bot for Sebastian Andrzej Siewior
2016-09-02 18:17 ` tip-bot for Sebastian Andrzej Siewior
2016-08-12 17:49 ` [PATCH 4/6] bus/arm-cci: Use cpu-hp's multi instance support instead " Sebastian Andrzej Siewior
2016-09-02 8:23 ` [tip:smp/hotplug] " tip-bot for Sebastian Andrzej Siewior
2016-09-02 18:17 ` tip-bot for Sebastian Andrzej Siewior
2016-08-12 17:49 ` [PATCH 5/6] bus/arm-ccn: " Sebastian Andrzej Siewior
2016-09-02 8:24 ` tip-bot for Sebastian Andrzej Siewior [this message]
2016-09-02 18:18 ` [tip:smp/hotplug] " tip-bot for Sebastian Andrzej Siewior
2016-08-12 17:49 ` [PATCH 6/6] net: virtio-net: Convert to hotplug state machine Sebastian Andrzej Siewior
2016-08-12 17:49 ` Sebastian Andrzej Siewior
2016-09-02 8:24 ` [tip:smp/hotplug] net/virtio-net: " tip-bot for Sebastian Andrzej Siewior
2016-09-02 18:18 ` tip-bot for Sebastian Andrzej Siewior
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=tip-ebade02256fd8a449445c7b27eacb093e22d7ee5@git.kernel.org \
--to=tipbot@zytor.com \
--cc=arnd@arndb.de \
--cc=bigeasy@linutronix.de \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mingo@kernel.org \
--cc=pawel.moll@arm.com \
--cc=peterz@infradead.org \
--cc=suzuki.poulose@arm.com \
--cc=tglx@linutronix.de \
--cc=will.deacon@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.