* [PATCH] viopath: use completion
@ 2007-05-13 15:50 Christoph Hellwig
2007-05-14 0:44 ` Stephen Rothwell
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Christoph Hellwig @ 2007-05-13 15:50 UTC (permalink / raw)
To: boutcher, linuxppc-dev
Use a completion instead of abusing a semaphore for hypervisor event
completion in viopath.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Index: linux-2.6/arch/powerpc/platforms/iseries/viopath.c
===================================================================
--- linux-2.6.orig/arch/powerpc/platforms/iseries/viopath.c 2007-05-10 10:53:13.000000000 +0200
+++ linux-2.6/arch/powerpc/platforms/iseries/viopath.c 2007-05-13 16:37:04.000000000 +0200
@@ -37,6 +37,7 @@
#include <linux/wait.h>
#include <linux/seq_file.h>
#include <linux/interrupt.h>
+#include <linux/completion.h>
#include <asm/system.h>
#include <asm/uaccess.h>
@@ -115,7 +116,7 @@ static int proc_viopath_show(struct seq_
u16 vlanMap;
dma_addr_t handle;
HvLpEvent_Rc hvrc;
- DECLARE_MUTEX_LOCKED(Semaphore);
+ DECLARE_COMPLETION(done);
struct device_node *node;
const char *sysid;
@@ -132,13 +133,13 @@ static int proc_viopath_show(struct seq_
HvLpEvent_AckInd_DoAck, HvLpEvent_AckType_ImmediateAck,
viopath_sourceinst(viopath_hostLp),
viopath_targetinst(viopath_hostLp),
- (u64)(unsigned long)&Semaphore, VIOVERSION << 16,
+ (u64)(unsigned long)&done, VIOVERSION << 16,
((u64)handle) << 32, HW_PAGE_SIZE, 0, 0);
if (hvrc != HvLpEvent_Rc_Good)
printk(VIOPATH_KERN_WARN "hv error on op %d\n", (int)hvrc);
- down(&Semaphore);
+ wait_for_completion(&done);
vlanMap = HvLpConfig_getVirtualLanIndexMap();
@@ -353,7 +354,7 @@ static void handleConfig(struct HvLpEven
return;
}
- up((struct semaphore *)event->xCorrelationToken);
+ complete((struct completion *)event->xCorrelationToken);
}
/*
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] viopath: use completion
2007-05-13 15:50 [PATCH] viopath: use completion Christoph Hellwig
@ 2007-05-14 0:44 ` Stephen Rothwell
2007-05-14 0:54 ` David Boutcher
2007-05-15 13:10 ` Christoph Hellwig
2 siblings, 0 replies; 4+ messages in thread
From: Stephen Rothwell @ 2007-05-14 0:44 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: boutcher, linuxppc-dev
[-- Attachment #1: Type: text/plain, Size: 377 bytes --]
On Sun, 13 May 2007 17:50:27 +0200 Christoph Hellwig <hch@lst.de> wrote:
>
> Use a completion instead of abusing a semaphore for hypervisor event
> completion in viopath.
>
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
Acked-by: Stephen Rothwell <sfr@canb.auug.org.au>
--
Cheers,
Stephen Rothwell sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] viopath: use completion
2007-05-13 15:50 [PATCH] viopath: use completion Christoph Hellwig
2007-05-14 0:44 ` Stephen Rothwell
@ 2007-05-14 0:54 ` David Boutcher
2007-05-15 13:10 ` Christoph Hellwig
2 siblings, 0 replies; 4+ messages in thread
From: David Boutcher @ 2007-05-14 0:54 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: linuxppc-dev
Christoph Hellwig <hch@lst.de> wrote on 05/13/2007 10:50:27 AM:
> Use a completion instead of abusing a semaphore for hypervisor event
> completion in viopath.
>
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
Not that my ack is terribly relevant any more, but
Acked-by: Dave Boutcher <boutcher@us.ibm.com>
Dave B
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] viopath: use completion
2007-05-13 15:50 [PATCH] viopath: use completion Christoph Hellwig
2007-05-14 0:44 ` Stephen Rothwell
2007-05-14 0:54 ` David Boutcher
@ 2007-05-15 13:10 ` Christoph Hellwig
2 siblings, 0 replies; 4+ messages in thread
From: Christoph Hellwig @ 2007-05-15 13:10 UTC (permalink / raw)
To: boutcher, linuxppc-dev
On Sun, May 13, 2007 at 05:50:27PM +0200, Christoph Hellwig wrote:
> Use a completion instead of abusing a semaphore for hypervisor event
> completion in viopath.
And some more of the same sort:
Signed-off-by: Christoph Hellwig <hch@lst.de>
Index: linux-2.6.20/arch/powerpc/platforms/iseries/viopath.c
===================================================================
--- linux-2.6.20.orig/arch/powerpc/platforms/iseries/viopath.c 2007-05-15 14:48:57.000000000 +0200
+++ linux-2.6.20/arch/powerpc/platforms/iseries/viopath.c 2007-05-15 14:51:36.000000000 +0200
@@ -81,7 +81,7 @@ static void handleMonitorEvent(struct Hv
* if system_state is not SYSTEM_RUNNING, then wait_atomic is used ...
*/
struct alloc_parms {
- struct semaphore sem;
+ struct completion done;
int number;
atomic_t wait_atomic;
int used_wait_atomic;
@@ -464,7 +464,7 @@ static void viopath_donealloc(void *parm
if (parmsp->used_wait_atomic)
atomic_set(&parmsp->wait_atomic, 0);
else
- up(&parmsp->sem);
+ complete(&parmsp->done);
}
static int allocateEvents(HvLpIndex remoteLp, int numEvents)
@@ -476,7 +476,7 @@ static int allocateEvents(HvLpIndex remo
atomic_set(&parms.wait_atomic, 1);
} else {
parms.used_wait_atomic = 0;
- init_MUTEX_LOCKED(&parms.sem);
+ init_completion(&parms.done);
}
mf_allocate_lp_events(remoteLp, HvLpEvent_Type_VirtualIo, 250, /* It would be nice to put a real number here! */
numEvents, &viopath_donealloc, &parms);
@@ -484,7 +484,7 @@ static int allocateEvents(HvLpIndex remo
while (atomic_read(&parms.wait_atomic))
mb();
} else
- down(&parms.sem);
+ wait_for_completion(&parms.done);
return parms.number;
}
@@ -585,10 +585,10 @@ int viopath_close(HvLpIndex remoteLp, in
spin_unlock_irqrestore(&statuslock, flags);
parms.used_wait_atomic = 0;
- init_MUTEX_LOCKED(&parms.sem);
+ init_completion(&parms.done);
mf_deallocate_lp_events(remoteLp, HvLpEvent_Type_VirtualIo,
numReq, &viopath_donealloc, &parms);
- down(&parms.sem);
+ wait_for_completion(&parms.done);
spin_lock_irqsave(&statuslock, flags);
for (i = 0, numOpen = 0; i < VIO_MAX_SUBTYPES; i++)
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2007-05-15 13:10 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-13 15:50 [PATCH] viopath: use completion Christoph Hellwig
2007-05-14 0:44 ` Stephen Rothwell
2007-05-14 0:54 ` David Boutcher
2007-05-15 13:10 ` Christoph Hellwig
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).