From: Thomas Hellstrom <thellstrom@vmware.com>
To: Jerome Glisse <j.glisse@gmail.com>
Cc: "airlied@redhat.com" <airlied@redhat.com>,
"dri-devel@lists.freedesktop.org"
<dri-devel@lists.freedesktop.org>
Subject: Re: [PATCH 0/1][RFC] drm/ttm Improved io_mem_reserve / io_mem_free_calling
Date: Thu, 11 Nov 2010 17:50:28 +0100 [thread overview]
Message-ID: <4CDC1ED4.4070903@vmware.com> (raw)
In-Reply-To: <AANLkTikPYXh75qFPYjM-cuHoLa+SR7205C+OqSn6YV2X@mail.gmail.com>
On 11/11/2010 04:27 PM, Jerome Glisse wrote:
> On Thu, Nov 11, 2010 at 3:41 AM, Thomas Hellstrom<thellstrom@vmware.com> wrote:
>
>> The following patch is really intended for the next merge window.
>>
>> RFC:
>> 1) Are there any implementations of driver::io_mem_reserve today that can't use
>> the fastpath?
>> 2) Can we put an atomic requirement on driver::io_mem_reserve /
>> driver::io_mem_free?
>>
>> The patch improves on the io_mem_reserve / io_mem_free calling sequences by
>> introducing a fastpath and an optional eviction mechanism.
>>
>> The fastpath is enabled by default and is switched off by the driver setting
>> struct ttm_mem_type_manager::io_reserve_fastpath to false on mem type init.
>> With the fastpath no locking occurs, and io_mem_free is never called.
>> I'm not sure if there are any implementations today that could not use the
>> fastpath.
>>
>> As mentioned in the patch, if the fastpath is disabled, calls to
>> io_mem_reserve and io_mem_free are exactly balanced, and refcounted within
>> struct ttm_mem_reg so that io_mem_reserve should never be called recursively
>> for the same struct ttm_mem_reg.
>> Locking is required to make sure that ptes are never present on when the
>> underlying memory region is not reserved. Currently I'm using
>> man::io_reserve_mutex for this. Can we use a spinlock? That would require
>> io_mem_reserve and io_mem_free to be atomic.
>>
>> Optionally, there is an eviction mechanism that is activated by setting
>> struct ttm_mem_type_manager::use_io_reserve_lru to true when initialized.
>> If the eviction mechanism is activated, and io_mem_reserve returns -EAGAIN,
>> it will attempt to kill user-space mappings to free up reserved regions.
>> Kernel mappings (ttm_bo_kmap) are not affected.
>>
>>
> Radeon can use fast path, i think nouveau can too. I am not sure we
> can consider io_mem_reserve as atomic. Use case i fear is GPU with
> remappable apperture i don't know what kind of code we would need for
> that and it might sleep. Thought my first guess is that it likely can
> be done atomicly.
>
In that case, I think I will change it to a spinlock, with a code
comment that it can be changed to a mutex later if it turns out to be
very hard / impossible to implement atomic operations. Another possible
concern is the execution of umap_mapping_range() that may in some cases
be long. Perhaps too long to use a spinlock.
> Quick review of the patch looks good, i will try to take a closer look latter.
>
> Cheers,
> Jerome Glisse
>
Great. Thanks,
Thomas
next prev parent reply other threads:[~2010-11-11 16:50 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-11 8:41 [PATCH 0/1][RFC] drm/ttm Improved io_mem_reserve / io_mem_free_calling Thomas Hellstrom
2010-11-11 8:41 ` [PATCH 1/1] drm/ttm: Fix up io_mem_reserve / io_mem_free calling Thomas Hellstrom
2010-11-11 15:27 ` [PATCH 0/1][RFC] drm/ttm Improved io_mem_reserve / io_mem_free_calling Jerome Glisse
2010-11-11 16:50 ` Thomas Hellstrom [this message]
2010-11-11 22:46 ` Ben Skeggs
2010-11-12 7:18 ` 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=4CDC1ED4.4070903@vmware.com \
--to=thellstrom@vmware.com \
--cc=airlied@redhat.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=j.glisse@gmail.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