Skip to content

Commit

Permalink
cxl: Rework context lifetimes
Browse files Browse the repository at this point in the history
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 <[email protected]>
Acked-by: Ian Munsie <[email protected]>
Signed-off-by: Michael Ellerman <[email protected]>
  • Loading branch information
mikey authored and mpe committed Jun 3, 2015
1 parent 2f66352 commit 7bb5d91
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
5 changes: 3 additions & 2 deletions drivers/misc/cxl/context.c
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,9 @@ int __detach_context(struct cxl_context *ctx)
return -EBUSY;

WARN_ON(cxl_detach_process(ctx));
flush_work(&ctx->fault_work); /* Only needed for dedicated process */
put_pid(ctx->pid);
cxl_ctx_put();
return 0;
}

Expand All @@ -204,7 +207,6 @@ void cxl_context_detach(struct cxl_context *ctx)
return;

afu_release_irqs(ctx, ctx);
flush_work(&ctx->fault_work); /* Only needed for dedicated process */
wake_up_all(&ctx->wq);
}

Expand Down Expand Up @@ -245,7 +247,6 @@ static void reclaim_ctx(struct rcu_head *rcu)
free_page((u64)ctx->sstp);
ctx->sstp = NULL;

put_pid(ctx->pid);
kfree(ctx);
}

Expand Down
1 change: 0 additions & 1 deletion drivers/misc/cxl/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@ static int afu_release(struct inode *inode, struct file *file)
*/
cxl_context_free(ctx);

cxl_ctx_put();
return 0;
}

Expand Down

0 comments on commit 7bb5d91

Please sign in to comment.