[drm:qxl] BUG: sleeping function called from invalid context - qxl_bo_kmap_atomic_page()...splat
From: Mike Galbraith
Date: Mon May 08 2017 - 06:33:39 EST
Greetings,
I'm meeting this splat in master, call io_mapping_map_atomic_wc(),
then do something sleepy. In master-rt, I meet a variant of this
doing read_lock() in find_next_iomem_res(), due to rwlocks being
sleepy in RT.
[ 53.286236] BUG: sleeping function called from invalid context at mm/slab.h:432
[ 53.286809] in_atomic(): 1, irqs_disabled(): 0, pid: 2078, name: Xorg
[ 53.287354] Preemption disabled at:
[ 53.287360] [<ffffffffa0269c45>] qxl_bo_kmap_atomic_page+0xa5/0x100 [qxl]
[ 53.288028] CPU: 0 PID: 2078 Comm: Xorg Tainted: G E 4.12.0-master #35
[ 53.288530] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.8.1-0-g4adadbd-20161202_174313-build11a 04/01/2014
[ 53.289337] Call Trace:
[ 53.289513] dump_stack+0x65/0x89
[ 53.289739] ? qxl_bo_kmap_atomic_page+0xa5/0x100 [qxl]
[ 53.290084] ___might_sleep+0x11a/0x190
[ 53.290336] __might_sleep+0x4a/0x80
[ 53.290575] ? reserve_memtype+0xa5/0x390
[ 53.290841] kmem_cache_alloc_trace+0x46/0x180
[ 53.291185] reserve_memtype+0xa5/0x390
[ 53.291442] ? ttm_bo_kmap+0x1f5/0x230 [ttm]
[ 53.291724] __ioremap_caller+0xf2/0x330
[ 53.291987] ? preempt_count_add+0x47/0xb0
[ 53.292284] ioremap_nocache+0x17/0x20
[ 53.292536] ttm_bo_kmap+0x1f5/0x230 [ttm]
[ 53.292816] qxl_bo_kmap+0x43/0x70 [qxl]
[ 53.293076] qxl_cursor_atomic_update+0x8d/0x260 [qxl]
[ 53.293427] ? drm_atomic_helper_update_legacy_modeset_state+0x1d6/0x210 [drm_kms_helper]
[ 53.293966] drm_atomic_helper_commit_planes+0xec/0x230 [drm_kms_helper]
[ 53.294403] drm_atomic_helper_commit_tail+0x2b/0x60 [drm_kms_helper]
[ 53.294824] commit_tail+0x65/0x70 [drm_kms_helper]
[ 53.295145] drm_atomic_helper_commit+0xa9/0x100 [drm_kms_helper]
[ 53.295549] drm_atomic_commit+0x4b/0x50 [drm]
[ 53.295843] drm_atomic_helper_update_plane+0xf1/0x110 [drm_kms_helper]
[ 53.296407] __setplane_internal+0x19f/0x280 [drm]
[ 53.296737] drm_mode_cursor_universal+0x101/0x1c0 [drm]
[ 53.297091] drm_mode_cursor_common+0x15b/0x1d0 [drm]
[ 53.297434] drm_mode_cursor2_ioctl+0xe/0x10 [drm]
[ 53.297758] drm_ioctl+0x211/0x460 [drm]
[ 53.298205] ? drm_mode_cursor_ioctl+0x50/0x50 [drm]
[ 53.298638] ? handle_mm_fault+0x93/0x160
[ 53.298960] do_vfs_ioctl+0x96/0x6e0
[ 53.299200] ? __fget+0x73/0xa0
[ 53.299410] SyS_ioctl+0x41/0x70
[ 53.299630] entry_SYSCALL_64_fastpath+0x1a/0xa5
[ 53.299934] RIP: 0033:0x7fcdedfb0bc7
[ 53.300170] RSP: 002b:00007fffbde2ed48 EFLAGS: 00003246 ORIG_RAX: 0000000000000010
[ 53.300660] RAX: ffffffffffffffda RBX: 0000000000000040 RCX: 00007fcdedfb0bc7
[ 53.301130] RDX: 00007fffbde2ed80 RSI: 00000000c02464bb RDI: 000000000000000b
[ 53.301609] RBP: 0000000000000040 R08: 0000000000000040 R09: 000000000000000c
[ 53.302124] R10: 00007fffbde2eb80 R11: 0000000000003246 R12: 0000000000000018
[ 53.302614] R13: 000000000275b390 R14: 0000000000000040 R15: 00007fffbde2ee6c