mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-23 07:12:09 +00:00
signals: kill block_all_signals() and unblock_all_signals()
It is hardly possible to enumerate all problems with block_all_signals() and unblock_all_signals(). Just for example, 1. block_all_signals(SIGSTOP/etc) simply can't help if the caller is multithreaded. Another thread can dequeue the signal and force the group stop. 2. Even is the caller is single-threaded, it will "stop" anyway. It will not sleep, but it will spin in kernel space until SIGCONT or SIGKILL. And a lot more. In short, this interface doesn't work at all, at least the last 10+ years. Daniel said: Yeah the only times I played around with the DRM_LOCK stuff was when old drivers accidentally deadlocked - my impression is that the entire DRM_LOCK thing was never really tested properly ;-) Hence I'm all for purging where this leaks out of the drm subsystem. Signed-off-by: Oleg Nesterov <oleg@redhat.com> Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch> Acked-by: Dave Airlie <airlied@redhat.com> Cc: Richard Weinberger <richard@nod.at> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
4f05028f8d
commit
2e01fabe67
4 changed files with 2 additions and 98 deletions
|
@ -38,8 +38,6 @@
|
|||
#include "drm_legacy.h"
|
||||
#include "drm_internal.h"
|
||||
|
||||
static int drm_notifier(void *priv);
|
||||
|
||||
static int drm_lock_take(struct drm_lock_data *lock_data, unsigned int context);
|
||||
|
||||
/**
|
||||
|
@ -118,14 +116,8 @@ int drm_legacy_lock(struct drm_device *dev, void *data,
|
|||
* really probably not the correct answer but lets us debug xkb
|
||||
* xserver for now */
|
||||
if (!file_priv->is_master) {
|
||||
sigemptyset(&dev->sigmask);
|
||||
sigaddset(&dev->sigmask, SIGSTOP);
|
||||
sigaddset(&dev->sigmask, SIGTSTP);
|
||||
sigaddset(&dev->sigmask, SIGTTIN);
|
||||
sigaddset(&dev->sigmask, SIGTTOU);
|
||||
dev->sigdata.context = lock->context;
|
||||
dev->sigdata.lock = master->lock.hw_lock;
|
||||
block_all_signals(drm_notifier, dev, &dev->sigmask);
|
||||
}
|
||||
|
||||
if (dev->driver->dma_quiescent && (lock->flags & _DRM_LOCK_QUIESCENT))
|
||||
|
@ -169,7 +161,6 @@ int drm_legacy_unlock(struct drm_device *dev, void *data, struct drm_file *file_
|
|||
/* FIXME: Should really bail out here. */
|
||||
}
|
||||
|
||||
unblock_all_signals();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -287,38 +278,6 @@ int drm_legacy_lock_free(struct drm_lock_data *lock_data, unsigned int context)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* If we get here, it means that the process has called DRM_IOCTL_LOCK
|
||||
* without calling DRM_IOCTL_UNLOCK.
|
||||
*
|
||||
* If the lock is not held, then let the signal proceed as usual. If the lock
|
||||
* is held, then set the contended flag and keep the signal blocked.
|
||||
*
|
||||
* \param priv pointer to a drm_device structure.
|
||||
* \return one if the signal should be delivered normally, or zero if the
|
||||
* signal should be blocked.
|
||||
*/
|
||||
static int drm_notifier(void *priv)
|
||||
{
|
||||
struct drm_device *dev = priv;
|
||||
struct drm_hw_lock *lock = dev->sigdata.lock;
|
||||
unsigned int old, new, prev;
|
||||
|
||||
/* Allow signal delivery if lock isn't held */
|
||||
if (!lock || !_DRM_LOCK_IS_HELD(lock->lock)
|
||||
|| _DRM_LOCKING_CONTEXT(lock->lock) != dev->sigdata.context)
|
||||
return 1;
|
||||
|
||||
/* Otherwise, set flag to force call to
|
||||
drmUnlock */
|
||||
do {
|
||||
old = lock->lock;
|
||||
new = old | _DRM_LOCK_CONT;
|
||||
prev = cmpxchg(&lock->lock, old, new);
|
||||
} while (prev != old);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function returns immediately and takes the hw lock
|
||||
* with the kernel context if it is free, otherwise it gets the highest priority when and if
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue