Re: [PATCH] drm/xen: Add missing VM_DONTEXPAND flag in mmap callback
On 09.05.22 15:51, Oleksandr Tyshchenko wrote: From: Oleksandr Tyshchenko With Xen PV Display driver in use the "expected" VM_DONTEXPAND flag is not set (neither explicitly nor implicitly), so the driver hits the code path in drm_gem_mmap_obj() which triggers the WARNING. Signed-off-by: Oleksandr Tyshchenko Pushed to xen/tip.git for-linus-5.19a Juergen OpenPGP_0xB0DE9DD628BF132F.asc Description: OpenPGP public key OpenPGP_signature Description: OpenPGP digital signature
Re: [PATCH] drm/xen: Add missing VM_DONTEXPAND flag in mmap callback
Hi, Oleksandr! On 09.05.22 16:51, Oleksandr Tyshchenko wrote: > From: Oleksandr Tyshchenko > > With Xen PV Display driver in use the "expected" VM_DONTEXPAND flag > is not set (neither explicitly nor implicitly), so the driver hits > the code path in drm_gem_mmap_obj() which triggers the WARNING. > > Signed-off-by: Oleksandr Tyshchenko Reviewed-by: Oleksandr Andrushchenko > --- > This patch eliminates a WARNING which occurs during running any user space > application over drm (weston, modetest, etc) using PV Display frontend > in Xen guest (it worth mentioning the frontend still works despite the > WARNING): > > root@salvator-x-h3-4x2g-xt-domu:~# modetest -M xendrm-du -s 31:1920x1080 > (XEN) common/grant_table.c:1882:d2v0 Expanding d2 grant table from 5 to 9 > frames > [ 31.566759] [ cut here ] > [ 31.566811] WARNING: CPU: 0 PID: 235 at drivers/gpu/drm/drm_gem.c:1055 > drm_gem_mmap_obj+0x16c/0x180 > [ 31.566864] Modules linked in: > [ 31.566886] CPU: 0 PID: 235 Comm: modetest Not tainted > 5.18.0-rc4-yocto-standard-9-gabe87d78bbc9 #1 > [ 31.566922] Hardware name: XENVM-4.17 (DT) > [ 31.566940] pstate: 6005 (nZCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--) > [ 31.566973] pc : drm_gem_mmap_obj+0x16c/0x180 > [ 31.567001] lr : drm_gem_mmap_obj+0x78/0x180 > [ 31.567026] sp : 89d03bb0 > [ 31.567044] x29: 89d03bb0 x28: 0008 x27: > 0001c42d43c0 > [ 31.567080] x26: 0001c42d4cc0 x25: 07e9 x24: > 0001c0136000 > [ 31.567116] x23: 0001c031 x22: 0001c4002b80 x21: > > [ 31.567150] x20: 0001c42d43c0 x19: 0001c0137600 x18: > 0001 > [ 31.567186] x17: x16: x15: > 00035c81 > [ 31.567220] x14: x13: x12: > > [ 31.567258] x11: 0010 x10: 95d69000 x9 : > 0001c435ac30 > [ 31.567294] x8 : 8001f65ce000 x7 : 0001 x6 : > 0001c24de000 > [ 31.567329] x5 : 89d03a10 x4 : 0090 x3 : > 10046400 > [ 31.567365] x2 : 07e9 x1 : 9dd8cb7c02b1bd00 x0 : > 10fb > [ 31.567401] Call trace: > [ 31.567415] drm_gem_mmap_obj+0x16c/0x180 > [ 31.567439] drm_gem_mmap+0x128/0x228 > [ 31.567460] mmap_region+0x384/0x5a0 > [ 31.567484] do_mmap+0x354/0x4f0 > [ 31.567505] vm_mmap_pgoff+0xdc/0x108 > [ 31.567529] ksys_mmap_pgoff+0x1b8/0x208 > [ 31.567550] __arm64_sys_mmap+0x30/0x48 > [ 31.567576] invoke_syscall+0x44/0x108 > [ 31.567599] el0_svc_common.constprop.0+0xcc/0xf0 > [ 31.567629] do_el0_svc+0x24/0x88 > [ 31.567649] el0_svc+0x2c/0x88 > [ 31.567686] el0t_64_sync_handler+0xb0/0xb8 > [ 31.567708] el0t_64_sync+0x18c/0x190 > [ 31.567731] ---[ end trace ]--- > setting mode 1920x1080-60.00Hz@XR24 on connectors 31, crtc 34 > --- > drivers/gpu/drm/xen/xen_drm_front_gem.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/xen/xen_drm_front_gem.c > b/drivers/gpu/drm/xen/xen_drm_front_gem.c > index 5a5bf4e..e31554d 100644 > --- a/drivers/gpu/drm/xen/xen_drm_front_gem.c > +++ b/drivers/gpu/drm/xen/xen_drm_front_gem.c > @@ -71,7 +71,7 @@ static int xen_drm_front_gem_object_mmap(struct > drm_gem_object *gem_obj, >* the whole buffer. >*/ > vma->vm_flags &= ~VM_PFNMAP; > - vma->vm_flags |= VM_MIXEDMAP; > + vma->vm_flags |= VM_MIXEDMAP | VM_DONTEXPAND; > vma->vm_pgoff = 0; > > /*
[PATCH] drm/xen: Add missing VM_DONTEXPAND flag in mmap callback
From: Oleksandr Tyshchenko With Xen PV Display driver in use the "expected" VM_DONTEXPAND flag is not set (neither explicitly nor implicitly), so the driver hits the code path in drm_gem_mmap_obj() which triggers the WARNING. Signed-off-by: Oleksandr Tyshchenko --- This patch eliminates a WARNING which occurs during running any user space application over drm (weston, modetest, etc) using PV Display frontend in Xen guest (it worth mentioning the frontend still works despite the WARNING): root@salvator-x-h3-4x2g-xt-domu:~# modetest -M xendrm-du -s 31:1920x1080 (XEN) common/grant_table.c:1882:d2v0 Expanding d2 grant table from 5 to 9 frames [ 31.566759] [ cut here ] [ 31.566811] WARNING: CPU: 0 PID: 235 at drivers/gpu/drm/drm_gem.c:1055 drm_gem_mmap_obj+0x16c/0x180 [ 31.566864] Modules linked in: [ 31.566886] CPU: 0 PID: 235 Comm: modetest Not tainted 5.18.0-rc4-yocto-standard-9-gabe87d78bbc9 #1 [ 31.566922] Hardware name: XENVM-4.17 (DT) [ 31.566940] pstate: 6005 (nZCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--) [ 31.566973] pc : drm_gem_mmap_obj+0x16c/0x180 [ 31.567001] lr : drm_gem_mmap_obj+0x78/0x180 [ 31.567026] sp : 89d03bb0 [ 31.567044] x29: 89d03bb0 x28: 0008 x27: 0001c42d43c0 [ 31.567080] x26: 0001c42d4cc0 x25: 07e9 x24: 0001c0136000 [ 31.567116] x23: 0001c031 x22: 0001c4002b80 x21: [ 31.567150] x20: 0001c42d43c0 x19: 0001c0137600 x18: 0001 [ 31.567186] x17: x16: x15: 00035c81 [ 31.567220] x14: x13: x12: [ 31.567258] x11: 0010 x10: 95d69000 x9 : 0001c435ac30 [ 31.567294] x8 : 8001f65ce000 x7 : 0001 x6 : 0001c24de000 [ 31.567329] x5 : 89d03a10 x4 : 0090 x3 : 10046400 [ 31.567365] x2 : 07e9 x1 : 9dd8cb7c02b1bd00 x0 : 10fb [ 31.567401] Call trace: [ 31.567415] drm_gem_mmap_obj+0x16c/0x180 [ 31.567439] drm_gem_mmap+0x128/0x228 [ 31.567460] mmap_region+0x384/0x5a0 [ 31.567484] do_mmap+0x354/0x4f0 [ 31.567505] vm_mmap_pgoff+0xdc/0x108 [ 31.567529] ksys_mmap_pgoff+0x1b8/0x208 [ 31.567550] __arm64_sys_mmap+0x30/0x48 [ 31.567576] invoke_syscall+0x44/0x108 [ 31.567599] el0_svc_common.constprop.0+0xcc/0xf0 [ 31.567629] do_el0_svc+0x24/0x88 [ 31.567649] el0_svc+0x2c/0x88 [ 31.567686] el0t_64_sync_handler+0xb0/0xb8 [ 31.567708] el0t_64_sync+0x18c/0x190 [ 31.567731] ---[ end trace ]--- setting mode 1920x1080-60.00Hz@XR24 on connectors 31, crtc 34 --- drivers/gpu/drm/xen/xen_drm_front_gem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/xen/xen_drm_front_gem.c b/drivers/gpu/drm/xen/xen_drm_front_gem.c index 5a5bf4e..e31554d 100644 --- a/drivers/gpu/drm/xen/xen_drm_front_gem.c +++ b/drivers/gpu/drm/xen/xen_drm_front_gem.c @@ -71,7 +71,7 @@ static int xen_drm_front_gem_object_mmap(struct drm_gem_object *gem_obj, * the whole buffer. */ vma->vm_flags &= ~VM_PFNMAP; - vma->vm_flags |= VM_MIXEDMAP; + vma->vm_flags |= VM_MIXEDMAP | VM_DONTEXPAND; vma->vm_pgoff = 0; /* -- 2.7.4