diff options
author | Michael Ellerman <michael@ellerman.id.au> | 2005-06-30 01:16:09 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2005-06-30 01:16:09 -0400 |
commit | ed094150bdeb6eca691f1b7a05bd34d4d1a95488 (patch) | |
tree | 6dc4428b3ce794c2e26db1583cab724f5bcefe19 /arch/ppc64 | |
parent | 74889802a1585af4e1652f0cb853ac22a65816a4 (diff) |
[PATCH] ppc64: Simplify counting of lpevents, remove lpevent_count from paca
Currently there's a per-cpu count of lpevents processed, a per-queue (ie.
global) total count, and a count by event type.
Replace all that with a count by event for each cpu. We only need to add
it up int the proc code.
Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Acked-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/ppc64')
-rw-r--r-- | arch/ppc64/kernel/ItLpQueue.c | 44 |
1 files changed, 29 insertions, 15 deletions
diff --git a/arch/ppc64/kernel/ItLpQueue.c b/arch/ppc64/kernel/ItLpQueue.c index a849f6775ad6..4a6ab9de629d 100644 --- a/arch/ppc64/kernel/ItLpQueue.c +++ b/arch/ppc64/kernel/ItLpQueue.c | |||
@@ -28,7 +28,9 @@ | |||
28 | */ | 28 | */ |
29 | struct hvlpevent_queue hvlpevent_queue __attribute__((__section__(".data"))); | 29 | struct hvlpevent_queue hvlpevent_queue __attribute__((__section__(".data"))); |
30 | 30 | ||
31 | static char *event_types[9] = { | 31 | DEFINE_PER_CPU(unsigned long[HvLpEvent_Type_NumTypes], hvlpevent_counts); |
32 | |||
33 | static char *event_types[HvLpEvent_Type_NumTypes] = { | ||
32 | "Hypervisor\t\t", | 34 | "Hypervisor\t\t", |
33 | "Machine Facilities\t", | 35 | "Machine Facilities\t", |
34 | "Session Manager\t", | 36 | "Session Manager\t", |
@@ -129,7 +131,6 @@ static void hvlpevent_clear_valid( struct HvLpEvent * event ) | |||
129 | 131 | ||
130 | void process_hvlpevents(struct pt_regs *regs) | 132 | void process_hvlpevents(struct pt_regs *regs) |
131 | { | 133 | { |
132 | unsigned numIntsProcessed = 0; | ||
133 | struct HvLpEvent * nextLpEvent; | 134 | struct HvLpEvent * nextLpEvent; |
134 | 135 | ||
135 | /* If we have recursed, just return */ | 136 | /* If we have recursed, just return */ |
@@ -144,8 +145,6 @@ void process_hvlpevents(struct pt_regs *regs) | |||
144 | for (;;) { | 145 | for (;;) { |
145 | nextLpEvent = get_next_hvlpevent(); | 146 | nextLpEvent = get_next_hvlpevent(); |
146 | if ( nextLpEvent ) { | 147 | if ( nextLpEvent ) { |
147 | ++numIntsProcessed; | ||
148 | hvlpevent_queue.xLpIntCount++; | ||
149 | /* Call appropriate handler here, passing | 148 | /* Call appropriate handler here, passing |
150 | * a pointer to the LpEvent. The handler | 149 | * a pointer to the LpEvent. The handler |
151 | * must make a copy of the LpEvent if it | 150 | * must make a copy of the LpEvent if it |
@@ -160,7 +159,7 @@ void process_hvlpevents(struct pt_regs *regs) | |||
160 | * here! | 159 | * here! |
161 | */ | 160 | */ |
162 | if ( nextLpEvent->xType < HvLpEvent_Type_NumTypes ) | 161 | if ( nextLpEvent->xType < HvLpEvent_Type_NumTypes ) |
163 | hvlpevent_queue.xLpIntCountByType[nextLpEvent->xType]++; | 162 | __get_cpu_var(hvlpevent_counts)[nextLpEvent->xType]++; |
164 | if ( nextLpEvent->xType < HvLpEvent_Type_NumTypes && | 163 | if ( nextLpEvent->xType < HvLpEvent_Type_NumTypes && |
165 | lpEventHandler[nextLpEvent->xType] ) | 164 | lpEventHandler[nextLpEvent->xType] ) |
166 | lpEventHandler[nextLpEvent->xType](nextLpEvent, regs); | 165 | lpEventHandler[nextLpEvent->xType](nextLpEvent, regs); |
@@ -181,8 +180,6 @@ void process_hvlpevents(struct pt_regs *regs) | |||
181 | ItLpQueueInProcess = 0; | 180 | ItLpQueueInProcess = 0; |
182 | mb(); | 181 | mb(); |
183 | clear_inUse(); | 182 | clear_inUse(); |
184 | |||
185 | get_paca()->lpevent_count += numIntsProcessed; | ||
186 | } | 183 | } |
187 | 184 | ||
188 | static int set_spread_lpevents(char *str) | 185 | static int set_spread_lpevents(char *str) |
@@ -228,20 +225,37 @@ void setup_hvlpevent_queue(void) | |||
228 | 225 | ||
229 | static int proc_lpevents_show(struct seq_file *m, void *v) | 226 | static int proc_lpevents_show(struct seq_file *m, void *v) |
230 | { | 227 | { |
231 | unsigned int i; | 228 | int cpu, i; |
229 | unsigned long sum; | ||
230 | static unsigned long cpu_totals[NR_CPUS]; | ||
231 | |||
232 | /* FIXME: do we care that there's no locking here? */ | ||
233 | sum = 0; | ||
234 | for_each_online_cpu(cpu) { | ||
235 | cpu_totals[cpu] = 0; | ||
236 | for (i = 0; i < HvLpEvent_Type_NumTypes; i++) { | ||
237 | cpu_totals[cpu] += per_cpu(hvlpevent_counts, cpu)[i]; | ||
238 | } | ||
239 | sum += cpu_totals[cpu]; | ||
240 | } | ||
232 | 241 | ||
233 | seq_printf(m, "LpEventQueue 0\n"); | 242 | seq_printf(m, "LpEventQueue 0\n"); |
234 | seq_printf(m, " events processed:\t%lu\n", | 243 | seq_printf(m, " events processed:\t%lu\n", sum); |
235 | (unsigned long)hvlpevent_queue.xLpIntCount); | ||
236 | 244 | ||
237 | for (i = 0; i < 9; ++i) | 245 | for (i = 0; i < HvLpEvent_Type_NumTypes; ++i) { |
238 | seq_printf(m, " %s %10lu\n", event_types[i], | 246 | sum = 0; |
239 | (unsigned long)hvlpevent_queue.xLpIntCountByType[i]); | 247 | for_each_online_cpu(cpu) { |
248 | sum += per_cpu(hvlpevent_counts, cpu)[i]; | ||
249 | } | ||
250 | |||
251 | seq_printf(m, " %s %10lu\n", event_types[i], sum); | ||
252 | } | ||
240 | 253 | ||
241 | seq_printf(m, "\n events processed by processor:\n"); | 254 | seq_printf(m, "\n events processed by processor:\n"); |
242 | 255 | ||
243 | for_each_online_cpu(i) | 256 | for_each_online_cpu(cpu) { |
244 | seq_printf(m, " CPU%02d %10u\n", i, paca[i].lpevent_count); | 257 | seq_printf(m, " CPU%02d %10lu\n", cpu, cpu_totals[cpu]); |
258 | } | ||
245 | 259 | ||
246 | return 0; | 260 | return 0; |
247 | } | 261 | } |