[PATCH 3/3] drm/amdgpu: more descriptive message if HMM not enabled

Michel Dänzer michel at daenzer.net
Wed Mar 6 14:53:16 UTC 2019


On 2019-03-06 3:42 p.m., Yang, Philip wrote:
> On 2019-03-06 4:05 a.m., Michel Dänzer wrote:
>> On 2019-03-05 7:09 p.m., Yang, Philip wrote:
>>> If using old kernel config file, CONFIG_ZONE_DEVICE is not selected,
>>> so CONFIG_HMM and CONFIG_HMM_MIRROR is not enabled, the current driver
>>> error message "Failed to register MMU notifier" is not clear. Inform
>>> user with more descriptive message on how to fix the missing kernel
>>> config option.
>>>
>>> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=109808
>>>
>>> Change-Id: Idfebaeababa4c37c1ef093c2b91a26910a167585
>>> Signed-off-by: Philip Yang <Philip.Yang at amd.com>
>>> ---
>>>   drivers/gpu/drm/amd/amdgpu/amdgpu_mn.h | 2 ++
>>>   1 file changed, 2 insertions(+)
>>>
>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mn.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_mn.h
>>> index 4803e216e174..b155cac52aca 100644
>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mn.h
>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mn.h
>>> @@ -53,6 +53,8 @@ static inline struct amdgpu_mn *amdgpu_mn_get(struct amdgpu_device *adev,
>>>   }
>>>   static inline int amdgpu_mn_register(struct amdgpu_bo *bo, unsigned long addr)
>>>   {
>>> +	DRM_ERROR("HMM_MIRROR kernel config option is not enabled\n");
>>> +	DRM_ERROR("add CONFIG_ZONE_DEVICE=y in config file to fix this\n");
>>>   	return -ENODEV;
>>>   }
>>>   static inline void amdgpu_mn_unregister(struct amdgpu_bo *bo) {}
>>>
>>
>> amdgpu_gem_userptr_ioctl calls amdgpu_mn_register if userspace sets the
>> AMDGPU_GEM_USERPTR_REGISTER flag, so buggy/malicious userspace could
>> spam dmesg with these errors. I'm afraid a different solution is needed.
>>
> The error message is inside dummy function amdgpu_mn_register, it only 
> shows if kernel config option HMM is not enabled. Driver does need HMM 
> kernel option to support userptr. We want to provide obvious message to 
> users to update kernel config file from old kernel, otherwise all 
> userptr related functions are broken. I will change this to WARN_ONCE to 
> avoid spam dmesg.

I hope you mean DRM_WARN_ONCE. :) Plain WARN_ONCE is probably also too
noisy/scary for something that can be triggered by userspace.


-- 
Earthling Michel Dänzer               |              https://www.amd.com
Libre software enthusiast             |             Mesa and X developer


More information about the amd-gfx mailing list