aboutsummaryrefslogtreecommitdiff
path: root/arch/powerpc/platforms/cell/spufs/file.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2007-06-04 23:26:51 +1000
committerPaul Mackerras <paulus@samba.org>2007-06-07 11:44:39 +1000
commit47d3a5faa3f72186f769ed9579c630afb8433f2b (patch)
tree01e33e214b40d34ee6051d1381ba87521caa5d82 /arch/powerpc/platforms/cell/spufs/file.c
parent89df00855beabfa700f9a9ed52f0983bdc4b021d (diff)
[POWERPC] spufs: Synchronize pte invalidation vs ps close
Make sure the mapping_lock also protects access to the various address_space pointers used for tearing down the ptes on a spu context switch. Because unmap_mapping_range can sleep we need to turn mapping_lock from a spinlock into a sleeping mutex. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc/platforms/cell/spufs/file.c')
-rw-r--r--arch/powerpc/platforms/cell/spufs/file.c56
1 files changed, 28 insertions, 28 deletions
diff --git a/arch/powerpc/platforms/cell/spufs/file.c b/arch/powerpc/platforms/cell/spufs/file.c
index 89a50110a3c..b1e7e2f8a2e 100644
--- a/arch/powerpc/platforms/cell/spufs/file.c
+++ b/arch/powerpc/platforms/cell/spufs/file.c
@@ -45,11 +45,11 @@ spufs_mem_open(struct inode *inode, struct file *file)
struct spufs_inode_info *i = SPUFS_I(inode);
struct spu_context *ctx = i->i_ctx;
- spin_lock(&ctx->mapping_lock);
+ mutex_lock(&ctx->mapping_lock);
file->private_data = ctx;
if (!i->i_openers++)
ctx->local_store = inode->i_mapping;
- spin_unlock(&ctx->mapping_lock);
+ mutex_unlock(&ctx->mapping_lock);
return 0;
}
@@ -59,10 +59,10 @@ spufs_mem_release(struct inode *inode, struct file *file)
struct spufs_inode_info *i = SPUFS_I(inode);
struct spu_context *ctx = i->i_ctx;
- spin_lock(&ctx->mapping_lock);
+ mutex_lock(&ctx->mapping_lock);
if (!--i->i_openers)
ctx->local_store = NULL;
- spin_unlock(&ctx->mapping_lock);
+ mutex_unlock(&ctx->mapping_lock);
return 0;
}
@@ -310,11 +310,11 @@ static int spufs_cntl_open(struct inode *inode, struct file *file)
struct spufs_inode_info *i = SPUFS_I(inode);
struct spu_context *ctx = i->i_ctx;
- spin_lock(&ctx->mapping_lock);
+ mutex_lock(&ctx->mapping_lock);
file->private_data = ctx;
if (!i->i_openers++)
ctx->cntl = inode->i_mapping;
- spin_unlock(&ctx->mapping_lock);
+ mutex_unlock(&ctx->mapping_lock);
return simple_attr_open(inode, file, spufs_cntl_get,
spufs_cntl_set, "0x%08lx");
}
@@ -327,10 +327,10 @@ spufs_cntl_release(struct inode *inode, struct file *file)
simple_attr_close(inode, file);
- spin_lock(&ctx->mapping_lock);
+ mutex_lock(&ctx->mapping_lock);
if (!--i->i_openers)
ctx->cntl = NULL;
- spin_unlock(&ctx->mapping_lock);
+ mutex_unlock(&ctx->mapping_lock);
return 0;
}
@@ -813,11 +813,11 @@ static int spufs_signal1_open(struct inode *inode, struct file *file)
struct spufs_inode_info *i = SPUFS_I(inode);
struct spu_context *ctx = i->i_ctx;
- spin_lock(&ctx->mapping_lock);
+ mutex_lock(&ctx->mapping_lock);
file->private_data = ctx;
if (!i->i_openers++)
ctx->signal1 = inode->i_mapping;
- spin_unlock(&ctx->mapping_lock);
+ mutex_unlock(&ctx->mapping_lock);
return nonseekable_open(inode, file);
}
@@ -827,10 +827,10 @@ spufs_signal1_release(struct inode *inode, struct file *file)
struct spufs_inode_info *i = SPUFS_I(inode);
struct spu_context *ctx = i->i_ctx;
- spin_lock(&ctx->mapping_lock);
+ mutex_lock(&ctx->mapping_lock);
if (!--i->i_openers)
ctx->signal1 = NULL;
- spin_unlock(&ctx->mapping_lock);
+ mutex_unlock(&ctx->mapping_lock);
return 0;
}
@@ -937,11 +937,11 @@ static int spufs_signal2_open(struct inode *inode, struct file *file)
struct spufs_inode_info *i = SPUFS_I(inode);
struct spu_context *ctx = i->i_ctx;
- spin_lock(&ctx->mapping_lock);
+ mutex_lock(&ctx->mapping_lock);
file->private_data = ctx;
if (!i->i_openers++)
ctx->signal2 = inode->i_mapping;
- spin_unlock(&ctx->mapping_lock);
+ mutex_unlock(&ctx->mapping_lock);
return nonseekable_open(inode, file);
}
@@ -951,10 +951,10 @@ spufs_signal2_release(struct inode *inode, struct file *file)
struct spufs_inode_info *i = SPUFS_I(inode);
struct spu_context *ctx = i->i_ctx;
- spin_lock(&ctx->mapping_lock);
+ mutex_lock(&ctx->mapping_lock);
if (!--i->i_openers)
ctx->signal2 = NULL;
- spin_unlock(&ctx->mapping_lock);
+ mutex_unlock(&ctx->mapping_lock);
return 0;
}
@@ -1155,10 +1155,10 @@ static int spufs_mss_open(struct inode *inode, struct file *file)
file->private_data = i->i_ctx;
- spin_lock(&ctx->mapping_lock);
+ mutex_lock(&ctx->mapping_lock);
if (!i->i_openers++)
ctx->mss = inode->i_mapping;
- spin_unlock(&ctx->mapping_lock);
+ mutex_unlock(&ctx->mapping_lock);
return nonseekable_open(inode, file);
}
@@ -1168,10 +1168,10 @@ spufs_mss_release(struct inode *inode, struct file *file)
struct spufs_inode_info *i = SPUFS_I(inode);
struct spu_context *ctx = i->i_ctx;
- spin_lock(&ctx->mapping_lock);
+ mutex_lock(&ctx->mapping_lock);
if (!--i->i_openers)
ctx->mss = NULL;
- spin_unlock(&ctx->mapping_lock);
+ mutex_unlock(&ctx->mapping_lock);
return 0;
}
@@ -1212,11 +1212,11 @@ static int spufs_psmap_open(struct inode *inode, struct file *file)
struct spufs_inode_info *i = SPUFS_I(inode);
struct spu_context *ctx = i->i_ctx;
- spin_lock(&ctx->mapping_lock);
+ mutex_lock(&ctx->mapping_lock);
file->private_data = i->i_ctx;
if (!i->i_openers++)
ctx->psmap = inode->i_mapping;
- spin_unlock(&ctx->mapping_lock);
+ mutex_unlock(&ctx->mapping_lock);
return nonseekable_open(inode, file);
}
@@ -1226,10 +1226,10 @@ spufs_psmap_release(struct inode *inode, struct file *file)
struct spufs_inode_info *i = SPUFS_I(inode);
struct spu_context *ctx = i->i_ctx;
- spin_lock(&ctx->mapping_lock);
+ mutex_lock(&ctx->mapping_lock);
if (!--i->i_openers)
ctx->psmap = NULL;
- spin_unlock(&ctx->mapping_lock);
+ mutex_unlock(&ctx->mapping_lock);
return 0;
}
@@ -1282,11 +1282,11 @@ static int spufs_mfc_open(struct inode *inode, struct file *file)
if (atomic_read(&inode->i_count) != 1)
return -EBUSY;
- spin_lock(&ctx->mapping_lock);
+ mutex_lock(&ctx->mapping_lock);
file->private_data = ctx;
if (!i->i_openers++)
ctx->mfc = inode->i_mapping;
- spin_unlock(&ctx->mapping_lock);
+ mutex_unlock(&ctx->mapping_lock);
return nonseekable_open(inode, file);
}
@@ -1296,10 +1296,10 @@ spufs_mfc_release(struct inode *inode, struct file *file)
struct spufs_inode_info *i = SPUFS_I(inode);
struct spu_context *ctx = i->i_ctx;
- spin_lock(&ctx->mapping_lock);
+ mutex_lock(&ctx->mapping_lock);
if (!--i->i_openers)
ctx->mfc = NULL;
- spin_unlock(&ctx->mapping_lock);
+ mutex_unlock(&ctx->mapping_lock);
return 0;
}