Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=933b0e35247ef0dbd1a078a0ba3705ddbbda129f
Commit:     933b0e35247ef0dbd1a078a0ba3705ddbbda129f
Parent:     fe2f896d67b89a409c366c9a69e30291ab124467
Author:     Kazunori Asayama <[EMAIL PROTECTED]>
AuthorDate: Fri Jun 29 10:58:08 2007 +1000
Committer:  Paul Mackerras <[EMAIL PROTECTED]>
CommitDate: Tue Jul 3 15:24:46 2007 +1000

    [POWERPC] spufs: Fix lost events in poll/epoll on mfc
    
    When waiting for I/O events on mfc in an SPU context by using
    poll/epoll syscalls, some of the events can be lost because of wrong
    order of poll_wait and MFC status checks in the spufs_mfc_poll
    function and non-atomic update of tagwait.  This fixes the
    problem.
    
    Signed-off-by: Kazunori Asayama <[EMAIL PROTECTED]>
    Signed-off-by: Jeremy Kerr <[EMAIL PROTECTED]>
    Signed-off-by: Paul Mackerras <[EMAIL PROTECTED]>
---
 arch/powerpc/platforms/cell/spufs/file.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/arch/powerpc/platforms/cell/spufs/file.c 
b/arch/powerpc/platforms/cell/spufs/file.c
index 30f7b07..c2814ea 100644
--- a/arch/powerpc/platforms/cell/spufs/file.c
+++ b/arch/powerpc/platforms/cell/spufs/file.c
@@ -1499,14 +1499,15 @@ static ssize_t spufs_mfc_write(struct file *file, const 
char __user *buffer,
                if (status)
                        ret = status;
        }
-       spu_release(ctx);
 
        if (ret)
-               goto out;
+               goto out_unlock;
 
        ctx->tagwait |= 1 << cmd.tag;
        ret = size;
 
+out_unlock:
+       spu_release(ctx);
 out:
        return ret;
 }
@@ -1517,14 +1518,14 @@ static unsigned int spufs_mfc_poll(struct file 
*file,poll_table *wait)
        u32 free_elements, tagstatus;
        unsigned int mask;
 
+       poll_wait(file, &ctx->mfc_wq, wait);
+
        spu_acquire(ctx);
        ctx->ops->set_mfc_query(ctx, ctx->tagwait, 2);
        free_elements = ctx->ops->get_mfc_free_elements(ctx);
        tagstatus = ctx->ops->read_mfc_tagstatus(ctx);
        spu_release(ctx);
 
-       poll_wait(file, &ctx->mfc_wq, wait);
-
        mask = 0;
        if (free_elements & 0xffff)
                mask |= POLLOUT | POLLWRNORM;
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to