linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/9] x86: remove cpu_**_mask() functions
@ 2015-05-04 10:28 Bartosz Golaszewski
  2015-05-04 10:28 ` [PATCH v2 1/9] topology: rename topology_thread_cpumask() Bartosz Golaszewski
                   ` (9 more replies)
  0 siblings, 10 replies; 17+ messages in thread
From: Bartosz Golaszewski @ 2015-05-04 10:28 UTC (permalink / raw)
  To: LKML
  Cc: Thomas Gleixner, Ingo Molnar, H. Peter Anvin, x86,
	Rafael J. Wysocki, Viresh Kumar, Guenter Roeck, Jean Delvare,
	Fenghua Yu, Benoit Cousson, Jonathan Corbet, Oleg Drokin,
	Russell King, Catalin Marinas, Bartosz Golaszewski

Two functions defined in asm/smp.h: cpu_sibling_mask() and cpu_core_mask(),
have the same functionality as macros defined in linux/topology.h:
topology_thread_cpumask() and topology_core_cpumask() respectively.

They are not documented and are architecture specific. Also: different
naming for the same functionality (in case of cpu_sibling_mask() and
topology_thread_cpumask()) is a bit misleading.

This series makes all the callers switch to using the topology.h macros
and removes their smp.h counterparts. While we're at it: rename
topology_thread_cpumask() to topology_sibling_cpumask() to be
consistent with the term used in the scheduler.

The same duplication exists on powerpc.

NOTE: patch 2/9 had been already submitted separately but didn't
receive any attention, so I'm attaching it to this series.

v2:
- renamed topology_thread_cpumask() to topology_sibling_cpumask()
- updated Documentation/cputopology.txt

v1:
https://lkml.org/lkml/2015/4/30/188

Bartosz Golaszewski (9):
  topology: rename topology_thread_cpumask()
  Documentation: update cputopology.txt
  coretemp: replace cpu_sibling_mask() with topology_sibling_cpumask()
  powernow-k8: replace cpu_core_mask() with topology_core_cpumask()
  p4-clockmod: replace cpu_sibling_mask() with topology_sibling_cpumask()
  acpi-cpufreq: replace cpu_**_mask() with topology_**_cpumask()
  speedstep-ich: replace cpu_sibling_mask() with topology_sibling_cpumask()
  x86: replace cpu_**_mask() with topology_**_cpumask()
  x86: remove cpu_sibling_mask() and cpu_core_mask()

 Documentation/cputopology.txt                      | 37 +++++++++++++------
 arch/arm/include/asm/topology.h                    |  2 +-
 arch/arm64/include/asm/topology.h                  |  2 +-
 arch/ia64/include/asm/topology.h                   |  2 +-
 arch/mips/include/asm/topology.h                   |  2 +-
 arch/powerpc/include/asm/topology.h                |  2 +-
 arch/powerpc/mm/tlb_nohash.c                       |  2 +-
 arch/s390/include/asm/topology.h                   |  3 +-
 arch/sparc/include/asm/topology_64.h               |  2 +-
 arch/tile/include/asm/topology.h                   |  2 +-
 arch/x86/include/asm/smp.h                         | 10 ------
 arch/x86/include/asm/topology.h                    |  2 +-
 arch/x86/kernel/cpu/perf_event_intel.c             |  6 ++--
 arch/x86/kernel/cpu/proc.c                         |  3 +-
 arch/x86/kernel/smpboot.c                          | 42 +++++++++++-----------
 arch/x86/kernel/tsc_sync.c                         |  2 +-
 block/blk-mq-cpumap.c                              |  2 +-
 drivers/acpi/acpi_pad.c                            |  2 +-
 drivers/base/topology.c                            |  2 +-
 drivers/cpufreq/acpi-cpufreq.c                     |  5 +--
 drivers/cpufreq/p4-clockmod.c                      |  2 +-
 drivers/cpufreq/powernow-k8.c                      | 13 ++-----
 drivers/cpufreq/speedstep-ich.c                    |  2 +-
 drivers/hwmon/coretemp.c                           |  3 +-
 drivers/net/ethernet/sfc/efx.c                     |  2 +-
 .../staging/lustre/lustre/libcfs/linux/linux-cpu.c |  2 +-
 drivers/staging/lustre/lustre/ptlrpc/service.c     |  4 +--
 include/linux/topology.h                           |  6 ++--
 lib/cpu_rmap.c                                     |  2 +-
 29 files changed, 87 insertions(+), 81 deletions(-)

-- 
2.1.4


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH v2 1/9] topology: rename topology_thread_cpumask()
  2015-05-04 10:28 [PATCH v2 0/9] x86: remove cpu_**_mask() functions Bartosz Golaszewski
@ 2015-05-04 10:28 ` Bartosz Golaszewski
  2015-05-06 11:27   ` Russell King - ARM Linux
  2015-05-04 10:28 ` [PATCH v2 2/9] Documentation: update cputopology.txt Bartosz Golaszewski
                   ` (8 subsequent siblings)
  9 siblings, 1 reply; 17+ messages in thread
From: Bartosz Golaszewski @ 2015-05-04 10:28 UTC (permalink / raw)
  To: LKML
  Cc: Thomas Gleixner, Ingo Molnar, H. Peter Anvin, x86,
	Rafael J. Wysocki, Viresh Kumar, Guenter Roeck, Jean Delvare,
	Fenghua Yu, Benoit Cousson, Jonathan Corbet, Oleg Drokin,
	Russell King, Catalin Marinas, Bartosz Golaszewski

Rename topology_thread_cpumask() to topology_sibling_cpumask() for
more consistency with scheduler code.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
---
 Documentation/cputopology.txt                          | 2 +-
 arch/arm/include/asm/topology.h                        | 2 +-
 arch/arm64/include/asm/topology.h                      | 2 +-
 arch/ia64/include/asm/topology.h                       | 2 +-
 arch/mips/include/asm/topology.h                       | 2 +-
 arch/powerpc/include/asm/topology.h                    | 2 +-
 arch/powerpc/mm/tlb_nohash.c                           | 2 +-
 arch/s390/include/asm/topology.h                       | 3 ++-
 arch/sparc/include/asm/topology_64.h                   | 2 +-
 arch/tile/include/asm/topology.h                       | 2 +-
 arch/x86/include/asm/topology.h                        | 2 +-
 arch/x86/kernel/cpu/perf_event_intel.c                 | 6 +++---
 block/blk-mq-cpumap.c                                  | 2 +-
 drivers/acpi/acpi_pad.c                                | 2 +-
 drivers/base/topology.c                                | 2 +-
 drivers/net/ethernet/sfc/efx.c                         | 2 +-
 drivers/staging/lustre/lustre/libcfs/linux/linux-cpu.c | 2 +-
 drivers/staging/lustre/lustre/ptlrpc/service.c         | 4 ++--
 include/linux/topology.h                               | 6 +++---
 lib/cpu_rmap.c                                         | 2 +-
 20 files changed, 26 insertions(+), 25 deletions(-)

diff --git a/Documentation/cputopology.txt b/Documentation/cputopology.txt
index 0aad6de..428a961 100644
--- a/Documentation/cputopology.txt
+++ b/Documentation/cputopology.txt
@@ -44,7 +44,7 @@ these macros in include/asm-XXX/topology.h:
 #define topology_physical_package_id(cpu)
 #define topology_core_id(cpu)
 #define topology_book_id(cpu)
-#define topology_thread_cpumask(cpu)
+#define topology_sibling_cpumask(cpu)
 #define topology_core_cpumask(cpu)
 #define topology_book_cpumask(cpu)
 
diff --git a/arch/arm/include/asm/topology.h b/arch/arm/include/asm/topology.h
index 2fe85ff..370f7a7 100644
--- a/arch/arm/include/asm/topology.h
+++ b/arch/arm/include/asm/topology.h
@@ -18,7 +18,7 @@ extern struct cputopo_arm cpu_topology[NR_CPUS];
 #define topology_physical_package_id(cpu)	(cpu_topology[cpu].socket_id)
 #define topology_core_id(cpu)		(cpu_topology[cpu].core_id)
 #define topology_core_cpumask(cpu)	(&cpu_topology[cpu].core_sibling)
-#define topology_thread_cpumask(cpu)	(&cpu_topology[cpu].thread_sibling)
+#define topology_sibling_cpumask(cpu)	(&cpu_topology[cpu].thread_sibling)
 
 void init_cpu_topology(void);
 void store_cpu_topology(unsigned int cpuid);
