aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel/time.c
diff options
context:
space:
mode:
authorPaul Mackerras <paulus@samba.org>2010-08-30 21:59:53 -0400
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2010-09-02 00:07:32 -0400
commit872e439a45ed4a4bd499bc55cb0dffa74027f749 (patch)
tree2f07a64553b25fb0a457832722b46ee9549b74cb /arch/powerpc/kernel/time.c
parentcf9efce0ce3136fa076f53e53154e98455229514 (diff)
powerpc/pseries: Re-enable dispatch trace log userspace interface
Since the cpu accounting code uses the hypervisor dispatch trace log now when CONFIG_VIRT_CPU_ACCOUNTING = y, the previous commit disabled access to it via files in the /sys/kernel/debug/powerpc/dtl/ directory in that case. This restores those files. To do this, we now have a hook that the cpu accounting code will call as it processes each entry from the hypervisor dispatch trace log. The code in dtl.c now uses that to fill up its ring buffer, rather than having the hypervisor fill the ring buffer directly. This also fixes dtl_file_read() to handle overflow conditions a bit better and adds a spinlock to ensure that race conditions (multiple processes opening or reading the file concurrently) are handled correctly. Signed-off-by: Paul Mackerras <paulus@samba.org> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/kernel/time.c')
-rw-r--r--arch/powerpc/kernel/time.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c
index fca20643c368..bcb738b9ff8c 100644
--- a/arch/powerpc/kernel/time.c
+++ b/arch/powerpc/kernel/time.c
@@ -183,6 +183,8 @@ DEFINE_PER_CPU(unsigned long, cputime_scaled_last_delta);
183 183
184cputime_t cputime_one_jiffy; 184cputime_t cputime_one_jiffy;
185 185
186void (*dtl_consumer)(struct dtl_entry *, u64);
187
186static void calc_cputime_factors(void) 188static void calc_cputime_factors(void)
187{ 189{
188 struct div_result res; 190 struct div_result res;
@@ -218,7 +220,7 @@ static u64 read_spurr(u64 tb)
218 */ 220 */
219static u64 scan_dispatch_log(u64 stop_tb) 221static u64 scan_dispatch_log(u64 stop_tb)
220{ 222{
221 unsigned long i = local_paca->dtl_ridx; 223 u64 i = local_paca->dtl_ridx;
222 struct dtl_entry *dtl = local_paca->dtl_curr; 224 struct dtl_entry *dtl = local_paca->dtl_curr;
223 struct dtl_entry *dtl_end = local_paca->dispatch_log_end; 225 struct dtl_entry *dtl_end = local_paca->dispatch_log_end;
224 struct lppaca *vpa = local_paca->lppaca_ptr; 226 struct lppaca *vpa = local_paca->lppaca_ptr;
@@ -229,6 +231,8 @@ static u64 scan_dispatch_log(u64 stop_tb)
229 if (i == vpa->dtl_idx) 231 if (i == vpa->dtl_idx)
230 return 0; 232 return 0;
231 while (i < vpa->dtl_idx) { 233 while (i < vpa->dtl_idx) {
234 if (dtl_consumer)
235 dtl_consumer(dtl, i);
232 dtb = dtl->timebase; 236 dtb = dtl->timebase;
233 tb_delta = dtl->enqueue_to_dispatch_time + 237 tb_delta = dtl->enqueue_to_dispatch_time +
234 dtl->ready_to_enqueue_time; 238 dtl->ready_to_enqueue_time;