Re: [Xen-devel][PATCH] drm/xen-front: Fix mmap attributes for display buffers

From: Oleksandr Andrushchenko
Date: Fri Feb 01 2019 - 03:56:43 EST


On 1/30/19 11:09 AM, Oleksandr Andrushchenko wrote:
> On 1/29/19 9:07 PM, Julien Grall wrote:
>> Hi Oleksandr,
>>
>> On 1/29/19 3:04 PM, Oleksandr Andrushchenko wrote:
>>> From: Oleksandr Andrushchenko <oleksandr_andrushchenko@xxxxxxxx>
>>>
>>> When GEM backing storage is allocated those are normal pages,
>>> so there is no point using pgprot_writecombine while mmaping.
>>> This fixes mismatch of buffer pages' memory attributes between
>>> the frontend and backend which may cause screen artifacts.
>>>
>>> Fixes: c575b7eeb89f ("drm/xen-front: Add support for Xen PV display
>>> frontend")
>>>
>>> Signed-off-by: Oleksandr Andrushchenko
>>> <oleksandr_andrushchenko@xxxxxxxx>
>>> Suggested-by: Julien Grall <julien.grall@xxxxxxx>
>>> ---
>>> Â drivers/gpu/drm/xen/xen_drm_front_gem.c | 5 ++---
>>> Â 1 file changed, 2 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/xen/xen_drm_front_gem.c
>>> b/drivers/gpu/drm/xen/xen_drm_front_gem.c
>>> index d303a2e17f5e..9d5c03d7668d 100644
>>> --- a/drivers/gpu/drm/xen/xen_drm_front_gem.c
>>> +++ b/drivers/gpu/drm/xen/xen_drm_front_gem.c
>>> @@ -235,8 +235,7 @@ static int gem_mmap_obj(struct xen_gem_object
>>> *xen_obj,
>>> ÂÂÂÂÂ vma->vm_flags &= ~VM_PFNMAP;
>>> ÂÂÂÂÂ vma->vm_flags |= VM_MIXEDMAP;
>>> ÂÂÂÂÂ vma->vm_pgoff = 0;
>>> -ÂÂÂ vma->vm_page_prot =
>>> - pgprot_writecombine(vm_get_page_prot(vma->vm_flags));
>>> +ÂÂÂ vma->vm_page_prot = vm_get_page_prot(vma->vm_flags);
>>
>> The patch looks good to me. It would be worth expanding the comment a
>> bit before to explain that we overwrite vm_page_prot to use cacheable
>> attribute as required by the Xen ABI.
>>
> Ok, then I'll put:
>
> +ÂÂÂÂÂÂ /*
> +ÂÂÂÂÂÂÂ * According to Xen on ARM ABI (xen/include/public/arch-arm.h):
> +ÂÂÂÂÂÂÂ * all memory which is shared with other entities in the system
> +ÂÂÂÂÂÂÂ * (including the hypervisor and other guests) must reside in
> memory
> +ÂÂÂÂÂÂÂ * which is mapped as Normal Inner Write-Back Outer Write-Back
> +ÂÂÂÂÂÂÂ * Inner-Shareable.
> +ÂÂÂÂÂÂÂ */
> ÂÂÂÂÂÂÂ vma->vm_page_prot = vm_get_page_prot(vma->vm_flags);
> Please let me know if this is not what you want
>> With the comment updated:
>>
>> Acked-by: Julien Grall <julien.grall@xxxxxxx>
>>
If nobody objects I'll apply this to drm-misc-fixes next Monday
>> Cheers,
>>
> Thank you,
> Oleksandr