Re: [PATCH v4 1/4] usb: dbc: early driver for xhci debug capability

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux