From: Keith Busch <keith.busch@intel.com>
To: Alex Williamson <alex.williamson@redhat.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>,
Keith Busch <keith.busch@intel.com>,
"linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>
Subject: Re: [PATCHv2 0/2] PCI: driver function reset notification
Date: Thu, 16 Jan 2014 13:38:38 -0700 (MST) [thread overview]
Message-ID: <alpine.LRH.2.03.1401161257410.25844@AMR> (raw)
In-Reply-To: <1389899441.8705.60.camel@bling.home>
On Thu, 16 Jan 2014, Alex Williamson wrote:
> On Thu, 2014-01-16 at 11:49 -0700, Bjorn Helgaas wrote:
>> On Mon, Jan 13, 2014 at 3:26 PM, Keith Busch <keith.busch@intel.com> wrote:
...
>>> Actually ... I'm a little concered to be using slot_reset instead of
>>> defining a new callback for FLR. From looking at other device drivers,
>>> I'm not sure they would expect to have their slot_reset invoked in
>>> this situation.
>>
>> I haven't looked at other slot_reset callbacks. Do you have an
>> example we can look at and talk about?
I'm comparing with mpt[2,3]sas_scsih.c. It looks like their slot_reset
requires pci_errhandlers' "err_detected" called prior to slot_reset,
otherwise they'll fail the device remapping.
>> The existing model (even without your changes) allows a user to start
>> a reset via sysfs while the driver is still active. What happens when
>> the reset occurs while the driver is programming the device? For
>> example, if the driver sets up a DMA transfer address, the reset
>> occurs (destroying the address), and the driver initiates the DMA, the
>> DMA will go to the wrong place.
>>
>> I'm not sure how to fix this model of resets happening asynchronous to
>> the driver. Maybe we need to tell the driver *before* the reset.
>> Maybe we need to ask the driver to do the reset itself, and only do it
>> in the core if no driver is attached. Maybe we need to make the reset
>> look like a hotplug remove/add to the driver, so we detach the driver,
>> do the reset, and reattach a driver.
Ha, Willy actually recommended I add two calls before I sent the first
patch! Something like pci_reset_prepare(), pci_reset_complete().
Now that I think about it for my driver, these calls would do be identical
to suspend()/resume(). Can we use those?!
>> In the general case, we don't know what the device *is* after a reset
>> because it could have loaded new firmware. It could require more
>> resources or even a different driver.
Activating new firmware is the exact use I'm going for here. I've been
recommending users manually remove/reset/rescan the device with the
appriate sysfs writes. It sounds like your suggesting we make all that
automatically happen with only need to hit reset.
It turns out making this look like hotplug isn't desirable here because
the device's storage may be mounted partitions (sounds a little scary
to me), and a removal would take down opened disks.
>> I know it would cause Alex heartburn to make reset look like hotplug.
>
> Yes it would. I agree that it's theoretically possible for a device to
> undergo a metamorphosis to something new at reset, but in practice it
> just doesn't happen. Perhaps a reset with no driver attached could
> completely remove, reset, and rescan the device, but that might still
> cause problems with legacy KVM device assignment if pci-stub is not used
> to hold the device. For a device exposed to userspace through vfio, we
> want to be able to reset the device, but releasing the device and trying
> to reacquire it would be challenging to say the least. Thanks,
>
> Alex
>
>> What sort of NVMe problems would that cause? I assume most drivers
>> will have to treat a device coming out of reset basically the same way
>>
>> Bjorn
Thanks for the feedback!
Keith
next prev parent reply other threads:[~2014-01-16 20:39 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-13 22:26 [PATCHv2 0/2] PCI: driver function reset notification Keith Busch
2014-01-13 22:26 ` [PATCHv2 1/2] PCI: call pci reset callback to pci_driver on FLR Keith Busch
2014-01-13 22:26 ` [PATCHv2 2/2] NVMe: Implement pci reset callback Keith Busch
2014-01-16 18:49 ` [PATCHv2 0/2] PCI: driver function reset notification Bjorn Helgaas
2014-01-16 19:10 ` Alex Williamson
2014-01-16 20:38 ` Keith Busch [this message]
2014-01-17 17:26 ` Bjorn Helgaas
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=alpine.LRH.2.03.1401161257410.25844@AMR \
--to=keith.busch@intel.com \
--cc=alex.williamson@redhat.com \
--cc=bhelgaas@google.com \
--cc=linux-pci@vger.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