All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Wilson <chris@chris-wilson.co.uk>
To: Keith Packard <keithp@keithp.com>, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 2/2] drm/i915: Disable page-faults around the fast pwrite/pread paths
Date: Sat, 09 Jul 2011 21:50:26 +0100	[thread overview]
Message-ID: <aefc95$ohq3u@orsmga001.jf.intel.com> (raw)
In-Reply-To: <yunvcvbfbj1.fsf@aiko.keithp.com>

On Sat, 09 Jul 2011 13:24:02 -0700, Keith Packard <keithp@keithp.com> wrote:
> On Sat,  9 Jul 2011 09:38:51 +0100, Chris Wilson <chris@chris-wilson.co.uk> wrote:
> 
> > +		/* We have to disable faulting here in case the user address
> > +		 * is really a GTT mapping and so we can not enter
> > +		 * i915_gem_fault() whilst already holding struct_mutex.
> > +		 */
> 
> I would (far, far) rather disallow pread through the GTT
> mapping. There's no credible reason to allow it. Is there some
> reasonably fast way to detect that these addresses are within the GTT
> and just bail?

Something like:

vma = find_vma(current->mm, uaddr);
if (vma->vm_ops == dev->driver->gem_vm_ops)
	return -EINVAL;

I think would do, find_vma() is not necessary cheap though, and there are a
couple of optimisations that we haven't done for pwrite/pread yet to speed
up the transition to the slow path.

> Any performance penalty that serves solely to enable abuse of the
> interface is not reasonable.

The current code generates lockdep OOPSes and inconsistently applies
pagefault_disable along some paths, in particular for 32-bit kernels,
but not others. And the abuse is permitted through the OpenGL
specification, I believe. The offending app is just doing
glBufferData(glMapBuffer()), iiuc;
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre

  reply	other threads:[~2011-07-09 20:50 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 [this message]
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

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$ohq3u@orsmga001.jf.intel.com' \
    --to=chris@chris-wilson.co.uk \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=keithp@keithp.com \
    /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.