aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc/cxl
diff options
context:
space:
mode:
authorMichael Neuling <mikey@neuling.org>2015-05-27 02:07:14 -0400
committerMichael Ellerman <mpe@ellerman.id.au>2015-06-02 23:27:19 -0400
commit7bb5d91a4dda92e28b2704a3e7ebe94260ccd6f1 (patch)
tree85bc02ca2355a6216b403f7ec5b9e5bc9175c231 /drivers/misc/cxl
parent2f663527bd6aa94763aafd3a22332903815fbf81 (diff)
cxl: Rework context lifetimes
This reworks contexts lifetimes a bit to enable the kernel API where we may want to reuse contexts. Here we will want to start and stop contexts without freeing them. Start context does the get pid & ctx so stop context will need to do the puts. Here we move put pid & ctx to the detach context path which will become part of the stop context path. Signed-off-by: Michael Neuling <mikey@neuling.org> Acked-by: Ian Munsie <imunsie@au1.ibm.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Diffstat (limited to 'drivers/misc/cxl')
-rw-r--r--drivers/misc/cxl/context.c5
-rw-r--r--drivers/misc/cxl/file.c1
2 files changed, 3 insertions, 3 deletions
diff --git a/drivers/misc/cxl/context.c b/drivers/misc/cxl/context.c
index 7d857b7d686d..2a4c80ac322a 100644
--- a/drivers/misc/cxl/context.c
+++ b/drivers/misc/cxl/context.c
@@ -186,6 +186,9 @@ int __detach_context(struct cxl_context *ctx)
186 return -EBUSY; 186 return -EBUSY;
187 187
188 WARN_ON(cxl_detach_process(ctx)); 188 WARN_ON(cxl_detach_process(ctx));
189 flush_work(&ctx->fault_work); /* Only needed for dedicated process */
190 put_pid(ctx->pid);
191 cxl_ctx_put();
189 return 0; 192 return 0;
190} 193}
191 194
@@ -204,7 +207,6 @@ void cxl_context_detach(struct cxl_context *ctx)
204 return; 207 return;
205 208
206 afu_release_irqs(ctx, ctx); 209 afu_release_irqs(ctx, ctx);
207 flush_work(&ctx->fault_work); /* Only needed for dedicated process */
208 wake_up_all(&ctx->wq); 210 wake_up_all(&ctx->wq);
209} 211}
210 212
@@ -245,7 +247,6 @@ static void reclaim_ctx(struct rcu_head *rcu)
245 free_page((u64)ctx->sstp); 247 free_page((u64)ctx->sstp);
246 ctx->sstp = NULL; 248 ctx->sstp = NULL;
247 249
248 put_pid(ctx->pid);
249 kfree(ctx); 250 kfree(ctx);
250} 251}
251 252
diff --git a/drivers/misc/cxl/file.c b/drivers/misc/cxl/file.c
index 676e2c8bc1ab..c16bd6fa06ed 100644
--- a/drivers/misc/cxl/file.c
+++ b/drivers/misc/cxl/file.c
@@ -128,7 +128,6 @@ static int afu_release(struct inode *inode, struct file *file)
128 */ 128 */
129 cxl_context_free(ctx); 129 cxl_context_free(ctx);
130 130
131 cxl_ctx_put();
132 return 0; 131 return 0;
133} 132}
134 133