All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Wilson <chris@chris-wilson.co.uk>
To: akash goel <akash.goels@gmail.com>
Cc: intel-gfx@lists.freedesktop.org, "Goel, Akash" <akash.goel@intel.com>
Subject: Re: [PATCH v1] drm/i915/guc: Fix a fw content lost issue after it is evicted
Date: Mon, 23 Nov 2015 09:37:32 +0000	[thread overview]
Message-ID: <20151123093732.GB20097@nuc-i3427.alporthouse.com> (raw)
In-Reply-To: <CAK_0AV0mPzNUhF+GvQT-kbj=+01viOrx=uionDdN6oR8F0GMwA@mail.gmail.com>

On Mon, Nov 23, 2015 at 02:48:24PM +0530, akash goel wrote:
> On Wed, Nov 11, 2015 at 2:37 PM, Chris Wilson <chris@chris-wilson.co.uk> wrote:
> > On Tue, Nov 10, 2015 at 03:27:36PM -0800, yu.dai@intel.com wrote:
> >> From: Alex Dai <yu.dai@intel.com>
> >>
> >> We keep a copy of GuC fw in a GEM obj. However its content is lost
> >> if the GEM obj is swapped (igt/gem_evict_*). Therefore, the later
> >> fw loading during GPU reset will fail. Mark the obj dirty after
> >> copying data into the pages. So its content will be kept during
> >> swapped out.
> >>
> >> Signed-off-by: Alex Dai <yu.dai@intel.com>
> >> ---
> >>  drivers/gpu/drm/i915/i915_gem.c | 1 +
> >>  1 file changed, 1 insertion(+)
> >>
> >> diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> >> index f1e3fde..3b15167 100644
> >> --- a/drivers/gpu/drm/i915/i915_gem.c
> >> +++ b/drivers/gpu/drm/i915/i915_gem.c
> >> @@ -5199,6 +5199,7 @@ i915_gem_object_create_from_data(struct drm_device *dev,
> >>       i915_gem_object_pin_pages(obj);
> >>       sg = obj->pages;
> >>       bytes = sg_copy_from_buffer(sg->sgl, sg->nents, (void *)data, size);
> >> +     obj->dirty = 1;
> >
> > That's one way of doing it, but atypical for our CPU access to the pages.
> > The root cause is still that sg_copy_from_buffer() isn't calling
> > set_page_dirty() and so there will be other places in the kernel that
> > fall foul of it. Also, not that we could have written this to not require
> > the whole object to be pinned at once as well.
> >
> > I would prefer this to be fixed in sg_copy_from_buffer() for the reason
> > that all callers are susceptible to this bug.
> > -Chris
> 
> Probably the sg_copy_from_buffer is written with an assumption that
> the pages it is supposed to write to,

Seems unlikely considering it is supposed to be a generic library
helper.

> would always be the kernel pages (GFP_KERNEL), which will always be
> resident in RAM. Thus no real need to mark the pages as dirty.
> Or the Clients/Users of  sg_copy_from_buffer function are expected to
> explicitly mark the pages as dirty.

In which case, we shouldn't be using it. So back to making the library
function correct, or using a better interface to write the shmemfs pages
directly (which would avoid the extra clears, or for more points an
internal object which we can write and avoid even the kmalloc through
the generic firmware loader).
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2015-11-23  9:37 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-06 21:55 [PATCH] drm/i915/guc: Fix a fw content lost issue after it is evicted yu.dai
2015-11-06 22:07 ` Chris Wilson
2015-11-06 23:18   ` Yu Dai
2015-11-09 10:15     ` Chris Wilson
2015-11-10 23:27       ` [PATCH v1] " yu.dai
2015-11-11  9:07         ` Chris Wilson
2015-11-11 19:01           ` Yu Dai
2015-11-23  9:18           ` akash goel
2015-11-23  9:37             ` Chris Wilson [this message]
2015-11-24 15:47         ` Dave Gordon
2015-11-24 16:04           ` Daniel Vetter
2015-11-24 17:47             ` Dave Gordon
2015-11-24 18:06               ` Daniel Vetter
2015-11-24 23:01                 ` Chris Wilson
2015-11-25  8:40                   ` Daniel Vetter
2015-11-25  9:02                     ` Chris Wilson
2015-11-25  9:59                       ` Daniel Vetter
2015-11-10 23:29       ` [PATCH] " Yu Dai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20151123093732.GB20097@nuc-i3427.alporthouse.com \
    --to=chris@chris-wilson.co.uk \
    --cc=akash.goel@intel.com \
    --cc=akash.goels@gmail.com \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.