userptr support in drm drivers

Christian König christian.koenig at
Thu Feb 18 09:48:18 UTC 2016

Hi Jean,

Am 18.02.2016 um 09:59 schrieb Jean Delvare:
> Hi Daniel,
> On Tue, 16 Feb 2016 22:14:12 +0100, Daniel Vetter wrote:
>> On Tue, Feb 16, 2016 at 09:33:51PM +0100, Christian König wrote:
>>> At least for Radeon and Amdgpu the current situation is actually what we
>>> want.
>>>> However I still find it confusing
>>>> that full userptr support is under #if defined(CONFIG_MMU_NOTIFIER),
>>>> and not under #if defined(CONFIG_RADEON_USERPTR), resp. #if
>>>> defined(CONFIG_AMDGPU_USERPTR). It means that full userptr support may
>>>> be included even if these options are disabled.
>>> Which is perfectly fine. Userptr support should be enabled when MMU_NOTIFIER
>>> is available.
>>> How this becomes available is a different story. You can explicitly enable
>>> it which then pulls in the MMU_NOTIFIER dependency or you just enable it
>>> when you have the notfier anyway because of some other dependency.
>>> That we have two options doing the same is just a matter of branching of
>>> amdgpu from radeon and not cleaning up the configuration options. So feel
>>> free to cleaning this up and write a patch which makes pulling in
>>> MMU_NOTIFIER as a general DRM option.
>> Yeah I like that flow. Jean, if you want to bring i915 into alignment with
>> radone by adding a I915_USERPTR option that selects MMU_NOTIFIER (probably
>> default y since vulkan needs this), then I very much want will merge it.
> Maybe I was not clear enough in my original post, but I am really
> advocating for FEWER kconfig options, not more. Plus I just explained
> why I think the radeon and amdgpu drivers do it wrong, so I'm certainly
> not going to align i915 on that.
>> Distro kernels pretty much all select MMU_NOTIFIER already for unrelated
>> reasons, but it's good to be less suprising for everyone who builds their
>> own custom kernel.
> The current situation is actually very surprising and this is what I
> would like to change. The options of one driver depending on choices
> made somewhere else is utterly confusing. CONFIG_RADEON_USERPTR and
> CONFIG_AMDGPU_USERPTR give the user a little more control where i915
> gives none, but that's only in one direction (you can force full
> userptr support in, but you can't force it out.)

As I said, that is perfectly fine and exactly what we want.

> I'm still waiting for someone to explain why we can't just
> unconditionally select MMU_NOTIFIER in these 3 drivers and be done with
> it. That's less work at kernel configuration time AND fewer
> preprocessing conditionals within the code, so easier/better testing
> coverage and more readable code. We would need a very good reason for
> NOT doing it.

Adding the MMU Notifier causes overhead in the MM which people want to 
avoid when they don't need userptr support.

We used to select MMU_NOTIFIER unconditionally before and explicitly 
added this option on user request. So yes it is clearly necessary.

The additional userptr support code in the drivers are negligible so 
always enabling the code when the MMU Notifier is available is also 
perfectly fine.

So if you want to clean it up make a common DRM option which selects MMU 
Notifier if it isn't already selected.


More information about the dri-devel mailing list