public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [edk2-devel] [PATCH] MdeModulePkg/PciBusDxe: Fix hotplug functionality for USB4 bridge
@ 2024-02-06 22:34 Hsueh, Hong-Chih (Neo) via groups.io
  2024-02-07 20:51 ` Laszlo Ersek
  0 siblings, 1 reply; 8+ messages in thread
From: Hsueh, Hong-Chih (Neo) via groups.io @ 2024-02-06 22:34 UTC (permalink / raw)
  To: devel; +Cc: feng1.ding, jiangang.he, abner.chang, ray.ni, gaoliming,
	Neo Hsueh

A USB4 or TBT bridge can be plugged or unplugged on USB4 port. The actions require PciHotPlugRequestNotify to add a root bridge or remove a root bridge completely.
In the plug-unplug-plug scenerio, PciHotPlugRequestNotify will return with no-action on second plug because bridge tree shows configured.
Destroy Pci Device Tree in function PciHotPlugRequestNotify for unplug event to fix this issue.

Cc: Feng Ding <feng1.ding@amd.com>
Cc: Jiangang He <jiangang.he@amd.com>
Signed-off-by: Neo Hsueh <Hong-Chih.Hsueh@amd.com>
---
 MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.c b/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.c
index 3f8c6e6da7..2b7af60e0a 100644
--- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.c
+++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.c
@@ -2103,6 +2103,8 @@ PciHotPlugRequestNotify (
       }
     }
 
+    DestroyPciDeviceTree (Bridge);
+
     //
     // End for
     //
-- 
2.40.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#115190): https://edk2.groups.io/g/devel/message/115190
Mute This Topic: https://groups.io/mt/104208348/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [edk2-devel] [PATCH] MdeModulePkg/PciBusDxe: Fix hotplug functionality for USB4 bridge
  2024-02-06 22:34 [edk2-devel] [PATCH] MdeModulePkg/PciBusDxe: Fix hotplug functionality for USB4 bridge Hsueh, Hong-Chih (Neo) via groups.io
@ 2024-02-07 20:51 ` Laszlo Ersek
  2024-02-08 23:09   ` Ding, Feng (Sunnyvale) via groups.io
  0 siblings, 1 reply; 8+ messages in thread
From: Laszlo Ersek @ 2024-02-07 20:51 UTC (permalink / raw)
  To: devel, hong-chih.hsueh
  Cc: feng1.ding, jiangang.he, abner.chang, ray.ni, gaoliming

On 2/6/24 23:34, Hsueh, Hong-Chih (Neo) via groups.io wrote:
> A USB4 or TBT bridge can be plugged or unplugged on USB4 port. The actions require PciHotPlugRequestNotify to add a root bridge or remove a root bridge completely.
> In the plug-unplug-plug scenerio, PciHotPlugRequestNotify will return with no-action on second plug because bridge tree shows configured.
> Destroy Pci Device Tree in function PciHotPlugRequestNotify for unplug event to fix this issue.
> 
> Cc: Feng Ding <feng1.ding@amd.com>
> Cc: Jiangang He <jiangang.he@amd.com>
> Signed-off-by: Neo Hsueh <Hong-Chih.Hsueh@amd.com>
> ---
>  MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.c b/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.c
> index 3f8c6e6da7..2b7af60e0a 100644
> --- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.c
> +++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.c
> @@ -2103,6 +2103,8 @@ PciHotPlugRequestNotify (
>        }
>      }
>  
> +    DestroyPciDeviceTree (Bridge);
> +
>      //
>      // End for
>      //

I think the subject line is too specific. This patch appears to fix a general resource leak in the PCI hot-unplug functionality. Writing up the USB4 angle in the commit message is welcome in my opinion, but the subject should state something like:

MdeModulePkg/PciBusDxe: plug device hierarchy leak upon bridge hot-unplug

(And I think the bridge doesn't even have to be a *root* bridge for the leak to occur; is that right?)

Laszlo



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#115252): https://edk2.groups.io/g/devel/message/115252
Mute This Topic: https://groups.io/mt/104208348/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [edk2-devel] [PATCH] MdeModulePkg/PciBusDxe: Fix hotplug functionality for USB4 bridge
  2024-02-07 20:51 ` Laszlo Ersek
