Skip to contentSkip to conversation

RFC: console: hack up console_lock more v3

PATCH In review Daniel Vetter 6 participants 21 messages May 9, 2019 – May 15, 2019

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 RFC: console: hack up console_lock more v3

console_trylock, called from within printk, can be called from pretty much anywhere. Including try_to_wake_up. Note that this isn't common, usually the box is in pretty bad shape at that point already. But it really doesn't help when then lockdep jumps in and spams the logs, potentially obscuring the real backtrace we're really interested in. One case I've seen (slightly simplified backtrace):

 Call Trace:
  <IRQ>
  console_trylock+0xe/0x60
  vprintk_emit+0xf1/0x320
  printk+0x4d/0x69
  __warn_printk+0x46/0x90
  native_smp_send_reschedule+0x2f/0x40
  check_preempt_curr+0x81/0xa0
  ttwu_do_wakeup+0x14/0x220
  try_to_wake_up+0x218/0x5f0
  pollwake+0x6f/0x90
  credit_entropy_bits+0x204/0x310
  add_interrupt_randomness+0x18f/0x210
  handle_irq+0x67/0x160
  do_IRQ+0x5e/0x130
  common_interrupt+0xf/0xf
  </IRQ>

This alone isn't a problem, but the spinlock in the semaphore is also still held while waking up waiters (up() -> __up() -> try_to_wake_up() callchain), which then closes the runqueue vs. semaphore.lock loop, and upsets lockdep, which issues a circular locking splat to dmesg. Worse it upsets developers, since we don't want to spam dmesg with clutter when the machine is dying already.

Fix this by creating a prinkt_safe_up() which calls wake_up_process outside of the spinlock. This isn't correct in full generality, but good enough for console_lock:

- console_lock doesn't use interruptible or killable or timeout down() calls, hence an up() is the only thing that can wake up a process. Hence the process can't get woken and killed and reaped while we try to wake it up too.

- semaphore.c always updates the waiter list while under the spinlock, so there's no other races. Specifically another process that races with a quick console_lock/unlock while we've dropped the spinlock already won't see our own waiter.

Note that we only have to break the recursion for the semaphore.lock spinlock of the console_lock. Recursion within various scheduler related locks is already prevented by the printk_safe_enter/exit pair in __up_console_sem().

Also cc'ing John Ogness since perhaps his printk rework fixes this all properly.

v2: Ditch attempt to fix console_trylock.

v3: Add a comment explaining why the taks we're waking won't disappear (Chris), and improve commit message to address review questions.

Cc Peter Zijlstra <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Will Deacon <[email protected]>
Cc Petr Mladek <[email protected]>
Cc Sergey Senozhatsky <[email protected]>
Cc Steven Rostedt <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc John Ogness <[email protected]>
Cc Chris Wilson <[email protected]>
---
 include/linux/semaphore.h  |  1 +
 kernel/locking/semaphore.c | 31 +++++++++++++++++++++++++++++++
 kernel/printk/printk.c     |  2 +-
 3 files changed, 33 insertions(+), 1 deletion(-)
include/linux/semaphore.h +1 -0
index 11c86fbfeb98..7e839c72809d 100644
@@ -41,6 +41,7 @@ extern int __must_check down_interruptible(struct semaphore *sem);
 extern int __must_check down_killable(struct semaphore *sem);
 extern int __must_check down_trylock(struct semaphore *sem);
 extern int __must_check down_timeout(struct semaphore *sem, long jiffies);
+extern void printk_safe_up(struct semaphore *sem);
 extern void up(struct semaphore *sem);
 
 #endif /* __LINUX_SEMAPHORE_H */
kernel/locking/semaphore.c +31 -0
index 561acdd39960..55a896f18d91 100644
@@ -197,6 +197,37 @@ struct semaphore_waiter {
 	bool up;
 };
 
+/**
+ * printk_safe_up - release the semaphore in console_unlock
+ * @sem: the semaphore to release
+ *
+ * Release the semaphore.  Unlike mutexes, up() may be called from any
+ * context and even by tasks which have never called down().
+ *
+ * NOTE: This is a special version of up() for console_unlock only. It is only
+ * safe if there are no killable, interruptible or timing out down() calls.
+ */
+void printk_safe_up(struct semaphore *sem)
+{
+	unsigned long flags;
+	struct semaphore_waiter *waiter = NULL;
+
+	raw_spin_lock_irqsave(&sem->lock, flags);
+	if (likely(list_empty(&sem->wait_list))) {
+		sem->count++;
+	} else {
+		waiter = list_first_entry(&sem->wait_list,
+					  struct semaphore_waiter, list);
+		list_del(&waiter->list);
+		waiter->up = true;
+	}
+	raw_spin_unlock_irqrestore(&sem->lock, flags);
+
+	if (waiter) /* protected by being sole wake source */
+		wake_up_process(waiter->task);
+}
+EXPORT_SYMBOL(printk_safe_up);
+
 /*
  * Because this function is inlined, the 'state' parameter will be
  * constant, and thus optimised away by the compiler.  Likewise the
kernel/printk/printk.c +1 -1
index 02ca827b8fac..62303929afda 100644
@@ -234,7 +234,7 @@ static void __up_console_sem(unsigned long ip)
 	mutex_release(&console_lock_dep_map, 1, ip);
 
 	printk_safe_enter_irqsave(flags);
-	up(&console_sem);
+	printk_safe_up(&console_sem);
 	printk_safe_exit_irqrestore(flags);
 }
 #define up_console_sem() __up_console_sem(_RET_IP_)
Signature · 1 line
2.20.1
Reviewed-by on v1 1/1
#1 lore raw

Quoting Daniel Vetter (2019-05-09 13:09:03)

Quoted 60 lines

console_trylock, called from within printk, can be called from pretty much anywhere. Including try_to_wake_up. Note that this isn't common, usually the box is in pretty bad shape at that point already. But it really doesn't help when then lockdep jumps in and spams the logs, potentially obscuring the real backtrace we're really interested in. One case I've seen (slightly simplified backtrace):

 Call Trace:
  <IRQ>
  console_trylock+0xe/0x60
  vprintk_emit+0xf1/0x320
  printk+0x4d/0x69
  __warn_printk+0x46/0x90
  native_smp_send_reschedule+0x2f/0x40
  check_preempt_curr+0x81/0xa0
  ttwu_do_wakeup+0x14/0x220
  try_to_wake_up+0x218/0x5f0
  pollwake+0x6f/0x90
  credit_entropy_bits+0x204/0x310
  add_interrupt_randomness+0x18f/0x210
  handle_irq+0x67/0x160
  do_IRQ+0x5e/0x130
  common_interrupt+0xf/0xf
  </IRQ>

This alone isn't a problem, but the spinlock in the semaphore is also still held while waking up waiters (up() -> __up() -> try_to_wake_up() callchain), which then closes the runqueue vs. semaphore.lock loop, and upsets lockdep, which issues a circular locking splat to dmesg. Worse it upsets developers, since we don't want to spam dmesg with clutter when the machine is dying already.

Fix this by creating a prinkt_safe_up() which calls wake_up_process outside of the spinlock. This isn't correct in full generality, but good enough for console_lock:

- console_lock doesn't use interruptible or killable or timeout down() calls, hence an up() is the only thing that can wake up a process. Hence the process can't get woken and killed and reaped while we try to wake it up too.

- semaphore.c always updates the waiter list while under the spinlock, so there's no other races. Specifically another process that races with a quick console_lock/unlock while we've dropped the spinlock already won't see our own waiter.

Note that we only have to break the recursion for the semaphore.lock spinlock of the console_lock. Recursion within various scheduler related locks is already prevented by the printk_safe_enter/exit pair in __up_console_sem().

Also cc'ing John Ogness since perhaps his printk rework fixes this all properly.

v2: Ditch attempt to fix console_trylock.

v3: Add a comment explaining why the taks we're waking won't disappear (Chris), and improve commit message to address review questions.

Quoted 12 lines
Cc Peter Zijlstra <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Will Deacon <[email protected]>
Cc Petr Mladek <[email protected]>
Cc Sergey Senozhatsky <[email protected]>
Cc Steven Rostedt <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc John Ogness <[email protected]>
Cc Chris Wilson <[email protected]>

I'm a bit nervous about that this is only safe for the precisely controlled conditions, but then again that it is called printk_safe should deter any other users.

The logic checks out, and you convinced me that the dereference is protected, so

-Chris

maintainer
#2 lore raw
In reply to Daniel Vetter
Quoted 6 lines · Daniel Vetter

Fix this by creating a prinkt_safe_up() which calls wake_up_process outside of the spinlock. This isn't correct in full generality, but good enough for console_lock:

- console_lock doesn't use interruptible or killable or timeout down() calls, hence an up() is the only thing that can wake up a process.

Wrong :/ Any task can be woken at any random time. We must, at all times, assume spurious wakeups will happen.

Quoted 10 lines
(quoted diff) +10 -0
+void printk_safe_up(struct semaphore *sem)
+{
+	unsigned long flags;
+	struct semaphore_waiter *waiter = NULL;
+
+	raw_spin_lock_irqsave(&sem->lock, flags);
+	if (likely(list_empty(&sem->wait_list))) {
+		sem->count++;
+	} else {
+		waiter = list_first_entry(&sem->wait_list,

Review

Quoted 10 lines
(quoted diff) +10 -0
+					  struct semaphore_waiter, list);
+		list_del(&waiter->list);
+		waiter->up = true;
+	}
+	raw_spin_unlock_irqrestore(&sem->lock, flags);
+
+	if (waiter) /* protected by being sole wake source */
+		wake_up_process(waiter->task);
+}
+EXPORT_SYMBOL(printk_safe_up);

