* [PATCH 0/4] powerpc/pseries: VPHN code cleanups
@ 2011-01-21 5:00 Jesse Larrew
2011-01-21 5:00 ` [PATCH 1/4] powerpc/pseries: Fix typo in VPHN comments Jesse Larrew
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Jesse Larrew @ 2011-01-21 5:00 UTC (permalink / raw)
To: linuxppc-dev; +Cc: markn, tbreeds, lkessler, Jesse Larrew, mjwolf
From: Jesse Larrew <jlarrew@linux.vnet.ibm.com>
This patch set includes some simple style cleanups for VPHN:
PATCH 1/4: powerpc/pseries: Fix typo in VPHN comments
PATCH 2/4: powerpc/pseries: Fix brace placement in numa.c
PATCH 3/4: powerpc/pseries: Remove unnecessary initializations in numa.c
PATCH 4/4: powerpc/pseries: Reorder VPHN functions to reduce forward
declarations
arch/powerpc/mm/numa.c | 143 +++++++++++++++++++++++-------------------------
1 files changed, 69 insertions(+), 74 deletions(-)
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/4] powerpc/pseries: Fix typo in VPHN comments
2011-01-21 5:00 [PATCH 0/4] powerpc/pseries: VPHN code cleanups Jesse Larrew
@ 2011-01-21 5:00 ` Jesse Larrew
2011-01-21 5:01 ` [PATCH 2/4] powerpc/pseries: Fix brace placement in numa.c Jesse Larrew
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Jesse Larrew @ 2011-01-21 5:00 UTC (permalink / raw)
To: linuxppc-dev; +Cc: markn, tbreeds, lkessler, Jesse Larrew, mjwolf
From: Jesse Larrew <jlarrew@linux.vnet.ibm.com>
Correct a spelling error in VPHN comments in numa.c.
Signed-off-by: Jesse Larrew <jlarrew@linux.vnet.ibm.com>
---
arch/powerpc/mm/numa.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
index 8f8845e..5259dde 100644
--- a/arch/powerpc/mm/numa.c
+++ b/arch/powerpc/mm/numa.c
@@ -1263,7 +1263,7 @@ int hot_add_scn_to_nid(unsigned long scn_addr)
#endif /* CONFIG_MEMORY_HOTPLUG */
-/* Vrtual Processor Home Node (VPHN) support */
+/* Virtual Processor Home Node (VPHN) support */
#ifdef CONFIG_PPC_SPLPAR
#define VPHN_NR_CHANGE_CTRS (8)
static u8 vphn_cpu_change_counts[NR_CPUS][VPHN_NR_CHANGE_CTRS];
--
1.7.3.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/4] powerpc/pseries: Fix brace placement in numa.c
2011-01-21 5:00 [PATCH 0/4] powerpc/pseries: VPHN code cleanups Jesse Larrew
2011-01-21 5:00 ` [PATCH 1/4] powerpc/pseries: Fix typo in VPHN comments Jesse Larrew
@ 2011-01-21 5:01 ` Jesse Larrew
2011-01-21 5:01 ` [PATCH 3/4] powerpc/pseries: Remove unnecessary variable initializations " Jesse Larrew
2011-01-21 5:01 ` [PATCH 4/4] powerpc/pseries: Reorder VPHN functions to reduce forward declarations Jesse Larrew
3 siblings, 0 replies; 5+ messages in thread
From: Jesse Larrew @ 2011-01-21 5:01 UTC (permalink / raw)
To: linuxppc-dev; +Cc: markn, tbreeds, lkessler, Jesse Larrew, mjwolf
From: Jesse Larrew <jlarrew@linux.vnet.ibm.com>
Fix brace placement in VPHN code.
Signed-off-by: Jesse Larrew <jlarrew@linux.vnet.ibm.com>
---
arch/powerpc/mm/numa.c | 9 +++------
1 files changed, 3 insertions(+), 6 deletions(-)
diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
index 5259dde..db36a2c 100644
--- a/arch/powerpc/mm/numa.c
+++ b/arch/powerpc/mm/numa.c
@@ -1285,9 +1285,8 @@ static void setup_cpu_associativity_change_counters(void)
u8 *counts = vphn_cpu_change_counts[cpu];
volatile u8 *hypervisor_counts = lppaca[cpu].vphn_assoc_counts;
- for (i = 0; i < VPHN_NR_CHANGE_CTRS; i++) {
+ for (i = 0; i < VPHN_NR_CHANGE_CTRS; i++)
counts[i] = hypervisor_counts[i];
- }
}
}
@@ -1354,14 +1353,12 @@ static int vphn_unpack_associativity(const long *packed, unsigned int *unpacked)
*/
unpacked[i] = *((u32*)field);
field += 2;
- }
- else if (*field & VPHN_FIELD_MSB) {
+ } else if (*field & VPHN_FIELD_MSB) {
/* Data is in the lower 15 bits of this field */
unpacked[i] = *field & VPHN_FIELD_MASK;
field++;
nr_assoc_doms++;
- }
- else {
+ } else {
/* Data is in the lower 15 bits of this field
* concatenated with the next 16 bit field
*/
--
1.7.3.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 3/4] powerpc/pseries: Remove unnecessary variable initializations in numa.c
2011-01-21 5:00 [PATCH 0/4] powerpc/pseries: VPHN code cleanups Jesse Larrew
2011-01-21 5:00 ` [PATCH 1/4] powerpc/pseries: Fix typo in VPHN comments Jesse Larrew
2011-01-21 5:01 ` [PATCH 2/4] powerpc/pseries: Fix brace placement in numa.c Jesse Larrew
@ 2011-01-21 5:01 ` Jesse Larrew
2011-01-21 5:01 ` [PATCH 4/4] powerpc/pseries: Reorder VPHN functions to reduce forward declarations Jesse Larrew
3 siblings, 0 replies; 5+ messages in thread
From: Jesse Larrew @ 2011-01-21 5:01 UTC (permalink / raw)
To: linuxppc-dev; +Cc: markn, tbreeds, lkessler, Jesse Larrew, mjwolf
From: Jesse Larrew <jlarrew@linux.vnet.ibm.com>
Remove unnecessary variable initializations in VPHN functions.
Signed-off-by: Jesse Larrew <jlarrew@linux.vnet.ibm.com>
---
arch/powerpc/mm/numa.c | 17 ++++++++---------
1 files changed, 8 insertions(+), 9 deletions(-)
diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
index db36a2c..f7971d2 100644
--- a/arch/powerpc/mm/numa.c
+++ b/arch/powerpc/mm/numa.c
@@ -1278,10 +1278,10 @@ int stop_topology_update(void);
*/
static void setup_cpu_associativity_change_counters(void)
{
- int cpu = 0;
+ int cpu;
for_each_possible_cpu(cpu) {
- int i = 0;
+ int i;
u8 *counts = vphn_cpu_change_counts[cpu];
volatile u8 *hypervisor_counts = lppaca[cpu].vphn_assoc_counts;
@@ -1303,7 +1303,7 @@ static void setup_cpu_associativity_change_counters(void)
*/
static int update_cpu_associativity_changes_mask(void)
{
- int cpu = 0, nr_cpus = 0;
+ int cpu, nr_cpus = 0;
cpumask_t *changes = &cpu_associativity_changes_mask;
cpumask_clear(changes);
@@ -1337,8 +1337,7 @@ static int update_cpu_associativity_changes_mask(void)
*/
static int vphn_unpack_associativity(const long *packed, unsigned int *unpacked)
{
- int i = 0;
- int nr_assoc_doms = 0;
+ int i, nr_assoc_doms = 0;
const u16 *field = (const u16*) packed;
#define VPHN_FIELD_UNUSED (0xffff)
@@ -1377,7 +1376,7 @@ static int vphn_unpack_associativity(const long *packed, unsigned int *unpacked)
*/
static long hcall_vphn(unsigned long cpu, unsigned int *associativity)
{
- long rc = 0;
+ long rc;
long retbuf[PLPAR_HCALL9_BUFSIZE] = {0};
u64 flags = 1;
int hwcpu = get_hard_smp_processor_id(cpu);
@@ -1391,7 +1390,7 @@ static long hcall_vphn(unsigned long cpu, unsigned int *associativity)
static long vphn_get_associativity(unsigned long cpu,
unsigned int *associativity)
{
- long rc = 0;
+ long rc;
rc = hcall_vphn(cpu, associativity);
@@ -1417,9 +1416,9 @@ static long vphn_get_associativity(unsigned long cpu,
*/
int arch_update_cpu_topology(void)
{
- int cpu = 0, nid = 0, old_nid = 0;
+ int cpu, nid, old_nid;
unsigned int associativity[VPHN_ASSOC_BUFSIZE] = {0};
- struct sys_device *sysdev = NULL;
+ struct sys_device *sysdev;
for_each_cpu_mask(cpu, cpu_associativity_changes_mask) {
vphn_get_associativity(cpu, associativity);
--
1.7.3.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 4/4] powerpc/pseries: Reorder VPHN functions to reduce forward declarations
2011-01-21 5:00 [PATCH 0/4] powerpc/pseries: VPHN code cleanups Jesse Larrew
` (2 preceding siblings ...)
2011-01-21 5:01 ` [PATCH 3/4] powerpc/pseries: Remove unnecessary variable initializations " Jesse Larrew
@ 2011-01-21 5:01 ` Jesse Larrew
3 siblings, 0 replies; 5+ messages in thread
From: Jesse Larrew @ 2011-01-21 5:01 UTC (permalink / raw)
To: linuxppc-dev; +Cc: markn, tbreeds, lkessler, Jesse Larrew, mjwolf
From: Jesse Larrew <jlarrew@linux.vnet.ibm.com>
Reorder VPHN functions to reduce the need for forward declarations.
Signed-off-by: Jesse Larrew <jlarrew@linux.vnet.ibm.com>
---
arch/powerpc/mm/numa.c | 115 ++++++++++++++++++++++++------------------------
1 files changed, 57 insertions(+), 58 deletions(-)
diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
index f7971d2..2010a17 100644
--- a/arch/powerpc/mm/numa.c
+++ b/arch/powerpc/mm/numa.c
@@ -1270,7 +1270,6 @@ static u8 vphn_cpu_change_counts[NR_CPUS][VPHN_NR_CHANGE_CTRS];
static cpumask_t cpu_associativity_changes_mask;
static int vphn_enabled;
static void set_topology_timer(void);
-int stop_topology_update(void);
/*
* Store the current values of the associativity change counters in the
@@ -1328,6 +1327,63 @@ static int update_cpu_associativity_changes_mask(void)
return nr_cpus;
}
+static void topology_work_fn(struct work_struct *work)
+{
+ rebuild_sched_domains();
+}
+static DECLARE_WORK(topology_work, topology_work_fn);
+
+void topology_schedule_update(void)
+{
+ schedule_work(&topology_work);
+}
+
+static void topology_timer_fn(unsigned long ignored)
+{
+ if (!vphn_enabled)
+ return;
+ if (update_cpu_associativity_changes_mask() > 0)
+ topology_schedule_update();
+ set_topology_timer();
+}
+static struct timer_list topology_timer =
+ TIMER_INITIALIZER(topology_timer_fn, 0, 0);
+
+static void set_topology_timer(void)
+{
+ topology_timer.data = 0;
+ topology_timer.expires = jiffies + 60 * HZ;
+ add_timer(&topology_timer);
+}
+
+/*
+ * Start polling for VPHN associativity changes.
+ */
+int start_topology_update(void)
+{
+ int rc = 0;
+
+ if (firmware_has_feature(FW_FEATURE_VPHN)) {
+ vphn_enabled = 1;
+ setup_cpu_associativity_change_counters();
+ init_timer_deferrable(&topology_timer);
+ set_topology_timer();
+ rc = 1;
+ }
+
+ return rc;
+}
+__initcall(start_topology_update);
+
+/*
+ * Disable polling for VPHN associativity changes.
+ */
+int stop_topology_update(void)
+{
+ vphn_enabled = 0;
+ return del_timer_sync(&topology_timer);
+}
+
/* 6 64-bit registers unpacked into 12 32-bit associativity values */
#define VPHN_ASSOC_BUFSIZE (6*sizeof(u64)/sizeof(u32))
@@ -1446,61 +1502,4 @@ int arch_update_cpu_topology(void)
return 1;
}
-
-static void topology_work_fn(struct work_struct *work)
-{
- rebuild_sched_domains();
-}
-static DECLARE_WORK(topology_work, topology_work_fn);
-
-void topology_schedule_update(void)
-{
- schedule_work(&topology_work);
-}
-
-static void topology_timer_fn(unsigned long ignored)
-{
- if (!vphn_enabled)
- return;
- if (update_cpu_associativity_changes_mask() > 0)
- topology_schedule_update();
- set_topology_timer();
-}
-static struct timer_list topology_timer =
- TIMER_INITIALIZER(topology_timer_fn, 0, 0);
-
-static void set_topology_timer(void)
-{
- topology_timer.data = 0;
- topology_timer.expires = jiffies + 60 * HZ;
- add_timer(&topology_timer);
-}
-
-/*
- * Start polling for VPHN associativity changes.
- */
-int start_topology_update(void)
-{
- int rc = 0;
-
- if (firmware_has_feature(FW_FEATURE_VPHN)) {
- vphn_enabled = 1;
- setup_cpu_associativity_change_counters();
- init_timer_deferrable(&topology_timer);
- set_topology_timer();
- rc = 1;
- }
-
- return rc;
-}
-__initcall(start_topology_update);
-
-/*
- * Disable polling for VPHN associativity changes.
- */
-int stop_topology_update(void)
-{
- vphn_enabled = 0;
- return del_timer_sync(&topology_timer);
-}
#endif /* CONFIG_PPC_SPLPAR */
--
1.7.3.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-01-21 5:08 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-21 5:00 [PATCH 0/4] powerpc/pseries: VPHN code cleanups Jesse Larrew
2011-01-21 5:00 ` [PATCH 1/4] powerpc/pseries: Fix typo in VPHN comments Jesse Larrew
2011-01-21 5:01 ` [PATCH 2/4] powerpc/pseries: Fix brace placement in numa.c Jesse Larrew
2011-01-21 5:01 ` [PATCH 3/4] powerpc/pseries: Remove unnecessary variable initializations " Jesse Larrew
2011-01-21 5:01 ` [PATCH 4/4] powerpc/pseries: Reorder VPHN functions to reduce forward declarations Jesse Larrew
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).