Hi, Oleksandr! On 09.05.22 16:51, Oleksandr Tyshchenko wrote: > From: Oleksandr Tyshchenko <oleksandr_tyshchenko@xxxxxxxx> > > 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 <oleksandr_tyshchenko@xxxxxxxx> Reviewed-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@xxxxxxxx> > --- > 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-00009-gabe87d78bbc9 #1 > [ 31.566922] Hardware name: XENVM-4.17 (DT) > [ 31.566940] pstate: 60000005 (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 : ffff800009d03bb0 > [ 31.567044] x29: ffff800009d03bb0 x28: 0000000000000008 x27: ffff0001c42d43c0 > [ 31.567080] x26: ffff0001c42d4cc0 x25: 00000000000007e9 x24: ffff0001c0136000 > [ 31.567116] x23: ffff0001c0310000 x22: ffff0001c4002b80 x21: 0000000000000000 > [ 31.567150] x20: ffff0001c42d43c0 x19: ffff0001c0137600 x18: 0000000000000001 > [ 31.567186] x17: 0000000000000000 x16: 0000000000000000 x15: 0000000000035c81 > [ 31.567220] x14: 0000000000000000 x13: 0000000000000000 x12: 0000000000000000 > [ 31.567258] x11: 0000000000100000 x10: 0000ffff95d69000 x9 : ffff0001c435ac30 > [ 31.567294] x8 : ffff8001f65ce000 x7 : 0000000000000001 x6 : ffff0001c24de000 > [ 31.567329] x5 : ffff800009d03a10 x4 : 0000000000000090 x3 : 0000000010046400 > [ 31.567365] x2 : 00000000000007e9 x1 : 9dd8cb7c02b1bd00 x0 : 00000000100000fb > [ 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 0000000000000000 ]--- > 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; > > /*