linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [BUG] completely bonkers use of set_need_resched + VM_FAULT_NOPAGE
@ 2013-09-12 15:06 Peter Zijlstra
  2013-09-12 15:11 ` Maarten Lankhorst
  2013-09-12 15:36 ` Daniel Vetter
  0 siblings, 2 replies; 58+ messages in thread
From: Peter Zijlstra @ 2013-09-12 15:06 UTC (permalink / raw)
  To: airlied
  Cc: Daniel Vetter, Maarten Lankhorst, Thomas Hellstrom, intel-gfx,
	dri-devel, linux-kernel, Ingo Molnar, Thomas Gleixner

Hi Dave,

So I'm poking around the preemption code and stumbled upon:

drivers/gpu/drm/i915/i915_gem.c:                set_need_resched();
drivers/gpu/drm/ttm/ttm_bo_vm.c:                        set_need_resched();
drivers/gpu/drm/ttm/ttm_bo_vm.c:                        set_need_resched();
drivers/gpu/drm/udl/udl_gem.c:          set_need_resched();

All these sites basically do:

  while (!trylock())
  	yield();

which is a horrible and broken locking pattern. 

Firstly its deadlock prone, suppose the faulting process is a FIFOn+1
task that preempted the lock holder at FIFOn.

Secondly the implementation is worse than usual by abusing
VM_FAULT_NOPAGE, which is supposed to install a PTE so that the fault
doesn't retry, but you're using it as a get out of fault path. And
you're using set_need_resched() which is not something a driver should
_ever_ touch.

Now I'm going to take away set_need_resched() -- and while you can
'reimplement' it using set_thread_flag() you're not going to do that
because it will be broken due to changes to the preempt code.

So please as to fix ASAP and don't allow anybody to trick you into
merging silly things like that again ;-)

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

end of thread, other threads:[~2013-10-09 12:37 UTC | newest]

Thread overview: 58+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-12 15:06 [BUG] completely bonkers use of set_need_resched + VM_FAULT_NOPAGE Peter Zijlstra
2013-09-12 15:11 ` Maarten Lankhorst
2013-09-12 15:14   ` Peter Zijlstra
2013-09-12 15:36 ` Daniel Vetter
2013-09-12 15:43   ` Peter Zijlstra
2013-09-12 15:58     ` Daniel Vetter
2013-09-12 16:22       ` Peter Zijlstra
2013-09-12 16:35         ` Chris Wilson
2013-09-12 20:30           ` Peter Zijlstra
2013-09-12 20:37             ` Thomas Gleixner
2013-09-12 19:52         ` Daniel Vetter
2013-09-12 19:58           ` Thomas Gleixner
2013-09-12 20:04             ` Daniel Vetter
2013-09-12 20:20               ` Thomas Gleixner
2013-09-12 20:23                 ` Daniel Vetter
2013-09-12 20:39                   ` Thomas Gleixner
2013-09-12 20:48                     ` Thomas Hellstrom
2013-09-12 16:33       ` Thomas Hellstrom
2013-09-12 15:45   ` Maarten Lankhorst
2013-09-12 16:44     ` Thomas Hellstrom
2013-09-12 19:48       ` Daniel Vetter
2013-09-12 21:50       ` Maarten Lankhorst
2013-09-13  5:33         ` Thomas Hellstrom
2013-09-13  8:26           ` Daniel Vetter
2013-10-08 14:14           ` [RFC PATCH] drm/radeon: fixup locking inversion between mmap_sem and reservations Maarten Lankhorst
2013-10-08 14:33             ` Jerome Glisse
2013-10-08 14:45               ` Christian König
2013-10-08 14:55                 ` Jerome Glisse
2013-10-08 16:29                   ` Thomas Hellstrom
2013-10-08 16:47                     ` Jerome Glisse
2013-10-08 16:58                       ` Thomas Hellstrom
2013-10-09 12:36                         ` [RFC PATCH v2] drm/radeon: fixup locking inversion between, " Maarten Lankhorst
2013-10-09 10:58                       ` [RFC PATCH] drm/radeon: fixup locking inversion between " Maarten Lankhorst
2013-10-08 14:45               ` Maarten Lankhorst
2013-09-13  6:44         ` [BUG] completely bonkers use of set_need_resched + VM_FAULT_NOPAGE Thomas Hellstrom
2013-09-13  7:16           ` Maarten Lankhorst
2013-09-13  7:46             ` Thomas Hellstrom
2013-09-13  7:51               ` Maarten Lankhorst
2013-09-13  8:23                 ` Thomas Hellstrom
2013-09-13  8:32                   ` Daniel Vetter
2013-09-13  8:39                     ` Thomas Hellstrom
2013-09-13  8:58                   ` Maarten Lankhorst
2013-09-13  9:21                     ` Thomas Hellstrom
2013-09-13  8:29               ` Peter Zijlstra
2013-09-13  8:41                 ` Daniel Vetter
2013-09-13  9:00                   ` Peter Zijlstra
2013-09-23 15:33                     ` [RFC PATCH] drm/nouveau: fix nested locking in mmap handler Maarten Lankhorst
2013-09-24  7:22                       ` Thomas Hellstrom
2013-09-24  7:34                         ` Maarten Lankhorst
2013-09-24  8:20                           ` Ingo Molnar
2013-09-24  9:03                           ` Thomas Hellstrom
2013-09-24  9:36                             ` Daniel Vetter
2013-09-24 10:11                               ` Maarten Lankhorst
2013-09-24 10:33                                 ` Thomas Hellstrom
2013-09-24 11:32                                   ` Maarten Lankhorst
2013-09-24 17:04                                     ` Thomas Hellstrom
2013-09-24  9:43                             ` Maarten Lankhorst
2013-09-24 17:53                               ` Thomas Hellstrom

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