linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [Xen-devel][PATCH] drm/xen-front: Fix mmap attributes for display buffers
@ 2019-01-29 15:04 Oleksandr Andrushchenko
  2019-01-29 19:07 ` Julien Grall
  0 siblings, 1 reply; 5+ messages in thread
From: Oleksandr Andrushchenko @ 2019-01-29 15:04 UTC (permalink / raw)
  To: xen-devel, linux-kernel, dri-devel, daniel.vetter, jgross,
	boris.ostrovsky, kraxel, noralf, hch, julien.grall
  Cc: andr2000, Oleksandr Andrushchenko

From: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>

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@epam.com>
Suggested-by: Julien Grall <julien.grall@arm.com>
---
 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);
 
 	/*
 	 * vm_operations_struct.fault handler will be called if CPU access
@@ -283,7 +282,7 @@ void *xen_drm_front_gem_prime_vmap(struct drm_gem_object *gem_obj)
 		return NULL;
 
 	return vmap(xen_obj->pages, xen_obj->num_pages,
-		    VM_MAP, pgprot_writecombine(PAGE_KERNEL));
+		    VM_MAP, PAGE_KERNEL);
 }
 
 void xen_drm_front_gem_prime_vunmap(struct drm_gem_object *gem_obj,
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [Xen-devel][PATCH] drm/xen-front: Fix mmap attributes for display buffers
  2019-01-29 15:04 [Xen-devel][PATCH] drm/xen-front: Fix mmap attributes for display buffers Oleksandr Andrushchenko
@ 2019-01-29 19:07 ` Julien Grall
  2019-01-30  9:09   ` Oleksandr Andrushchenko
  2019-02-04  6:55   ` Oleksandr Andrushchenko
  0 siblings, 2 replies; 5+ messages in thread
From: Julien Grall @ 2019-01-29 19:07 UTC (permalink / raw)
  To: Oleksandr Andrushchenko, xen-devel, linux-kernel, dri-devel,
	daniel.vetter, jgross, boris.ostrovsky, kraxel, noralf, hch
  Cc: Oleksandr Andrushchenko

Hi Oleksandr,

On 1/29/19 3:04 PM, Oleksandr Andrushchenko wrote:
> From: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
> 
> 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@epam.com>
> Suggested-by: Julien Grall <julien.grall@arm.com>
> ---
>   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.

With the comment updated:

Acked-by: Julien Grall <julien.grall@arm.com>

Cheers,

-- 
Julien Grall

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Xen-devel][PATCH] drm/xen-front: Fix mmap attributes for display buffers
  2019-01-29 19:07 ` Julien Grall
@ 2019-01-30  9:09   ` Oleksandr Andrushchenko
  2019-02-01  8:56     ` Oleksandr Andrushchenko
  2019-02-04  6:55   ` Oleksandr Andrushchenko
  1 sibling, 1 reply; 5+ messages in thread
From: Oleksandr Andrushchenko @ 2019-01-30  9:09 UTC (permalink / raw)
  To: Julien Grall, Oleksandr Andrushchenko, xen-devel, linux-kernel,
	dri-devel, daniel.vetter, jgross, boris.ostrovsky, kraxel,
	noralf, hch

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@epam.com>
>>
>> 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@epam.com>
>> Suggested-by: Julien Grall <julien.grall@arm.com>
>> ---
>>   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@arm.com>
>
> Cheers,
>
Thank you,
Oleksandr

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Xen-devel][PATCH] drm/xen-front: Fix mmap attributes for display buffers
  2019-01-30  9:09   ` Oleksandr Andrushchenko
@ 2019-02-01  8:56     ` Oleksandr Andrushchenko
  0 siblings, 0 replies; 5+ messages in thread
From: Oleksandr Andrushchenko @ 2019-02-01  8:56 UTC (permalink / raw)
  To: Julien Grall, Oleksandr Andrushchenko, xen-devel, linux-kernel,
	dri-devel, daniel.vetter, jgross, boris.ostrovsky, kraxel,
	noralf, hch

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@epam.com>
>>>
>>> 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@epam.com>
>>> Suggested-by: Julien Grall <julien.grall@arm.com>
>>> ---
>>>   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@arm.com>
>>
If nobody objects I'll apply this to drm-misc-fixes next Monday
>> Cheers,
>>
> Thank you,
> Oleksandr

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Xen-devel][PATCH] drm/xen-front: Fix mmap attributes for display buffers
  2019-01-29 19:07 ` Julien Grall
  2019-01-30  9:09   ` Oleksandr Andrushchenko
@ 2019-02-04  6:55   ` Oleksandr Andrushchenko
  1 sibling, 0 replies; 5+ messages in thread
From: Oleksandr Andrushchenko @ 2019-02-04  6:55 UTC (permalink / raw)
  To: Julien Grall, Oleksandr Andrushchenko, xen-devel, linux-kernel,
	dri-devel, daniel.vetter, jgross, boris.ostrovsky, kraxel,
	noralf, hch

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@epam.com>
>>
>> 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@epam.com>
>> Suggested-by: Julien Grall <julien.grall@arm.com>
>> ---
>>   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.
>
> With the comment updated:
>
> Acked-by: Julien Grall <julien.grall@arm.com>
>
> Cheers,
>
Applied to drm-misc-next

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-02-04  6:56 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-29 15:04 [Xen-devel][PATCH] drm/xen-front: Fix mmap attributes for display buffers Oleksandr Andrushchenko
2019-01-29 19:07 ` Julien Grall
2019-01-30  9:09   ` Oleksandr Andrushchenko
2019-02-01  8:56     ` Oleksandr Andrushchenko
2019-02-04  6:55   ` Oleksandr Andrushchenko

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).