diff options
Diffstat (limited to 'arch/ia64/kernel/perfmon.c')
| -rw-r--r-- | arch/ia64/kernel/perfmon.c | 43 |
1 files changed, 33 insertions, 10 deletions
diff --git a/arch/ia64/kernel/perfmon.c b/arch/ia64/kernel/perfmon.c index 376fcbc3f8da..71c101601e3e 100644 --- a/arch/ia64/kernel/perfmon.c +++ b/arch/ia64/kernel/perfmon.c | |||
| @@ -1265,6 +1265,8 @@ out: | |||
| 1265 | } | 1265 | } |
| 1266 | EXPORT_SYMBOL(pfm_unregister_buffer_fmt); | 1266 | EXPORT_SYMBOL(pfm_unregister_buffer_fmt); |
| 1267 | 1267 | ||
| 1268 | extern void update_pal_halt_status(int); | ||
| 1269 | |||
| 1268 | static int | 1270 | static int |
| 1269 | pfm_reserve_session(struct task_struct *task, int is_syswide, unsigned int cpu) | 1271 | pfm_reserve_session(struct task_struct *task, int is_syswide, unsigned int cpu) |
| 1270 | { | 1272 | { |
| @@ -1311,6 +1313,11 @@ pfm_reserve_session(struct task_struct *task, int is_syswide, unsigned int cpu) | |||
| 1311 | is_syswide, | 1313 | is_syswide, |
| 1312 | cpu)); | 1314 | cpu)); |
| 1313 | 1315 | ||
| 1316 | /* | ||
| 1317 | * disable default_idle() to go to PAL_HALT | ||
| 1318 | */ | ||
| 1319 | update_pal_halt_status(0); | ||
| 1320 | |||
| 1314 | UNLOCK_PFS(flags); | 1321 | UNLOCK_PFS(flags); |
| 1315 | 1322 | ||
| 1316 | return 0; | 1323 | return 0; |
| @@ -1366,6 +1373,12 @@ pfm_unreserve_session(pfm_context_t *ctx, int is_syswide, unsigned int cpu) | |||
| 1366 | is_syswide, | 1373 | is_syswide, |
| 1367 | cpu)); | 1374 | cpu)); |
| 1368 | 1375 | ||
| 1376 | /* | ||
| 1377 | * if possible, enable default_idle() to go into PAL_HALT | ||
| 1378 | */ | ||
| 1379 | if (pfm_sessions.pfs_task_sessions == 0 && pfm_sessions.pfs_sys_sessions == 0) | ||
| 1380 | update_pal_halt_status(1); | ||
| 1381 | |||
| 1369 | UNLOCK_PFS(flags); | 1382 | UNLOCK_PFS(flags); |
| 1370 | 1383 | ||
| 1371 | return 0; | 1384 | return 0; |
| @@ -4202,7 +4215,7 @@ pfm_context_load(pfm_context_t *ctx, void *arg, int count, struct pt_regs *regs) | |||
| 4202 | DPRINT(("cannot load to [%d], invalid ctx_state=%d\n", | 4215 | DPRINT(("cannot load to [%d], invalid ctx_state=%d\n", |
| 4203 | req->load_pid, | 4216 | req->load_pid, |
| 4204 | ctx->ctx_state)); | 4217 | ctx->ctx_state)); |
| 4205 | return -EINVAL; | 4218 | return -EBUSY; |
| 4206 | } | 4219 | } |
| 4207 | 4220 | ||
| 4208 | DPRINT(("load_pid [%d] using_dbreg=%d\n", req->load_pid, ctx->ctx_fl_using_dbreg)); | 4221 | DPRINT(("load_pid [%d] using_dbreg=%d\n", req->load_pid, ctx->ctx_fl_using_dbreg)); |
| @@ -4704,16 +4717,26 @@ recheck: | |||
| 4704 | if (task == current || ctx->ctx_fl_system) return 0; | 4717 | if (task == current || ctx->ctx_fl_system) return 0; |
| 4705 | 4718 | ||
| 4706 | /* | 4719 | /* |
| 4707 | * if context is UNLOADED we are safe to go | 4720 | * we are monitoring another thread |
| 4708 | */ | ||
| 4709 | if (state == PFM_CTX_UNLOADED) return 0; | ||
| 4710 | |||
| 4711 | /* | ||
| 4712 | * no command can operate on a zombie context | ||
| 4713 | */ | 4721 | */ |
| 4714 | if (state == PFM_CTX_ZOMBIE) { | 4722 | switch(state) { |
| 4715 | DPRINT(("cmd %d state zombie cannot operate on context\n", cmd)); | 4723 | case PFM_CTX_UNLOADED: |
| 4716 | return -EINVAL; | 4724 | /* |
| 4725 | * if context is UNLOADED we are safe to go | ||
| 4726 | */ | ||
| 4727 | return 0; | ||
| 4728 | case PFM_CTX_ZOMBIE: | ||
| 4729 | /* | ||
| 4730 | * no command can operate on a zombie context | ||
| 4731 | */ | ||
| 4732 | DPRINT(("cmd %d state zombie cannot operate on context\n", cmd)); | ||
| 4733 | return -EINVAL; | ||
| 4734 | case PFM_CTX_MASKED: | ||
| 4735 | /* | ||
| 4736 | * PMU state has been saved to software even though | ||
| 4737 | * the thread may still be running. | ||
| 4738 | */ | ||
| 4739 | if (cmd != PFM_UNLOAD_CONTEXT) return 0; | ||
| 4717 | } | 4740 | } |
| 4718 | 4741 | ||
| 4719 | /* | 4742 | /* |
