* [PATCH 1/3] nouveau: Do not BUG_ON(!spin_is_locked()) on UP
@ 2014-12-21 16:43 Bruno Prémont
2015-01-12 19:00 ` Bruno Prémont
0 siblings, 1 reply; 2+ messages in thread
From: Bruno Prémont @ 2014-12-21 16:43 UTC (permalink / raw)
To: David Airlie, Ben Skeggs; +Cc: Nouveau List, dri-devel
On !SMP systems spinlocks do not exist. Thus checking of they
are active will always fail.
Use
assert_spin_locked(lock);
instead of
BUG_ON(!spin_is_locked(lock));
to not BUG() on all UP systems.
Signed-off-by: Bruno Prémont <bonbons@linux-vserver.org>
---
See also fdo bug #87552
drivers/gpu/drm/nouveau/core/core/event.c | 4 ++--
drivers/gpu/drm/nouveau/core/core/notify.c | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/nouveau/core/core/event.c b/drivers/gpu/drm/nouveau/core/core/event.c
index ff2b434..760947e 100644
--- a/drivers/gpu/drm/nouveau/core/core/event.c
+++ b/drivers/gpu/drm/nouveau/core/core/event.c
@@ -26,7 +26,7 @@
void
nvkm_event_put(struct nvkm_event *event, u32 types, int index)
{
- BUG_ON(!spin_is_locked(&event->refs_lock));
+ assert_spin_locked(&event->refs_lock);
while (types) {
int type = __ffs(types); types &= ~(1 << type);
if (--event->refs[index * event->types_nr + type] == 0) {
@@ -39,7 +39,7 @@ nvkm_event_put(struct nvkm_event *event, u32 types, int index)
void
nvkm_event_get(struct nvkm_event *event, u32 types, int index)
{
- BUG_ON(!spin_is_locked(&event->refs_lock));
+ assert_spin_locked(&event->refs_lock);
while (types) {
int type = __ffs(types); types &= ~(1 << type);
if (++event->refs[index * event->types_nr + type] == 1) {
diff --git a/drivers/gpu/drm/nouveau/core/core/notify.c b/drivers/gpu/drm/nouveau/core/core/notify.c
index d1bcde5..839a325 100644
--- a/drivers/gpu/drm/nouveau/core/core/notify.c
+++ b/drivers/gpu/drm/nouveau/core/core/notify.c
@@ -98,7 +98,7 @@ nvkm_notify_send(struct nvkm_notify *notify, void *data, u32 size)
struct nvkm_event *event = notify->event;
unsigned long flags;
- BUG_ON(!spin_is_locked(&event->list_lock));
+ assert_spin_locked(&event->list_lock);
BUG_ON(size != notify->size);
spin_lock_irqsave(&event->refs_lock, flags);
--
1.8.1.5
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 1/3] nouveau: Do not BUG_ON(!spin_is_locked()) on UP
2014-12-21 16:43 [PATCH 1/3] nouveau: Do not BUG_ON(!spin_is_locked()) on UP Bruno Prémont
@ 2015-01-12 19:00 ` Bruno Prémont
0 siblings, 0 replies; 2+ messages in thread
From: Bruno Prémont @ 2015-01-12 19:00 UTC (permalink / raw)
To: stable; +Cc: dri-devel, Nouveau List
Hi Greg, stable team,
Please apply this patch to stable (3.18 and 3.17).
It is commit ff4c0d5213b015e60aa87c1352604f10ba9c3e12 in linus's tree:
http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=ff4c0d5213b015e60aa87c1352604f10ba9c3e12
Thanks,
Bruno
On Sun, 21 December 2014 Bruno Prémont wrote:
> On !SMP systems spinlocks do not exist. Thus checking of they
> are active will always fail.
>
> Use
> assert_spin_locked(lock);
> instead of
> BUG_ON(!spin_is_locked(lock));
> to not BUG() on all UP systems.
>
> Signed-off-by: Bruno Prémont <bonbons@linux-vserver.org>
> ---
> See also fdo bug #87552
>
> drivers/gpu/drm/nouveau/core/core/event.c | 4 ++--
> drivers/gpu/drm/nouveau/core/core/notify.c | 2 +-
> 2 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/nouveau/core/core/event.c b/drivers/gpu/drm/nouveau/core/core/event.c
> index ff2b434..760947e 100644
> --- a/drivers/gpu/drm/nouveau/core/core/event.c
> +++ b/drivers/gpu/drm/nouveau/core/core/event.c
> @@ -26,7 +26,7 @@
> void
> nvkm_event_put(struct nvkm_event *event, u32 types, int index)
> {
> - BUG_ON(!spin_is_locked(&event->refs_lock));
> + assert_spin_locked(&event->refs_lock);
> while (types) {
> int type = __ffs(types); types &= ~(1 << type);
> if (--event->refs[index * event->types_nr + type] == 0) {
> @@ -39,7 +39,7 @@ nvkm_event_put(struct nvkm_event *event, u32 types, int index)
> void
> nvkm_event_get(struct nvkm_event *event, u32 types, int index)
> {
> - BUG_ON(!spin_is_locked(&event->refs_lock));
> + assert_spin_locked(&event->refs_lock);
> while (types) {
> int type = __ffs(types); types &= ~(1 << type);
> if (++event->refs[index * event->types_nr + type] == 1) {
> diff --git a/drivers/gpu/drm/nouveau/core/core/notify.c b/drivers/gpu/drm/nouveau/core/core/notify.c
> index d1bcde5..839a325 100644
> --- a/drivers/gpu/drm/nouveau/core/core/notify.c
> +++ b/drivers/gpu/drm/nouveau/core/core/notify.c
> @@ -98,7 +98,7 @@ nvkm_notify_send(struct nvkm_notify *notify, void *data, u32 size)
> struct nvkm_event *event = notify->event;
> unsigned long flags;
>
> - BUG_ON(!spin_is_locked(&event->list_lock));
> + assert_spin_locked(&event->list_lock);
> BUG_ON(size != notify->size);
>
> spin_lock_irqsave(&event->refs_lock, flags);
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-01-12 19:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-21 16:43 [PATCH 1/3] nouveau: Do not BUG_ON(!spin_is_locked()) on UP Bruno Prémont
2015-01-12 19:00 ` Bruno Prémont
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox