rpms/kernel/devel linux-2.6-cell-spufs-fixes.patch, NONE, 1.1 kernel-2.6.spec, 1.3107, 1.3108 linux-2.6-ps3-wrap-spu-runctl.patch, 1.2, 1.3

fedora-cvs-commits at redhat.com fedora-cvs-commits at redhat.com
Tue Apr 24 17:03:12 UTC 2007


Author: dwmw2

Update of /cvs/dist/rpms/kernel/devel
In directory cvs.devel.redhat.com:/tmp/cvs-serv10156

Modified Files:
	kernel-2.6.spec linux-2.6-ps3-wrap-spu-runctl.patch 
Added Files:
	linux-2.6-cell-spufs-fixes.patch 
Log Message:
spufs fixes

linux-2.6-cell-spufs-fixes.patch:
 arch/powerpc/platforms/cell/spu_base.c          |  161 +-----------------
 arch/powerpc/platforms/cell/spu_coredump.c      |   34 +--
 arch/powerpc/platforms/cell/spufs/Makefile      |    2 
 arch/powerpc/platforms/cell/spufs/backing_ops.c |    6 
 arch/powerpc/platforms/cell/spufs/context.c     |   45 -----
 arch/powerpc/platforms/cell/spufs/coredump.c    |   19 +-
 arch/powerpc/platforms/cell/spufs/fault.c       |  211 ++++++++++++++++++++++++
 arch/powerpc/platforms/cell/spufs/file.c        |  152 +++++++++++++++--
 arch/powerpc/platforms/cell/spufs/hw_ops.c      |    9 +
 arch/powerpc/platforms/cell/spufs/inode.c       |   42 +++-
 arch/powerpc/platforms/cell/spufs/run.c         |  123 ++++++-------
 arch/powerpc/platforms/cell/spufs/sched.c       |  109 +++++++-----
 arch/powerpc/platforms/cell/spufs/spufs.h       |   34 ++-
 arch/powerpc/platforms/cell/spufs/switch.c      |    8 
 include/asm-powerpc/mmu.h                       |    1 
 include/asm-powerpc/spu_csa.h                   |    1 
 16 files changed, 591 insertions(+), 366 deletions(-)

--- NEW FILE linux-2.6-cell-spufs-fixes.patch ---
commit ccf17e9d008dfebbf90dfa4ee1a56e81c784c73e
Author: Jeremy Kerr <jk at ozlabs.org>
Date:   Mon Apr 23 21:08:29 2007 +0200

    [POWERPC] spu_base: fix initialisation on systems with no SPEs
    
    This change fixes the case where spu_base and spufs are initialised on a
    system with no SPEs - unconditionally create the spu_lists so spu_alloc
    doesn't explode, and check for spu_management ops before starting spufs.
    
    Signed-off-by: Jeremy Kerr <jk at ozlabs.org>
    Signed-off-by: Arnd Bergmann <arnd.bergmann at de.ibm.com>
    
     arch/powerpc/platforms/cell/spu_base.c    |    7 ++++---
     arch/powerpc/platforms/cell/spufs/inode.c |    5 +++++
     2 files changed, 9 insertions(+), 3 deletions(-)

commit befdc746ee027d686a06be29cb1391f9d2c45cf6
Author: Christoph Hellwig <hch at lst.de>
Date:   Mon Apr 23 21:08:28 2007 +0200

    [POWERPC] spu_base: remove cleanup_spu_base
    
    spu_base.c is always built into the kernel image, so there is no need
    for a cleanup function.  And some of the things it does are in the
    way for my following patches, so I'd rather get rid of it ASAP.
    
    Signed-off-by: Christoph Hellwig <hch at lst.de>
    Signed-off-by: Arnd Bergmann <arnd.bergmann at de.ibm.com>

commit aa45e2569ffe963dfbbbfddfdccd12afe69b2d65
Author: Christoph Hellwig <hch at lst.de>
Date:   Mon Apr 23 21:08:27 2007 +0200

    [POWERPC] spufs: various run.c cleanups
    
     - remove the spu_acquire_runnable from spu_run_init.  I need to
       opencode it in spufs_run_spu in the next patch
     - remove various inline attributes, we don't really want to inline
       long functions with multiple callsites
     - cleanup return values and runcntl_write calls in spu_run_init
     - use normal kernel codingstyle in spu_reacquire_runnable
    
    Signed-off-by: Christoph Hellwig <hch at lst.de>
    Signed-off-by: Arnd Bergmann <arnd.bergmann at de.ibm.com>

commit fe8a29db5bce1b5bd1ceb85fd153fac52cdab7b2
Author: Akinobu Mita <mita at fixstars.com>
Date:   Mon Apr 23 21:08:26 2007 +0200

    [POWERPC] spufs: enable SPU coredump for kernel-builtin spufs
    
    spu_coredump_calls.owner is NULL in case of a builtin spufs,
    so the checks in here break.
    Check for the availability of the spu_coredump_calls variable
    instead.
    
    Signed-off-by: Arnd Bergmann <arnd.bergmann at de.ibm.com>

commit 6cf2179202cf706471777ad6ee5d0377d5990ab7
Author: Arnd Bergmann <arnd.bergmann at de.ibm.com>
Date:   Mon Apr 23 21:08:25 2007 +0200

    [POWERPC] spufs: fix memory leak on coredump
    
    Dynamically allocated read/write buffer in spufs_arch_write_note() will
    not be freed. Convert it to get_free_page at the same time.
    
    Cc: Akinobu Mita <mita at fixstars.com>
    Signed-off-by: Arnd Bergmann <arnd.bergmann at de.ibm.com>

commit d3764397d07b1e03943edfdcc3fb77af7bdac02b
Author: Jeremy Kerr <jk at ozlabs.org>
Date:   Mon Apr 23 21:08:24 2007 +0200

    [POWERPC] spufs: Minor cleanup of spu_wait
    
    Change the loop in spu_wait to be a little more straightforward.
    
    Signed-off-by: Jeremy Kerr <jk at ozlabs.org>
    Signed-off-by: Arnd Bergmann <arnd.bergmann at de.ibm.com>

commit f11f5ee70f48899506514e5e0d10ee2c8ddd359a
Author: Jeremy Kerr <jk at ozlabs.org>
Date:   Mon Apr 23 21:08:23 2007 +0200

    [POWERPC] spufs: add mode= mount option
    
    Add a 'mode=' option to spufs mount arguments. This allows more
    control over access to the top-level spufs directory.
    
    Tested on Cell.
    
    Signed-off-by: Jeremy Kerr <jk at ozlabs.org>
    Signed-off-by: Arnd Bergmann <arnd.bergmann at de.ibm.com>

commit 9e2fe2ce4e957a79d3dc5d813e0cfb10d79b79b3
Author: Akinobu Mita <mita at fixstars.com>
Date:   Mon Apr 23 21:08:22 2007 +0200

    [POWERPC] spufs: use memcpy_fromio() to copy from local store
    
    GCC may generates inline copy loop to handle memcpy() function
    instead of kernel defined memcpy(). But this inlined version of memcpy()
    causes an alignment interrupt when copying from local store.
    
    This patch uses memcpy_fromio() and memcpy_toio to copy local store
    to prevent memcpy() being inlined.
    
    Signed-off-by: Akinobu Mita <mita at fixstars.com>
    Signed-off-by: Arnd Bergmann <arnd.bergmann at de.ibm.com>

commit 8a7d86bdb22678b17928eef0c8fa356d8b21cc76
Author: Christoph Hellwig <hch at lst.de>
Date:   Mon Apr 23 21:08:21 2007 +0200

    [POWERPC] spufs: avoid spurious memory barriers
    
    We now have proper locking around assignets of the mapping pointers,
    and the spin_unlock implies enough of a barrier to get rid of the
    explicit one.
    
    Signed-off-by: Christoph Hellwig <hch at lst.de>
    Signed-off-by: Arnd Bergmann <arnd.bergmann at de.ibm.com>