diff --git a/arch/arm64/include/asm/topology.h b/arch/arm64/include/asm/topology.h
index 7ebcd31..225ec35 100644
--- a/arch/arm64/include/asm/topology.h
+++ b/arch/arm64/include/asm/topology.h
@@ -18,7 +18,7 @@ extern struct cpu_topology cpu_topology[NR_CPUS];
 #define topology_physical_package_id(cpu)	(cpu_topology[cpu].cluster_id)
 #define topology_core_id(cpu)		(cpu_topology[cpu].core_id)
 #define topology_core_cpumask(cpu)	(&cpu_topology[cpu].core_sibling)
-#define topology_thread_cpumask(cpu)	(&cpu_topology[cpu].thread_sibling)
+#define topology_sibling_cpumask(cpu)	(&cpu_topology[cpu].thread_sibling)
 
 void init_cpu_topology(void);
 void store_cpu_topology(unsigned int cpuid);
diff --git a/arch/ia64/include/asm/topology.h b/arch/ia64/include/asm/topology.h
index 6437ca2..3ad8f69 100644
--- a/arch/ia64/include/asm/topology.h
+++ b/arch/ia64/include/asm/topology.h
@@ -53,7 +53,7 @@ void build_cpu_to_node_map(void);
 #define topology_physical_package_id(cpu)	(cpu_data(cpu)->socket_id)
 #define topology_core_id(cpu)			(cpu_data(cpu)->core_id)
 #define topology_core_cpumask(cpu)		(&cpu_core_map[cpu])
-#define topology_thread_cpumask(cpu)		(&per_cpu(cpu_sibling_map, cpu))
+#define topology_sibling_cpumask(cpu)		(&per_cpu(cpu_sibling_map, cpu))
 #endif
 
 extern void arch_fix_phys_package_id(int num, u32 slot);
diff --git a/arch/mips/include/asm/topology.h b/arch/mips/include/asm/topology.h
index 3e307ec..7afda41 100644
--- a/arch/mips/include/asm/topology.h
+++ b/arch/mips/include/asm/topology.h
@@ -15,7 +15,7 @@
 #define topology_physical_package_id(cpu)	(cpu_data[cpu].package)
 #define topology_core_id(cpu)			(cpu_data[cpu].core)
 #define topology_core_cpumask(cpu)		(&cpu_core_map[cpu])
-#define topology_thread_cpumask(cpu)		(&cpu_sibling_map[cpu])
+#define topology_sibling_cpumask(cpu)		(&cpu_sibling_map[cpu])
 #endif
 
 #endif /* __ASM_TOPOLOGY_H */
diff --git a/arch/powerpc/include/asm/topology.h b/arch/powerpc/include/asm/topology.h
index 5f1048e..8b3b46b 100644
--- a/arch/powerpc/include/asm/topology.h
+++ b/arch/powerpc/include/asm/topology.h
@@ -87,7 +87,7 @@ static inline int prrn_is_enabled(void)
 #include <asm/smp.h>
 
 #define topology_physical_package_id(cpu)	(cpu_to_chip_id(cpu))
-#define topology_thread_cpumask(cpu)	(per_cpu(cpu_sibling_map, cpu))
+#define topology_sibling_cpumask(cpu)	(per_cpu(cpu_sibling_map, cpu))
 #define topology_core_cpumask(cpu)	(per_cpu(cpu_core_map, cpu))
 #define topology_core_id(cpu)		(cpu_to_core_id(cpu))
 #endif
