From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: "Li, Meng" <Meng.Li@windriver.com>,
Steven Rostedt <rostedt@goodmis.org>,
Ingo Molnar <mingo@redhat.com>,
USB mailing list <linux-usb@vger.kernel.org>,
linux-rt-users <linux-rt-users@vger.kernel.org>
Subject: Re: USB: add check to detect host controller hardware removal
Date: Fri, 3 Nov 2023 16:46:24 +0100 [thread overview]
Message-ID: <20231103154624.WEWPMHTp@linutronix.de> (raw)
In-Reply-To: <1f26049d-b16d-4db8-8b7a-ed93213faf76@rowland.harvard.edu>
On 2023-10-20 11:19:49 [-0400], Alan Stern wrote:
> Hmmm... This turns out not to be as easy as one might think.
>
> Sebastian, if you can instead suggest a way to call drivers' interrupt
> handlers (i.e., simulate an interrupt) without causing problems for RT
> kernels, I think that would be a better approach.
So there is generic_handle_irq_safe(). It should get all the details
right like incrementing the counter in /proc/interrupts, doing nothing
if the interrupt has been masked or waking the interrupt thread if the
interrupt has happen to be threaded.
It triggers the interrupt so for a shared handler it will invoke _all_
registered interrupt handler and for threaded interrupts it will return
before the thread had a chance to run (free_irq() will handle it
properly and wait for the interrupt thread/handler to complete).
> The fundamental problem here is that the uhci-hcd driver was not written
> with unexpected hardware removal in mind. It doesn't have timeouts to
> handle situations where the device doesn't generate an IRQ to indicate
> completion of an I/O operation. And since it's been ten years since
> I've done any significant work on the driver, I'd really like to avoid
> the need for such a far-reaching change (not least because I don't have
> any way to test it).
I see. Don't over complicate or "correct" things here. What should work
is that the removal callback can be called at any time and things
continue work. That means it will purge all queues, cancel all requests,
timers, whatever and free all resources associated with the driver/
device.
If it comes to PCI-hotplug you have to have a so called PCI-hotplug
slot. This "slot" will let the OS know if the hardware has been removed
or added. If you don't have such a thing you have to maintain the state
yourself by using the "remove" and "rescan" sysfs files of the PCI slot.
I'm not aware of any requirement for a PCI-driver to check if its device
has been removed.
> I suppose an alternative approach would be to add a new callback pointer
> to the hc_driver structure -- something that could tell the driver to
> check for hardware removal. I'll do that if there's no other choice.
> But simulating an interrupt seems easier, provided it can be done at
> all.
>
> Alan Stern
Sebastian
next prev parent reply other threads:[~2023-11-03 15:46 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <PH0PR11MB5191464B2F01511D2ADECB3BF1D2A@PH0PR11MB5191.namprd11.prod.outlook.com>
2023-10-13 17:17 ` USB: add check to detect host controller hardware removal Alan Stern
2023-10-15 13:37 ` Li, Meng
2023-10-16 16:56 ` Steven Rostedt
2023-10-16 19:23 ` Alan Stern
2023-10-17 2:23 ` Li, Meng
2023-10-17 14:06 ` Alan Stern
2023-10-18 5:00 ` Li, Meng
2023-10-18 15:20 ` Alan Stern
2023-10-18 15:34 ` Alan Stern
2023-10-19 12:38 ` Sebastian Andrzej Siewior
2023-10-19 15:09 ` Alan Stern
2023-10-19 15:27 ` Alan Stern
2023-10-20 9:52 ` Sebastian Andrzej Siewior
2023-10-20 15:19 ` Alan Stern
2023-11-03 15:46 ` Sebastian Andrzej Siewior [this message]
2023-11-03 20:42 ` Alan Stern
2023-11-06 3:02 ` Li, Meng
2023-11-06 8:28 ` Sebastian Andrzej Siewior
2023-11-06 8:54 ` Li, Meng
2023-11-06 9:09 ` Sebastian Andrzej Siewior
2023-11-07 3:08 ` Li, Meng
2023-11-07 6:17 ` Greg KH
2023-11-06 15:25 ` Alan Stern
2023-11-06 8:27 ` Sebastian Andrzej Siewior
2023-10-19 12:49 ` Sebastian Andrzej Siewior
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=20231103154624.WEWPMHTp@linutronix.de \
--to=bigeasy@linutronix.de \
--cc=Meng.Li@windriver.com \
--cc=linux-rt-users@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=rostedt@goodmis.org \
--cc=stern@rowland.harvard.edu \
/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