commit db1384b40d12eda6910513ff429ad90453ca49e1
Author: Akinobu Mita <mita at fixstars.com>
Date:   Mon Apr 23 21:08:20 2007 +0200

    [POWERPC] spufs: fix memory leak on spufs reloading
    
    When SPU isolation mode enabled, isolated_loader would be
    allocated by spufs_init_isolated_loader() on module_init().
    But anyone do not free it.
    
    This patch introduces spufs_exit_isolated_loader() which is
    the opposite of spufs_init_isolated_loader() and called on
    module_exit().
    
    Cc: Arnd Bergmann <arnd at arndb.de>
    Signed-off-by: Akinobu Mita <mita at fixstars.com>
    Signed-off-by: Christoph Hellwig <hch at lst.de>
    Signed-off-by: Arnd Bergmann <arnd.bergmann at de.ibm.com>

commit c99c1994a2bb9493b4ac372b2b6ee2606d291171
Author: Akinobu Mita <mita at fixstars.com>
Date:   Mon Apr 23 21:08:19 2007 +0200

    [POWERPC] spufs: fix missing error handling in module_init()
    
    spufs module_init forgot to call a few cleanup functions
    on error path. This patch also includes cosmetic changes in
    spu_sched_init() (identation fix and return error code).
    
    [modified by hch to apply ontop of the latest schedule changes]
    
    Cc: Arnd Bergmann <arnd at arndb.de>
    Signed-off-by: Akinobu Mita <mita at fixstars.com>
    Signed-off-by: Christoph Hellwig <hch at lst.de>
    Signed-off-by: Arnd Bergmann <arnd.bergmann at de.ibm.com>

commit 577f8f1021f9ee6ef2a98a142652759ec122d27f
Author: Akinobu Mita <mita at fixstars.com>
Date:   Mon Apr 23 21:08:18 2007 +0200

    [POWERPC] spufs: check spu_acquire_runnable() return value
    
    This patch checks return value of spu_acquire_runnable() in
    spufs_mfc_write().
    
    Signed-off-by: Akinobu Mita <mita at fixstars.com>
    Signed-off-by: Christoph Hellwig <hch at lst.de>
    Signed-off-by: Arnd Bergmann <arnd.bergmann at de.ibm.com>

commit e45d48a34d4d1862d28d22c2533b8c6bb83b8c1f
Author: Christoph Hellwig <hch at lst.de>
Date:   Mon Apr 23 21:08:17 2007 +0200

    [POWERPC] spufs: turn run_sema into run_mutex
    
    There is no reason for run_sema to be a struct semaphore.  Changing
    it to a mutex and rename it accordingly.
    
    Signed-off-by: Christoph Hellwig <hch at lst.de>
    Signed-off-by: Arnd Bergmann <arnd.bergmann at de.ibm.com>

commit c8a1e9393a86f862ab9c8bc0db9b8a1822226f84
Author: Jeremy Kerr <jk at ozlabs.org>
Date:   Mon Apr 23 21:08:16 2007 +0200

    [POWERPC] spufs: provide siginfo for SPE faults
    
    This change populates a siginfo struct for SPE application exceptions
    (ie, invalid DMAs and illegal instructions).
    
    Tested on an IBM Cell Blade.
    
    Signed-off-by: Jeremy Kerr <jk at ozlabs.org>
    Signed-off-by: Arnd Bergmann <arnd.bergmann at de.ibm.com>
[...1665 lines suppressed...]
+		spin_lock(&spu_prio->runq_lock);
+		__spu_del_from_rq(ctx);
 	}
+	spin_unlock(&spu_prio->runq_lock);
 	__set_current_state(TASK_RUNNING);
 	remove_wait_queue(&ctx->stop_wq, &wait);
 }
@@ -280,9 +290,14 @@ static void spu_reschedule(struct spu *spu)
 	spin_lock(&spu_prio->runq_lock);
 	best = sched_find_first_bit(spu_prio->bitmap);
 	if (best < MAX_PRIO) {
-		struct spu_context *ctx = spu_grab_context(best);
-		if (ctx)
-			wake_up(&ctx->stop_wq);
+		struct list_head *rq = &spu_prio->runq[best];
+		struct spu_context *ctx;
+
+		BUG_ON(list_empty(rq));
+
+		ctx = list_entry(rq->next, struct spu_context, rq);
+		__spu_del_from_rq(ctx);
+		wake_up(&ctx->stop_wq);
 	}
 	spin_unlock(&spu_prio->runq_lock);
 }