Since its only used from printk, that EXPORT really isn't needed.

Something like the below might work.

---
 kernel/locking/semaphore.c | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)
kernel/locking/semaphore.c +13 -13
index 561acdd39960..ac0a67e95aac 100644
@@ -38,7 +38,6 @@ static noinline void __down(struct semaphore *sem);
 static noinline int __down_interruptible(struct semaphore *sem);
 static noinline int __down_killable(struct semaphore *sem);
 static noinline int __down_timeout(struct semaphore *sem, long timeout);
-static noinline void __up(struct semaphore *sem);
 
 /**
  * down - acquire the semaphore
@@ -178,14 +177,24 @@ EXPORT_SYMBOL(down_timeout);
  */
 void up(struct semaphore *sem)
 {
+	struct semaphore_waiter *waiter;
+	DEFINE_WAKE_Q(wake_q);
 	unsigned long flags;
 
 	raw_spin_lock_irqsave(&sem->lock, flags);
-	if (likely(list_empty(&sem->wait_list)))
+	if (likely(list_empty(&sem->wait_list))) {
 		sem->count++;
-	else
-		__up(sem);
+		goto unlock;
+	}
+
+	waiter = list_first_entry(&sem->wait_list, struct semaphore_waiter, list);
+	list_del(&waiter->list);
+	waiter->up = true;
+	wake_q_add(&wake_q, waiter->task);
+unlock:
 	raw_spin_unlock_irqrestore(&sem->lock, flags);
+
+	wake_up_q(&wake_q);
 }
 EXPORT_SYMBOL(up);
 
@@ -252,12 +261,3 @@ static noinline int __sched __down_timeout(struct semaphore *sem, long timeout)
 {
 	return __down_common(sem, TASK_UNINTERRUPTIBLE, timeout);
 }
-
-static noinline void __sched __up(struct semaphore *sem)
-{
-	struct semaphore_waiter *waiter = list_first_entry(&sem->wait_list,
-						struct semaphore_waiter, list);
-	list_del(&waiter->list);
-	waiter->up = true;
-	wake_up_process(waiter->task);
-}

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#3 lore raw
Quoted 10 lines · Peter Zijlstra
Quoted 6 lines · Daniel Vetter

Fix this by creating a prinkt_safe_up() which calls wake_up_process outside of the spinlock. This isn't correct in full generality, but good enough for console_lock:

- console_lock doesn't use interruptible or killable or timeout down() calls, hence an up() is the only thing that can wake up a process.

Wrong :/ Any task can be woken at any random time. We must, at all times, assume spurious wakeups will happen.

Out of curiosity, where do these come from? I know about the races where you need to recheck on the waiter side to avoid getting stuck, but didn't know about this. Are these earlier (possibly spurious) wakeups that got held up and delayed for a while, then hit the task much later when it's already continued doing something else? Or even more random, and even if I never put a task on a wait list or anything else, ever, it can get woken spuriously?

Quoted 23 lines
Quoted 10 lines
(quoted diff) +10 -0
+void printk_safe_up(struct semaphore *sem)
+{
+     unsigned long flags;
+     struct semaphore_waiter *waiter = NULL;
+
+     raw_spin_lock_irqsave(&sem->lock, flags);
+     if (likely(list_empty(&sem->wait_list))) {
+             sem->count++;
+     } else {
+             waiter = list_first_entry(&sem->wait_list,

Review

Quoted 10 lines
(quoted diff) +10 -0
+                                       struct semaphore_waiter, list);
+             list_del(&waiter->list);
+             waiter->up = true;
+     }
+     raw_spin_unlock_irqrestore(&sem->lock, flags);
+
+     if (waiter) /* protected by being sole wake source */
+             wake_up_process(waiter->task);
+}
+EXPORT_SYMBOL(printk_safe_up);

Since its only used from printk, that EXPORT really isn't needed.

Quoted 1 line

Something like the below might work.

Yeah that looks like the proper fix. I guess semaphores are uncritical enough that we can roll this out for everyone. Thanks for the hint. -Daniel

Quoted 58 lines
---
 kernel/locking/semaphore.c | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)
kernel/locking/semaphore.c +13 -13
index 561acdd39960..ac0a67e95aac 100644
@@ -38,7 +38,6 @@ static noinline void __down(struct semaphore *sem);
 static noinline int __down_interruptible(struct semaphore *sem);
 static noinline int __down_killable(struct semaphore *sem);
 static noinline int __down_timeout(struct semaphore *sem, long timeout);
-static noinline void __up(struct semaphore *sem);
 
 /**
  * down - acquire the semaphore
@@ -178,14 +177,24 @@ EXPORT_SYMBOL(down_timeout);
  */
 void up(struct semaphore *sem)
 {
+       struct semaphore_waiter *waiter;
+       DEFINE_WAKE_Q(wake_q);
        unsigned long flags;
 
        raw_spin_lock_irqsave(&sem->lock, flags);
-       if (likely(list_empty(&sem->wait_list)))
+       if (likely(list_empty(&sem->wait_list))) {
                sem->count++;
-       else
-               __up(sem);
+               goto unlock;
+       }
+
+       waiter = list_first_entry(&sem->wait_list, struct semaphore_waiter, list);
+       list_del(&waiter->list);
+       waiter->up = true;
+       wake_q_add(&wake_q, waiter->task);
+unlock:
        raw_spin_unlock_irqrestore(&sem->lock, flags);
+
+       wake_up_q(&wake_q);
 }
 EXPORT_SYMBOL(up);
 
@@ -252,12 +261,3 @@ static noinline int __sched __down_timeout(struct semaphore *sem, long timeout)
 {
        return __down_common(sem, TASK_UNINTERRUPTIBLE, timeout);
 }
-
-static noinline void __sched __up(struct semaphore *sem)
-{
-       struct semaphore_waiter *waiter = list_first_entry(&sem->wait_list,
-                                               struct semaphore_waiter, list);
-       list_del(&waiter->list);
-       waiter->up = true;
-       wake_up_process(waiter->task);
-}
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
maintainer
#4 lore raw
Quoted 9 lines · Daniel Vetter
Quoted 8 lines · Peter Zijlstra
Quoted 6 lines · Daniel Vetter

Fix this by creating a prinkt_safe_up() which calls wake_up_process outside of the spinlock. This isn't correct in full generality, but good enough for console_lock:

- console_lock doesn't use interruptible or killable or timeout down() calls, hence an up() is the only thing that can wake up a process.

Quoted 8 lines
Quoted 2 lines

Wrong :/ Any task can be woken at any random time. We must, at all times, assume spurious wakeups will happen.

Out of curiosity, where do these come from? I know about the races where you need to recheck on the waiter side to avoid getting stuck, but didn't know about this. Are these earlier (possibly spurious) wakeups that got held up and delayed for a while, then hit the task much later when it's already continued doing something else?

Yes, this. So they all more or less have the form:

CPU0 CPU1

enqueue_waiter()
done = true;
if (waiters)

		for (;;) {
		  if (done)
		    break;

		  ...
		}

		dequeue_waiter()

		do something else again

wake_up_task
<gets wakeup>

The wake_q thing made the above much more common, but we've had it forever.

Quoted 3 lines

Or even
more random, and even if I never put a task on a wait list or anything else, ever, it can get woken spuriously?

I had patches that did that on purpose, but no.

Quoted 4 lines
Quoted 1 line

Something like the below might work.

Yeah that looks like the proper fix. I guess semaphores are uncritical enough that we can roll this out for everyone. Thanks for the hint.

It's actually an optimization that we never did because semaphores are so uncritical :-)

The thing is, by delaying the wakup until after we've released the spinlock, the waiter will not contend on the spinlock the moment it wakes.
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

maintainer
#5 lore raw
In reply to Daniel Vetter
Quoted 46 lines · Daniel Vetter

console_trylock, called from within printk, can be called from pretty much anywhere. Including try_to_wake_up. Note that this isn't common, usually the box is in pretty bad shape at that point already. But it really doesn't help when then lockdep jumps in and spams the logs, potentially obscuring the real backtrace we're really interested in. One case I've seen (slightly simplified backtrace):

 Call Trace:
  <IRQ>
  console_trylock+0xe/0x60
  vprintk_emit+0xf1/0x320
  printk+0x4d/0x69
  __warn_printk+0x46/0x90
  native_smp_send_reschedule+0x2f/0x40
  check_preempt_curr+0x81/0xa0
  ttwu_do_wakeup+0x14/0x220
  try_to_wake_up+0x218/0x5f0
  pollwake+0x6f/0x90
  credit_entropy_bits+0x204/0x310
  add_interrupt_randomness+0x18f/0x210
  handle_irq+0x67/0x160
  do_IRQ+0x5e/0x130
  common_interrupt+0xf/0xf
  </IRQ>

This alone isn't a problem, but the spinlock in the semaphore is also still held while waking up waiters (up() -> __up() -> try_to_wake_up() callchain), which then closes the runqueue vs. semaphore.lock loop, and upsets lockdep, which issues a circular locking splat to dmesg. Worse it upsets developers, since we don't want to spam dmesg with clutter when the machine is dying already.

Fix this by creating a prinkt_safe_up() which calls wake_up_process outside of the spinlock. This isn't correct in full generality, but good enough for console_lock:

