From: Ethan Zhao <haifeng.zhao@linux.intel.com>
To: Baolu Lu <baolu.lu@linux.intel.com>,
bhelgaas@google.com, dwmw2@infradead.org, will@kernel.org,
robin.murphy@arm.com
Cc: linux-pci@vger.kernel.org, iommu@lists.linux.dev,
linux-kernel@vger.kernel.org,
Haorong Ye <yehaorong@bytedance.com>
Subject: Re: [PATCH 2/2] iommu/vt-d: don's issue devTLB flush request when device is disconnected
Date: Fri, 15 Dec 2023 09:03:37 +0800 [thread overview]
Message-ID: <8c8a1e49-5447-4d61-b3ba-782873cc0f4a@linux.intel.com> (raw)
In-Reply-To: <e6fddbb0-fa8f-43d4-8a5e-d177e9465912@linux.intel.com>
On 12/14/2023 10:26 AM, Ethan Zhao wrote:
>
> On 12/13/2023 7:59 PM, Baolu Lu wrote:
>> On 2023/12/13 11:46, Ethan Zhao wrote:
>>> For those endpoint devices connect to system via hotplug capable ports,
>>> users could request a warm reset to the device by flapping device's
>>> link
>>> through setting the slot's link control register, as pciehpt_ist()
>>> DLLSC
>>> interrupt sequence response, pciehp will unload the device driver and
>>> then power it off.
>>
>> Is it possible for pciehp to disable ATS on the device before unloading
>> the driver? Or should the device follow some specific steps to warm
>> reset the device?
>>
> In this case, link down first, then pciehp_ist() got DLLSC interrupt
> to know
>
> that, I don't think it makes sense to disable device ATS here, but it
> could
>
> flag the device is ATS disabled, well, "disconnected" is enough to let
>
> vt-d like software knows the device state.
>
>
For hot "unplug" cases:
1. safe_removal
Users request unplug the device via sysfs or press the attention button,
Then pciehp will response to unconfig device/unload device driver, power
if off, and devcie is ready to remove. in this case, devTLB invalidate
request is sent before device link to be brought down or device power
to be turned off. so it doesn't trigger the hard lockup.
2. supprise_removal
Users remove the devece directly or bring the device link down/turn off
device power first by setting pci config space, link-down/not-present/
power-off are all handled by pciehp the same way "supprise_removal", in
such case, pciehp_ist() will flag the device as "disconnected" first, then
unconfig the devcie, unload driver, iommu release device(issing devTLB
flush)
delete device. so we checking the device state could work such cases.
But I am still think about if there are other windows.
Thanks,
Ethan
>> What happens if IOMMU issues device TLB invalidation after link down but
>> before pci_dev_is_disconnected() returns true?
>
> Seems it wouldn't happen with hotplug cases, safe_removal or
>
> supprise_removal.
>
>
>
> Thanks,
>
> Ethan
>
>>
>> Best regards,
>> baolu
next prev parent reply other threads:[~2023-12-15 1:03 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-13 3:46 [PATCH RFC 0/2] fix vt-d hard lockup when hotplug ATS capable device Ethan Zhao
2023-12-13 3:46 ` [PATCH 1/2] PCI: make pci_dev_is_disconnected() helper public for other drivers Ethan Zhao
2023-12-13 10:49 ` Lukas Wunner
2023-12-14 0:58 ` Ethan Zhao
2023-12-21 10:51 ` Lukas Wunner
2023-12-22 2:35 ` Ethan Zhao
2023-12-13 3:46 ` [PATCH 2/2] iommu/vt-d: don's issue devTLB flush request when device is disconnected Ethan Zhao
2023-12-13 10:44 ` Lukas Wunner
2023-12-13 11:54 ` Robin Murphy
2023-12-14 2:40 ` Ethan Zhao
2023-12-21 10:42 ` Lukas Wunner
2023-12-21 11:01 ` Robin Murphy
2023-12-21 11:07 ` Lukas Wunner
2023-12-22 3:20 ` Ethan Zhao
2023-12-14 2:16 ` Ethan Zhao
2023-12-15 0:43 ` Ethan Zhao
2023-12-13 11:59 ` Baolu Lu
2023-12-14 2:26 ` Ethan Zhao
2023-12-15 1:03 ` Ethan Zhao [this message]
2023-12-15 1:34 ` Baolu Lu
2023-12-15 1:51 ` Ethan Zhao
-- strict thread matches above, loose matches on Subject: below --
2023-12-20 0:51 [PATCH v4 0/2] fix vt-d hard lockup when hotplug ATS capable device Ethan Zhao
2023-12-20 0:51 ` [PATCH v4 1/2] PCI: make pci_dev_is_disconnected() helper public for other drivers Ethan Zhao
2023-12-20 0:51 ` [PATCH v4 2/2] iommu/vt-d: don's issue devTLB flush request when device is disconnected Ethan Zhao
2023-12-21 10:39 ` Lukas Wunner
2023-12-21 11:01 ` Lukas Wunner
2023-12-22 2:08 ` Ethan Zhao
2023-12-22 3:56 ` Ethan Zhao
2023-12-22 1:56 ` Ethan Zhao
2023-12-22 8:14 ` Lukas Wunner
2023-12-22 9:01 ` Ethan Zhao
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=8c8a1e49-5447-4d61-b3ba-782873cc0f4a@linux.intel.com \
--to=haifeng.zhao@linux.intel.com \
--cc=baolu.lu@linux.intel.com \
--cc=bhelgaas@google.com \
--cc=dwmw2@infradead.org \
--cc=iommu@lists.linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=robin.murphy@arm.com \
--cc=will@kernel.org \
--cc=yehaorong@bytedance.com \
/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