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
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to