[PATCH v5] drm/i915/gvt: add a NULL pointer check to avoid kernel panic
Dong, Chuanxiao
chuanxiao.dong at intel.com
Mon Feb 20 02:38:42 UTC 2017
> -----Original Message-----
> From: Zhenyu Wang [mailto:zhenyuw at linux.intel.com]
> Sent: Monday, February 20, 2017 10:34 AM
> To: Dong, Chuanxiao <chuanxiao.dong at intel.com>
> Cc: intel-gvt-dev at lists.freedesktop.org
> Subject: Re: [PATCH v5] drm/i915/gvt: add a NULL pointer check to avoid
> kernel panic
>
> On 2017.02.17 19:29:52 +0800, Chuanxiao Dong wrote:
> > Due to the request replay, context switch interrupt may come after gvt
> > free the workload thus can cause a kernel NULL pointer kernel panic.
> > This patch will add a simple check to avoid this for a short term.
> >
> > From long term, gvt workload lifecycle doesn't match with i915 request
> > and need to find a proper way to manage this.
> >
> > v2: update the commit message;
> > add EINPROGRESS check for workload->status
> >
> > v3: make the status check gracefully.
> > v4: simplify the NULL pointer check.
> > v5: add unlikely to optimize.
> >
>
> As this takes new way to fix, above changelog might not make sense any
> more, I'd do some clean up when apply this later. Thanks!
Sure. Thanks a lot!
>
> > Signed-off-by: Chuanxiao Dong <chuanxiao.dong at intel.com>
> > ---
> > drivers/gpu/drm/i915/gvt/scheduler.c | 3 +++
> > 1 file changed, 3 insertions(+)
> >
> > diff --git a/drivers/gpu/drm/i915/gvt/scheduler.c
> > b/drivers/gpu/drm/i915/gvt/scheduler.c
> > index d6b6d0e..e355a82 100644
> > --- a/drivers/gpu/drm/i915/gvt/scheduler.c
> > +++ b/drivers/gpu/drm/i915/gvt/scheduler.c
> > @@ -139,6 +139,9 @@ static int shadow_context_status_change(struct
> notifier_block *nb,
> > struct intel_vgpu_workload *workload =
> > scheduler->current_workload[req->engine->id];
> >
> > + if (unlikely(!workload))
> > + return NOTIFY_OK;
> > +
> > switch (action) {
> > case INTEL_CONTEXT_SCHEDULE_IN:
> > intel_gvt_load_render_mmio(workload->vgpu,
> > --
> > 2.7.4
> >
> > _______________________________________________
> > intel-gvt-dev mailing list
> > intel-gvt-dev at lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/intel-gvt-dev
>
> --
> Open Source Technology Center, Intel ltd.
>
> $gpg --keyserver wwwkeys.pgp.net --recv-keys 4D781827
More information about the intel-gvt-dev
mailing list