hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/arch/s390/kernel/processor.c
....@@ -7,6 +7,7 @@
77 #define KMSG_COMPONENT "cpu"
88 #define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
99
10
+#include <linux/stop_machine.h>
1011 #include <linux/cpufeature.h>
1112 #include <linux/bitops.h>
1213 #include <linux/kernel.h>
....@@ -31,6 +32,7 @@
3132 };
3233
3334 static DEFINE_PER_CPU(struct cpu_info, cpu_info);
35
+static DEFINE_PER_CPU(int, cpu_relax_retry);
3436
3537 static bool machine_has_cpu_mhz;
3638
....@@ -58,15 +60,20 @@
5860 on_each_cpu(update_cpu_mhz, NULL, 0);
5961 }
6062
61
-void notrace cpu_relax_yield(void)
63
+void notrace stop_machine_yield(const struct cpumask *cpumask)
6264 {
63
- if (!smp_cpu_mtid && MACHINE_HAS_DIAG44) {
64
- diag_stat_inc(DIAG_STAT_X044);
65
- asm volatile("diag 0,0,0x44");
65
+ int cpu, this_cpu;
66
+
67
+ this_cpu = smp_processor_id();
68
+ if (__this_cpu_inc_return(cpu_relax_retry) >= spin_retry) {
69
+ __this_cpu_write(cpu_relax_retry, 0);
70
+ cpu = cpumask_next_wrap(this_cpu, cpumask, this_cpu, false);
71
+ if (cpu >= nr_cpu_ids)
72
+ return;
73
+ if (arch_vcpu_is_preempted(cpu))
74
+ smp_yield_cpu(cpu);
6675 }
67
- barrier();
6876 }
69
-EXPORT_SYMBOL(cpu_relax_yield);
7077
7178 /*
7279 * cpu_init - initializes state that is per-CPU.
....@@ -109,7 +116,8 @@
109116 {
110117 static const char *hwcap_str[] = {
111118 "esan3", "zarch", "stfle", "msa", "ldisp", "eimm", "dfp",
112
- "edat", "etf3eh", "highgprs", "te", "vx", "vxd", "vxe", "gs"
119
+ "edat", "etf3eh", "highgprs", "te", "vx", "vxd", "vxe", "gs",
120
+ "vxe2", "vxp", "sort", "dflt"
113121 };
114122 static const char * const int_hwcap_str[] = {
115123 "sie"
....@@ -143,10 +151,35 @@
143151 }
144152 }
145153
154
+static void show_cpu_topology(struct seq_file *m, unsigned long n)
155
+{
156
+#ifdef CONFIG_SCHED_TOPOLOGY
157
+ seq_printf(m, "physical id : %d\n", topology_physical_package_id(n));
158
+ seq_printf(m, "core id : %d\n", topology_core_id(n));
159
+ seq_printf(m, "book id : %d\n", topology_book_id(n));
160
+ seq_printf(m, "drawer id : %d\n", topology_drawer_id(n));
161
+ seq_printf(m, "dedicated : %d\n", topology_cpu_dedicated(n));
162
+ seq_printf(m, "address : %d\n", smp_cpu_get_cpu_address(n));
163
+ seq_printf(m, "siblings : %d\n", cpumask_weight(topology_core_cpumask(n)));
164
+ seq_printf(m, "cpu cores : %d\n", topology_booted_cores(n));
165
+#endif /* CONFIG_SCHED_TOPOLOGY */
166
+}
167
+
168
+static void show_cpu_ids(struct seq_file *m, unsigned long n)
169
+{
170
+ struct cpuid *id = &per_cpu(cpu_info.cpu_id, n);
171
+
172
+ seq_printf(m, "version : %02X\n", id->version);
173
+ seq_printf(m, "identification : %06X\n", id->ident);
174
+ seq_printf(m, "machine : %04X\n", id->machine);
175
+}
176
+
146177 static void show_cpu_mhz(struct seq_file *m, unsigned long n)
147178 {
148179 struct cpu_info *c = per_cpu_ptr(&cpu_info, n);
149180
181
+ if (!machine_has_cpu_mhz)
182
+ return;
150183 seq_printf(m, "cpu MHz dynamic : %d\n", c->cpu_mhz_dynamic);
151184 seq_printf(m, "cpu MHz static : %d\n", c->cpu_mhz_static);
152185 }
....@@ -161,9 +194,9 @@
161194
162195 if (n == first)
163196 show_cpu_summary(m, v);
164
- if (!machine_has_cpu_mhz)
165
- return 0;
166197 seq_printf(m, "\ncpu number : %ld\n", n);
198
+ show_cpu_topology(m, n);
199
+ show_cpu_ids(m, n);
167200 show_cpu_mhz(m, n);
168201 return 0;
169202 }