[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Fri, 11 Nov 2016 10:49:04 +0800
From: Lu Baolu <baolu.lu@...ux.intel.com>
To: Thomas Gleixner <tglx@...utronix.de>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Mathias Nyman <mathias.nyman@...ux.intel.com>,
Ingo Molnar <mingo@...hat.com>, linux-usb@...r.kernel.org,
x86@...nel.org, LKML <linux-kernel@...r.kernel.org>,
Peter Zijlstra <peterz@...radead.org>
Subject: Re: [PATCH v4 1/4] usb: dbc: early driver for xhci debug capability
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
Powered by blists - more mailing lists