From: Lu Baolu <baolu.lu@linux.intel.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Mathias Nyman <mathias.nyman@linux.intel.com>,
Ingo Molnar <mingo@redhat.com>,
linux-usb@vger.kernel.org, x86@kernel.org,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v4 1/4] usb: dbc: early driver for xhci debug capability
Date: Sat, 12 Nov 2016 15:35:02 +0800 [thread overview]
Message-ID: <5826C626.4010600@linux.intel.com> (raw)
In-Reply-To: <20161111122824.GH3117@twins.programming.kicks-ass.net>
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
next prev parent reply other threads:[~2016-11-12 7:35 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-01 4:59 [PATCH v4 0/4] usb: early: add support for early printk through USB3 debug port Lu Baolu
2016-11-01 4:59 ` [PATCH v4 1/4] usb: dbc: early driver for xhci debug capability Lu Baolu
2016-11-09 9:23 ` Thomas Gleixner
2016-11-10 1:13 ` Lu Baolu
2016-11-09 9:37 ` Thomas Gleixner
2016-11-10 1:20 ` Lu Baolu
2016-11-10 8:56 ` Thomas Gleixner
2016-11-10 11:44 ` Peter Zijlstra
2016-11-11 4:33 ` Lu Baolu
2016-11-11 12:28 ` Peter Zijlstra
2016-11-12 7:35 ` Lu Baolu [this message]
2016-11-12 11:32 ` Thomas Gleixner
2016-11-11 2:24 ` Lu Baolu
2016-11-11 2:49 ` Lu Baolu
2016-11-01 4:59 ` [PATCH v4 2/4] x86: add support for earlyprintk via USB3 debug port Lu Baolu
2016-11-01 4:59 ` [PATCH v4 3/4] usb: serial: usb_debug: add support for dbc debug device Lu Baolu
2016-11-01 4:59 ` [PATCH v4 4/4] usb: doc: add document for USB3 debug port usage Lu Baolu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5826C626.4010600@linux.intel.com \
--to=baolu.lu@linux.intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=mathias.nyman@linux.intel.com \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).