From: Chris Wilson <chris@chris-wilson.co.uk>
To: Ben Widawsky <ben@bwidawsk.net>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 1/2] drm/i915: Prefault all pages for pread and pwrite
Date: Sun, 10 Jul 2011 09:08:50 +0100 [thread overview]
Message-ID: <aefc95$okvdr@orsmga001.jf.intel.com> (raw)
In-Reply-To: <20110710014031.GA8410@cloud01>
On Sun, 10 Jul 2011 01:40:31 +0000, Ben Widawsky <ben@bwidawsk.net> wrote:
> On Sat, Jul 09, 2011 at 09:38:50AM +0100, Chris Wilson wrote:
> > diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> > index 4fc9738..2fce620 100644
> > --- a/drivers/gpu/drm/i915/i915_gem.c
> > +++ b/drivers/gpu/drm/i915/i915_gem.c
> > @@ -503,6 +503,19 @@ out:
> > return ret;
> > }
> >
> > +static int prefault_writeable(unsigned long uaddr, unsigned long len)
> > +{
> > + int ret = 0;
> > +
> > + len += uaddr;
> > + while (uaddr < len) {
> > + ret |= __put_user(0, (char __user *)uaddr);
> > + uaddr += 4096;
> > + }
> > +
> > + return ret ? -EFAULT : 0;
> > +}
> > +
> > /**
> > * Reads data from the object referenced by handle.
> > *
>
> What's the reason for not breaking out of the loop on the first failing
> fault? It seems like you could incur a bunch of latency for a call which
> you know will ending up failin anyway. Although TBH I'm not clear how
> it could actually fail if you've called access_ok().
Because encountering a fault in that loop is an extremely rare event, and
the branch inside the loop appeared on the profiles.
-Chris
--
Chris Wilson, Intel Open Source Technology Centre
prev parent reply other threads:[~2011-07-10 13:33 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-09 8:38 [PATCH 1/2] drm/i915: Prefault all pages for pread and pwrite Chris Wilson
2011-07-09 8:38 ` [PATCH 2/2] drm/i915: Disable page-faults around the fast pwrite/pread paths Chris Wilson
2011-07-09 14:41 ` Eric Anholt
2011-07-09 17:40 ` Chris Wilson
2011-07-09 20:24 ` Keith Packard
2011-07-09 20:50 ` Chris Wilson
2011-07-09 21:06 ` Keith Packard
2011-07-09 21:23 ` Chris Wilson
2011-07-09 22:07 ` Keith Packard
2011-07-11 16:51 ` Chris Wilson
2011-07-11 19:55 ` Keith Packard
2011-07-10 18:45 ` Eric Anholt
2011-07-10 20:29 ` Keith Packard
2011-07-09 20:21 ` [PATCH 1/2] drm/i915: Prefault all pages for pread and pwrite Keith Packard
2011-07-09 20:31 ` Chris Wilson
2011-07-10 1:40 ` Ben Widawsky
2011-07-10 8:08 ` Chris Wilson [this message]
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='aefc95$okvdr@orsmga001.jf.intel.com' \
--to=chris@chris-wilson.co.uk \
--cc=ben@bwidawsk.net \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).