Skip to content

Commit

Permalink
cxl: Only check pid for userspace contexts
Browse files Browse the repository at this point in the history
We only need to check the pid attached to this context for userspace contexts.
Kernel contexts can skip this check.

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>
  • Loading branch information
Michael Neuling authored and Michael Ellerman committed Jun 3, 2015
1 parent 1a1a94b commit a6b07d8
Showing 1 changed file with 19 additions and 15 deletions.
34 changes: 19 additions & 15 deletions drivers/misc/cxl/fault.c
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,8 @@ void cxl_handle_fault(struct work_struct *fault_work)
container_of(fault_work, struct cxl_context, fault_work);
u64 dsisr = ctx->dsisr;
u64 dar = ctx->dar;
struct task_struct *task;
struct mm_struct *mm;
struct task_struct *task = NULL;
struct mm_struct *mm = NULL;

if (cxl_p2n_read(ctx->afu, CXL_PSL_DSISR_An) != dsisr ||
cxl_p2n_read(ctx->afu, CXL_PSL_DAR_An) != dar ||
Expand All @@ -194,17 +194,19 @@ void cxl_handle_fault(struct work_struct *fault_work)
pr_devel("CXL BOTTOM HALF handling fault for afu pe: %i. "
"DSISR: %#llx DAR: %#llx\n", ctx->pe, dsisr, dar);

if (!(task = get_pid_task(ctx->pid, PIDTYPE_PID))) {
pr_devel("cxl_handle_fault unable to get task %i\n",
pid_nr(ctx->pid));
cxl_ack_ae(ctx);
return;
}
if (!(mm = get_task_mm(task))) {
pr_devel("cxl_handle_fault unable to get mm %i\n",
pid_nr(ctx->pid));
cxl_ack_ae(ctx);
goto out;
if (!ctx->kernel) {
if (!(task = get_pid_task(ctx->pid, PIDTYPE_PID))) {
pr_devel("cxl_handle_fault unable to get task %i\n",
pid_nr(ctx->pid));
cxl_ack_ae(ctx);
return;
}
if (!(mm = get_task_mm(task))) {
pr_devel("cxl_handle_fault unable to get mm %i\n",
pid_nr(ctx->pid));
cxl_ack_ae(ctx);
goto out;
}
}

if (dsisr & CXL_PSL_DSISR_An_DS)
Expand All @@ -214,9 +216,11 @@ void cxl_handle_fault(struct work_struct *fault_work)
else
WARN(1, "cxl_handle_fault has nothing to handle\n");

mmput(mm);
if (mm)
mmput(mm);
out:
put_task_struct(task);
if (task)
put_task_struct(task);
}

static void cxl_prefault_one(struct cxl_context *ctx, u64 ea)
Expand Down

0 comments on commit a6b07d8

Please sign in to comment.