[IA64] sem2mutex: arch/ia64/kernel/perfmon.c

Migrate perfmon from using an old semaphore to a completion handler.

Signed-off-by: Jes Sorensen <jes@sgi.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Tony Luck <tony.luck@intel.com>
This commit is contained in:
Jes Sorensen 2006-01-18 23:46:52 -08:00 committed by Tony Luck
parent 92ff2ecd0d
commit 60f1c4443c

View File

@ -40,6 +40,7 @@
#include <linux/bitops.h> #include <linux/bitops.h>
#include <linux/capability.h> #include <linux/capability.h>
#include <linux/rcupdate.h> #include <linux/rcupdate.h>
#include <linux/completion.h>
#include <asm/errno.h> #include <asm/errno.h>
#include <asm/intrinsics.h> #include <asm/intrinsics.h>
@ -286,7 +287,7 @@ typedef struct pfm_context {
unsigned long ctx_ovfl_regs[4]; /* which registers overflowed (notification) */ unsigned long ctx_ovfl_regs[4]; /* which registers overflowed (notification) */
struct semaphore ctx_restart_sem; /* use for blocking notification mode */ struct completion ctx_restart_done; /* use for blocking notification mode */
unsigned long ctx_used_pmds[4]; /* bitmask of PMD used */ unsigned long ctx_used_pmds[4]; /* bitmask of PMD used */
unsigned long ctx_all_pmds[4]; /* bitmask of all accessible PMDs */ unsigned long ctx_all_pmds[4]; /* bitmask of all accessible PMDs */
@ -1991,7 +1992,7 @@ pfm_close(struct inode *inode, struct file *filp)
/* /*
* force task to wake up from MASKED state * force task to wake up from MASKED state
*/ */
up(&ctx->ctx_restart_sem); complete(&ctx->ctx_restart_done);
DPRINT(("waking up ctx_state=%d\n", state)); DPRINT(("waking up ctx_state=%d\n", state));
@ -2706,7 +2707,7 @@ pfm_context_create(pfm_context_t *ctx, void *arg, int count, struct pt_regs *reg
/* /*
* init restart semaphore to locked * init restart semaphore to locked
*/ */
sema_init(&ctx->ctx_restart_sem, 0); init_completion(&ctx->ctx_restart_done);
/* /*
* activation is used in SMP only * activation is used in SMP only
@ -3687,7 +3688,7 @@ pfm_restart(pfm_context_t *ctx, void *arg, int count, struct pt_regs *regs)
*/ */
if (CTX_OVFL_NOBLOCK(ctx) == 0 && state == PFM_CTX_MASKED) { if (CTX_OVFL_NOBLOCK(ctx) == 0 && state == PFM_CTX_MASKED) {
DPRINT(("unblocking [%d] \n", task->pid)); DPRINT(("unblocking [%d] \n", task->pid));
up(&ctx->ctx_restart_sem); complete(&ctx->ctx_restart_done);
} else { } else {
DPRINT(("[%d] armed exit trap\n", task->pid)); DPRINT(("[%d] armed exit trap\n", task->pid));
@ -5089,7 +5090,7 @@ pfm_handle_work(void)
* may go through without blocking on SMP systems * may go through without blocking on SMP systems
* if restart has been received already by the time we call down() * if restart has been received already by the time we call down()
*/ */
ret = down_interruptible(&ctx->ctx_restart_sem); ret = wait_for_completion_interruptible(&ctx->ctx_restart_done);
DPRINT(("after block sleeping ret=%d\n", ret)); DPRINT(("after block sleeping ret=%d\n", ret));