From: "Thomas Hellström" <thellstrom@vmware.com>
To: Ilija Hadzic <ilijahadzic@gmail.com>
Cc: Dave Airlie <airlied@redhat.com>,
linux-graphics-maintainer@vmware.com,
"dri-devel@lists.freedesktop.org"
<dri-devel@lists.freedesktop.org>
Subject: Re: Breakage in "track dev_mapping in more robust and flexible way"
Date: Thu, 25 Oct 2012 20:27:07 +0200 [thread overview]
Message-ID: <5089847B.50808@vmware.com> (raw)
In-Reply-To: <CA+4h6HkCcCG8Yr_DsvKEjKJzVL9bm3bwxO4aG626i9-OwXmRoA@mail.gmail.com>
On 10/25/12 7:12 PM, Ilija Hadzic wrote:
> On Thu, Oct 25, 2012 at 11:10 AM, Thomas Hellström
> <thellstrom@vmware.com> wrote:
>> On 10/25/12 4:41 PM, Jerome Glisse wrote:
>>> On Thu, Oct 25, 2012 at 04:02:25PM +0200, Thomas Hellstrom wrote:
>>>> Hi,
>>>>
>>>> This commit
>>>>
>>>> From 949c4a34afacfe800fc442afac117aba15284962 Mon Sep 17 00:00:00 2001
>>>> From: Ilija Hadzic <ihadzic@research.bell-labs.com>
>>>> Date: Tue, 15 May 2012 16:40:10 -0400
>>>> Subject: [PATCH] drm: track dev_mapping in more robust and flexible way
>>>>
>>>> Setting dev_mapping (pointer to the address_space structure
>>>> used for memory mappings) to the address_space of the first
>>>> opener's inode and then failing if other openers come in
>>>> through a different inode has a few restrictions that are
>>>> eliminated by this patch.
>>>>
>>>> If we already have valid dev_mapping and we spot an opener
>>>> with different i_node, we force its i_mapping pointer to the
>>>> already established address_space structure (first opener's
>>>> inode). This will make all mappings from drm device hang off
>>>> the same address_space object.
>>>> ...
>>>>
>>>> Breaks drivers using TTM, since when the X server calls into the
>>>> driver open, drm's dev_mapping has not
>>>> yet been setup. The setup needs to be moved before the driver's open
>>>> hook is called.
>>>>
>>>> Typically, if a TTM-aware driver is provoked by the Xorg server to
>>>> move a buffer from system to VRAM or AGP,
>>>> before any other drm client is started, The user-space page table
>>>> entries are not killed before the move, and left pointing
>>>> into freed pages, causing system crashes and / or user-space access
>>>> to arbitrary memory.
>>> Doesn't handle move invalidate the drm file mapping before scheduling
>>> the move ?
>> Yes, but to do that it needs a correct value of bdev::dev_mapping, which is
>> now incorrectly set on the
>> *second* open instead of the first open.
>>
> So you are implying that in the first open the assignment of dev->dev_mapping is
> somehow skipped (which could happen if drm_setup returns an error) or that the
> driver on which you are having problems with (nouveau I presume) needs
> dev_mapping
> in the firstopen hook ?
No. On open, driver::open is called from drm::open. It copies the value
of dev->dev_mapping, however,
driver::open is called *before* dev->dev_mapping is set up, so what I'm
saying is that the setup of
dev->dev_mapping must be moved to before driver::open is called from
drm::open
(this was hit while testing vmwgfx with new code, BTW. It will be hard,
but probably possible to trigger
from unpriviliged user-space with the current vmwgfx code.
Thanks,
Thomas
next prev parent reply other threads:[~2012-10-25 18:27 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-25 14:02 Breakage in "track dev_mapping in more robust and flexible way" Thomas Hellstrom
2012-10-25 14:41 ` Jerome Glisse
2012-10-25 15:10 ` Thomas Hellström
2012-10-25 17:12 ` Ilija Hadzic
2012-10-25 17:31 ` Ilija Hadzic
2012-10-25 18:27 ` Thomas Hellström [this message]
2012-10-25 21:27 ` Ilija Hadzic
2012-10-26 8:11 ` Thomas Hellstrom
2012-10-26 13:14 ` Ilija Hadzic
2012-10-29 8:39 ` Thomas Hellstrom
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=5089847B.50808@vmware.com \
--to=thellstrom@vmware.com \
--cc=airlied@redhat.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=ilijahadzic@gmail.com \
--cc=linux-graphics-maintainer@vmware.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 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).