Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1520200
| From | Lu Baolu <baolu.lu@linux.intel.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v4 1/4] usb: dbc: early driver for xhci debug capability |
| Date | 2016-11-12 08:40 +0100 |
| Message-ID | <sCB4S-7qv-3@gated-at.bofh.it> (permalink) |
| References | (3 earlier) <sBMlI-77l-9@gated-at.bofh.it> <sBTnb-3hK-9@gated-at.bofh.it> <sBW1I-5Bk-39@gated-at.bofh.it> <sCbN7-7VX-1@gated-at.bofh.it> <sCj7Y-4hu-31@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Hi Peter,
On 11/11/2016 08:28 PM, Peter Zijlstra wrote:
> On Fri, Nov 11, 2016 at 12:33:29PM +0800, Lu Baolu wrote:
>
>> Things become complicated when it comes to USB debug port.
>> But it's still addressable.
>>
>> At this time, we can do it like this.
>>
>> write()
>> {
>> if (in_nmi() && raw_spin_is_locked(&lock))
>> return;
>>
>> raw_spinlock_irqsave(&lock, flags);
>> ....
>>
> Please use raw_spin_trlock_irqsave() instead, spin_is_locked() is fairly
> icky.
Sure.
>
> Also, there's a bunch of exception contexts that do not set in_nmi().
> That is in_nmi() is really only set for #NM. #MC and #DB and
> others do not set this.
That's worth another fix patch. Let me look into it later.
>
>> This will filter some messages from NMI handler in case that
>> another thread is holding the spinlock. I have no idea about
>> how much chance could a debug user faces this. But it might
>> further be fixed with below enhancement.
>>
>> write()
>> {
>> if (in_nmi() && raw_spin_is_locked(&lock)) {
>> produce_a_pending_item_in_ring();
>> return;
>> }
>>
>> raw_spinlock_irqsave(&lock, flags);
>>
>> while (!pending_item_ring_is_empty)
>> consume_a_pending_item_in_ring();
>>
>> ....
>>
>>
>> We can design the pending item ring in a producer-consumer
>> model. It's easy to avoid race between the producer and
>> consumer.
> Problem is that the consumer might never happen, those are the fun most
> bugs.
>
> Not being able to deal with random nested exception context really
> reduces the utility of this thing.
>
> Again, a UART rules. Make a virtual UART in hardware, that'd be totally
> awesome. This thing, I'm not convinced its worth having.
This is the initial work. It helps at least in cases where people need
to dump kernel messages but lacking of a console. It's also a cheap
way, people don't need to buy any third-party devices.
With more and more people trying and enhancing it, it will become
more robust and helpful.
Best regards,
Lu Baolu
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v4 0/4] usb: early: add support for early printk through USB3 debug port Lu Baolu <baolu.lu@linux.intel.com> - 2016-11-01 06:10 +0100
[PATCH v4 4/4] usb: doc: add document for USB3 debug port usage Lu Baolu <baolu.lu@linux.intel.com> - 2016-11-01 06:10 +0100
[PATCH v4 1/4] usb: dbc: early driver for xhci debug capability Lu Baolu <baolu.lu@linux.intel.com> - 2016-11-01 06:10 +0100
Re: [PATCH v4 1/4] usb: dbc: early driver for xhci debug capability Thomas Gleixner <tglx@linutronix.de> - 2016-11-09 10:30 +0100
Re: [PATCH v4 1/4] usb: dbc: early driver for xhci debug capability Lu Baolu <baolu.lu@linux.intel.com> - 2016-11-10 02:20 +0100
Re: [PATCH v4 1/4] usb: dbc: early driver for xhci debug capability Thomas Gleixner <tglx@linutronix.de> - 2016-11-09 10:40 +0100
Re: [PATCH v4 1/4] usb: dbc: early driver for xhci debug capability Lu Baolu <baolu.lu@linux.intel.com> - 2016-11-10 02:30 +0100
Re: [PATCH v4 1/4] usb: dbc: early driver for xhci debug capability Thomas Gleixner <tglx@linutronix.de> - 2016-11-10 10:00 +0100
Re: [PATCH v4 1/4] usb: dbc: early driver for xhci debug capability Peter Zijlstra <peterz@infradead.org> - 2016-11-10 12:50 +0100
Re: [PATCH v4 1/4] usb: dbc: early driver for xhci debug capability Lu Baolu <baolu.lu@linux.intel.com> - 2016-11-11 05:40 +0100
Re: [PATCH v4 1/4] usb: dbc: early driver for xhci debug capability Peter Zijlstra <peterz@infradead.org> - 2016-11-11 13:30 +0100
Re: [PATCH v4 1/4] usb: dbc: early driver for xhci debug capability Lu Baolu <baolu.lu@linux.intel.com> - 2016-11-12 08:40 +0100
Re: [PATCH v4 1/4] usb: dbc: early driver for xhci debug capability Thomas Gleixner <tglx@linutronix.de> - 2016-11-12 12:40 +0100
Re: [PATCH v4 1/4] usb: dbc: early driver for xhci debug capability Lu Baolu <baolu.lu@linux.intel.com> - 2016-11-11 03:30 +0100
Re: [PATCH v4 1/4] usb: dbc: early driver for xhci debug capability Lu Baolu <baolu.lu@linux.intel.com> - 2016-11-11 03:50 +0100
[PATCH v4 2/4] x86: add support for earlyprintk via USB3 debug port Lu Baolu <baolu.lu@linux.intel.com> - 2016-11-01 06:10 +0100
csiph-web