@ 2024-02-08 23:09   ` Ding, Feng (Sunnyvale) via groups.io
  2024-02-20 19:48     ` [edk2-devel] [PATCH] MdeModulePkg/PciBusDxe: plug device hierarchy leak upon bridge hot-unplug Hsueh, Hong-Chih (Neo) via groups.io
  2024-08-16  2:33     ` [edk2-devel] [PATCH] MdeModulePkg/PciBusDxe: Fix hotplug functionality for USB4 bridge Yoshinoya
  0 siblings, 2 replies; 8+ messages in thread
From: Ding, Feng (Sunnyvale) via groups.io @ 2024-02-08 23:09 UTC (permalink / raw)
  To: Laszlo Ersek, devel@edk2.groups.io, Hsueh, Hong-Chih (Neo)
  Cc: He, Jiangang, Chang, Abner, ray.ni@intel.com,
	gaoliming@byosoft.com.cn, Gopal, Pradeep

[AMD Official Use Only - General]

Hi Laszlo,

" MdeModulePkg/PciBusDxe: plug device hierarchy leak upon bridge hot-unplug " is perfect description for the issue.
"a root bridge" is "a (PCIe Hotplug) bridge", locating anywhere.

Thanks
feng

-----Original Message-----
From: Laszlo Ersek <lersek@redhat.com>
Sent: Wednesday, February 7, 2024 12:51 PM
To: devel@edk2.groups.io; Hsueh, Hong-Chih (Neo) <Hong-Chih.Hsueh@amd.com>
Cc: Ding, Feng (Sunnyvale) <feng1.ding@amd.com>; He, Jiangang <Jiangang.He@amd.com>; Chang, Abner <Abner.Chang@amd.com>; ray.ni@intel.com; gaoliming@byosoft.com.cn
Subject: Re: [edk2-devel] [PATCH] MdeModulePkg/PciBusDxe: Fix hotplug functionality for USB4 bridge

Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.


On 2/6/24 23:34, Hsueh, Hong-Chih (Neo) via groups.io wrote:
> A USB4 or TBT bridge can be plugged or unplugged on USB4 port. The actions require PciHotPlugRequestNotify to add a root bridge or remove a root bridge completely.
> In the plug-unplug-plug scenerio, PciHotPlugRequestNotify will return with no-action on second plug because bridge tree shows configured.
> Destroy Pci Device Tree in function PciHotPlugRequestNotify for unplug event to fix this issue.
>
> Cc: Feng Ding <feng1.ding@amd.com>
> Cc: Jiangang He <jiangang.he@amd.com>
> Signed-off-by: Neo Hsueh <Hong-Chih.Hsueh@amd.com>
> ---
>  MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.c b/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.c
> index 3f8c6e6da7..2b7af60e0a 100644
> --- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.c
> +++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.c
> @@ -2103,6 +2103,8 @@ PciHotPlugRequestNotify (
>        }
>      }
>
> +    DestroyPciDeviceTree (Bridge);
> +
>      //
>      // End for
>      //

I think the subject line is too specific. This patch appears to fix a general resource leak in the PCI hot-unplug functionality. Writing up the USB4 angle in the commit message is welcome in my opinion, but the subject should state something like:

MdeModulePkg/PciBusDxe: plug device hierarchy leak upon bridge hot-unplug

(And I think the bridge doesn't even have to be a *root* bridge for the leak to occur; is that right?)

Laszlo



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#115298): https://edk2.groups.io/g/devel/message/115298
Mute This Topic: https://groups.io/mt/104208348/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [edk2-devel] [PATCH] MdeModulePkg/PciBusDxe: plug device hierarchy leak upon bridge hot-unplug
  2024-02-08 23:09   ` Ding, Feng (Sunnyvale) via groups.io
@ 2024-02-20 19:48     ` Hsueh, Hong-Chih (Neo) via groups.io
  2024-02-21 20:05       ` Laszlo Ersek
  2024-02-22 16:33       ` Hsueh, Hong-Chih (Neo) via groups.io
  2024-08-16  2:33     ` [edk2-devel] [PATCH] MdeModulePkg/PciBusDxe: Fix hotplug functionality for USB4 bridge Yoshinoya
  1 sibling, 2 replies; 8+ messages in thread