@@ -365,6 +380,12 @@ static struct spu *find_victim(struct spu_context *ctx)
 			}
 			spu_unbind_context(spu, victim);
 			mutex_unlock(&victim->state_mutex);
+			/*
+			 * We need to break out of the wait loop in spu_run
+			 * manually to ensure this context gets put on the
+			 * runqueue again ASAP.
+			 */
+			wake_up(&victim->stop_wq);
 			return spu;
 		}
 	}
@@ -377,7 +398,7 @@ static struct spu *find_victim(struct spu_context *ctx)
  * @ctx:	spu context to schedule
  * @flags:	flags (currently ignored)
  *
- * Tries to find a free spu to run @ctx.  If no free spu is availble
+ * Tries to find a free spu to run @ctx.  If no free spu is available
  * add the context to the runqueue so it gets woken up once an spu
  * is available.
  */
@@ -402,9 +423,7 @@ int spu_activate(struct spu_context *ctx, unsigned long flags)
 			return 0;
 		}
 
-		spu_add_to_rq(ctx);
 		spu_prio_wait(ctx);
-		spu_del_from_rq(ctx);
 	} while (!signal_pending(current));
 
 	return -ERESTARTSYS;
diff --git a/arch/powerpc/platforms/cell/spufs/spufs.h b/arch/powerpc/platforms/cell/spufs/spufs.h
index 5c4e47d..0a947fd 100644
--- a/arch/powerpc/platforms/cell/spufs/spufs.h
+++ b/arch/powerpc/platforms/cell/spufs/spufs.h
@@ -41,7 +41,7 @@ struct spu_gang;
 
 /* ctx->sched_flags */
 enum {
-	SPU_SCHED_WAKE = 0, /* currently unused */
+	SPU_SCHED_EXITING = 0,
 };
 
 struct spu_context {
@@ -50,16 +50,17 @@ struct spu_context {
 	spinlock_t mmio_lock;		  /* protects mmio access */
 	struct address_space *local_store; /* local store mapping.  */
 	struct address_space *mfc;	   /* 'mfc' area mappings. */
-	struct address_space *cntl; 	   /* 'control' area mappings. */
-	struct address_space *signal1; 	   /* 'signal1' area mappings. */
-	struct address_space *signal2; 	   /* 'signal2' area mappings. */
-	struct address_space *mss; 	   /* 'mss' area mappings. */
-	struct address_space *psmap; 	   /* 'psmap' area mappings. */
+	struct address_space *cntl;	   /* 'control' area mappings. */
+	struct address_space *signal1;	   /* 'signal1' area mappings. */
+	struct address_space *signal2;	   /* 'signal2' area mappings. */
+	struct address_space *mss;	   /* 'mss' area mappings. */
+	struct address_space *psmap;	   /* 'psmap' area mappings. */
+	spinlock_t mapping_lock;
 	u64 object_id;		   /* user space pointer for oprofile */
 
 	enum { SPU_STATE_RUNNABLE, SPU_STATE_SAVED } state;
 	struct mutex state_mutex;
-	struct semaphore run_sema;
+	struct mutex run_mutex;
 
 	struct mm_struct *owner;
 
@@ -140,6 +141,7 @@ struct spu_context_ops {
 			       struct spu_dma_info * info);
 	void (*proxydma_info_read) (struct spu_context * ctx,
 				    struct spu_proxydma_info * info);
+	void (*restart_dma)(struct spu_context *ctx);
 };
 
 extern struct spu_context_ops spu_hw_ops;
@@ -149,6 +151,7 @@ struct spufs_inode_info {
 	struct spu_context *i_ctx;
 	struct spu_gang *i_gang;
 	struct inode vfs_inode;
+	int i_openers;
 };
 #define SPUFS_I(inode) \
 	container_of(inode, struct spufs_inode_info, vfs_inode)
@@ -170,6 +173,9 @@ int put_spu_gang(struct spu_gang *gang);
 void spu_gang_remove_ctx(struct spu_gang *gang, struct spu_context *ctx);
 void spu_gang_add_ctx(struct spu_gang *gang, struct spu_context *ctx);
 
+/* fault handling */
+int spufs_handle_class1(struct spu_context *ctx);
+
 /* context management */
 static inline void spu_acquire(struct spu_context *ctx)
 {
@@ -190,7 +196,6 @@ void spu_unmap_mappings(struct spu_context *ctx);
 void spu_forget(struct spu_context *ctx);
 int spu_acquire_runnable(struct spu_context *ctx, unsigned long flags);
 void spu_acquire_saved(struct spu_context *ctx);
-int spu_acquire_exclusive(struct spu_context *ctx);
 
 int spu_activate(struct spu_context *ctx, unsigned long flags);
 void spu_deactivate(struct spu_context *ctx);
@@ -218,14 +223,13 @@ extern char *isolated_loader;
 		prepare_to_wait(&(wq), &__wait, TASK_INTERRUPTIBLE);	\
 		if (condition)						\
 			break;						\
-		if (!signal_pending(current)) {				\
-			spu_release(ctx);				\
-			schedule();					\
-			spu_acquire(ctx);				\
-			continue;					\
+		if (signal_pending(current)) {				\
+			__ret = -ERESTARTSYS;				\
+			break;						\
 		}							\
-		__ret = -ERESTARTSYS;					\
-		break;							\
+		spu_release(ctx);					\
+		schedule();						\
+		spu_acquire(ctx);					\
 	}								\
 	finish_wait(&(wq), &__wait);					\
 	__ret;								\
diff --git a/arch/powerpc/platforms/cell/spufs/switch.c b/arch/powerpc/platforms/cell/spufs/switch.c
index fd91c73..8347c4a 100644
--- a/arch/powerpc/platforms/cell/spufs/switch.c
+++ b/arch/powerpc/platforms/cell/spufs/switch.c
@@ -2084,6 +2084,10 @@ int spu_save(struct spu_state *prev, struct spu *spu)
 	int rc;
 
 	acquire_spu_lock(spu);	        /* Step 1.     */
+	prev->dar = spu->dar;
+	prev->dsisr = spu->dsisr;
+	spu->dar = 0;
+	spu->dsisr = 0;
 	rc = __do_spu_save(prev, spu);	/* Steps 2-53. */
 	release_spu_lock(spu);
 	if (rc != 0 && rc != 2 && rc != 6) {
@@ -2109,9 +2113,9 @@ int spu_restore(struct spu_state *new, struct spu *spu)
 
 	acquire_spu_lock(spu);
 	harvest(NULL, spu);
-	spu->dar = 0;
-	spu->dsisr = 0;
 	spu->slb_replace = 0;
+	new->dar = 0;
+	new->dsisr = 0;
 	spu->class_0_pending = 0;
 	rc = __do_spu_restore(new, spu);
 	release_spu_lock(spu);
diff --git a/include/asm-powerpc/mmu.h b/include/asm-powerpc/mmu.h
index 200055a..e22fd88 100644
--- a/include/asm-powerpc/mmu.h
+++ b/include/asm-powerpc/mmu.h
@@ -234,6 +234,7 @@ extern int __hash_page_64K(unsigned long ea, unsigned long access,
 			   unsigned long vsid, pte_t *ptep, unsigned long trap,
 			   unsigned int local);
 struct mm_struct;
+extern int hash_page(unsigned long ea, unsigned long access, unsigned long trap);
 extern int hash_huge_page(struct mm_struct *mm, unsigned long access,
 			  unsigned long ea, unsigned long vsid, int local,
 			  unsigned long trap);
diff --git a/include/asm-powerpc/spu_csa.h b/include/asm-powerpc/spu_csa.h
index 8aad061..02e56a6 100644
--- a/include/asm-powerpc/spu_csa.h
+++ b/include/asm-powerpc/spu_csa.h
@@ -242,6 +242,7 @@ struct spu_state {
 	u64 spu_chnldata_RW[32];
 	u32 spu_mailbox_data[4];
 	u32 pu_mailbox_data[1];
+	u64 dar, dsisr;
 	unsigned long suspend_time;
 	spinlock_t register_lock;
 };


Index: kernel-2.6.spec
===================================================================
RCS file: /cvs/dist/rpms/kernel/devel/kernel-2.6.spec,v
retrieving revision 1.3107
retrieving revision 1.3108
diff -u -r1.3107 -r1.3108
--- kernel-2.6.spec	24 Apr 2007 11:00:17 -0000	1.3107
+++ kernel-2.6.spec	24 Apr 2007 17:03:10 -0000	1.3108
@@ -409,6 +409,7 @@
 Patch306: linux-2.6-powerpc-reserve-initrd-1.patch
 Patch307: linux-2.6-powerpc-reserve-initrd-2.patch
 Patch308: linux-2.6-cell-spu-device-tree.patch
+Patch309: linux-2.6-cell-spufs-fixes.patch
 
 Patch310: linux-2.6-common-uevent.patch
 Patch311: linux-2.6-uevent-macio.patch
@@ -1058,6 +1059,7 @@
 %patch306 -p1
 %patch307 -p1
 %patch308 -p1
+%patch309 -p1
 
 # uevent support for of_platform device
 %patch310 -p1
@@ -2334,6 +2336,7 @@
 %changelog
 * Tue Apr 24 2007 David Woodhouse <dwmw2 at redhat.com>
 - Support proper device-tree layout for Cell SPUs
+- Cell spufs fixes
 
 * Mon Apr 23 2007 Dave Jones <davej at redhat.com>
 - 2.6.21-rc7-git6

linux-2.6-ps3-wrap-spu-runctl.patch:
 arch/powerpc/platforms/cell/spu_manage.c        |   15 +++++++++++++++
 arch/powerpc/platforms/cell/spufs/backing_ops.c |    6 ++++++
 arch/powerpc/platforms/cell/spufs/hw_ops.c      |   10 ++++++++++
 arch/powerpc/platforms/cell/spufs/run.c         |    4 ++--
 arch/powerpc/platforms/cell/spufs/spufs.h       |    1 +
 arch/powerpc/platforms/ps3/spu.c                |   14 ++++++++++++++
 include/asm-powerpc/spu_priv1.h                 |   15 +++++++++++++++
 7 files changed, 63 insertions(+), 2 deletions(-)

Index: linux-2.6-ps3-wrap-spu-runctl.patch
===================================================================
RCS file: /cvs/dist/rpms/kernel/devel/linux-2.6-ps3-wrap-spu-runctl.patch,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- linux-2.6-ps3-wrap-spu-runctl.patch	21 Apr 2007 22:15:46 -0000	1.2
+++ linux-2.6-ps3-wrap-spu-runctl.patch	24 Apr 2007 17:03:10 -0000	1.3
@@ -31,16 +31,6 @@
  include/asm-powerpc/spu_priv1.h                 |   14 ++++++++++++++
  8 files changed, 63 insertions(+), 2 deletions(-)
 
---- ps3-linux-dev.orig/arch/powerpc/platforms/cell/spu_base.c
-+++ ps3-linux-dev/arch/powerpc/platforms/cell/spu_base.c
-@@ -39,6 +39,7 @@ const struct spu_management_ops *spu_man
- const struct spu_priv1_ops *spu_priv1_ops;
- 
- EXPORT_SYMBOL_GPL(spu_priv1_ops);
-+EXPORT_SYMBOL_GPL(spu_management_ops);
- 
- static int __spu_trap_invalid_dma(struct spu *spu)
- {
 --- ps3-linux-dev.orig/arch/powerpc/platforms/cell/spu_manage.c
 +++ ps3-linux-dev/arch/powerpc/platforms/cell/spu_manage.c
 @@ -35,6 +35,7 @@




More information about the fedora-cvs-commits mailing list