diff --git a/arch/powerpc/mm/tlb_nohash.c b/arch/powerpc/mm/tlb_nohash.c
index cbd3d06..723a099 100644
--- a/arch/powerpc/mm/tlb_nohash.c
+++ b/arch/powerpc/mm/tlb_nohash.c
@@ -217,7 +217,7 @@ static DEFINE_RAW_SPINLOCK(tlbivax_lock);
 static int mm_is_core_local(struct mm_struct *mm)
 {
 	return cpumask_subset(mm_cpumask(mm),
-			      topology_thread_cpumask(smp_processor_id()));
+			      topology_sibling_cpumask(smp_processor_id()));
 }
 
 struct tlb_flush_param {
diff --git a/arch/s390/include/asm/topology.h b/arch/s390/include/asm/topology.h
index b1453a2..4990f6c 100644
--- a/arch/s390/include/asm/topology.h
+++ b/arch/s390/include/asm/topology.h
@@ -22,7 +22,8 @@ DECLARE_PER_CPU(struct cpu_topology_s390, cpu_topology);
 
 #define topology_physical_package_id(cpu) (per_cpu(cpu_topology, cpu).socket_id)
 #define topology_thread_id(cpu)		  (per_cpu(cpu_topology, cpu).thread_id)
-#define topology_thread_cpumask(cpu)	  (&per_cpu(cpu_topology, cpu).thread_mask)
+#define topology_sibling_cpumask(cpu) \
+		(&per_cpu(cpu_topology, cpu).thread_mask)
 #define topology_core_id(cpu)		  (per_cpu(cpu_topology, cpu).core_id)
 #define topology_core_cpumask(cpu)	  (&per_cpu(cpu_topology, cpu).core_mask)
 #define topology_book_id(cpu)		  (per_cpu(cpu_topology, cpu).book_id)
diff --git a/arch/sparc/include/asm/topology_64.h b/arch/sparc/include/asm/topology_64.h
index ed8f071..9a928fc 100644
--- a/arch/sparc/include/asm/topology_64.h
+++ b/arch/sparc/include/asm/topology_64.h
@@ -41,7 +41,7 @@ static inline int pcibus_to_node(struct pci_bus *pbus)
 #define topology_physical_package_id(cpu)	(cpu_data(cpu).proc_id)
 #define topology_core_id(cpu)			(cpu_data(cpu).core_id)
 #define topology_core_cpumask(cpu)		(&cpu_core_map[cpu])
-#define topology_thread_cpumask(cpu)		(&per_cpu(cpu_sibling_map, cpu))
+#define topology_sibling_cpumask(cpu)		(&per_cpu(cpu_sibling_map, cpu))
 #endif /* CONFIG_SMP */
 
 extern cpumask_t cpu_core_map[NR_CPUS];
diff --git a/arch/tile/include/asm/topology.h b/arch/tile/include/asm/topology.h
index 9383118..76b0d0e 100644
--- a/arch/tile/include/asm/topology.h
+++ b/arch/tile/include/asm/topology.h
@@ -55,7 +55,7 @@ static inline const struct cpumask *cpumask_of_node(int node)
 #define topology_physical_package_id(cpu)       ((void)(cpu), 0)
 #define topology_core_id(cpu)                   (cpu)
 #define topology_core_cpumask(cpu)              ((void)(cpu), cpu_online_mask)
-#define topology_thread_cpumask(cpu)            cpumask_of(cpu)
+#define topology_sibling_cpumask(cpu)           cpumask_of(cpu)
 #endif
 
 #endif /* _ASM_TILE_TOPOLOGY_H */
diff --git a/arch/x86/include/asm/topology.h b/arch/x86/include/asm/topology.h
index 0e8f04f..5a77593f 100644
--- a/arch/x86/include/asm/topology.h
+++ b/arch/x86/include/asm/topology.h
@@ -124,7 +124,7 @@ extern const struct cpumask *cpu_coregroup_mask(int cpu);
 
 #ifdef ENABLE_TOPO_DEFINES
 #define topology_core_cpumask(cpu)		(per_cpu(cpu_core_map, cpu))
-#define topology_thread_cpumask(cpu)		(per_cpu(cpu_sibling_map, cpu))
+#define topology_sibling_cpumask(cpu)		(per_cpu(cpu_sibling_map, cpu))
 #endif
 
 static inline void arch_fix_phys_package_id(int num, u32 slot)
diff --git a/arch/x86/kernel/cpu/perf_event_intel.c b/arch/x86/kernel/cpu/perf_event_intel.c
index 219d3fb..1b176ff 100644
--- a/arch/x86/kernel/cpu/perf_event_intel.c
+++ b/arch/x86/kernel/cpu/perf_event_intel.c
@@ -2650,7 +2650,7 @@ static void intel_pmu_cpu_starting(int cpu)
 	if (!(x86_pmu.flags & PMU_FL_NO_HT_SHARING)) {
 		void **onln = &cpuc->kfree_on_online[X86_PERF_KFREE_SHARED];
 
-		for_each_cpu(i, topology_thread_cpumask(cpu)) {
+		for_each_cpu(i, topology_sibling_cpumask(cpu)) {
 			struct intel_shared_regs *pc;
 
 			pc = per_cpu(cpu_hw_events, i).shared_regs;
@@ -2670,7 +2670,7 @@ static void intel_pmu_cpu_starting(int cpu)
 	if (x86_pmu.flags & PMU_FL_EXCL_CNTRS) {
 		int h = x86_pmu.num_counters >> 1;
 
-		for_each_cpu(i, topology_thread_cpumask(cpu)) {
+		for_each_cpu(i, topology_sibling_cpumask(cpu)) {
 			struct intel_excl_cntrs *c;
 
 			c = per_cpu(cpu_hw_events, i).excl_cntrs;
@@ -3394,7 +3394,7 @@ static __init int fixup_ht_bug(void)
 	if (!(x86_pmu.flags & PMU_FL_EXCL_ENABLED))
 		return 0;
 
-	w = cpumask_weight(topology_thread_cpumask(cpu));
+	w = cpumask_weight(topology_sibling_cpumask(cpu));
 	if (w > 1) {
 		pr_info("PMU erratum BJ122, BV98, HSD29 worked around, HT is on\n");
 		return 0;
diff --git a/block/blk-mq-cpumap.c b/block/blk-mq-cpumap.c
index 5f13f4d..1e28ddb 100644
--- a/block/blk-mq-cpumap.c
+++ b/block/blk-mq-cpumap.c
@@ -24,7 +24,7 @@ static int get_first_sibling(unsigned int cpu)
 {
 	unsigned int ret;
 
-	ret = cpumask_first(topology_thread_cpumask(cpu));
+	ret = cpumask_first(topology_sibling_cpumask(cpu));
 	if (ret < nr_cpu_ids)
 		return ret;
 
diff --git a/drivers/acpi/acpi_pad.c b/drivers/acpi/acpi_pad.c
index 6bc9cbc..00b3980 100644
--- a/drivers/acpi/acpi_pad.c
+++ b/drivers/acpi/acpi_pad.c
@@ -105,7 +105,7 @@ static void round_robin_cpu(unsigned int tsk_index)
 	mutex_lock(&round_robin_lock);
 	cpumask_clear(tmp);
 	for_each_cpu(cpu, pad_busy_cpus)
-		cpumask_or(tmp, tmp, topology_thread_cpumask(cpu));
+		cpumask_or(tmp, tmp, topology_sibling_cpumask(cpu));
 	cpumask_andnot(tmp, cpu_online_mask, tmp);
 	/* avoid HT sibilings if possible */
 	if (cpumask_empty(tmp))
diff --git a/drivers/base/topology.c b/drivers/base/topology.c
index 6491f45..8b7d7f8 100644
--- a/drivers/base/topology.c
+++ b/drivers/base/topology.c
@@ -61,7 +61,7 @@ static DEVICE_ATTR_RO(physical_package_id);
 define_id_show_func(core_id);
 static DEVICE_ATTR_RO(core_id);
 
-define_siblings_show_func(thread_siblings, thread_cpumask);
+define_siblings_show_func(thread_siblings, sibling_cpumask);
 static DEVICE_ATTR_RO(thread_siblings);
 static DEVICE_ATTR_RO(thread_siblings_list);
 
diff --git a/drivers/net/ethernet/sfc/efx.c b/drivers/net/ethernet/sfc/efx.c
index 4b00545..65944dd 100644
--- a/drivers/net/ethernet/sfc/efx.c
+++ b/drivers/net/ethernet/sfc/efx.c
@@ -1304,7 +1304,7 @@ static unsigned int efx_wanted_parallelism(struct efx_nic *efx)
 			if (!cpumask_test_cpu(cpu, thread_mask)) {
 				++count;
 				cpumask_or(thread_mask, thread_mask,
-					   topology_thread_cpumask(cpu));
+					   topology_sibling_cpumask(cpu));
 			}
 		}
 
diff --git a/drivers/staging/lustre/lustre/libcfs/linux/linux-cpu.c b/drivers/staging/lustre/lustre/libcfs/linux/linux-cpu.c
index cc3ab35..f926224 100644
--- a/drivers/staging/lustre/lustre/libcfs/linux/linux-cpu.c
+++ b/drivers/staging/lustre/lustre/libcfs/linux/linux-cpu.c
@@ -87,7 +87,7 @@ static void cfs_cpu_core_siblings(int cpu, cpumask_t *mask)
 /* return cpumask of HTs in the same core */
 static void cfs_cpu_ht_siblings(int cpu, cpumask_t *mask)
 {
-	cpumask_copy(mask, topology_thread_cpumask(cpu));
+	cpumask_copy(mask, topology_sibling_cpumask(cpu));
 }
 
 static void cfs_node_to_cpumask(int node, cpumask_t *mask)
diff --git a/drivers/staging/lustre/lustre/ptlrpc/service.c b/drivers/staging/lustre/lustre/ptlrpc/service.c
index 8e61421..344189a 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/service.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/service.c
@@ -557,7 +557,7 @@ ptlrpc_server_nthreads_check(struct ptlrpc_service *svc,
 		 * there are.
 		 */
 		/* weight is # of HTs */
-		if (cpumask_weight(topology_thread_cpumask(0)) > 1) {
+		if (cpumask_weight(topology_sibling_cpumask(0)) > 1) {
 			/* depress thread factor for hyper-thread */
 			factor = factor - (factor >> 1) + (factor >> 3);
 		}
@@ -2768,7 +2768,7 @@ int ptlrpc_hr_init(void)
 
 	init_waitqueue_head(&ptlrpc_hr.hr_waitq);
 
-	weight = cpumask_weight(topology_thread_cpumask(0));
+	weight = cpumask_weight(topology_sibling_cpumask(0));
 
 	cfs_percpt_for_each(hrp, i, ptlrpc_hr.hr_partitions) {
 		hrp->hrp_cpt = i;
diff --git a/include/linux/topology.h b/include/linux/topology.h
index 909b6e4..73ddad1 100644
--- a/include/linux/topology.h
+++ b/include/linux/topology.h
@@ -191,8 +191,8 @@ static inline int cpu_to_mem(int cpu)
 #ifndef topology_core_id
 #define topology_core_id(cpu)			((void)(cpu), 0)
 #endif
-#ifndef topology_thread_cpumask
-#define topology_thread_cpumask(cpu)		cpumask_of(cpu)
+#ifndef topology_sibling_cpumask
+#define topology_sibling_cpumask(cpu)		cpumask_of(cpu)
 #endif
 #ifndef topology_core_cpumask
 #define topology_core_cpumask(cpu)		cpumask_of(cpu)
@@ -201,7 +201,7 @@ static inline int cpu_to_mem(int cpu)
 #ifdef CONFIG_SCHED_SMT
 static inline const struct cpumask *cpu_smt_mask(int cpu)
 {
-	return topology_thread_cpumask(cpu);
+	return topology_sibling_cpumask(cpu);
 }
 #endif
 
diff --git a/lib/cpu_rmap.c b/lib/cpu_rmap.c
index 4f134d8..f610b2a 100644
--- a/lib/cpu_rmap.c
+++ b/lib/cpu_rmap.c
@@ -191,7 +191,7 @@ int cpu_rmap_update(struct cpu_rmap *rmap, u16 index,
 	/* Update distances based on topology */
 	for_each_cpu(cpu, update_mask) {
 		if (cpu_rmap_copy_neigh(rmap, cpu,
-					topology_thread_cpumask(cpu), 1))
+					topology_sibling_cpumask(cpu), 1))
 			continue;
 		if (cpu_rmap_copy_neigh(rmap, cpu,
 					topology_core_cpumask(cpu), 2))
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH v2 2/9] Documentation: update cputopology.txt
  2015-05-04 10:28 [PATCH v2 0/9] x86: remove cpu_**_mask() functions Bartosz Golaszewski
  2015-05-04 10:28 ` [PATCH v2 1/9] topology: rename topology_thread_cpumask() Bartosz Golaszewski
@ 2015-05-04 10:28 ` Bartosz Golaszewski
  2015-05-04 10:28 ` [PATCH v2 3/9] coretemp: replace cpu_sibling_mask() with topology_sibling_cpumask() Bartosz Golaszewski
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 17+ messages in thread
From: Bartosz Golaszewski @ 2015-05-04 10:28 UTC (permalink / raw)
  To: LKML
  Cc: Thomas Gleixner, Ingo Molnar, H. Peter Anvin, x86,
	Rafael J. Wysocki, Viresh Kumar, Guenter Roeck, Jean Delvare,
	Fenghua Yu, Benoit Cousson, Jonathan Corbet, Oleg Drokin,
	Russell King, Catalin Marinas, Bartosz Golaszewski

The documentation on cpu topology seems to be a bit out-of-date. It
doesn't mention the **_siblings_list attributes and uses old names
for topology_**_cpumask() macros.

Add information on missing attributes plus some additional
clarifications.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
---
 Documentation/cputopology.txt | 35 ++++++++++++++++++++++++++---------
 1 file changed, 26 insertions(+), 9 deletions(-)

diff --git a/Documentation/cputopology.txt b/Documentation/cputopology.txt
index 428a961..12b1b25 100644
--- a/Documentation/cputopology.txt
+++ b/Documentation/cputopology.txt
@@ -1,6 +1,6 @@
 
 Export CPU topology info via sysfs. Items (attributes) are similar
-to /proc/cpuinfo.
+to /proc/cpuinfo output of some architectures:
 
 1) /sys/devices/system/cpu/cpuX/topology/physical_package_id:
 
@@ -23,20 +23,35 @@ to /proc/cpuinfo.
 4) /sys/devices/system/cpu/cpuX/topology/thread_siblings:
 
 	internal kernel map of cpuX's hardware threads within the same
-	core as cpuX
+	core as cpuX.
 
-5) /sys/devices/system/cpu/cpuX/topology/core_siblings:
+5) /sys/devices/system/cpu/cpuX/topology/thread_siblings_list:
+
+	human-readable list of cpuX's hardware threads within the same
+	core as cpuX.
+
+6) /sys/devices/system/cpu/cpuX/topology/core_siblings:
 
 	internal kernel map of cpuX's hardware threads within the same
 	physical_package_id.
 
-6) /sys/devices/system/cpu/cpuX/topology/book_siblings:
+7) /sys/devices/system/cpu/cpuX/topology/core_siblings_list:
+
+	human-readable list of cpuX's hardware threads within the same
+	physical_package_id.
+
+8) /sys/devices/system/cpu/cpuX/topology/book_siblings:
 
 	internal kernel map of cpuX's hardware threads within the same
 	book_id.
 
+9) /sys/devices/system/cpu/cpuX/topology/book_siblings_list:
+
+	human-readable list of cpuX's hardware threads within the same
+	book_id.
+
 To implement it in an architecture-neutral way, a new source file,
-drivers/base/topology.c, is to export the 4 or 6 attributes. The two book
+drivers/base/topology.c, is to export the 6 or 9 attributes. The three book
 related sysfs files will only be created if CONFIG_SCHED_BOOK is selected.
 
 For an architecture to support this feature, it must define some of
@@ -48,16 +63,18 @@ these macros in include/asm-XXX/topology.h:
 #define topology_core_cpumask(cpu)
 #define topology_book_cpumask(cpu)
 
-The type of **_id is int.
-The type of siblings is (const) struct cpumask *.
+The type of **_id macros is int.
+The type of **_cpumask macros is (const) struct cpumask *. The latter
+correspond with appropriate **_siblings sysfs attributes (except for
+topology_sibling_cpumask() which corresponds with thread_siblings).
 
 To be consistent on all architectures, include/linux/topology.h
 provides default definitions for any of the above macros that are
 not defined by include/asm-XXX/topology.h:
 1) physical_package_id: -1
 2) core_id: 0
-3) thread_siblings: just the given CPU
-4) core_siblings: just the given CPU
+3) sibling_cpumask: just the given CPU
+4) core_cpumask: just the given CPU
 
 For architectures that don't support books (CONFIG_SCHED_BOOK) there are no
 default definitions for topology_book_id() and topology_book_cpumask().
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH v2 3/9] coretemp: replace cpu_sibling_mask() with topology_sibling_cpumask()
  2015-05-04 10:28 [PATCH v2 0/9] x86: remove cpu_**_mask() functions Bartosz Golaszewski
  2015-05-04 10:28 ` [PATCH v2 1/9] topology: rename topology_thread_cpumask() Bartosz Golaszewski
  2015-05-04 10:28 ` [PATCH v2 2/9] Documentation: update cputopology.txt Bartosz Golaszewski
@ 2015-05-04 10:28 ` Bartosz Golaszewski
  2015-05-04 13:16   ` Guenter Roeck
  2015-05-04 10:28 ` [PATCH v2 4/9] powernow-k8: replace cpu_core_mask() with topology_core_cpumask() Bartosz Golaszewski
                   ` (6 subsequent siblings)
  9 siblings, 1 reply; 17+ messages in thread
From: Bartosz Golaszewski @ 2015-05-04 10:28 UTC (permalink / raw)
  To: LKML
  Cc: Thomas Gleixner, Ingo Molnar, H. Peter Anvin, x86,
	Rafael J. Wysocki, Viresh Kumar, Guenter Roeck, Jean Delvare,
	Fenghua Yu, Benoit Cousson, Jonathan Corbet, Oleg Drokin,
	Russell King, Catalin Marinas, Bartosz Golaszewski

The former duplicates the functionality of the latter but is neither
documented nor arch-independent.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
---
 drivers/hwmon/coretemp.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/hwmon/coretemp.c b/drivers/hwmon/coretemp.c
index ed303ba..3e03379 100644
--- a/drivers/hwmon/coretemp.c
+++ b/drivers/hwmon/coretemp.c
@@ -63,7 +63,8 @@ MODULE_PARM_DESC(tjmax, "TjMax value in degrees Celsius");
 #define TO_ATTR_NO(cpu)		(TO_CORE_ID(cpu) + BASE_SYSFS_ATTR_NO)
 
 #ifdef CONFIG_SMP
-#define for_each_sibling(i, cpu)	for_each_cpu(i, cpu_sibling_mask(cpu))
+#define for_each_sibling(i, cpu) \
+	for_each_cpu(i, topology_sibling_cpumask(cpu))
 #else
 #define for_each_sibling(i, cpu)	for (i = 0; false; )
 #endif
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH v2 4/9] powernow-k8: replace cpu_core_mask() with topology_core_cpumask()
  2015-05-04 10:28 [PATCH v2 0/9] x86: remove cpu_**_mask() functions Bartosz Golaszewski
                   ` (2 preceding siblings ...)
  2015-05-04 10:28 ` [PATCH v2 3/9] coretemp: replace cpu_sibling_mask() with topology_sibling_cpumask() Bartosz Golaszewski
@ 2015-05-04 10:28 ` Bartosz Golaszewski
  2015-05-05  7:07   ` Viresh Kumar
  2015-05-04 10:28 ` [PATCH v2 5/9] p4-clockmod: replace cpu_sibling_mask() with topology_sibling_cpumask() Bartosz Golaszewski
                   ` (5 subsequent siblings)
  9 siblings, 1 reply; 17+ messages in thread
From: Bartosz Golaszewski @ 2015-05-04 10:28 UTC (permalink / raw)
  To: LKML
  Cc: Thomas Gleixner, Ingo Molnar, H. Peter Anvin, x86,
	Rafael J. Wysocki, Viresh Kumar, Guenter Roeck, Jean Delvare,
	Fenghua Yu, Benoit Cousson, Jonathan Corbet, Oleg Drokin,
	Russell King, Catalin Marinas, Bartosz Golaszewski

The former duplicates the functionality of the latter but is neither
documented nor arch-independent.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
---
 drivers/cpufreq/powernow-k8.c | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)

diff --git a/drivers/cpufreq/powernow-k8.c b/drivers/cpufreq/powernow-k8.c
index f9ce7e4..5c035d0 100644
--- a/drivers/cpufreq/powernow-k8.c
+++ b/drivers/cpufreq/powernow-k8.c
@@ -57,13 +57,6 @@ static DEFINE_PER_CPU(struct powernow_k8_data *, powernow_data);
 
 static struct cpufreq_driver cpufreq_amd64_driver;
 
-#ifndef CONFIG_SMP
-static inline const struct cpumask *cpu_core_mask(int cpu)
-{
-	return cpumask_of(0);
-}
-#endif
-
 /* Return a frequency in MHz, given an input fid */
 static u32 find_freq_from_fid(u32 fid)
 {
@@ -620,7 +613,7 @@ static int fill_powernow_table(struct powernow_k8_data *data,
 
 	pr_debug("cfid 0x%x, cvid 0x%x\n", data->currfid, data->currvid);
 	data->powernow_table = powernow_table;
-	if (cpumask_first(cpu_core_mask(data->cpu)) == data->cpu)
+	if (cpumask_first(topology_core_cpumask(data->cpu)) == data->cpu)
 		print_basics(data);
 
 	for (j = 0; j < data->numps; j++)
@@ -784,7 +777,7 @@ static int powernow_k8_cpu_init_acpi(struct powernow_k8_data *data)
 		CPUFREQ_TABLE_END;
 	data->powernow_table = powernow_table;
 
-	if (cpumask_first(cpu_core_mask(data->cpu)) == data->cpu)
+	if (cpumask_first(topology_core_cpumask(data->cpu)) == data->cpu)
 		print_basics(data);
 
 	/* notify BIOS that we exist */
@@ -1090,7 +1083,7 @@ static int powernowk8_cpu_init(struct cpufreq_policy *pol)
 	if (rc != 0)
 		goto err_out_exit_acpi;
 
-	cpumask_copy(pol->cpus, cpu_core_mask(pol->cpu));
+	cpumask_copy(pol->cpus, topology_core_cpumask(pol->cpu));
 	data->available_cores = pol->cpus;
 
 	/* min/max the cpu is capable of */
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH v2 5/9] p4-clockmod: replace cpu_sibling_mask() with topology_sibling_cpumask()
  2015-05-04 10:28 [PATCH v2 0/9] x86: remove cpu_**_mask() functions Bartosz Golaszewski
                   ` (3 preceding siblings ...)
  2015-05-04 10:28 ` [PATCH v2 4/9] powernow-k8: replace cpu_core_mask() with topology_core_cpumask() Bartosz Golaszewski
@ 2015-05-04 10:28 ` Bartosz Golaszewski
  2015-05-05  7:07   ` Viresh Kumar
  2015-05-04 10:28 ` [PATCH v2 6/9] acpi-cpufreq: replace cpu_**_mask() with topology_**_cpumask() Bartosz Golaszewski
                   ` (4 subsequent siblings)
  9 siblings, 1 reply; 17+ messages in thread
From: Bartosz Golaszewski @ 2015-05-04 10:28 UTC (permalink / raw)
  To: LKML
  Cc: Thomas Gleixner, Ingo Molnar, H. Peter Anvin, x86,
	Rafael J. Wysocki, Viresh Kumar, Guenter Roeck, Jean Delvare,
	Fenghua Yu, Benoit Cousson, Jonathan Corbet, Oleg Drokin,
	Russell King, Catalin Marinas, Bartosz Golaszewski

The former duplicates the functionality of the latter but is neither
documented nor arch-independent.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
---
 drivers/cpufreq/p4-clockmod.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/cpufreq/p4-clockmod.c b/drivers/cpufreq/p4-clockmod.c
index 529cfd9..5dd95da 100644
--- a/drivers/cpufreq/p4-clockmod.c
+++ b/drivers/cpufreq/p4-clockmod.c
@@ -172,7 +172,7 @@ static int cpufreq_p4_cpu_init(struct cpufreq_policy *policy)
 	unsigned int i;
 
 #ifdef CONFIG_SMP
-	cpumask_copy(policy->cpus, cpu_sibling_mask(policy->cpu));
+	cpumask_copy(policy->cpus, topology_sibling_cpumask(policy->cpu));
 #endif
 
 	/* Errata workaround */
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH v2 6/9] acpi-cpufreq: replace cpu_**_mask() with topology_**_cpumask()
  2015-05-04 10:28 [PATCH v2 0/9] x86: remove cpu_**_mask() functions Bartosz Golaszewski
                   ` (4 preceding siblings ...)
  2015-05-04 10:28 ` [PATCH v2 5/9] p4-clockmod: replace cpu_sibling_mask() with topology_sibling_cpumask() Bartosz Golaszewski
@ 2015-05-04 10:28 ` Bartosz Golaszewski
  2015-05-05  7:08   ` Viresh Kumar
  2015-05-04 10:28 ` [PATCH v2 7/9] speedstep-ich: replace cpu_sibling_mask() with topology_sibling_cpumask() Bartosz Golaszewski
                   ` (3 subsequent siblings)
  9 siblings, 1 reply; 17+ messages in thread
From: Bartosz Golaszewski @ 2015-05-04 10:28 UTC (permalink / raw)
  To: LKML
  Cc: Thomas Gleixner, Ingo Molnar, H. Peter Anvin, x86,
	Rafael J. Wysocki, Viresh Kumar, Guenter Roeck, Jean Delvare,
	Fenghua Yu, Benoit Cousson, Jonathan Corbet, Oleg Drokin,
	Russell King, Catalin Marinas, Bartosz Golaszewski

The former duplicate the functionalities of the latter but are neither
documented nor arch-independent.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
---
 drivers/cpufreq/acpi-cpufreq.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/cpufreq/acpi-cpufreq.c b/drivers/cpufreq/acpi-cpufreq.c
index b0c18ed..0136dfc 100644
--- a/drivers/cpufreq/acpi-cpufreq.c
+++ b/drivers/cpufreq/acpi-cpufreq.c
@@ -699,13 +699,14 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy)
 	dmi_check_system(sw_any_bug_dmi_table);
 	if (bios_with_sw_any_bug && !policy_is_shared(policy)) {
 		policy->shared_type = CPUFREQ_SHARED_TYPE_ALL;
-		cpumask_copy(policy->cpus, cpu_core_mask(cpu));
+		cpumask_copy(policy->cpus, topology_core_cpumask(cpu));
 	}
 
 	if (check_amd_hwpstate_cpu(cpu) && !acpi_pstate_strict) {
 		cpumask_clear(policy->cpus);
 		cpumask_set_cpu(cpu, policy->cpus);
-		cpumask_copy(data->freqdomain_cpus, cpu_sibling_mask(cpu));
+		cpumask_copy(data->freqdomain_cpus,
+			     topology_sibling_cpumask(cpu));
 		policy->shared_type = CPUFREQ_SHARED_TYPE_HW;
 		pr_info_once(PFX "overriding BIOS provided _PSD data\n");
 	}
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH v2 7/9] speedstep-ich: replace cpu_sibling_mask() with topology_sibling_cpumask()
  2015-05-04 10:28 [PATCH v2 0/9] x86: remove cpu_**_mask() functions Bartosz Golaszewski
                   ` (5 preceding siblings ...)
  2015-05-04 10:28 ` [PATCH v2 6/9] acpi-cpufreq: replace cpu_**_mask() with topology_**_cpumask() Bartosz Golaszewski
@ 2015-05-04 10:28 ` Bartosz Golaszewski
  2015-05-05  7:08   ` Viresh Kumar
  2015-05-04 10:28 ` [PATCH v2 8/9] x86: replace cpu_**_mask() with topology_**_cpumask() Bartosz Golaszewski
                   ` (2 subsequent siblings)
  9 siblings, 1 reply; 17+ messages in thread
From: Bartosz Golaszewski @ 2015-05-04 10:28 UTC (permalink / raw)
  To: LKML
  Cc: Thomas Gleixner, Ingo Molnar, H. Peter Anvin, x86,
	Rafael J. Wysocki, Viresh Kumar, Guenter Roeck, Jean Delvare,
	Fenghua Yu, Benoit Cousson, Jonathan Corbet, Oleg Drokin,
	Russell King, Catalin Marinas, Bartosz Golaszewski

The former duplicates the functionality of the latter but is neither
documented nor arch-independent.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
---
 drivers/cpufreq/speedstep-ich.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/cpufreq/speedstep-ich.c b/drivers/cpufreq/speedstep-ich.c
index e56d632..37555c6 100644
--- a/drivers/cpufreq/speedstep-ich.c
+++ b/drivers/cpufreq/speedstep-ich.c
@@ -292,7 +292,7 @@ static int speedstep_cpu_init(struct cpufreq_policy *policy)
 
 	/* only run on CPU to be set, or on its sibling */
 #ifdef CONFIG_SMP
-	cpumask_copy(policy->cpus, cpu_sibling_mask(policy->cpu));
+	cpumask_copy(policy->cpus, topology_sibling_cpumask(policy->cpu));
 #endif
 	policy_cpu = cpumask_any_and(policy->cpus, cpu_online_mask);
 
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH v2 8/9] x86: replace cpu_**_mask() with topology_**_cpumask()
  2015-05-04 10:28 [PATCH v2 0/9] x86: remove cpu_**_mask() functions Bartosz Golaszewski
                   ` (6 preceding siblings ...)
  2015-05-04 10:28 ` [PATCH v2 7/9] speedstep-ich: replace cpu_sibling_mask() with topology_sibling_cpumask() Bartosz Golaszewski
@ 2015-05-04 10:28 ` Bartosz Golaszewski
  2015-05-04 10:28 ` [PATCH v2 9/9] x86: remove cpu_sibling_mask() and cpu_core_mask() Bartosz Golaszewski
  2015-05-04 11:22 ` [PATCH v2 0/9] x86: remove cpu_**_mask() functions Ingo Molnar
  9 siblings, 0 replies; 17+ messages in thread
From: Bartosz Golaszewski @ 2015-05-04 10:28 UTC (permalink / raw)
  To: LKML
  Cc: Thomas Gleixner, Ingo Molnar, H. Peter Anvin, x86,
	Rafael J. Wysocki, Viresh Kumar, Guenter Roeck, Jean Delvare,
	Fenghua Yu, Benoit Cousson, Jonathan Corbet, Oleg Drokin,
	Russell King, Catalin Marinas, Bartosz Golaszewski

The former duplicate the functionalities of the latter but are neither
documented nor arch-independent.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
---
 arch/x86/kernel/cpu/proc.c |  3 ++-
 arch/x86/kernel/smpboot.c  | 42 ++++++++++++++++++++++--------------------
 arch/x86/kernel/tsc_sync.c |  2 +-
 3 files changed, 25 insertions(+), 22 deletions(-)

diff --git a/arch/x86/kernel/cpu/proc.c b/arch/x86/kernel/cpu/proc.c
index e7d8c76..18ca99f 100644
--- a/arch/x86/kernel/cpu/proc.c
+++ b/arch/x86/kernel/cpu/proc.c
@@ -12,7 +12,8 @@ static void show_cpuinfo_core(struct seq_file *m, struct cpuinfo_x86 *c,
 {
 #ifdef CONFIG_SMP
 	seq_printf(m, "physical id\t: %d\n", c->phys_proc_id);
-	seq_printf(m, "siblings\t: %d\n", cpumask_weight(cpu_core_mask(cpu)));
+	seq_printf(m, "siblings\t: %d\n",
+		   cpumask_weight(topology_core_cpumask(cpu)));
 	seq_printf(m, "core id\t\t: %d\n", c->cpu_core_id);
 	seq_printf(m, "cpu cores\t: %d\n", c->booted_cores);
 	seq_printf(m, "apicid\t\t: %d\n", c->apicid);
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
index 50e547e..0e82096 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -314,10 +314,10 @@ topology_sane(struct cpuinfo_x86 *c, struct cpuinfo_x86 *o, const char *name)
 		cpu1, name, cpu2, cpu_to_node(cpu1), cpu_to_node(cpu2));
 }
 
-#define link_mask(_m, c1, c2)						\
+#define link_mask(mfunc, c1, c2)					\
 do {									\
-	cpumask_set_cpu((c1), cpu_##_m##_mask(c2));			\
-	cpumask_set_cpu((c2), cpu_##_m##_mask(c1));			\
+	cpumask_set_cpu((c1), mfunc(c2));				\
+	cpumask_set_cpu((c2), mfunc(c1));				\
 } while (0)
 
 static bool match_smt(struct cpuinfo_x86 *c, struct cpuinfo_x86 *o)
@@ -398,9 +398,9 @@ void set_cpu_sibling_map(int cpu)
 	cpumask_set_cpu(cpu, cpu_sibling_setup_mask);
 
 	if (!has_mp) {
-		cpumask_set_cpu(cpu, cpu_sibling_mask(cpu));
+		cpumask_set_cpu(cpu, topology_sibling_cpumask(cpu));
 		cpumask_set_cpu(cpu, cpu_llc_shared_mask(cpu));
-		cpumask_set_cpu(cpu, cpu_core_mask(cpu));
+		cpumask_set_cpu(cpu, topology_core_cpumask(cpu));
 		c->booted_cores = 1;
 		return;
 	}
@@ -409,32 +409,34 @@ void set_cpu_sibling_map(int cpu)
 		o = &cpu_data(i);
 
 		if ((i == cpu) || (has_smt && match_smt(c, o)))
-			link_mask(sibling, cpu, i);
+			link_mask(topology_sibling_cpumask, cpu, i);
 
 		if ((i == cpu) || (has_mp && match_llc(c, o)))
-			link_mask(llc_shared, cpu, i);
+			link_mask(cpu_llc_shared_mask, cpu, i);
 
 	}
 
 	/*
 	 * This needs a separate iteration over the cpus because we rely on all
-	 * cpu_sibling_mask links to be set-up.
+	 * topology_sibling_cpumask links to be set-up.
 	 */
 	for_each_cpu(i, cpu_sibling_setup_mask) {
 		o = &cpu_data(i);
 
 		if ((i == cpu) || (has_mp && match_die(c, o))) {
-			link_mask(core, cpu, i);
+			link_mask(topology_core_cpumask, cpu, i);
 
 			/*
 			 *  Does this new cpu bringup a new core?
 			 */
-			if (cpumask_weight(cpu_sibling_mask(cpu)) == 1) {
+			if (cpumask_weight(
+			    topology_sibling_cpumask(cpu)) == 1) {
 				/*
 				 * for each core in package, increment
 				 * the booted_cores for this new cpu
 				 */
-				if (cpumask_first(cpu_sibling_mask(i)) == i)
+				if (cpumask_first(
+				    topology_sibling_cpumask(i)) == i)
 					c->booted_cores++;
 				/*
 				 * increment the core count for all
@@ -1009,8 +1011,8 @@ static __init void disable_smp(void)
 		physid_set_mask_of_physid(boot_cpu_physical_apicid, &phys_cpu_present_map);
 	else
 		physid_set_mask_of_physid(0, &phys_cpu_present_map);
-	cpumask_set_cpu(0, cpu_sibling_mask(0));
-	cpumask_set_cpu(0, cpu_core_mask(0));
+	cpumask_set_cpu(0, topology_sibling_cpumask(0));
+	cpumask_set_cpu(0, topology_core_cpumask(0));
 }
 
 enum {
@@ -1293,22 +1295,22 @@ static void remove_siblinginfo(int cpu)
 	int sibling;
 	struct cpuinfo_x86 *c = &cpu_data(cpu);
 
-	for_each_cpu(sibling, cpu_core_mask(cpu)) {
-		cpumask_clear_cpu(cpu, cpu_core_mask(sibling));
+	for_each_cpu(sibling, topology_core_cpumask(cpu)) {
+		cpumask_clear_cpu(cpu, topology_core_cpumask(sibling));
 		/*/
 		 * last thread sibling in this cpu core going down
 		 */
-		if (cpumask_weight(cpu_sibling_mask(cpu)) == 1)
+		if (cpumask_weight(topology_sibling_cpumask(cpu)) == 1)
 			cpu_data(sibling).booted_cores--;
 	}
 
-	for_each_cpu(sibling, cpu_sibling_mask(cpu))
-		cpumask_clear_cpu(cpu, cpu_sibling_mask(sibling));
+	for_each_cpu(sibling, topology_sibling_cpumask(cpu))
+		cpumask_clear_cpu(cpu, topology_sibling_cpumask(sibling));
 	for_each_cpu(sibling, cpu_llc_shared_mask(cpu))
 		cpumask_clear_cpu(cpu, cpu_llc_shared_mask(sibling));
 	cpumask_clear(cpu_llc_shared_mask(cpu));
-	cpumask_clear(cpu_sibling_mask(cpu));
-	cpumask_clear(cpu_core_mask(cpu));
+	cpumask_clear(topology_sibling_cpumask(cpu));
+	cpumask_clear(topology_core_cpumask(cpu));
 	c->phys_proc_id = 0;
 	c->cpu_core_id = 0;
 	cpumask_clear_cpu(cpu, cpu_sibling_setup_mask);
diff --git a/arch/x86/kernel/tsc_sync.c b/arch/x86/kernel/tsc_sync.c
index 2648848..dd8d079 100644
--- a/arch/x86/kernel/tsc_sync.c
+++ b/arch/x86/kernel/tsc_sync.c
@@ -113,7 +113,7 @@ static void check_tsc_warp(unsigned int timeout)
  */
 static inline unsigned int loop_timeout(int cpu)
 {
-	return (cpumask_weight(cpu_core_mask(cpu)) > 1) ? 2 : 20;
+	return (cpumask_weight(topology_core_cpumask(cpu)) > 1) ? 2 : 20;
 }
 
 /*
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH v2 9/9] x86: remove cpu_sibling_mask() and cpu_core_mask()
  2015-05-04 10:28 [PATCH v2 0/9] x86: remove cpu_**_mask() functions Bartosz Golaszewski
                   ` (7 preceding siblings ...)
  2015-05-04 10:28 ` [PATCH v2 8/9] x86: replace cpu_**_mask() with topology_**_cpumask() Bartosz Golaszewski
@ 2015-05-04 10:28 ` Bartosz Golaszewski
  2015-05-04 11:22 ` [PATCH v2 0/9] x86: remove cpu_**_mask() functions Ingo Molnar
  9 siblings, 0 replies; 17+ messages in thread
From: Bartosz Golaszewski @ 2015-05-04 10:28 UTC (permalink / raw)
  To: LKML
  Cc: Thomas Gleixner, Ingo Molnar, H. Peter Anvin, x86,
	Rafael J. Wysocki, Viresh Kumar, Guenter Roeck, Jean Delvare,
	Fenghua Yu, Benoit Cousson, Jonathan Corbet, Oleg Drokin,
	Russell King, Catalin Marinas, Bartosz Golaszewski

These functions are arch-specific and duplicate the functionality
of macros defined in linux/include/topology.h.

Remove them as all the callers in x86 have now switched to using
the topology_**_cpumask() family.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
---
 arch/x86/include/asm/smp.h | 10 ----------
 1 file changed, 10 deletions(-)

diff --git a/arch/x86/include/asm/smp.h b/arch/x86/include/asm/smp.h
index 17a8dce..222a6a3 100644
--- a/arch/x86/include/asm/smp.h
+++ b/arch/x86/include/asm/smp.h
@@ -37,16 +37,6 @@ DECLARE_PER_CPU_READ_MOSTLY(cpumask_var_t, cpu_llc_shared_map);
 DECLARE_PER_CPU_READ_MOSTLY(u16, cpu_llc_id);
 DECLARE_PER_CPU_READ_MOSTLY(int, cpu_number);
 
-static inline struct cpumask *cpu_sibling_mask(int cpu)
-{
-	return per_cpu(cpu_sibling_map, cpu);
-}
-
-static inline struct cpumask *cpu_core_mask(int cpu)
-{
-	return per_cpu(cpu_core_map, cpu);
-}
-
 static inline struct cpumask *cpu_llc_shared_mask(int cpu)
 {
 	return per_cpu(cpu_llc_shared_map, cpu);
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* Re: [PATCH v2 0/9] x86: remove cpu_**_mask() functions
  2015-05-04 10:28 [PATCH v2 0/9] x86: remove cpu_**_mask() functions Bartosz Golaszewski
                   ` (8 preceding siblings ...)
  2015-05-04 10:28 ` [PATCH v2 9/9] x86: remove cpu_sibling_mask() and cpu_core_mask() Bartosz Golaszewski
@ 2015-05-04 11:22 ` Ingo Molnar
  9 siblings, 0 replies; 17+ messages in thread
From: Ingo Molnar @ 2015-05-04 11:22 UTC (permalink / raw)
  To: Bartosz Golaszewski
  Cc: LKML, Thomas Gleixner, Ingo Molnar, H. Peter Anvin, x86,
	Rafael J. Wysocki, Viresh Kumar, Guenter Roeck, Jean Delvare,
	Fenghua Yu, Benoit Cousson, Jonathan Corbet, Oleg Drokin,
	Russell King, Catalin Marinas


* Bartosz Golaszewski <bgolaszewski@baylibre.com> wrote:

> Two functions defined in asm/smp.h: cpu_sibling_mask() and cpu_core_mask(),
> have the same functionality as macros defined in linux/topology.h:
> topology_thread_cpumask() and topology_core_cpumask() respectively.
> 
> They are not documented and are architecture specific. Also: different
> naming for the same functionality (in case of cpu_sibling_mask() and
> topology_thread_cpumask()) is a bit misleading.
> 
> This series makes all the callers switch to using the topology.h macros
> and removes their smp.h counterparts. While we're at it: rename
> topology_thread_cpumask() to topology_sibling_cpumask() to be
> consistent with the term used in the scheduler.
> 
> The same duplication exists on powerpc.
> 
> NOTE: patch 2/9 had been already submitted separately but didn't
> receive any attention, so I'm attaching it to this series.
> 
> v2:
> - renamed topology_thread_cpumask() to topology_sibling_cpumask()
> - updated Documentation/cputopology.txt
> 
> v1:
> https://lkml.org/lkml/2015/4/30/188
> 
> Bartosz Golaszewski (9):
>   topology: rename topology_thread_cpumask()
>   Documentation: update cputopology.txt
>   coretemp: replace cpu_sibling_mask() with topology_sibling_cpumask()
>   powernow-k8: replace cpu_core_mask() with topology_core_cpumask()
>   p4-clockmod: replace cpu_sibling_mask() with topology_sibling_cpumask()
>   acpi-cpufreq: replace cpu_**_mask() with topology_**_cpumask()
>   speedstep-ich: replace cpu_sibling_mask() with topology_sibling_cpumask()
>   x86: replace cpu_**_mask() with topology_**_cpumask()
>   x86: remove cpu_sibling_mask() and cpu_core_mask()

Acked-by: Ingo Molnar <mingo@kernel.org>

Thanks,

	Ingo

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v2 3/9] coretemp: replace cpu_sibling_mask() with topology_sibling_cpumask()
  2015-05-04 10:28 ` [PATCH v2 3/9] coretemp: replace cpu_sibling_mask() with topology_sibling_cpumask() Bartosz Golaszewski
@ 2015-05-04 13:16   ` Guenter Roeck
  0 siblings, 0 replies; 17+ messages in thread
From: Guenter Roeck @ 2015-05-04 13:16 UTC (permalink / raw)
  To: Bartosz Golaszewski, LKML
  Cc: Thomas Gleixner, Ingo Molnar, H. Peter Anvin, x86,
	Rafael J. Wysocki, Viresh Kumar, Jean Delvare, Fenghua Yu,
	Benoit Cousson, Jonathan Corbet, Oleg Drokin, Russell King,
	Catalin Marinas

On 05/04/2015 03:28 AM, Bartosz Golaszewski wrote:
> The former duplicates the functionality of the latter but is neither
> documented nor arch-independent.
>
> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>

Acked-by: Guenter Roeck <linux@roeck-us.net>

> ---
>   drivers/hwmon/coretemp.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/hwmon/coretemp.c b/drivers/hwmon/coretemp.c
> index ed303ba..3e03379 100644
> --- a/drivers/hwmon/coretemp.c
> +++ b/drivers/hwmon/coretemp.c
> @@ -63,7 +63,8 @@ MODULE_PARM_DESC(tjmax, "TjMax value in degrees Celsius");
>   #define TO_ATTR_NO(cpu)		(TO_CORE_ID(cpu) + BASE_SYSFS_ATTR_NO)
>
>   #ifdef CONFIG_SMP
> -#define for_each_sibling(i, cpu)	for_each_cpu(i, cpu_sibling_mask(cpu))
> +#define for_each_sibling(i, cpu) \
> +	for_each_cpu(i, topology_sibling_cpumask(cpu))
>   #else
>   #define for_each_sibling(i, cpu)	for (i = 0; false; )
>   #endif
>


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v2 4/9] powernow-k8: replace cpu_core_mask() with topology_core_cpumask()
  2015-05-04 10:28 ` [PATCH v2 4/9] powernow-k8: replace cpu_core_mask() with topology_core_cpumask() Bartosz Golaszewski
@ 2015-05-05  7:07   ` Viresh Kumar
  0 siblings, 0 replies; 17+ messages in thread
From: Viresh Kumar @ 2015-05-05  7:07 UTC (permalink / raw)
  To: Bartosz Golaszewski
  Cc: LKML, Thomas Gleixner, Ingo Molnar, H. Peter Anvin, x86,
	Rafael J. Wysocki, Guenter Roeck, Jean Delvare, Fenghua Yu,
	Benoit Cousson, Jonathan Corbet, Oleg Drokin, Russell King,
	Catalin Marinas

On 4 May 2015 at 15:58, Bartosz Golaszewski <bgolaszewski@baylibre.com> wrote:
> The former duplicates the functionality of the latter but is neither
> documented nor arch-independent.
>
> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> ---
>  drivers/cpufreq/powernow-k8.c | 13 +++----------
>  1 file changed, 3 insertions(+), 10 deletions(-)

Acked-by: Viresh Kumar <viresh.kumar@linaro.org>

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v2 5/9] p4-clockmod: replace cpu_sibling_mask() with topology_sibling_cpumask()
  2015-05-04 10:28 ` [PATCH v2 5/9] p4-clockmod: replace cpu_sibling_mask() with topology_sibling_cpumask() Bartosz Golaszewski
@ 2015-05-05  7:07   ` Viresh Kumar
  0 siblings, 0 replies; 17+ messages in thread
From: Viresh Kumar @ 2015-05-05  7:07 UTC (permalink / raw)
  To: Bartosz Golaszewski
  Cc: LKML, Thomas Gleixner, Ingo Molnar, H. Peter Anvin, x86,
	Rafael J. Wysocki, Guenter Roeck, Jean Delvare, Fenghua Yu,
	Benoit Cousson, Jonathan Corbet, Oleg Drokin, Russell King,
	Catalin Marinas

On 4 May 2015 at 15:58, Bartosz Golaszewski <bgolaszewski@baylibre.com> wrote:
> The former duplicates the functionality of the latter but is neither
> documented nor arch-independent.
>
> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> ---
>  drivers/cpufreq/p4-clockmod.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Acked-by: Viresh Kumar <viresh.kumar@linaro.org>

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v2 6/9] acpi-cpufreq: replace cpu_**_mask() with topology_**_cpumask()
  2015-05-04 10:28 ` [PATCH v2 6/9] acpi-cpufreq: replace cpu_**_mask() with topology_**_cpumask() Bartosz Golaszewski
@ 2015-05-05  7:08   ` Viresh Kumar
  0 siblings, 0 replies; 17+ messages in thread
From: Viresh Kumar @ 2015-05-05  7:08 UTC (permalink / raw)
  To: Bartosz Golaszewski
  Cc: LKML, Thomas Gleixner, Ingo Molnar, H. Peter Anvin, x86,
	Rafael J. Wysocki, Guenter Roeck, Jean Delvare, Fenghua Yu,
	Benoit Cousson, Jonathan Corbet, Oleg Drokin, Russell King,
	Catalin Marinas

On 4 May 2015 at 15:58, Bartosz Golaszewski <bgolaszewski@baylibre.com> wrote:
> The former duplicate the functionalities of the latter but are neither
> documented nor arch-independent.
>
> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> ---
>  drivers/cpufreq/acpi-cpufreq.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)

Acked-by: Viresh Kumar <viresh.kumar@linaro.org>

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v2 7/9] speedstep-ich: replace cpu_sibling_mask() with topology_sibling_cpumask()
  2015-05-04 10:28 ` [PATCH v2 7/9] speedstep-ich: replace cpu_sibling_mask() with topology_sibling_cpumask() Bartosz Golaszewski
@ 2015-05-05  7:08   ` Viresh Kumar
  0 siblings, 0 replies; 17+ messages in thread
From: Viresh Kumar @ 2015-05-05  7:08 UTC (permalink / raw)
  To: Bartosz Golaszewski
  Cc: LKML, Thomas Gleixner, Ingo Molnar, H. Peter Anvin, x86,
	Rafael J. Wysocki, Guenter Roeck, Jean Delvare, Fenghua Yu,
	Benoit Cousson, Jonathan Corbet, Oleg Drokin, Russell King,
	Catalin Marinas

On 4 May 2015 at 15:58, Bartosz Golaszewski <bgolaszewski@baylibre.com> wrote:
> The former duplicates the functionality of the latter but is neither
> documented nor arch-independent.
>
> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> ---
>  drivers/cpufreq/speedstep-ich.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Acked-by: Viresh Kumar <viresh.kumar@linaro.org>

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v2 1/9] topology: rename topology_thread_cpumask()
  2015-05-04 10:28 ` [PATCH v2 1/9] topology: rename topology_thread_cpumask() Bartosz Golaszewski
@ 2015-05-06 11:27   ` Russell King - ARM Linux
  0 siblings, 0 replies; 17+ messages in thread
From: Russell King - ARM Linux @ 2015-05-06 11:27 UTC (permalink / raw)
  To: Bartosz Golaszewski
  Cc: LKML, Thomas Gleixner, Ingo Molnar, H. Peter Anvin, x86,
	Rafael J. Wysocki, Viresh Kumar, Guenter Roeck, Jean Delvare,
	Fenghua Yu, Benoit Cousson, Jonathan Corbet, Oleg Drokin,
	Catalin Marinas

On Mon, May 04, 2015 at 12:28:16PM +0200, Bartosz Golaszewski wrote:
> Rename topology_thread_cpumask() to topology_sibling_cpumask() for
> more consistency with scheduler code.
> 
> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>

Acked-by: Russell King <rmk+kernel@arm.linux.org.uk>

for:

>  arch/arm/include/asm/topology.h                        | 2 +-

> diff --git a/arch/arm/include/asm/topology.h b/arch/arm/include/asm/topology.h
> index 2fe85ff..370f7a7 100644
> --- a/arch/arm/include/asm/topology.h
> +++ b/arch/arm/include/asm/topology.h
> @@ -18,7 +18,7 @@ extern struct cputopo_arm cpu_topology[NR_CPUS];
>  #define topology_physical_package_id(cpu)	(cpu_topology[cpu].socket_id)
>  #define topology_core_id(cpu)		(cpu_topology[cpu].core_id)
>  #define topology_core_cpumask(cpu)	(&cpu_topology[cpu].core_sibling)
> -#define topology_thread_cpumask(cpu)	(&cpu_topology[cpu].thread_sibling)
> +#define topology_sibling_cpumask(cpu)	(&cpu_topology[cpu].thread_sibling)
>  
>  void init_cpu_topology(void);
>  void store_cpu_topology(unsigned int cpuid);

Thanks.

-- 
FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up
according to speedtest.net.

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2015-05-06 11:27 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-04 10:28 [PATCH v2 0/9] x86: remove cpu_**_mask() functions Bartosz Golaszewski
2015-05-04 10:28 ` [PATCH v2 1/9] topology: rename topology_thread_cpumask() Bartosz Golaszewski
2015-05-06 11:27   ` Russell King - ARM Linux
2015-05-04 10:28 ` [PATCH v2 2/9] Documentation: update cputopology.txt Bartosz Golaszewski
2015-05-04 10:28 ` [PATCH v2 3/9] coretemp: replace cpu_sibling_mask() with topology_sibling_cpumask() Bartosz Golaszewski
2015-05-04 13:16   ` Guenter Roeck
2015-05-04 10:28 ` [PATCH v2 4/9] powernow-k8: replace cpu_core_mask() with topology_core_cpumask() Bartosz Golaszewski
2015-05-05  7:07   ` Viresh Kumar
2015-05-04 10:28 ` [PATCH v2 5/9] p4-clockmod: replace cpu_sibling_mask() with topology_sibling_cpumask() Bartosz Golaszewski
2015-05-05  7:07   ` Viresh Kumar
2015-05-04 10:28 ` [PATCH v2 6/9] acpi-cpufreq: replace cpu_**_mask() with topology_**_cpumask() Bartosz Golaszewski
2015-05-05  7:08   ` Viresh Kumar
2015-05-04 10:28 ` [PATCH v2 7/9] speedstep-ich: replace cpu_sibling_mask() with topology_sibling_cpumask() Bartosz Golaszewski
2015-05-05  7:08   ` Viresh Kumar
2015-05-04 10:28 ` [PATCH v2 8/9] x86: replace cpu_**_mask() with topology_**_cpumask() Bartosz Golaszewski
2015-05-04 10:28 ` [PATCH v2 9/9] x86: remove cpu_sibling_mask() and cpu_core_mask() Bartosz Golaszewski
2015-05-04 11:22 ` [PATCH v2 0/9] x86: remove cpu_**_mask() functions Ingo Molnar

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).