lkml.org 
[lkml]   [2016]   [Nov]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v4 1/4] usb: dbc: early driver for xhci debug capability
From
Date
Hi,

On 11/11/2016 10:24 AM, Lu Baolu wrote:
>> The only thing you can do to make this work is to prevent printing in NMI
>> > context:
>> >
>> > write()
>> > {
>> > if (in_nmi())
>> > return;
>> >
>> > raw_spinlock_irqsave(&lock, flags);
>> > ....
>> >
>> > That fully serializes the writes and just ignores NMI context printks. Not
>> > optimal, but I fear that's all you can do.
> Yes. But I want to add a bit more.
>
> write()
> {
> if (in_nmi() && raw_spin_is_locked(&lock)) {
> trace("... ...");
> return;
> }
>
> raw_spinlock_irqsave(&lock, flags);
> ....

Or...?

write()
{
if (in_nmi() && raw_spin_is_locked(&lock)) {
save_nmi_message_in_local_buf();
set_nmi_message_pending_flag();
return;
}

if (nmi_message_pending_flag_is_set()) {
write_nmi_message();
clear_nmi_message_pending_flag();
}

raw_spinlock_irqsave(&lock, flags);
....


Best regards,
Lu Baolu

\
 
 \ /
  Last update: 2016-11-11 03:49    [W:0.061 / U:3.092 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site