console stalled, cause Hard LOCKUP.
A message that is not in the archive (sent off-list or not yet received): [email protected]/
A message that is not in the archive (sent off-list or not yet received): [email protected]/
Hello,
Let's switch to email.
Cc-ing Petr and Steven
Quoted 8 lines · On (03/05/18 07:50), [email protected] wrote:
https://bugzilla.kernel.org/show_bug.cgi?id=199003
yangwen ([email protected]) changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |[email protected]
Thanks, will take a look.
In the meantime, could you check this message:
https://marc.info/?l=linux-kernel&m=152016852803716
It lists several commit IDs that you might backport and try out. Thanks in advance!
-ss
A message that is not in the archive (sent off-list or not yet received): [email protected]/
On (03/20/18 09:34), [email protected] wrote:
[..]
Quoted 3 lines
Thanks very much.
commite480af09c49736848f749a43dff2c902104f6691avoided the NMI watchdog trigger.
Hm, okay... But "touch_nmi_watchdog() everywhere printk/console-related" is not exactly where I wanted us to be.
By the way e480af09c49736848f749a43dff2c902104f6691 is from 2006. Are you sure you meant exactly that commit? What kernel do you use?
Are you saying that none of Steven's patches helped on your setups?
Quoted 4 lines
And this patch may avdoid long time blocking:
https://lkml.org/lkml/2018/3/8/584We've test it several days.
Hm, printk_deferred is a bit dangerous; it moves console_unlock() to IRQ. So you still can have the problem of stuck CPUs, it's just now you shut up the watchdog. Did you test Steven's patches?
A tricky part about printk_deferred() is that it does not use hand off mechanism. And even more... What we have with "printk vs printk" sceanrio
CPU0 CPU1 ... CPUN
printk printk
console_unlock hand off printk
console_unlock hand off
console_unlock
turns into a good old "one CPU prints it all" when we have "printk vs printk_deferred" case. Because printk_deferred just log_store messages and then _may be_ it grabs the console_sem from IRQ and invokes console_unlock().
So it's something like this
CPU0 CPU1 ... CPUN printk printk_deffered console_unlock printk_deferred console_unlock console_unlock ... ... ... printk_deffered printk_deferred console_unlock console_unlock
// offtopic "I can has printk_kthread?"
You now touch_nmi_watchdog() from the console driver [well... at least this is what e480af09c4973 is doing, but I'm not sure I see how come you didn't have it applied], so that's why you don't see hard lockups on that CPU0. But your printing CPU still can stuck, which will defer RCUs on that CPU, etc. etc. etc. So I'd say that those two approaches
printk_deferred + touch_nmi_watchdog
combined can do quite some harm. One thing for sure - they don't really fix any problems.
-ss
A message that is not in the archive (sent off-list or not yet received): [email protected]/
Cc-ing the kernel list and printk people.
Wen Yang, any chance we can switch to email? Bugzilla is not very handful.
Quoted 8 lines · On (03/26/18 02:40), [email protected] wrote:
https://bugzilla.kernel.org/show_bug.cgi?id=199003
--- Comment #11 from Wen Yang ([email protected]) --- Hello Steven,
(quoted diff) +2
-0+module_param_named(synchronous, printk_sync, bool, S_IRUGO); +MODULE_PARM_DESC(synchronous, "make printing to console synchronous");
Quoted 5 lines
It's depend on this kernel parameter(printk.synchronous), but this parameter is readonly.
So we must change grub files, and alse need to restart the server for changes to take effect.
If we can configure it dynamically, it will be more useful.
So you are testing printk_kthread now, right? May I ask why? Did Steven's patch help?
-ss
A message that is not in the archive (sent off-list or not yet received): [email protected]/
I'll Cc blockdev
Quoted 9 lines · On (03/27/18 08:36), [email protected] wrote:
Quoted 8 lines
--- Comment #17 from [email protected] ---
Quoted 3 lines · On (03/26/18 13:05), [email protected] wrote:
Therefore the serial console is actually pretty fast. It seems that the deadline
10ms-per-character is not in the game here.As the name suggests this is dmesg - content of logbuf. We can't tell anything about serial consoles speed from it.
Quoted 6 lines
Grrr, you are right. It would be interesting to see the output from the serial port as well.
Anyway, it does not change the fact that printing so many same lines is useless. The throttling still would make sense and probably would solve the problem.
You are right.
Looking at backtraces (https://bugzilla.kernel.org/attachment.cgi?id=274953&action=edit)
there *probably* was just one CPU doing all printk-s and all printouts. And there was one CPU waiting for that printing CPU to unlock the queue spin_lock.
The printing CPU was looping in scsi_request_fn() picking up requests and calling sdev_printk() for each of them, because the device was offline. Given that serial console is not very fast, that we called serial console under queue spin_lock and the number of printks called, it was enough to lockup the CPU which was spining on queue spin_lock and to hard lockup the system.
scsi_request_fn() does unlock the queue lock later, but not in that !scsi_device_online(sdev) error case.
scsi_request_fn()
{
for (;;) {
int rtn;
/*
* get next queueable request. We do this early to make sure
* that the request is fully prepared even if we cannot
* accept it.
*/
req = blk_peek_request(q);
if (!req)
break;
if (unlikely(!scsi_device_online(sdev))) {
sdev_printk(KERN_ERR, sdev,
"rejecting I/O to offline device\n");
scsi_kill_request(req, q);
continue;
^^^^^^^^^ still under spinlock
}
}I'd probably just unlock/lock queue lock, rather than ratelimit printk-s, before `continue'. Dunno.
James, Martin, what do you think?
-ss