From mboxrd@z Thu Jan 1 00:00:00 1970 From: Chris Wilson 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 Message-ID: References: <1310200731-18086-1-git-send-email-chris@chris-wilson.co.uk> <1310200731-18086-2-git-send-email-chris@chris-wilson.co.uk> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by gabe.freedesktop.org (Postfix) with ESMTP id 7D62B9EDA0 for ; Sat, 9 Jul 2011 13:50:29 -0700 (PDT) In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org To: Keith Packard , intel-gfx@lists.freedesktop.org List-Id: intel-gfx@lists.freedesktop.org On Sat, 09 Jul 2011 13:24:02 -0700, Keith Packard wrote: > On Sat, 9 Jul 2011 09:38:51 +0100, Chris Wilson 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