public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Ethan Zhao <haifeng.zhao@linux.intel.com>
To: Bjorn Helgaas <helgaas@kernel.org>
Cc: bhelgaas@google.com, baolu.lu@linux.intel.com,
	dwmw2@infradead.org, will@kernel.org, robin.murphy@arm.com,
	lukas@wunner.de, linux-pci@vger.kernel.org,
	iommu@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCH v8 4/5] iommu/vt-d: don't issue device-TLB invalidate request when device is disconnected
Date: Thu, 28 Dec 2023 07:31:35 +0800	[thread overview]
Message-ID: <64c77298-dd3e-4102-a9d3-0433708d33ac@linux.intel.com> (raw)
In-Reply-To: <20231227131151.GA1499234@bhelgaas>


On 12/27/2023 9:11 PM, Bjorn Helgaas wrote:
> I suggest using "ATS Invalidate Request" in the subject as well.
> Otherwise we have to figure out whether "device-TLB invalidate
> request" is the same as "ATS Invalidate Request".
>
> If they are the same, just use the same words.
>
> On Tue, Dec 26, 2023 at 09:59:22PM -0500, Ethan Zhao wrote:
>> Except those aggressive hotplug cases - surprise remove a hotplug device
>> while its safe removal is requested and handled in process by:
>>
>> 1. pull it out directly.
>> 2. turn off its power.
>> 3. bring the link down.
>> 4. just died there that moment.
>>
>> etc, in a word, 'gone' or 'disconnected'.
>>
>> Mostly are regular normal safe removal and surprise removal unplug.
>> these hot unplug handling process could be optimized for fix the ATS
>> invalidation hang issue by calling pci_dev_is_disconnected() in function
>> devtlb_invalidation_with_pasid() to check target device state to avoid
>> sending meaningless ATS invalidation request to iommu when device is gone.
>> (see IMPLEMENTATION NOTE in PCIe spec r6.1 section 10.3.1)
> Suggest "ATS Invalidate Request", capitalized exactly that way so we
> know it's a specific name of something defined in the PCIe spec.
>
>> For safe removal, device wouldn't be removed untill the whole software
>> handling process is done, it wouldn't trigger the hard lock up issue
>> caused by too long ATS invalidation timeout wait. in safe removal path,
> Ditto.
>
> Capitalize "In the safe removal ..." since it starts a new sentence.
>
>> device state isn't set to pci_channel_io_perm_failure in
>> pciehp_unconfigure_device() by checking 'presence' parameter, calling
>> pci_dev_is_disconnected() in devtlb_invalidation_with_pasid() will return
>> false there, wouldn't break the function.
>>
>> For surprise removal, device state is set to pci_channel_io_perm_failure in
>> pciehp_unconfigure_device(), means device is already gone (disconnected)
>> call pci_dev_is_disconnected() in devtlb_invalidation_with_pasid() will
>> return true to break the function not to send ATS invalidation request to
> Ditto.

Okay.


Thanks,

Ethan

>> the disconnected device blindly, thus avoid the further long time waiting
>> triggers the hard lockup.
>>
>> safe removal & surprise removal
>>
>> pciehp_ist()
>>     pciehp_handle_presence_or_link_change()
>>       pciehp_disable_slot()
>>         remove_board()
>>           pciehp_unconfigure_device(presence)

  reply	other threads:[~2023-12-27 23:31 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-27  2:59 [RFC PATCH v8 0/5] fix vt-d hard lockup when hotplug ATS capable device Ethan Zhao
2023-12-27  2:59 ` [RFC PATCH v8 1/5] iommu/vt-d: add flush_target_dev member to struct intel_iommu and pass device info to all ATS invalidation functions Ethan Zhao
2023-12-27  2:59 ` [RFC PATCH v8 2/5] iommu/vt-d: break out device-TLB invalidation if target device is gone Ethan Zhao
2023-12-27  2:59 ` [RFC PATCH v8 3/5] PCI: make pci_dev_is_disconnected() helper public for other drivers Ethan Zhao
2023-12-27  2:59 ` [RFC PATCH v8 4/5] iommu/vt-d: don't issue device-TLB invalidate request when device is disconnected Ethan Zhao
2023-12-27 13:11   ` Bjorn Helgaas
2023-12-27 23:31     ` Ethan Zhao [this message]
2023-12-27  2:59 ` [RFC PATCH v8 5/5] iommu/vt-d: don't loop for timeout device-TLB invalidation request forever Ethan Zhao
2023-12-27  3:03   ` Ethan Zhao
2023-12-27  3:11   ` Ethan Zhao
2023-12-27  3:05 ` [RFC PATCH v8 0/5] fix vt-d hard lockup when hotplug ATS capable device Ethan Zhao
  -- strict thread matches above, loose matches on Subject: below --
2023-12-27  3:09 Ethan Zhao
2023-12-27  3:09 ` [RFC PATCH v8 4/5] iommu/vt-d: don't issue device-TLB invalidate request when device is disconnected 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=64c77298-dd3e-4102-a9d3-0433708d33ac@linux.intel.com \
    --to=haifeng.zhao@linux.intel.com \
    --cc=baolu.lu@linux.intel.com \
    --cc=bhelgaas@google.com \
    --cc=dwmw2@infradead.org \
    --cc=helgaas@kernel.org \
    --cc=iommu@lists.linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=lukas@wunner.de \
    --cc=robin.murphy@arm.com \
    --cc=will@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