From: Hsueh, Hong-Chih (Neo) via groups.io @ 2024-02-20 19:48 UTC (permalink / raw)
  To: Ding, Feng (Sunnyvale), Laszlo Ersek, devel@edk2.groups.io
  Cc: He, Jiangang, Chang, Abner, ray.ni@intel.com,
	gaoliming@byosoft.com.cn, Gopal, Pradeep


[-- Attachment #1.1: Type: text/plain, Size: 3671 bytes --]

[AMD Official Use Only - General]

Hi Feng & Laszlo,

Thank you for the feedback, I have changed the title of this email and the title of the commit message of this patch.
The new patch as attached. If this patch looks good to you, could you please help to add reviewed-by?

Thanks!

Regards,
Neo

________________________________
From: Ding, Feng (Sunnyvale) <feng1.ding@amd.com>
Sent: Thursday, February 8, 2024 5:09 PM
To: Laszlo Ersek <lersek@redhat.com>; devel@edk2.groups.io <devel@edk2.groups.io>; Hsueh, Hong-Chih (Neo) <Hong-Chih.Hsueh@amd.com>
Cc: He, Jiangang <Jiangang.He@amd.com>; Chang, Abner <Abner.Chang@amd.com>; ray.ni@intel.com <ray.ni@intel.com>; gaoliming@byosoft.com.cn <gaoliming@byosoft.com.cn>; Gopal, Pradeep <Pradeep.Gopal@amd.com>
Subject: RE: [edk2-devel] [PATCH] MdeModulePkg/PciBusDxe: Fix hotplug functionality for USB4 bridge

[AMD Official Use Only - General]

Hi Laszlo,

" MdeModulePkg/PciBusDxe: plug device hierarchy leak upon bridge hot-unplug " is perfect description for the issue.
"a root bridge" is "a (PCIe Hotplug) bridge", locating anywhere.

Thanks
feng

-----Original Message-----
From: Laszlo Ersek <lersek@redhat.com>
Sent: Wednesday, February 7, 2024 12:51 PM
To: devel@edk2.groups.io; Hsueh, Hong-Chih (Neo) <Hong-Chih.Hsueh@amd.com>
Cc: Ding, Feng (Sunnyvale) <feng1.ding@amd.com>; He, Jiangang <Jiangang.He@amd.com>; Chang, Abner <Abner.Chang@amd.com>; ray.ni@intel.com; gaoliming@byosoft.com.cn
Subject: Re: [edk2-devel] [PATCH] MdeModulePkg/PciBusDxe: Fix hotplug functionality for USB4 bridge

Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.


On 2/6/24 23:34, Hsueh, Hong-Chih (Neo) via groups.io wrote:
> A USB4 or TBT bridge can be plugged or unplugged on USB4 port. The actions require PciHotPlugRequestNotify to add a root bridge or remove a root bridge completely.
> In the plug-unplug-plug scenerio, PciHotPlugRequestNotify will return with no-action on second plug because bridge tree shows configured.
> Destroy Pci Device Tree in function PciHotPlugRequestNotify for unplug event to fix this issue.
>
> Cc: Feng Ding <feng1.ding@amd.com>
> Cc: Jiangang He <jiangang.he@amd.com>
> Signed-off-by: Neo Hsueh <Hong-Chih.Hsueh@amd.com>
> ---
>  MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.c b/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.c
> index 3f8c6e6da7..2b7af60e0a 100644
> --- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.c
> +++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.c
> @@ -2103,6 +2103,8 @@ PciHotPlugRequestNotify (
>        }
>      }
>
> +    DestroyPciDeviceTree (Bridge);
> +
>      //
>      // End for
>      //

I think the subject line is too specific. This patch appears to fix a general resource leak in the PCI hot-unplug functionality. Writing up the USB4 angle in the commit message is welcome in my opinion, but the subject should state something like:

MdeModulePkg/PciBusDxe: plug device hierarchy leak upon bridge hot-unplug

