public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: "Thomas Hellström" <thomas@shipmail.org>
Cc: Jesse Barnes <jbarnes@virtuousgeek.org>,
	Dave Airlie <airlied@linux.ie>,
	linux-kernel@vger.kernel.org, kerolasa@iki.fi,
	Laurent Pinchart <laurent.pinchart@skynet.be>,
	Dickins <hugh@veritas.com>,
	dri-devel@lists.sourceforge.net, kerolasa@gmail.com
Subject: Re: PROBLEM: kernel BUG at drivers/gpu/drm/drm_fops.c:146!
Date: Fri, 30 Jan 2009 01:21:34 -0800	[thread overview]
Message-ID: <20090130012134.bb4fe0bf.akpm@linux-foundation.org> (raw)
In-Reply-To: <4982C4D3.4040704@shipmail.org>

On Fri, 30 Jan 2009 10:13:55 +0100 Thomas Hellstr__m <thomas@shipmail.org> wrote:

> >> Sounds right to me.  The offsets are just handles, not real file objects or 
> >> backing store addresses.  We use them to take advantage of all the inode 
> >> address mapping helpers, since they track stuff for us.
> >>
> >> That said, unmap_mapping_range may not be the best way to do this; basically 
> >> we need a way to invalidate a given processes' mapping of a GTT range (which 
> >> in turn is backed by real RAM).  If there's some other way we should be doing 
> >> this I'm all ears.
> >>     
> >
> > Well, we'd need to call in the big guns on this one - I've already
> > stirred Hugh ;)
> >
> > unmap_mapping_range() is basically a truncate thing - it shoots down
> > all mappings of a range of a *file*.  Across all processes in the
> > machine which map that file.
> >
> > If that isn't what you want to do (and it sounds that way) then you'd
> > want to use something which is mm_struct (or vma) centric, rather than
> > file-centric.  zap_page_range(), methinks.
> >
> >   
> I guess I was the one starting to use this function, so some explanation:
> 
> When the drm device is used to provide address space for buffers, 
> user-space actually see it as a file with a distinct offset where 
> buffers are laid out in a linear fashion, To access a certain buffer you 
> need to lseek() to the correct offset and then read() write() or, the 
> more common use, mmap / munmap.
> 
> When looking through its implementation, unmap_mapping_range() seemed to 
> do exactly the thing I wanted, namely to kill all user-space mappings of 
> all vmas of all processes mapping a part of the device address space. 

That's different from what Jesse said.  That _is_ a more appropriate
use of unmap_mapping_range().  Although all the futzing that function
does with truncate_count is now looking inappropriately-placed.

> And it saves us from storing a list of all vmas mapping the device 
> within the drm device.
> 
> What makes usage of unmap_mapping_range() on a device node with a well 
> defined offset-to-data mapping different from using it on a file?

umm, nothing I guess, if the driver sufficiently imitates a regular
file.  It's unexpected (by me).  I don't think we wrote that code with
this application in mind ;)




  reply	other threads:[~2009-01-30  9:22 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <a6f8318b0901210358w7cced8e9yab86c487b3587d75@mail.gmail.com>
2009-01-21 12:27 ` PROBLEM: kernel BUG at drivers/gpu/drm/drm_fops.c:146! Sami Kerola
2009-01-30  0:30   ` Andrew Morton
2009-01-30  1:06     ` Dave Airlie
2009-01-30  1:17       ` Dan Nicholson
2009-01-30  1:20       ` Andrew Morton
2009-01-30  1:43         ` Dave Airlie
2009-01-30  3:50           ` Jesse Barnes
2009-01-30  4:44             ` Andrew Morton
2009-01-30  8:42               ` Sami Kerola
2009-01-30  9:13               ` Thomas Hellström
2009-01-30  9:21                 ` Andrew Morton [this message]
2009-01-30 10:42                   ` Thomas Hellström
2009-01-30 16:55                   ` Jesse Barnes

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=20090130012134.bb4fe0bf.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=airlied@linux.ie \
    --cc=dri-devel@lists.sourceforge.net \
    --cc=hugh@veritas.com \
    --cc=jbarnes@virtuousgeek.org \
    --cc=kerolasa@gmail.com \
    --cc=kerolasa@iki.fi \
    --cc=laurent.pinchart@skynet.be \
    --cc=linux-kernel@vger.kernel.org \
    --cc=thomas@shipmail.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