.. | .. |
---|
7 | 7 | #define KMSG_COMPONENT "cpu" |
---|
8 | 8 | #define pr_fmt(fmt) KMSG_COMPONENT ": " fmt |
---|
9 | 9 | |
---|
| 10 | +#include <linux/stop_machine.h> |
---|
10 | 11 | #include <linux/cpufeature.h> |
---|
11 | 12 | #include <linux/bitops.h> |
---|
12 | 13 | #include <linux/kernel.h> |
---|
.. | .. |
---|
31 | 32 | }; |
---|
32 | 33 | |
---|
33 | 34 | static DEFINE_PER_CPU(struct cpu_info, cpu_info); |
---|
| 35 | +static DEFINE_PER_CPU(int, cpu_relax_retry); |
---|
34 | 36 | |
---|
35 | 37 | static bool machine_has_cpu_mhz; |
---|
36 | 38 | |
---|
.. | .. |
---|
58 | 60 | on_each_cpu(update_cpu_mhz, NULL, 0); |
---|
59 | 61 | } |
---|
60 | 62 | |
---|
61 | | -void notrace cpu_relax_yield(void) |
---|
| 63 | +void notrace stop_machine_yield(const struct cpumask *cpumask) |
---|
62 | 64 | { |
---|
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); |
---|
66 | 75 | } |
---|
67 | | - barrier(); |
---|
68 | 76 | } |
---|
69 | | -EXPORT_SYMBOL(cpu_relax_yield); |
---|
70 | 77 | |
---|
71 | 78 | /* |
---|
72 | 79 | * cpu_init - initializes state that is per-CPU. |
---|
.. | .. |
---|
109 | 116 | { |
---|
110 | 117 | static const char *hwcap_str[] = { |
---|
111 | 118 | "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" |
---|
113 | 121 | }; |
---|
114 | 122 | static const char * const int_hwcap_str[] = { |
---|
115 | 123 | "sie" |
---|
.. | .. |
---|
143 | 151 | } |
---|
144 | 152 | } |
---|
145 | 153 | |
---|
| 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 | + |
---|
146 | 177 | static void show_cpu_mhz(struct seq_file *m, unsigned long n) |
---|
147 | 178 | { |
---|
148 | 179 | struct cpu_info *c = per_cpu_ptr(&cpu_info, n); |
---|
149 | 180 | |
---|
| 181 | + if (!machine_has_cpu_mhz) |
---|
| 182 | + return; |
---|
150 | 183 | seq_printf(m, "cpu MHz dynamic : %d\n", c->cpu_mhz_dynamic); |
---|
151 | 184 | seq_printf(m, "cpu MHz static : %d\n", c->cpu_mhz_static); |
---|
152 | 185 | } |
---|
.. | .. |
---|
161 | 194 | |
---|
162 | 195 | if (n == first) |
---|
163 | 196 | show_cpu_summary(m, v); |
---|
164 | | - if (!machine_has_cpu_mhz) |
---|
165 | | - return 0; |
---|
166 | 197 | seq_printf(m, "\ncpu number : %ld\n", n); |
---|
| 198 | + show_cpu_topology(m, n); |
---|
| 199 | + show_cpu_ids(m, n); |
---|
167 | 200 | show_cpu_mhz(m, n); |
---|
168 | 201 | return 0; |
---|
169 | 202 | } |
---|