- console_lock doesn't use interruptible or killable or timeout down() calls, hence an up() is the only thing that can wake up a process. Hence the process can't get woken and killed and reaped while we try to wake it up too.

- semaphore.c always updates the waiter list while under the spinlock, so there's no other races. Specifically another process that races with a quick console_lock/unlock while we've dropped the spinlock already won't see our own waiter.

Quoted 4 lines

Note that we only have to break the recursion for the semaphore.lock spinlock of the console_lock. Recursion within various scheduler related locks is already prevented by the printk_safe_enter/exit pair in __up_console_sem().

This is not fully true. printk_safe() helps only when the first try_to_wake_up() is called from printk_safe() context.

Quoted 24 lines
kernel/locking/semaphore.c +18 -0
@@ -197,6 +197,37 @@ struct semaphore_waiter {
 	bool up;
 };
 
+/**
+ * printk_safe_up - release the semaphore in console_unlock
+ * @sem: the semaphore to release
+ *
+ * Release the semaphore.  Unlike mutexes, up() may be called from any
+ * context and even by tasks which have never called down().
+ *
+ * NOTE: This is a special version of up() for console_unlock only. It is only
+ * safe if there are no killable, interruptible or timing out down() calls.
+ */
+void printk_safe_up(struct semaphore *sem)
+{
+	unsigned long flags;
+	struct semaphore_waiter *waiter = NULL;
+
+	raw_spin_lock_irqsave(&sem->lock, flags);
+	if (likely(list_empty(&sem->wait_list))) {
+		sem->count++;

kernel/locking/semaphore.c struct semaphore_waiter { · line 227

Quoted 10 lines
kernel/locking/semaphore.c +10 -0
+	} else {
+		waiter = list_first_entry(&sem->wait_list,
+					  struct semaphore_waiter, list);
+		list_del(&waiter->list);
+		waiter->up = true;
+	}
+	raw_spin_unlock_irqrestore(&sem->lock, flags);
+
+	if (waiter) /* protected by being sole wake source */
+		wake_up_process(waiter->task);

I still do not see how this could help. Let's take the above backtrace as example:

   <IRQ>
   console_trylock+0xe/0x60
   vprintk_emit+0xf1/0x320
   printk+0x4d/0x69
   __warn_printk+0x46/0x90
   native_smp_send_reschedule +0x2f/0x40
   check_preempt_curr+0x81/0xa0
   ttwu_do_wakeup+0x14/0x220
   try_to_wake_up+0x218/0x5f0
   pollwake+0x6f/0x90
   credit_entropy_bits+0x204/0x310
   add_interrupt_randomness+0x18f/0x210
   handle_irq+0x67/0x160
   do_IRQ+0x5e/0x130
   common_interrupt+0xf/0xf
   </IRQ>

We have the following chain of calls:

+ do_IRQ()
...
+ try_to_wake_up() # takes p->pi_lock
+ ttwu_remote() # takes rq lock
+ ttwu_do_wakeup()
+ check_preempt_curr()
+ native_smp_send_reschedule()
+ __warn_printk()
+ printk()
+ vprintk_emit()
+ console_trylock() # success
+ console_unlock()
+ up_console_sem()
+ up() # wait list in not empty
+ __up()
+ wake_up_process()
+ try_to_wake_up()

!BANG! Deadlock on p->pi_lock.

It does not matter if the nested try_to_wake_up() was called under sem->lock or outside.

By other words. The patch removed one lockdep warning. But it just just delayed the deadlock. It will not happen on sem->lock but later on p->pi_lock.

I am repeating myself. But IMHO, the only solution is to introduce printk deferred context and use it in WARN_DEFERRED().

Best Regards,
Petr

#6 lore raw
Quoted 131 lines · Petr Mladek
Quoted 46 lines · Daniel Vetter

console_trylock, called from within printk, can be called from pretty much anywhere. Including try_to_wake_up. Note that this isn't common, usually the box is in pretty bad shape at that point already. But it really doesn't help when then lockdep jumps in and spams the logs, potentially obscuring the real backtrace we're really interested in. One case I've seen (slightly simplified backtrace):

 Call Trace:
  <IRQ>
  console_trylock+0xe/0x60
  vprintk_emit+0xf1/0x320
  printk+0x4d/0x69
  __warn_printk+0x46/0x90
  native_smp_send_reschedule+0x2f/0x40
  check_preempt_curr+0x81/0xa0
  ttwu_do_wakeup+0x14/0x220
  try_to_wake_up+0x218/0x5f0
  pollwake+0x6f/0x90
  credit_entropy_bits+0x204/0x310
  add_interrupt_randomness+0x18f/0x210
  handle_irq+0x67/0x160
  do_IRQ+0x5e/0x130
  common_interrupt+0xf/0xf
  </IRQ>

This alone isn't a problem, but the spinlock in the semaphore is also still held while waking up waiters (up() -> __up() -> try_to_wake_up() callchain), which then closes the runqueue vs. semaphore.lock loop, and upsets lockdep, which issues a circular locking splat to dmesg. Worse it upsets developers, since we don't want to spam dmesg with clutter when the machine is dying already.

Fix this by creating a prinkt_safe_up() which calls wake_up_process outside of the spinlock. This isn't correct in full generality, but good enough for console_lock:

- console_lock doesn't use interruptible or killable or timeout down() calls, hence an up() is the only thing that can wake up a process. Hence the process can't get woken and killed and reaped while we try to wake it up too.

- semaphore.c always updates the waiter list while under the spinlock, so there's no other races. Specifically another process that races with a quick console_lock/unlock while we've dropped the spinlock already won't see our own waiter.

Quoted 4 lines

Note that we only have to break the recursion for the semaphore.lock spinlock of the console_lock. Recursion within various scheduler related locks is already prevented by the printk_safe_enter/exit pair in __up_console_sem().

This is not fully true. printk_safe() helps only when the first try_to_wake_up() is called from printk_safe() context.

Quoted 24 lines
kernel/locking/semaphore.c +18 -0
@@ -197,6 +197,37 @@ struct semaphore_waiter {
      bool up;
 };
 
+/**
+ * printk_safe_up - release the semaphore in console_unlock
+ * @sem: the semaphore to release
+ *
+ * Release the semaphore.  Unlike mutexes, up() may be called from any
+ * context and even by tasks which have never called down().
+ *
+ * NOTE: This is a special version of up() for console_unlock only. It is only
+ * safe if there are no killable, interruptible or timing out down() calls.
+ */
+void printk_safe_up(struct semaphore *sem)
+{
+     unsigned long flags;
+     struct semaphore_waiter *waiter = NULL;
+
+     raw_spin_lock_irqsave(&sem->lock, flags);
+     if (likely(list_empty(&sem->wait_list))) {
+             sem->count++;

kernel/locking/semaphore.c struct semaphore_waiter { · line 227

Quoted 10 lines
kernel/locking/semaphore.c +10 -0
+     } else {
+             waiter = list_first_entry(&sem->wait_list,
+                                       struct semaphore_waiter, list);
+             list_del(&waiter->list);
+             waiter->up = true;
+     }
+     raw_spin_unlock_irqrestore(&sem->lock, flags);
+
+     if (waiter) /* protected by being sole wake source */
+             wake_up_process(waiter->task);

I still do not see how this could help. Let's take the above backtrace as example:

   <IRQ>
   console_trylock+0xe/0x60
   vprintk_emit+0xf1/0x320
   printk+0x4d/0x69
   __warn_printk+0x46/0x90
   native_smp_send_reschedule +0x2f/0x40
   check_preempt_curr+0x81/0xa0
   ttwu_do_wakeup+0x14/0x220
   try_to_wake_up+0x218/0x5f0
   pollwake+0x6f/0x90
   credit_entropy_bits+0x204/0x310
   add_interrupt_randomness+0x18f/0x210
   handle_irq+0x67/0x160
   do_IRQ+0x5e/0x130
   common_interrupt+0xf/0xf
   </IRQ>

We have the following chain of calls:

+ do_IRQ()
...
+ try_to_wake_up() # takes p->pi_lock
+ ttwu_remote() # takes rq lock
+ ttwu_do_wakeup()
+ check_preempt_curr()
+ native_smp_send_reschedule()
+ __warn_printk()
+ printk()
+ vprintk_emit()
+ console_trylock() # success
+ console_unlock()
+ up_console_sem()
+ up() # wait list in not empty
+ __up()
+ wake_up_process()
+ try_to_wake_up()

Quoted 1 line

!BANG! Deadlock on p->pi_lock.

Hm right ... I only looked at this starting with console_unlock.

Quoted 9 lines

It does not matter if the nested try_to_wake_up() was called under sem->lock or outside.

By other words. The patch removed one lockdep warning. But it just just delayed the deadlock. It will not happen on sem->lock but later on p->pi_lock.

I am repeating myself. But IMHO, the only solution is to introduce printk deferred context and use it in WARN_DEFERRED().

One thing to keep in mind is that the kernel is already dying, and things will come crashing down later on (I've seen this only in dmesg tails capture in pstore in our CI, i.e. the box died for good). I just want to make sure that the useful information isn't overwritten by more dmesg splats that happen as a consequence of us somehow trying to run things on an offline cpu. Once console_unlock has completed in your above backtrace and the important stuff has gone out I'm totally fine with the kernel just dying. Pulling the wake_up_process out from under the semaphore.lock is enough to prevent lockdep from dumping more stuff while we're trying to print the important things, and I think the untangling of the locking hiararchy is useful irrespective of this lockdep splat. Plus Peter doesn't sound like he likes to roll out more printk_deferred kind of things.

But if you think I should do the printk_deferred thing too I can look into that. Just not quite sure what that's supposed to look like now. -Daniel

--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

maintainer
#7 lore raw
Quoted 2 lines · Daniel Vetter

One thing to keep in mind is that the kernel is already dying, and things will come crashing down later on

This is important information. I havn't seen it mentioned earlier.

Quoted 9 lines

(I've seen this only in dmesg
tails capture in pstore in our CI, i.e. the box died for good). I just want to make sure that the useful information isn't overwritten by more dmesg splats that happen as a consequence of us somehow trying to run things on an offline cpu. Once console_unlock has completed in your above backtrace and the important stuff has gone out I'm totally fine with the kernel just dying. Pulling the wake_up_process out from under the semaphore.lock is enough to prevent lockdep from dumping more stuff while we're trying to print the important things,

With the more stuff you mean the lockdep splat? If yes, it might make sense to call debug_locks_off() earlier in panic().

Quoted 6 lines

and I think the untangling of the locking hiararchy is useful irrespective of this lockdep splat. Plus Peter doesn't sound like he likes to roll out more printk_deferred kind of things.

But if you think I should do the printk_deferred thing too I can look into that. Just not quite sure what that's supposed to look like now.

Your patch might remove the particular lockdep splat. It might be worth it (Peter mentioned also an optimization effect). Anyway it will not prevent the deadlock.

The only way to avoid the deadlock is to use printk_deferred() with the current printk() code.

Finally, I have recently worked on similar problem with dying system. I sent the following patch for testing. I wonder if it might be acceptable upstream:

From: Petr Mladek <[email protected]>
Subject: sched/x86: Do not warn about offline CPUs when all are being stopped
Patch-mainline: No, just for testing
References: bsc#1104406

The warning about rescheduling offline CPUs cause dealock when the CPUs need to get stopped using NMI. It might happen with logbuf_lock, locks used by console drivers, especially tty. But it might also be caused by a registered kernel message dumper, for example, pstore.

The warning is pretty common when there is a high load and CPUs are being stopped by native_stop_other_cpus(). But they are not really useful in this context. And they scrolls the really important messages off the screen.

We need to fix printk() in the long term. But disabling the message looks reasonable at least in the meantime.

---
 arch/x86/kernel/smp.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
arch/x86/kernel/smp.c +2 -1
@@ -124,7 +124,8 @@ static bool smp_no_nmi_ipi = false;
  */
 static void native_smp_send_reschedule(int cpu)
 {
-	if (unlikely(cpu_is_offline(cpu))) {
+	if (unlikely(cpu_is_offline(cpu) &&
+		     atomic_read(&stopping_cpu) < 0)) {
 		WARN(1, "sched: Unexpected reschedule of offline CPU#%d!\n", cpu);
 		return;
 	}

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#8 lore raw

On (05/10/19 11:15), Petr Mladek wrote:
[..]

Quoted 6 lines
 arch/x86/kernel/smp.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

arch/x86/kernel/smp.c static bool smp_no_nmi_ipi = false; · line 131

Quoted 9 lines
arch/x86/kernel/smp.c +2 -1
@@ -124,7 +124,8 @@ static bool smp_no_nmi_ipi = false;
  */
 static void native_smp_send_reschedule(int cpu)
 {
-	if (unlikely(cpu_is_offline(cpu))) {
+	if (unlikely(cpu_is_offline(cpu) &&
+		     atomic_read(&stopping_cpu) < 0)) {
 		WARN(1, "sched: Unexpected reschedule of offline CPU#%d!\n", cpu);
 		return;
 	}

I think we need to remove CPU which we IPI_STOP from idle_cpus_mask. So then scheduler won't pick up stopped CPUs (cpumask_first(nohz.idle_cpus_mask)) and attempt rescheduling to them. It seems that currently native_stop_other_cpus() doesn't do that.

	-ss
#9 lore raw
In reply to Petr Mladek
Quoted 5 lines · Petr Mladek
Quoted 2 lines · Daniel Vetter

One thing to keep in mind is that the kernel is already dying, and things will come crashing down later on

This is important information. I havn't seen it mentioned earlier.

I thought I explained that, sorry if this wasn't clear.

Quoted 10 lines
Quoted 9 lines

(I've seen this only in dmesg
tails capture in pstore in our CI, i.e. the box died for good). I just want to make sure that the useful information isn't overwritten by more dmesg splats that happen as a consequence of us somehow trying to run things on an offline cpu. Once console_unlock has completed in your above backtrace and the important stuff has gone out I'm totally fine with the kernel just dying. Pulling the wake_up_process out from under the semaphore.lock is enough to prevent lockdep from dumping more stuff while we're trying to print the important things,

Quoted 2 lines

With the more stuff you mean the lockdep splat? If yes, it might make sense to call debug_locks_off() earlier in panic().

I'm not sure this only happens in panics (I'm honestly not sure at all why we're complaining about offline cpus). But in general I've seen piles of dying systems that dump WARNINGS and then eventually panic. Still would be good to not have a pointless lockdep splat in between.

Quoted 47 lines
Quoted 6 lines

and I think the untangling of the locking hiararchy is useful irrespective of this lockdep splat. Plus Peter doesn't sound like he likes to roll out more printk_deferred kind of things.

But if you think I should do the printk_deferred thing too I can look into that. Just not quite sure what that's supposed to look like now.

Your patch might remove the particular lockdep splat. It might be worth it (Peter mentioned also an optimization effect). Anyway it will not prevent the deadlock.

The only way to avoid the deadlock is to use printk_deferred() with the current printk() code.

Finally, I have recently worked on similar problem with dying system. I sent the following patch for testing. I wonder if it might be acceptable upstream:

From: Petr Mladek <[email protected]>
Subject: sched/x86: Do not warn about offline CPUs when all are being stopped
Patch-mainline: No, just for testing
References: bsc#1104406

The warning about rescheduling offline CPUs cause dealock when the CPUs need to get stopped using NMI. It might happen with logbuf_lock, locks used by console drivers, especially tty. But it might also be caused by a registered kernel message dumper, for example, pstore.

The warning is pretty common when there is a high load and CPUs are being stopped by native_stop_other_cpus(). But they are not really useful in this context. And they scrolls the really important messages off the screen.

We need to fix printk() in the long term. But disabling the message looks reasonable at least in the meantime.

---
 arch/x86/kernel/smp.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

arch/x86/kernel/smp.c static bool smp_no_nmi_ipi = false; · line 128

Quoted 6 lines
arch/x86/kernel/smp.c +2 -1
@@ -124,7 +124,8 @@ static bool smp_no_nmi_ipi = false;
  */
 static void native_smp_send_reschedule(int cpu)
 {
-       if (unlikely(cpu_is_offline(cpu))) {
+       if (unlikely(cpu_is_offline(cpu) &&
+                    atomic_read(&stopping_cpu) < 0)) {

Hm yeah this sounds like another fix which would stop things from getting worse when the machine is dying. I can try and stuff this (or something like this, I honestly have no idea about cpu handling code so no idea what's reasonable) into our CI and see what happens.

Thanks, Daniel

Quoted 3 lines
arch/x86/kernel/smp.c +0 -0
                WARN(1, "sched: Unexpected reschedule of offline CPU#%d!\n", cpu);
                return;
        }
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#10 lore raw

✗ Fi.CI.BAT: failure for RFC: console: hack up console_lock more v3 (rev2)

In reply to Daniel Vetter
== Series Details ==

== Series Details ==

Series: RFC: console: hack up console_lock more v3 (rev2)
URL : https://patchwork.freedesktop.org/series/60467/
State : failure

== Summary ==

CALL scripts/checksyscalls.sh
CALL scripts/atomic/check-atomics.sh
DESCEND objtool
CHK include/generated/compile.h
CC kernel/locking/semaphore.o
kernel/locking/semaphore.c: In function ‘up’:
kernel/locking/semaphore.c:181:2: error: implicit declaration of function ‘DEFINE_WAKE_Q’; did you mean ‘DEFINE_WAIT’? [-Werror=implicit-function-declaration]
DEFINE_WAKE_Q(wake_q);
^~~~~~~~~~~~~
DEFINE_WAIT
kernel/locking/semaphore.c:181:16: error: ‘wake_q’ undeclared (first use in this function); did you mean ‘wake_up’?

  DEFINE_WAKE_Q(wake_q);
                ^~~~~~
                wake_up

kernel/locking/semaphore.c:181:16: note: each undeclared identifier is reported only once for each function it appears in kernel/locking/semaphore.c:182:2: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
unsigned long flags;
^~~~~~~~
In file included from kernel/locking/semaphore.c:28:0:
./include/linux/kernel.h:979:51: error: dereferencing pointer to incomplete type ‘struct semaphore_waiter’

  BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
                                                   ^
./include/linux/compiler.h:324:9: note: in definition of macro ‘__compiletime_assert’
   if (!(condition))     \
         ^~~~~~~~~

./include/linux/compiler.h:344:2: note: in expansion of macro ‘_compiletime_assert’
_compiletime_assert(condition, msg, __compiletime_assert_, __LINE__) ^~~~~~~~~~~~~~~~~~~
./include/linux/build_bug.h:39:37: note: in expansion of macro ‘compiletime_assert’

 #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
                                     ^~~~~~~~~~~~~~~~~~

./include/linux/kernel.h:979:2: note: in expansion of macro ‘BUILD_BUG_ON_MSG’
BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
^~~~~~~~~~~~~~~~
./include/linux/kernel.h:979:20: note: in expansion of macro ‘__same_type’

  BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
                    ^~~~~~~~~~~

./include/linux/list.h:430:2: note: in expansion of macro ‘container_of’
container_of(ptr, type, member)
^~~~~~~~~~~~
./include/linux/list.h:441:2: note: in expansion of macro ‘list_entry’
list_entry((ptr)->next, type, member)
^~~~~~~~~~
kernel/locking/semaphore.c:190:11: note: in expansion of macro ‘list_first_entry’

  waiter = list_first_entry(&sem->wait_list, struct semaphore_waiter, list);
           ^~~~~~~~~~~~~~~~
In file included from <command-line>:0:0:
././include/linux/compiler_types.h:127:35: error: invalid use of undefined type ‘struct semaphore_waiter’
 #define __compiler_offsetof(a, b) __builtin_offsetof(a, b)
                                   ^
./include/linux/stddef.h:17:32: note: in expansion of macro ‘__compiler_offsetof’
 #define offsetof(TYPE, MEMBER) __compiler_offsetof(TYPE, MEMBER)
                                ^~~~~~~~~~~~~~~~~~~
./include/linux/kernel.h:982:21: note: in expansion of macro ‘offsetof’
  ((type *)(__mptr - offsetof(type, member))); })
                     ^~~~~~~~

./include/linux/list.h:430:2: note: in expansion of macro ‘container_of’
container_of(ptr, type, member)
^~~~~~~~~~~~
./include/linux/list.h:441:2: note: in expansion of macro ‘list_entry’
list_entry((ptr)->next, type, member)
^~~~~~~~~~
kernel/locking/semaphore.c:190:11: note: in expansion of macro ‘list_first_entry’

  waiter = list_first_entry(&sem->wait_list, struct semaphore_waiter, list);
           ^~~~~~~~~~~~~~~~

kernel/locking/semaphore.c:193:2: error: implicit declaration of function ‘wake_q_add’; did you mean ‘wake_up_all’? [-Werror=implicit-function-declaration]
wake_q_add(&wake_q, waiter->task);
^~~~~~~~~~
wake_up_all
kernel/locking/semaphore.c:197:2: error: implicit declaration of function ‘wake_up_q’; did you mean ‘wake_up_nr’? [-Werror=implicit-function-declaration]
wake_up_q(&wake_q);
^~~~~~~~~
wake_up_nr
cc1: some warnings being treated as errors
scripts/Makefile.build:275: recipe for target 'kernel/locking/semaphore.o' failed
make[2]: *** [kernel/locking/semaphore.o] Error 1
scripts/Makefile.build:486: recipe for target 'kernel/locking' failed
make[1]: *** [kernel/locking] Error 2
Makefile:1051: recipe for target 'kernel' failed
make: *** [kernel] Error 2

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#11 lore raw

PATCH 1/1 kernel/locking/semaphore: use wake_q in up()

In reply to Daniel Vetter

console_trylock, called from within printk, can be called from pretty much anywhere. Including try_to_wake_up. Note that this isn't common, usually the box is in pretty bad shape at that point already. But it really doesn't help when then lockdep jumps in and spams the logs, potentially obscuring the real backtrace we're really interested in. One case I've seen (slightly simplified backtrace):

 Call Trace:
  <IRQ>
  console_trylock+0xe/0x60
  vprintk_emit+0xf1/0x320
  printk+0x4d/0x69
  __warn_printk+0x46/0x90
  native_smp_send_reschedule+0x2f/0x40
  check_preempt_curr+0x81/0xa0
  ttwu_do_wakeup+0x14/0x220
  try_to_wake_up+0x218/0x5f0
  pollwake+0x6f/0x90
  credit_entropy_bits+0x204/0x310
  add_interrupt_randomness+0x18f/0x210
  handle_irq+0x67/0x160
  do_IRQ+0x5e/0x130
  common_interrupt+0xf/0xf
  </IRQ>

This alone isn't a problem, but the spinlock in the semaphore is also still held while waking up waiters (up() -> __up() -> try_to_wake_up() callchain), which then closes the runqueue vs. semaphore.lock loop, and upsets lockdep, which issues a circular locking splat to dmesg. Worse it upsets developers, since we don't want to spam dmesg with clutter when the machine is dying already.

Fix this specific locking recursion by moving the wake_up_process out from under the semaphore.lock spinlock, using wake_q as recommended by Peter Zijlstra.

As Petr Mladek points out this doesn't fix all the locking recursions in this area. If we actually recursive in the above callchain:

+ try_to_wake_up() # takes p->pi_lock
+ ttwu_remote() # takes rq lock
+ ttwu_do_wakeup()
+ check_preempt_curr()
+ native_smp_send_reschedule()
+ __warn_printk()
+ printk()
+ vprintk_emit()
+ console_trylock() # success
+ console_unlock()
+ up_console_sem()
+ up() # wait list in not empty
+ __up()
+ wake_up_process()
+ try_to_wake_up()

Then there's any number of scheduler related locks will deadlock. Given that the kernel is dying already (the printk() in native_smp_send_reschedule() happens because we run on an offlined CPU) I think there's limited value in trying to fix this:

- We haven't seen the actual deadlock in our CI, only lockdep complaining about the possibility.

- The real issue is that the lockdep splat hides useful dmesg information we capture in e.g. pstore or on screen about the real cause of why the kernel is dying.

- The console_unlock in the above callchain should have managed to get all the dmesg up to that point out already. Dying later on is somewhat ok - I've only seen this lockdep splat in pstore when the machine died anyway.

Also cc'ing John Ogness since perhaps his printk rework fixes this all properly.

v2: Ditch attempt to fix console_trylock.

v3: Add a comment explaining why the taks we're waking won't disappear (Chris), and improve commit message to address review questions.

v4: Use wake_q (Peter Z).

Cc Peter Zijlstra <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Will Deacon <[email protected]>
Cc Petr Mladek <[email protected]>
Cc Sergey Senozhatsky <[email protected]>
Cc Steven Rostedt <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc John Ogness <[email protected]>
Cc Chris Wilson <[email protected]>
---
 kernel/locking/semaphore.c | 42 +++++++++++++++++++-------------------
 1 file changed, 21 insertions(+), 21 deletions(-)
kernel/locking/semaphore.c +21 -21
index 561acdd39960..7a6f33715688 100644
@@ -33,12 +33,12 @@
 #include <linux/semaphore.h>
 #include <linux/spinlock.h>
 #include <linux/ftrace.h>
+#include <linux/sched/wake_q.h>
 
 static noinline void __down(struct semaphore *sem);
 static noinline int __down_interruptible(struct semaphore *sem);
 static noinline int __down_killable(struct semaphore *sem);
 static noinline int __down_timeout(struct semaphore *sem, long timeout);
-static noinline void __up(struct semaphore *sem);
 
 /**
  * down - acquire the semaphore
@@ -169,6 +169,14 @@ int down_timeout(struct semaphore *sem, long timeout)
 }
 EXPORT_SYMBOL(down_timeout);
 
+/* Functions for the contended case */
+
+struct semaphore_waiter {
+	struct list_head list;
+	struct task_struct *task;
+	bool up;
+};
+
 /**
  * up - release the semaphore
  * @sem: the semaphore to release
@@ -179,24 +187,25 @@ EXPORT_SYMBOL(down_timeout);
 void up(struct semaphore *sem)
 {
 	unsigned long flags;
+	struct semaphore_waiter *waiter;
+	DEFINE_WAKE_Q(wake_q);
 
 	raw_spin_lock_irqsave(&sem->lock, flags);
-	if (likely(list_empty(&sem->wait_list)))
+	if (likely(list_empty(&sem->wait_list))) {
 		sem->count++;
-	else
-		__up(sem);
+	} else {
+		waiter =  list_first_entry(&sem->wait_list,
+					   struct semaphore_waiter, list);
+		list_del(&waiter->list);
+		waiter->up = true;
+		wake_q_add(&wake_q, waiter->task);
+	}
 	raw_spin_unlock_irqrestore(&sem->lock, flags);
+
+	wake_up_q(&wake_q);
 }
 EXPORT_SYMBOL(up);
 
-/* Functions for the contended case */
-
-struct semaphore_waiter {
-	struct list_head list;
-	struct task_struct *task;
-	bool up;
-};
-
 /*
  * Because this function is inlined, the 'state' parameter will be
  * constant, and thus optimised away by the compiler.  Likewise the
@@ -252,12 +261,3 @@ static noinline int __sched __down_timeout(struct semaphore *sem, long timeout)
 {
 	return __down_common(sem, TASK_UNINTERRUPTIBLE, timeout);
 }
-
-static noinline void __sched __up(struct semaphore *sem)
-{
-	struct semaphore_waiter *waiter = list_first_entry(&sem->wait_list,
-						struct semaphore_waiter, list);
-	list_del(&waiter->list);
-	waiter->up = true;
-	wake_up_process(waiter->task);
-}
Signature · 1 line
2.20.1
#12 lore raw

Re: [PATCH] kernel/locking/semaphore: use wake_q in up()

On (05/09/19 22:06), Daniel Vetter wrote:
[..]

Quoted 22 lines
kernel/locking/semaphore.c +11 -1
+/* Functions for the contended case */
+
+struct semaphore_waiter {
+	struct list_head list;
+	struct task_struct *task;
+	bool up;
+};
+
 /**
  * up - release the semaphore
  * @sem: the semaphore to release
@@ -179,24 +187,25 @@ EXPORT_SYMBOL(down_timeout);
 void up(struct semaphore *sem)
 {
 	unsigned long flags;
+	struct semaphore_waiter *waiter;
+	DEFINE_WAKE_Q(wake_q);
 
 	raw_spin_lock_irqsave(&sem->lock, flags);
-	if (likely(list_empty(&sem->wait_list)))
+	if (likely(list_empty(&sem->wait_list))) {
 		sem->count++;

kernel/locking/semaphore.c EXPORT_SYMBOL(down_timeout); · line 203

Quoted 10 lines
kernel/locking/semaphore.c +7 -2
-	else
-		__up(sem);
+	} else {
+		waiter =  list_first_entry(&sem->wait_list,
+					   struct semaphore_waiter, list);
+		list_del(&waiter->list);
+		waiter->up = true;
+		wake_q_add(&wake_q, waiter->task);
+	}
 	raw_spin_unlock_irqrestore(&sem->lock, flags);

So the new code still can printk/WARN under sem->lock in some buggy cases.

E.g.

	wake_q_add()
	 get_task_struct()
	  refcount_inc_checked()
	   WARN_ONCE()

Are we fine with that?

	-ss
#13 lore raw

Re: [PATCH] kernel/locking/semaphore: use wake_q in up()

Quoted 39 lines · Sergey Senozhatsky

On (05/09/19 22:06), Daniel Vetter wrote:
[..]

Quoted 22 lines
kernel/locking/semaphore.c +11 -1
+/* Functions for the contended case */
+
+struct semaphore_waiter {
+     struct list_head list;
+     struct task_struct *task;
+     bool up;
+};
+
 /**
  * up - release the semaphore
  * @sem: the semaphore to release
@@ -179,24 +187,25 @@ EXPORT_SYMBOL(down_timeout);
 void up(struct semaphore *sem)
 {
      unsigned long flags;
+     struct semaphore_waiter *waiter;
+     DEFINE_WAKE_Q(wake_q);
 
      raw_spin_lock_irqsave(&sem->lock, flags);
-     if (likely(list_empty(&sem->wait_list)))
+     if (likely(list_empty(&sem->wait_list))) {
              sem->count++;

kernel/locking/semaphore.c EXPORT_SYMBOL(down_timeout); · line 203

Quoted 10 lines
kernel/locking/semaphore.c +7 -2
-     else
-             __up(sem);
+     } else {
+             waiter =  list_first_entry(&sem->wait_list,
+                                        struct semaphore_waiter, list);
+             list_del(&waiter->list);
+             waiter->up = true;
+             wake_q_add(&wake_q, waiter->task);
+     }
      raw_spin_unlock_irqrestore(&sem->lock, flags);

So the new code still can printk/WARN under sem->lock in some buggy cases.

Quoted 7 lines

E.g.

        wake_q_add()
         get_task_struct()
          refcount_inc_checked()
           WARN_ONCE()

Are we fine with that?

Hm not great. It's not as bad as the one I'm trying to fix (or not the same at least), because with the wake up chain we have a few locks in there. Which allows lockdep to connect the loop and complain, even when we never actually hit that specific recursion. I.e. once hitting a WARN_ON from try_to_wake_up is enough, plus a totally separate callchain can then close the semaphore.lock->scheduler locks part. Your chain only goes boom if it happens from the console_lock's up.

wake_q_add_safe would be an option, but then we somehow need to arrange for down to call get_task_struct(current) and releasing that, but only if there's no waker who needs that task ref. Sounds tricky ... Also not sure we want to stuff that trickery into the generic semaphore code.
-Daniel

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
maintainer
#14 lore raw

Re: [PATCH] kernel/locking/semaphore: use wake_q in up()

In reply to Daniel Vetter
Quoted 10 lines · Daniel Vetter

console_trylock, called from within printk, can be called from pretty much anywhere. Including try_to_wake_up. Note that this isn't common, usually the box is in pretty bad shape at that point already. But it really doesn't help when then lockdep jumps in and spams the logs, potentially obscuring the real backtrace we're really interested in. One case I've seen (slightly simplified backtrace):

Fix this specific locking recursion by moving the wake_up_process out from under the semaphore.lock spinlock, using wake_q as recommended by Peter Zijlstra.

It might make sense to mention also the optimization effect mentioned by Peter.

Quoted 20 lines
kernel/locking/semaphore.c +8 -0
index 561acdd39960..7a6f33715688 100644
@@ -169,6 +169,14 @@ int down_timeout(struct semaphore *sem, long timeout)
 }
 EXPORT_SYMBOL(down_timeout);
 
+/* Functions for the contended case */
+
+struct semaphore_waiter {
+	struct list_head list;
+	struct task_struct *task;
+	bool up;
+};
+
 /**
  * up - release the semaphore
  * @sem: the semaphore to release

kernel/locking/semaphore.c EXPORT_SYMBOL(down_timeout); · line 191

Quoted 5 lines
kernel/locking/semaphore.c +2 -0
@@ -179,24 +187,25 @@ EXPORT_SYMBOL(down_timeout);
 void up(struct semaphore *sem)
 {
 	unsigned long flags;
+	struct semaphore_waiter *waiter;
+	DEFINE_WAKE_Q(wake_q);

We need to call wake_q_init(&wake_q) to make sure that it is empty.

Best Regards,
Petr

Quoted 30 lines
kernel/locking/semaphore.c +10 -11
 	raw_spin_lock_irqsave(&sem->lock, flags);
-	if (likely(list_empty(&sem->wait_list)))
+	if (likely(list_empty(&sem->wait_list))) {
 		sem->count++;
-	else
-		__up(sem);
+	} else {
+		waiter =  list_first_entry(&sem->wait_list,
+					   struct semaphore_waiter, list);
+		list_del(&waiter->list);
+		waiter->up = true;
+		wake_q_add(&wake_q, waiter->task);
+	}
 	raw_spin_unlock_irqrestore(&sem->lock, flags);
+
+	wake_up_q(&wake_q);
 }
 EXPORT_SYMBOL(up);
 
-/* Functions for the contended case */
-
-struct semaphore_waiter {
-	struct list_head list;
-	struct task_struct *task;
-	bool up;
-};
-
 /*
  * Because this function is inlined, the 'state' parameter will be
  * constant, and thus optimised away by the compiler.  Likewise the
#15 lore raw

Re: [PATCH] kernel/locking/semaphore: use wake_q in up()

Quoted 36 lines · Petr Mladek
Quoted 10 lines · Daniel Vetter

console_trylock, called from within printk, can be called from pretty much anywhere. Including try_to_wake_up. Note that this isn't common, usually the box is in pretty bad shape at that point already. But it really doesn't help when then lockdep jumps in and spams the logs, potentially obscuring the real backtrace we're really interested in. One case I've seen (slightly simplified backtrace):

Fix this specific locking recursion by moving the wake_up_process out from under the semaphore.lock spinlock, using wake_q as recommended by Peter Zijlstra.

It might make sense to mention also the optimization effect mentioned by Peter.

Quoted 20 lines
kernel/locking/semaphore.c +8 -0
index 561acdd39960..7a6f33715688 100644
@@ -169,6 +169,14 @@ int down_timeout(struct semaphore *sem, long timeout)
 }
 EXPORT_SYMBOL(down_timeout);
 
+/* Functions for the contended case */
+
+struct semaphore_waiter {
+     struct list_head list;
+     struct task_struct *task;
+     bool up;
+};
+
 /**
  * up - release the semaphore
  * @sem: the semaphore to release
@@ -179,24 +187,25 @@ EXPORT_SYMBOL(down_timeout);
Quoted 8 lines

kernel/locking/semaphore.c EXPORT_SYMBOL(down_timeout); · line 191

Quoted 5 lines
kernel/locking/semaphore.c +2 -0
 void up(struct semaphore *sem)
 {
      unsigned long flags;
+     struct semaphore_waiter *waiter;
+     DEFINE_WAKE_Q(wake_q);

We need to call wake_q_init(&wake_q) to make sure that it is empty.

DEFINE_WAKE_Q does that already, and if it didn't, I'd wonder how I managed to boot with this patch. console_lock is usally terribly contented because thanks to fbcon we must do a full display modeset while holding it, which takes forever. As long as anyone printks meanwhile (guaranteed while loading drivers really) you have contention.
-Daniel

Quoted 33 lines

Best Regards,
Petr

Quoted 30 lines
kernel/locking/semaphore.c +10 -11
      raw_spin_lock_irqsave(&sem->lock, flags);
-     if (likely(list_empty(&sem->wait_list)))
+     if (likely(list_empty(&sem->wait_list))) {
              sem->count++;
-     else
-             __up(sem);
+     } else {
+             waiter =  list_first_entry(&sem->wait_list,
+                                        struct semaphore_waiter, list);
+             list_del(&waiter->list);
+             waiter->up = true;
+             wake_q_add(&wake_q, waiter->task);
+     }
      raw_spin_unlock_irqrestore(&sem->lock, flags);
+
+     wake_up_q(&wake_q);
 }
 EXPORT_SYMBOL(up);
 
-/* Functions for the contended case */
-
-struct semaphore_waiter {
-     struct list_head list;
-     struct task_struct *task;
-     bool up;
-};
-
 /*
  * Because this function is inlined, the 'state' parameter will be
  * constant, and thus optimised away by the compiler.  Likewise the
Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
maintainer Reviewed-by
#16 lore raw

Re: [PATCH] kernel/locking/semaphore: use wake_q in up()

Quoted 46 lines · Daniel Vetter
Quoted 36 lines · Petr Mladek
Quoted 10 lines · Daniel Vetter

console_trylock, called from within printk, can be called from pretty much anywhere. Including try_to_wake_up. Note that this isn't common, usually the box is in pretty bad shape at that point already. But it really doesn't help when then lockdep jumps in and spams the logs, potentially obscuring the real backtrace we're really interested in. One case I've seen (slightly simplified backtrace):

Fix this specific locking recursion by moving the wake_up_process out from under the semaphore.lock spinlock, using wake_q as recommended by Peter Zijlstra.

It might make sense to mention also the optimization effect mentioned by Peter.

Quoted 20 lines
kernel/locking/semaphore.c +8 -0
index 561acdd39960..7a6f33715688 100644
@@ -169,6 +169,14 @@ int down_timeout(struct semaphore *sem, long timeout)
 }
 EXPORT_SYMBOL(down_timeout);
 
+/* Functions for the contended case */
+
+struct semaphore_waiter {
+     struct list_head list;
+     struct task_struct *task;
+     bool up;
+};
+
 /**
  * up - release the semaphore
  * @sem: the semaphore to release
@@ -179,24 +187,25 @@ EXPORT_SYMBOL(down_timeout);
Quoted 8 lines

kernel/locking/semaphore.c EXPORT_SYMBOL(down_timeout); · line 191

Quoted 5 lines
kernel/locking/semaphore.c +2 -0
 void up(struct semaphore *sem)
 {
      unsigned long flags;
+     struct semaphore_waiter *waiter;
+     DEFINE_WAKE_Q(wake_q);

We need to call wake_q_init(&wake_q) to make sure that it is empty.

Quoted 7 lines

DEFINE_WAKE_Q does that already, and if it didn't, I'd wonder how I managed to boot with this patch. console_lock is usally terribly contented because thanks to fbcon we must do a full display modeset while holding it, which takes forever. As long as anyone printks meanwhile (guaranteed while loading drivers really) you have contention.
-Daniel

You are right. It is initialized by DEFINE_WAKE_Q. The patch looks correct to me then:

Best Regards,
Petr
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#17 lore raw

✓ Fi.CI.BAT: success for RFC: console: hack up console_lock more v3 (rev3)

In reply to Daniel Vetter
== Series Details ==

== Series Details ==

Series: RFC: console: hack up console_lock more v3 (rev3)
URL : https://patchwork.freedesktop.org/series/60467/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_6072 -> Patchwork_12998
====================================================

Summary
-------

**SUCCESS**

No regressions found.

External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_12998/

Known issues
------------

Here are the changes found in Patchwork_12998 that come from known issues:

### IGT changes ###

#### Issues hit ####

* igt@i915_selftest@live_hangcheck:
- fi-skl-iommu: [PASS][1] -> [INCOMPLETE][2] ([fdo#108602] / [fdo#108744])
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6072/fi-skl-iommu/igt@i915_selftest@live_hangcheck.html
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_12998/fi-skl-iommu/igt@i915_selftest@live_hangcheck.html

* igt@kms_cursor_legacy@basic-flip-before-cursor-varying-size:
- fi-bsw-n3050: [PASS][3] -> [FAIL][4] ([fdo#106081])
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6072/fi-bsw-n3050/igt@[email protected]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_12998/fi-bsw-n3050/igt@[email protected]

#### Possible fixes ####

* igt@gem_exec_suspend@basic-s4-devices:
- fi-kbl-7500u: [DMESG-WARN][5] ([fdo#105128] / [fdo#107139]) -> [PASS][6]
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6072/fi-kbl-7500u/igt@[email protected]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_12998/fi-kbl-7500u/igt@[email protected]

#### Warnings ####

* igt@i915_selftest@live_hangcheck:
- fi-apl-guc: [INCOMPLETE][7] ([fdo#103927] / [fdo#110624]) -> [INCOMPLETE][8] ([fdo#103927])
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6072/fi-apl-guc/igt@i915_selftest@live_hangcheck.html
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_12998/fi-apl-guc/igt@i915_selftest@live_hangcheck.html

[fdo#103927]: https://bugs.freedesktop.org/show_bug.cgi?id=103927
[fdo#105128]: https://bugs.freedesktop.org/show_bug.cgi?id=105128
[fdo#106081]: https://bugs.freedesktop.org/show_bug.cgi?id=106081
[fdo#107139]: https://bugs.freedesktop.org/show_bug.cgi?id=107139
[fdo#108602]: https://bugs.freedesktop.org/show_bug.cgi?id=108602
[fdo#108744]: https://bugs.freedesktop.org/show_bug.cgi?id=108744
[fdo#110624]: https://bugs.freedesktop.org/show_bug.cgi?id=110624

Participating hosts (49 -> 44)
------------------------------

Additional (1): fi-blb-e6850
Missing (6): fi-ilk-m540 fi-hsw-4200u fi-byt-squawks fi-bsw-cyan fi-ctg-p8600 fi-byt-clapper

Build changes
-------------

* Linux: CI_DRM_6072 -> Patchwork_12998

CI_DRM_6072: 645586708589c3d2ac81114595e875cdfbbff385 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_4976: b1d91d0228db999145405e529952ca49bab7f706 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_12998: b17a5bb889228f9e9db3679cf90a820c3a4bd3d7 @ git://anongit.freedesktop.org/gfx-ci/linux

== Linux commits ==

b17a5bb88922 kernel/locking/semaphore: use wake_q in up()

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_12998/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#18 lore raw

✓ Fi.CI.IGT: success for RFC: console: hack up console_lock more v3 (rev3)

In reply to Daniel Vetter
== Series Details ==

== Series Details ==

Series: RFC: console: hack up console_lock more v3 (rev3)
URL : https://patchwork.freedesktop.org/series/60467/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_6072_full -> Patchwork_12998_full
====================================================

Summary
-------

**SUCCESS**

No regressions found.

Known issues
------------

Here are the changes found in Patchwork_12998_full that come from known issues:

### IGT changes ###

#### Issues hit ####

* igt@gem_ctx_isolation@rcs0-s3:
- shard-apl: [PASS][1] -> [DMESG-WARN][2] ([fdo#108566]) +5 similar issues
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6072/shard-apl7/igt@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_12998/shard-apl8/igt@[email protected]

* igt@gem_pread@snoop:
- shard-hsw: [PASS][3] -> [INCOMPLETE][4] ([fdo#103540])
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6072/shard-hsw7/igt@[email protected]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_12998/shard-hsw4/igt@[email protected]

* igt@i915_pm_rpm@modeset-stress-extra-wait:
- shard-skl: [PASS][5] -> [INCOMPLETE][6] ([fdo#107807])
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6072/shard-skl8/igt@[email protected]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_12998/shard-skl5/igt@[email protected]

* igt@kms_cursor_legacy@2x-long-cursor-vs-flip-legacy:
- shard-hsw: [PASS][7] -> [FAIL][8] ([fdo#105767])
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6072/shard-hsw8/igt@[email protected]
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_12998/shard-hsw8/igt@[email protected]

* igt@kms_flip@flip-vs-suspend-interruptible:
- shard-skl: [PASS][9] -> [INCOMPLETE][10] ([fdo#109507])
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6072/shard-skl2/igt@[email protected]
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_12998/shard-skl8/igt@[email protected]

* igt@kms_frontbuffer_tracking@fbcpsr-1p-primscrn-cur-indfb-draw-mmap-gtt:
- shard-iclb: [PASS][11] -> [FAIL][12] ([fdo#103167]) +2 similar issues
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6072/shard-iclb1/igt@kms_frontbuffer_tracking@fbcpsr-1p-primscrn-cur-indfb-draw-mmap-gtt.html
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_12998/shard-iclb5/igt@kms_frontbuffer_tracking@fbcpsr-1p-primscrn-cur-indfb-draw-mmap-gtt.html

* igt@kms_psr@no_drrs:
- shard-iclb: [PASS][13] -> [FAIL][14] ([fdo#108341])
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6072/shard-iclb6/igt@kms_psr@no_drrs.html
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_12998/shard-iclb1/igt@kms_psr@no_drrs.html

* igt@kms_psr@psr2_sprite_plane_move:
- shard-iclb: [PASS][15] -> [SKIP][16] ([fdo#109441])
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6072/shard-iclb2/igt@kms_psr@psr2_sprite_plane_move.html
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_12998/shard-iclb6/igt@kms_psr@psr2_sprite_plane_move.html

* igt@kms_setmode@basic:
- shard-apl: [PASS][17] -> [FAIL][18] ([fdo#99912])
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6072/shard-apl1/igt@[email protected]
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_12998/shard-apl7/igt@[email protected]

#### Possible fixes ####

* igt@i915_suspend@debugfs-reader:
- shard-apl: [DMESG-WARN][19] ([fdo#108566]) -> [PASS][20] +5 similar issues
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6072/shard-apl6/igt@[email protected]
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_12998/shard-apl8/igt@[email protected]

* igt@kms_cursor_edge_walk@pipe-b-64x64-bottom-edge:
- shard-snb: [SKIP][21] ([fdo#109271] / [fdo#109278]) -> [PASS][22]
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6072/shard-snb7/igt@[email protected]
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_12998/shard-snb4/igt@[email protected]

* igt@kms_flip@flip-vs-suspend:
- shard-kbl: [DMESG-WARN][23] ([fdo#108566]) -> [PASS][24]
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6072/shard-kbl1/igt@[email protected]
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_12998/shard-kbl7/igt@[email protected]

* igt@kms_flip@plain-flip-fb-recreate-interruptible:
- shard-skl: [FAIL][25] ([fdo#100368]) -> [PASS][26]
[25]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6072/shard-skl2/igt@[email protected]
[26]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_12998/shard-skl7/igt@[email protected]

* igt@kms_frontbuffer_tracking@fbc-1p-shrfb-fliptrack:
- shard-skl: [FAIL][27] ([fdo#103167]) -> [PASS][28] +2 similar issues
[27]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6072/shard-skl5/igt@[email protected]
[28]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_12998/shard-skl5/igt@[email protected]

* igt@kms_frontbuffer_tracking@fbc-rgb101010-draw-mmap-gtt:
- shard-skl: [FAIL][29] ([fdo#103167] / [fdo#110379]) -> [PASS][30]
[29]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6072/shard-skl5/igt@[email protected]
[30]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_12998/shard-skl5/igt@[email protected]

* igt@kms_frontbuffer_tracking@fbcpsr-1p-primscrn-cur-indfb-draw-render:
- shard-iclb: [FAIL][31] ([fdo#103167]) -> [PASS][32] +3 similar issues
[31]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6072/shard-iclb2/igt@kms_frontbuffer_tracking@fbcpsr-1p-primscrn-cur-indfb-draw-render.html
[32]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_12998/shard-iclb6/igt@kms_frontbuffer_tracking@fbcpsr-1p-primscrn-cur-indfb-draw-render.html

* igt@kms_plane_alpha_blend@pipe-a-coverage-7efc:
- shard-skl: [FAIL][33] ([fdo#108145]) -> [PASS][34]
[33]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6072/shard-skl5/igt@[email protected]
[34]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_12998/shard-skl5/igt@[email protected]

* igt@kms_psr@psr2_dpms:
- shard-iclb: [SKIP][35] ([fdo#109441]) -> [PASS][36]
[35]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6072/shard-iclb4/igt@kms_psr@psr2_dpms.html
[36]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_12998/shard-iclb2/igt@kms_psr@psr2_dpms.html

* igt@perf@oa-exponents:
- shard-glk: [FAIL][37] ([fdo#105483]) -> [PASS][38]
[37]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6072/shard-glk5/igt@[email protected]
[38]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_12998/shard-glk2/igt@[email protected]

#### Warnings ####

* igt@i915_pm_rpm@dpms-mode-unset-non-lpsp:
- shard-skl: [SKIP][39] ([fdo#109271]) -> [INCOMPLETE][40] ([fdo#107807])
[39]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6072/shard-skl1/igt@[email protected]
[40]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_12998/shard-skl1/igt@[email protected]

* igt@i915_pm_rpm@modeset-pc8-residency-stress:
- shard-skl: [INCOMPLETE][41] ([fdo#107807]) -> [SKIP][42] ([fdo#109271])
[41]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6072/shard-skl10/igt@[email protected]
[42]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_12998/shard-skl2/igt@[email protected]

* igt@kms_cursor_legacy@cursora-vs-flipb-toggle:
- shard-iclb: [SKIP][43] ([fdo#109274]) -> [INCOMPLETE][44] ([fdo#107713])
[43]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6072/shard-iclb3/igt@[email protected]
[44]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_12998/shard-iclb3/igt@[email protected]

[fdo#100368]: https://bugs.freedesktop.org/show_bug.cgi?id=100368
[fdo#103167]: https://bugs.freedesktop.org/show_bug.cgi?id=103167
[fdo#103540]: https://bugs.freedesktop.org/show_bug.cgi?id=103540
[fdo#105483]: https://bugs.freedesktop.org/show_bug.cgi?id=105483
[fdo#105767]: https://bugs.freedesktop.org/show_bug.cgi?id=105767
[fdo#107713]: https://bugs.freedesktop.org/show_bug.cgi?id=107713
[fdo#107807]: https://bugs.freedesktop.org/show_bug.cgi?id=107807
[fdo#108145]: https://bugs.freedesktop.org/show_bug.cgi?id=108145
[fdo#108341]: https://bugs.freedesktop.org/show_bug.cgi?id=108341
[fdo#108566]: https://bugs.freedesktop.org/show_bug.cgi?id=108566
[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[fdo#109274]: https://bugs.freedesktop.org/show_bug.cgi?id=109274
[fdo#109278]: https://bugs.freedesktop.org/show_bug.cgi?id=109278
[fdo#109441]: https://bugs.freedesktop.org/show_bug.cgi?id=109441
[fdo#109507]: https://bugs.freedesktop.org/show_bug.cgi?id=109507
[fdo#110379]: https://bugs.freedesktop.org/show_bug.cgi?id=110379
[fdo#99912]: https://bugs.freedesktop.org/show_bug.cgi?id=99912

Participating hosts (10 -> 10)
------------------------------

No changes in participating hosts

Build changes
-------------

* Linux: CI_DRM_6072 -> Patchwork_12998

CI_DRM_6072: 645586708589c3d2ac81114595e875cdfbbff385 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_4976: b1d91d0228db999145405e529952ca49bab7f706 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_12998: b17a5bb889228f9e9db3679cf90a820c3a4bd3d7 @ git://anongit.freedesktop.org/gfx-ci/linux
piglit_4509: fdc5a4ca11124ab8413c7988896eec4c97336694 @ git://anongit.freedesktop.org/piglit

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_12998/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#19 lore raw

✗ Fi.CI.CHECKPATCH: warning for RFC: console: hack up console_lock more v3 (rev4)

In reply to Daniel Vetter
== Series Details ==

== Series Details ==

Series: RFC: console: hack up console_lock more v3 (rev4)
URL : https://patchwork.freedesktop.org/series/60467/
State : warning

== Summary ==

$ dim checkpatch origin/drm-tip
7e7042b1b9a6 RFC: console: hack up console_lock more v3
-:25: WARNING:COMMIT_LOG_LONG_LINE: Possible unwrapped commit description (prefer a maximum 75 chars per line)
#25: 
Quoted 1 line

and I think the untangling of the locking hiararchy is useful irrespective

total: 0 errors, 1 warnings, 0 checks, 9 lines checked

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#20 lore raw

✗ Fi.CI.BAT: failure for RFC: console: hack up console_lock more v3 (rev4)

In reply to Daniel Vetter
== Series Details ==

== Series Details ==

Series: RFC: console: hack up console_lock more v3 (rev4)
URL : https://patchwork.freedesktop.org/series/60467/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_6073 -> Patchwork_13001
====================================================

Summary
-------

**FAILURE**

Serious unknown changes coming with Patchwork_13001 absolutely need to be verified manually.

If you think the reported changes have nothing to do with the changes introduced in Patchwork_13001, please notify your bug team to allow them to document this new failure mode, which will reduce false positives in CI.

External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13001/

Possible new issues
-------------------

Here are the unknown changes that may have been introduced in Patchwork_13001:

### IGT changes ###

#### Possible regressions ####

* igt@i915_selftest@live_sanitycheck:
- fi-skl-lmem: [PASS][1] -> [INCOMPLETE][2]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6073/fi-skl-lmem/igt@i915_selftest@live_sanitycheck.html
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13001/fi-skl-lmem/igt@i915_selftest@live_sanitycheck.html

Known issues
------------

Here are the changes found in Patchwork_13001 that come from known issues:

### IGT changes ###

#### Possible fixes ####

* igt@i915_selftest@live_contexts:
- fi-bdw-gvtdvm: [DMESG-FAIL][3] ([fdo#110235]) -> [PASS][4]
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6073/fi-bdw-gvtdvm/igt@i915_selftest@live_contexts.html
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13001/fi-bdw-gvtdvm/igt@i915_selftest@live_contexts.html

* igt@i915_selftest@live_hangcheck:
- {fi-icl-u2}: [INCOMPLETE][5] ([fdo#107713] / [fdo#108569]) -> [PASS][6]
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6073/fi-icl-u2/igt@i915_selftest@live_hangcheck.html
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13001/fi-icl-u2/igt@i915_selftest@live_hangcheck.html

{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).

[fdo#107713]: https://bugs.freedesktop.org/show_bug.cgi?id=107713
[fdo#108569]: https://bugs.freedesktop.org/show_bug.cgi?id=108569
[fdo#110235]: https://bugs.freedesktop.org/show_bug.cgi?id=110235

Participating hosts (47 -> 43)
------------------------------

Additional (3): fi-icl-y fi-blb-e6850 fi-apl-guc
Missing (7): fi-ilk-m540 fi-hsw-4200u fi-byt-squawks fi-bsw-cyan fi-kbl-7500u fi-pnv-d510 fi-byt-clapper

Build changes
-------------

* Linux: CI_DRM_6073 -> Patchwork_13001

CI_DRM_6073: c059ddabfe60a5072ace44a34a9de9b4202df6ec @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_4978: b9b3646d4f04dd0204ead2a1a10f9e1806a0b622 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_13001: 7e7042b1b9a60db79de8464000c3bfe5016e054f @ git://anongit.freedesktop.org/gfx-ci/linux

== Linux commits ==

7e7042b1b9a6 RFC: console: hack up console_lock more v3

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13001/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx