All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ethan Zhao <haifeng.zhao@linux.intel.com>
To: Baolu Lu <baolu.lu@linux.intel.com>, Jason Gunthorpe <jgg@ziepe.ca>
Cc: Yunhui Cui <cuiyunhui@bytedance.com>,
	dwmw2@infradead.org, joro@8bytes.org, will@kernel.org,
	robin.murphy@arm.com, iommu@lists.linux.dev,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] iommu/vt-d: fix system hang on reboot -f
Date: Wed, 26 Feb 2025 13:55:28 +0800	[thread overview]
Message-ID: <83039906-77f7-4318-94bf-4c98bb3f0e32@linux.intel.com> (raw)
In-Reply-To: <33c4755d-6a0f-4734-88e0-84f0de67b652@linux.intel.com>


在 2025/2/26 13:18, Baolu Lu 写道:
> On 2/26/25 11:50, Ethan Zhao wrote:
>>>>>>
>>> If the schedular doesn't run how did we get from 4 -> 5?
>>>
>>> Maybe the issue is the shutdown handler here is running in the wrong
>>> time and it should not be running after the scheduler has been shut
>>> down.
>>>
>>> I don't think removing the lock is a great idea without more
>>> explanation.
>>
>> Seems it is not so simple job to explain why there is no race window 
>> between
>> this iommu_shutdown() and following dmar_global_lock holders.
>>
>> 1. PCIe hotplug dmar_pci_bus_notifier()
>>
>> 2. mm_core_init detect_intel_iommu()
>>
>> 3. late_initcall dmar_free_unused_resources()
>>
>> 4. acpi attach dmar_device_hotplug()
>>
>> 5. pci_iommu_init intel_iommu_init() init_dmars()
>>
>> 6. rootfs_initcall ir_dev_scope_init()
>>
>> though here is the last stage of reboot. then how about we turn back 
>> to v1
>>
>> Just repalce with own_write() with down_write_trylock().
>
> I don't think trylock is a reasonable solution. intel_iommu_shutdown()
> should not become a no-op simply because it cannot acquire a lock
> immediately.

No other CPUs is holding lock after they were brought down by sync call to

functionnative_stop_other_cpus(1).

So actually it wouldn't fail to acquire a lock.  this is also the reason why we don't

need to down_write() thedmar_global_lock.

>
> The lock here is to protect the drhd (representation of iommu hardware)
> list. It needs protection because this driver supports iommu hot-add and
> remove, which is triggered by an ACPI event for I/O board hotplug.

Yup, the lock is used to protect the global listdmar_drhd_units.

but here all IOAPIC/LAPIC are brought down, hotplug interrupts couldn't 
happend either. (only legacy and NMI are alive).

> Provided the system does not respond to those events when this function
> is called, it's fine to remove the lock.
I agree.
>
> Thanks,
> baolu

-- 
"firm, enduring, strong, and long-lived"


  reply	other threads:[~2025-02-26  5:55 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-25  6:48 [PATCH v2] iommu/vt-d: fix system hang on reboot -f Yunhui Cui
2025-02-25  7:01 ` Baolu Lu
2025-02-25  8:54   ` Ethan Zhao
2025-02-25 14:26     ` Jason Gunthorpe
2025-02-26  0:35       ` Ethan Zhao
2025-02-26  3:50       ` Ethan Zhao
2025-02-26  5:18         ` Baolu Lu
2025-02-26  5:55           ` Ethan Zhao [this message]
2025-02-26 13:04             ` Jason Gunthorpe
2025-02-27  0:40               ` Ethan Zhao
2025-02-27 20:38                 ` Jason Gunthorpe
2025-02-28  0:51                   ` Ethan Zhao
2025-02-28  2:18                     ` [External] " yunhui cui
2025-02-28  4:34                       ` 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=83039906-77f7-4318-94bf-4c98bb3f0e32@linux.intel.com \
    --to=haifeng.zhao@linux.intel.com \
    --cc=baolu.lu@linux.intel.com \
    --cc=cuiyunhui@bytedance.com \
    --cc=dwmw2@infradead.org \
    --cc=iommu@lists.linux.dev \
    --cc=jgg@ziepe.ca \
    --cc=joro@8bytes.org \
    --cc=linux-kernel@vger.kernel.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.