From: Jerome Glisse Subject: Re: [PATCH 01/12] drm/ttm: remove userspace backed ttm object support Date: Wed, 9 Nov 2011 15:34:05 -0500 Message-ID: <20111109203405.GC13067@homer.localdomain> References: <1320709232-29477-1-git-send-email-j.glisse@gmail.com> <1320709232-29477-2-git-send-email-j.glisse@gmail.com> <4EB8D8C8.7090808@vmware.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail-qw0-f42.google.com (mail-qw0-f42.google.com [209.85.216.42]) by gabe.freedesktop.org (Postfix) with ESMTP id B3C04A0B11 for ; Wed, 9 Nov 2011 12:29:59 -0800 (PST) Received: by qadc16 with SMTP id c16so1834058qad.15 for ; Wed, 09 Nov 2011 12:29:59 -0800 (PST) Content-Disposition: inline In-Reply-To: <4EB8D8C8.7090808@vmware.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dri-devel-bounces+sf-dri-devel=m.gmane.org@lists.freedesktop.org Errors-To: dri-devel-bounces+sf-dri-devel=m.gmane.org@lists.freedesktop.org To: Thomas Hellstrom Cc: Jerome Glisse , dri-devel@lists.freedesktop.org List-Id: dri-devel@lists.freedesktop.org On Tue, Nov 08, 2011 at 08:22:48AM +0100, Thomas Hellstrom wrote: > On 11/08/2011 12:40 AM, j.glisse@gmail.com wrote: > >From: Jerome Glisse > > > >This was never use in none of the driver, properly using userspace > >page for bo would need more code (vma interaction mostly). Removing > >this dead code in preparation of ttm_tt& backend merge. > > > > Jerome, > I actually have using user-space TTMs in the pipe for vmwgfx, and it > doesn't need more code > (it was used by the psb driver). There are extra requirements, > though: It only supports cached memory and user-space CPU-access > needs to be done using existing VMAs. > > Anyway, I'll try to figure out a way to do this in the context of > the unified tt / tt_backends. > Issue, and i might be wrong here, is that you need to mark the user vma as reserved and you need to split the vma to covert only the portion you want. linux kernel a no helper for that. omap people use mlock on the range they want to use to make sure that page associated to the vma are lock and that the vma is split to only cover the range. I don't think it's safe/enough as userspace can unlock the vma in our back and things might fall apart at that point. My idea was to use mlock to split the vma and then set the reserved flags on the vma. This will forbid userspace to munlock. When memory is no longer needed you have to go back to locked flag and then munlock. Also we might want to do things with page of the vma, for instance if the object move to vram we might want to free those pages, but here i fear i need to take a closer look at linux mm to see what we can do safely on those page to not break any of the kernel assumptions on those pages. Anyway, from my inspection this whole things is fragile in regards of other mm activities that might happen. Cheers, Jerome