(And I think the bridge doesn't even have to be a *root* bridge for the leak to occur; is that right?)

Laszlo



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#115677): https://edk2.groups.io/g/devel/message/115677
Mute This Topic: https://groups.io/mt/104474693/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



[-- Attachment #1.2: Type: text/html, Size: 7182 bytes --]

[-- Attachment #2: 0001-MdeModulePkg-PciBusDxe-plug-device-hierarchy-leak-up.patch --]
[-- Type: application/octet-stream, Size: 1370 bytes --]

From 3a640aa0f5555ccc327588ef7bb8d4ba5941442d Mon Sep 17 00:00:00 2001
Message-Id: <3a640aa0f5555ccc327588ef7bb8d4ba5941442d.1708458402.git.Hong-Chih.Hsueh@amd.com>
From: Neo Hsueh <Hong-Chih.Hsueh@amd.com>
Date: Tue, 6 Feb 2024 16:12:34 -0600
Subject: [PATCH] MdeModulePkg/PciBusDxe: plug device hierarchy leak upon
 bridge hot-unplug

A USB4 or TBT bridge can be plugged or unplugged on USB4 port. The actions require PciHotPlugRequestNotify to add a root bridge or remove a root bridge completely.
In the plug-unplug-plug scenerio, PciHotPlugRequestNotify will return with no-action on second plug because bridge tree shows configured.
Destroy Pci Device Tree in function PciHotPlugRequestNotify for unplug event to fix this issue.

Cc: Feng Ding <feng1.ding@amd.com>
Cc: Jiangang He <jiangang.he@amd.com>
Signed-off-by: Neo Hsueh <Hong-Chih.Hsueh@amd.com>
---
 MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.c b/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.c
index 3f8c6e6da7..2b7af60e0a 100644
--- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.c
+++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.c
@@ -2103,6 +2103,8 @@ PciHotPlugRequestNotify (
       }
     }
 
+    DestroyPciDeviceTree (Bridge);
+
     //
     // End for
     //
-- 
2.40.0.windows.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [edk2-devel] [PATCH] MdeModulePkg/PciBusDxe: plug device hierarchy leak upon bridge hot-unplug
  2024-02-20 19:48     ` [edk2-devel] [PATCH] MdeModulePkg/PciBusDxe: plug device hierarchy leak upon bridge hot-unplug Hsueh, Hong-Chih (Neo) via groups.io
@ 2024-02-21 20:05       ` Laszlo Ersek
  2024-02-22 16:33       ` Hsueh, Hong-Chih (Neo) via groups.io
  1 sibling, 0 replies; 8+ messages in thread
From: Laszlo Ersek @ 2024-02-21 20:05 UTC (permalink / raw)
  To: Hsueh, Hong-Chih (Neo), Ding, Feng (Sunnyvale),
	devel@edk2.groups.io
  Cc: He, Jiangang, Chang, Abner, ray.ni@intel.com,
	gaoliming@byosoft.com.cn, Gopal, Pradeep

On 2/20/24 20:48, Hsueh, Hong-Chih (Neo) wrote:
> [AMD Official Use Only - General]
> 
> 
> Hi Feng & Laszlo,
> 
> Thank you for the feedback, I have changed the title of this email and
> the title of the commit message of this patch.
> The new patch as attached. If this patch looks good to you, could you
> please help to add reviewed-by?

Please post the patch (with "v2" in the subject prefix) to the mailing
list, as a standalone thread-starter.

Thanks,
Laszlo


> 
> Thanks!
> 
> Regards,
> Neo
> 
> ------------------------------------------------------------------------
> *From:* Ding, Feng (Sunnyvale) <feng1.ding@amd.com>
> *Sent:* Thursday, February 8, 2024 5:09 PM
> *To:* Laszlo Ersek <lersek@redhat.com>; devel@edk2.groups.io
> <devel@edk2.groups.io>; Hsueh, Hong-Chih (Neo) <Hong-Chih.Hsueh@amd.com>
> *Cc:* He, Jiangang <Jiangang.He@amd.com>; Chang, Abner
> <Abner.Chang@amd.com>; ray.ni@intel.com <ray.ni@intel.com>;
> gaoliming@byosoft.com.cn <gaoliming@byosoft.com.cn>; Gopal, Pradeep
> <Pradeep.Gopal@amd.com>
> *Subject:* RE: [edk2-devel] [PATCH] MdeModulePkg/PciBusDxe: Fix hotplug
> functionality for USB4 bridge
>  
> [AMD Official Use Only - General]
> 
> Hi Laszlo,
> 
> " MdeModulePkg/PciBusDxe: plug device hierarchy leak upon bridge
> hot-unplug " is perfect description for the issue.
> "a root bridge" is "a (PCIe Hotplug) bridge", locating anywhere.
> 
> Thanks
> feng
> 
> -----Original Message-----
> From: Laszlo Ersek <lersek@redhat.com>
> Sent: Wednesday, February 7, 2024 12:51 PM
> To: devel@edk2.groups.io; Hsueh, Hong-Chih (Neo) <Hong-Chih.Hsueh@amd.com>
> Cc: Ding, Feng (Sunnyvale) <feng1.ding@amd.com>; He, Jiangang
> <Jiangang.He@amd.com>; Chang, Abner <Abner.Chang@amd.com>;
> ray.ni@intel.com; gaoliming@byosoft.com.cn
> Subject: Re: [edk2-devel] [PATCH] MdeModulePkg/PciBusDxe: Fix hotplug
> functionality for USB4 bridge
> 
> Caution: This message originated from an External Source. Use proper
> caution when opening attachments, clicking links, or responding.
> 
> 
> On 2/6/24 23:34, Hsueh, Hong-Chih (Neo) via groups.io wrote:
>> A USB4 or TBT bridge can be plugged or unplugged on USB4 port. The actions require PciHotPlugRequestNotify to add a root bridge or remove a root bridge completely.
>> In the plug-unplug-plug scenerio, PciHotPlugRequestNotify will return with no-action on second plug because bridge tree shows configured.
>> Destroy Pci Device Tree in function PciHotPlugRequestNotify for unplug event to fix this issue.
>>
>> Cc: Feng Ding <feng1.ding@amd.com>
>> Cc: Jiangang He <jiangang.he@amd.com>
>> Signed-off-by: Neo Hsueh <Hong-Chih.Hsueh@amd.com>
>> ---
>>  MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.c | 2 ++
>>  1 file changed, 2 insertions(+)
>>
>> diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.c b/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.c
>> index 3f8c6e6da7..2b7af60e0a 100644
>> --- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.c
>> +++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.c
>> @@ -2103,6 +2103,8 @@ PciHotPlugRequestNotify (
>>        }
>>      }
>>
>> +    DestroyPciDeviceTree (Bridge);
>> +
>>      //
>>      // End for
>>      //
> 
> I think the subject line is too specific. This patch appears to fix a
> general resource leak in the PCI hot-unplug functionality. Writing up
> the USB4 angle in the commit message is welcome in my opinion, but the
> subject should state something like:
> 
> MdeModulePkg/PciBusDxe: plug device hierarchy leak upon bridge hot-unplug
> 
> (And I think the bridge doesn't even have to be a *root* bridge for the
> leak to occur; is that right?)
> 
> Laszlo
> 



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#115733): https://edk2.groups.io/g/devel/message/115733
Mute This Topic: https://groups.io/mt/104474693/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [edk2-devel] [PATCH] MdeModulePkg/PciBusDxe: plug device hierarchy leak upon bridge hot-unplug
  2024-02-20 19:48     ` [edk2-devel] [PATCH] MdeModulePkg/PciBusDxe: plug device hierarchy leak upon bridge hot-unplug Hsueh, Hong-Chih (Neo) via groups.io
  2024-02-21 20:05       ` Laszlo Ersek
@ 2024-02-22 16:33       ` Hsueh, Hong-Chih (Neo) via groups.io
  1 sibling, 0 replies; 8+ messages in thread
From: Hsueh, Hong-Chih (Neo) via groups.io @ 2024-02-22 16:33 UTC (permalink / raw)
  To: Ding, Feng (Sunnyvale), Laszlo Ersek, devel@edk2.groups.io
  Cc: He, Jiangang, Chang, Abner, ray.ni@intel.com,
	gaoliming@byosoft.com.cn, Gopal, Pradeep

[-- Attachment #1: Type: text/plain, Size: 4414 bytes --]

[AMD Official Use Only - General]

Please kindly ignore this mail thread as I have created and sent out [PATCH V2] with correct title in another mail thread for review.

Thank you.

Regards,
Neo
________________________________
From: Hsueh, Hong-Chih (Neo) <Hong-Chih.Hsueh@amd.com>
Sent: Tuesday, February 20, 2024 1:48 PM
To: Ding, Feng (Sunnyvale) <feng1.ding@amd.com>; Laszlo Ersek <lersek@redhat.com>; devel@edk2.groups.io <devel@edk2.groups.io>
Cc: He, Jiangang <Jiangang.He@amd.com>; Chang, Abner <Abner.Chang@amd.com>; ray.ni@intel.com <ray.ni@intel.com>; gaoliming@byosoft.com.cn <gaoliming@byosoft.com.cn>; Gopal, Pradeep <Pradeep.Gopal@amd.com>
Subject: Re: [edk2-devel] [PATCH] MdeModulePkg/PciBusDxe: plug device hierarchy leak upon bridge hot-unplug

Hi Feng & Laszlo,

Thank you for the feedback, I have changed the title of this email and the title of the commit message of this patch.
The new patch as attached. If this patch looks good to you, could you please help to add reviewed-by?

Thanks!

Regards,
Neo

________________________________
From: Ding, Feng (Sunnyvale) <feng1.ding@amd.com>
Sent: Thursday, February 8, 2024 5:09 PM
To: Laszlo Ersek <lersek@redhat.com>; devel@edk2.groups.io <devel@edk2.groups.io>; Hsueh, Hong-Chih (Neo) <Hong-Chih.Hsueh@amd.com>
Cc: He, Jiangang <Jiangang.He@amd.com>; Chang, Abner <Abner.Chang@amd.com>; ray.ni@intel.com <ray.ni@intel.com>; gaoliming@byosoft.com.cn <gaoliming@byosoft.com.cn>; Gopal, Pradeep <Pradeep.Gopal@amd.com>
Subject: RE: [edk2-devel] [PATCH] MdeModulePkg/PciBusDxe: Fix hotplug functionality for USB4 bridge

[AMD Official Use Only - General]

Hi Laszlo,

" MdeModulePkg/PciBusDxe: plug device hierarchy leak upon bridge hot-unplug " is perfect description for the issue.
"a root bridge" is "a (PCIe Hotplug) bridge", locating anywhere.

Thanks
feng

-----Original Message-----
From: Laszlo Ersek <lersek@redhat.com>
Sent: Wednesday, February 7, 2024 12:51 PM
To: devel@edk2.groups.io; Hsueh, Hong-Chih (Neo) <Hong-Chih.Hsueh@amd.com>
Cc: Ding, Feng (Sunnyvale) <feng1.ding@amd.com>; He, Jiangang <Jiangang.He@amd.com>; Chang, Abner <Abner.Chang@amd.com>; ray.ni@intel.com; gaoliming@byosoft.com.cn
Subject: Re: [edk2-devel] [PATCH] MdeModulePkg/PciBusDxe: Fix hotplug functionality for USB4 bridge

Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.


On 2/6/24 23:34, Hsueh, Hong-Chih (Neo) via groups.io wrote:
> A USB4 or TBT bridge can be plugged or unplugged on USB4 port. The actions require PciHotPlugRequestNotify to add a root bridge or remove a root bridge completely.
> In the plug-unplug-plug scenerio, PciHotPlugRequestNotify will return with no-action on second plug because bridge tree shows configured.
> Destroy Pci Device Tree in function PciHotPlugRequestNotify for unplug event to fix this issue.
>
> Cc: Feng Ding <feng1.ding@amd.com>
> Cc: Jiangang He <jiangang.he@amd.com>
> Signed-off-by: Neo Hsueh <Hong-Chih.Hsueh@amd.com>
> ---
>  MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.c b/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.c
> index 3f8c6e6da7..2b7af60e0a 100644
> --- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.c
> +++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.c
> @@ -2103,6 +2103,8 @@ PciHotPlugRequestNotify (
>        }
>      }
>
> +    DestroyPciDeviceTree (Bridge);
> +
>      //
>      // End for
>      //

I think the subject line is too specific. This patch appears to fix a general resource leak in the PCI hot-unplug functionality. Writing up the USB4 angle in the commit message is welcome in my opinion, but the subject should state something like:

MdeModulePkg/PciBusDxe: plug device hierarchy leak upon bridge hot-unplug

(And I think the bridge doesn't even have to be a *root* bridge for the leak to occur; is that right?)

Laszlo



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#115834): https://edk2.groups.io/g/devel/message/115834
Mute This Topic: https://groups.io/mt/104474693/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



[-- Attachment #2: Type: text/html, Size: 9314 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [edk2-devel] [PATCH] MdeModulePkg/PciBusDxe: Fix hotplug functionality for USB4 bridge
  2024-02-08 23:09   ` Ding, Feng (Sunnyvale) via groups.io
  2024-02-20 19:48     ` [edk2-devel] [PATCH] MdeModulePkg/PciBusDxe: plug device hierarchy leak upon bridge hot-unplug Hsueh, Hong-Chih (Neo) via groups.io
@ 2024-08-16  2:33     ` Yoshinoya
  2024-08-16  6:55       ` Ni, Ray
  1 sibling, 1 reply; 8+ messages in thread
From: Yoshinoya @ 2024-08-16  2:33 UTC (permalink / raw)
  To: Ding, Feng (Sunnyvale), devel

[-- Attachment #1: Type: text/plain, Size: 531 bytes --]

Hi, Hsueh:
It seems pcie device's hot plug operation is rare during UEFI BIOS phase.

Does this patch aim to solve usb4 storage hot-plug during UEFI BIOS phase?


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#120354): https://edk2.groups.io/g/devel/message/120354
Mute This Topic: https://groups.io/mt/104208348/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



[-- Attachment #2: Type: text/html, Size: 999 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [edk2-devel] [PATCH] MdeModulePkg/PciBusDxe: Fix hotplug functionality for USB4 bridge
  2024-08-16  2:33     ` [edk2-devel] [PATCH] MdeModulePkg/PciBusDxe: Fix hotplug functionality for USB4 bridge Yoshinoya
@ 2024-08-16  6:55       ` Ni, Ray
  0 siblings, 0 replies; 8+ messages in thread
From: Ni, Ray @ 2024-08-16  6:55 UTC (permalink / raw)
  To: Ding, Feng (Sunnyvale), devel@edk2.groups.io,
	yoshinoyatoko@163.com

[-- Attachment #1: Type: text/plain, Size: 1104 bytes --]

I remember there was a patch to fix some resource leak issue and later we agreed it was a false alarm (no bug in PciBus drver).
I am not sure if this is the patch we discussed earlier.


Thanks,
Ray
________________________________
From: devel@edk2.groups.io <devel@edk2.groups.io> on behalf of Yoshinoya <yoshinoyatoko@163.com>
Sent: Friday, August 16, 2024 10:33
To: Ding, Feng (Sunnyvale) <feng1.ding@amd.com>; devel@edk2.groups.io <devel@edk2.groups.io>
Subject: Re: [edk2-devel] [PATCH] MdeModulePkg/PciBusDxe: Fix hotplug functionality for USB4 bridge

Hi, Hsueh:
It seems pcie device's hot plug operation is rare during UEFI BIOS phase.

Does this patch aim to solve usb4 storage hot-plug during UEFI BIOS phase?



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#120355): https://edk2.groups.io/g/devel/message/120355
Mute This Topic: https://groups.io/mt/104208348/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



[-- Attachment #2: Type: text/html, Size: 3114 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2024-08-16  6:55 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-06 22:34 [edk2-devel] [PATCH] MdeModulePkg/PciBusDxe: Fix hotplug functionality for USB4 bridge Hsueh, Hong-Chih (Neo) via groups.io
2024-02-07 20:51 ` Laszlo Ersek
2024-02-08 23:09   ` Ding, Feng (Sunnyvale) via groups.io
2024-02-20 19:48     ` [edk2-devel] [PATCH] MdeModulePkg/PciBusDxe: plug device hierarchy leak upon bridge hot-unplug Hsueh, Hong-Chih (Neo) via groups.io
2024-02-21 20:05       ` Laszlo Ersek
2024-02-22 16:33       ` Hsueh, Hong-Chih (Neo) via groups.io
2024-08-16  2:33     ` [edk2-devel] [PATCH] MdeModulePkg/PciBusDxe: Fix hotplug functionality for USB4 bridge Yoshinoya
2024-08-16  6:55       ` Ni, Ray

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox