public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [edk2-devel] [PATCH v2] MdeModulePkg/PciBusDxe: plug device hierarchy leak upon bridge hot-unplug
@ 2024-02-22 16:28 Hsueh, Hong-Chih (Neo) via groups.io
  2024-02-25 13:59 ` Laszlo Ersek
  0 siblings, 1 reply; 6+ messages in thread
From: Hsueh, Hong-Chih (Neo) via groups.io @ 2024-02-22 16:28 UTC (permalink / raw)
  To: devel
  Cc: feng1.ding, jiangang.he, abner.chang, ray.ni, gaoliming, lersek,
	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 (#115833): https://edk2.groups.io/g/devel/message/115833
Mute This Topic: https://groups.io/mt/104511503/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] 6+ messages in thread

* Re: [edk2-devel] [PATCH v2] MdeModulePkg/PciBusDxe: plug device hierarchy leak upon bridge hot-unplug
  2024-02-22 16:28 [edk2-devel] [PATCH v2] MdeModulePkg/PciBusDxe: plug device hierarchy leak upon bridge hot-unplug Hsueh, Hong-Chih (Neo) via groups.io
@ 2024-02-25 13:59 ` Laszlo Ersek
  2024-04-30 18:24   ` Hsueh, Hong-Chih (Neo) via groups.io
  0 siblings, 1 reply; 6+ messages in thread
From: Laszlo Ersek @ 2024-02-25 13:59 UTC (permalink / raw)
  To: Neo Hsueh, devel; +Cc: feng1.ding, jiangang.he, abner.chang, ray.ni, gaoliming

On 2/22/24 17:28, Neo Hsueh 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
>      //

This looks convincing to me, but I don't now nearly enough about
PciBusDxe internals (resource management in particular) to confidently
approve this patch. I can give an

Acked-by: Laszlo Ersek <lersek@redhat.com>

but the patch should not be merged until Ray provides an R-b.

Laszlo



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



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

* Re: [edk2-devel] [PATCH v2] MdeModulePkg/PciBusDxe: plug device hierarchy leak upon bridge hot-unplug
  2024-02-25 13:59 ` Laszlo Ersek
@ 2024-04-30 18:24   ` Hsueh, Hong-Chih (Neo) via groups.io
  2024-05-08  3:25     ` Ni, Ray
  0 siblings, 1 reply; 6+ messages in thread
From: Hsueh, Hong-Chih (Neo) via groups.io @ 2024-04-30 18:24 UTC (permalink / raw)
  To: Laszlo Ersek, devel@edk2.groups.io, ray.ni@intel.com
  Cc: Ding, Feng (Sunnyvale), He, Jiangang, Chang, Abner,
	gaoliming@byosoft.com.cn

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

[AMD Official Use Only - General]

Hi @ray.ni@intel.com<mailto:ray.ni@intel.com>,

Sorry you bother you, may I have your feedback for this patch?
If it looks good to you could you help to give me an R-b ?

Thank you.

Regards,
Neo

________________________________
From: Laszlo Ersek <lersek@redhat.com>
Sent: Sunday, February 25, 2024 7:59 AM
To: Hsueh, Hong-Chih (Neo) <Hong-Chih.Hsueh@amd.com>; devel@edk2.groups.io <devel@edk2.groups.io>
Cc: Ding, Feng (Sunnyvale) <feng1.ding@amd.com>; 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>
Subject: Re: [PATCH v2] MdeModulePkg/PciBusDxe: plug device hierarchy leak upon bridge hot-unplug

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


On 2/22/24 17:28, Neo Hsueh 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
>      //

This looks convincing to me, but I don't now nearly enough about
PciBusDxe internals (resource management in particular) to confidently
approve this patch. I can give an

Acked-by: Laszlo Ersek <lersek@redhat.com>

but the patch should not be merged until Ray provides an R-b.

Laszlo



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#118446): https://edk2.groups.io/g/devel/message/118446
Mute This Topic: https://groups.io/mt/104511503/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: 6112 bytes --]

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

* Re: [edk2-devel] [PATCH v2] MdeModulePkg/PciBusDxe: plug device hierarchy leak upon bridge hot-unplug
  2024-04-30 18:24   ` Hsueh, Hong-Chih (Neo) via groups.io
@ 2024-05-08  3:25     ` Ni, Ray
  2024-05-17  0:39       ` Ding, Feng (Sunnyvale) via groups.io
  0 siblings, 1 reply; 6+ messages in thread
From: Ni, Ray @ 2024-05-08  3:25 UTC (permalink / raw)
  To: Hsueh, Hong-Chih (Neo), Laszlo Ersek, devel@edk2.groups.io
  Cc: Ding, Feng (Sunnyvale), He, Jiangang, Chang, Abner,
	gaoliming@byosoft.com.cn

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

Neo,
I don't think your change is needed because of the following existing logic where RemoveAllPciDeviceOnBridge() is called to destroy/free all PCI nodes.

  if (Operation == EfiPciHotplugRequestRemove) {
    if (*NumberOfChildren == 0) {
      //
      // Remove all devices on the bridge
      //
      RemoveAllPciDeviceOnBridge (RootBridgeHandle, Bridge);
      return EFI_SUCCESS;
    }


Thanks,
Ray
________________________________
From: Hsueh, Hong-Chih (Neo) <Hong-Chih.Hsueh@amd.com>
Sent: Wednesday, May 1, 2024 2:24
To: Laszlo Ersek <lersek@redhat.com>; devel@edk2.groups.io <devel@edk2.groups.io>; Ni, Ray <ray.ni@intel.com>
Cc: Ding, Feng (Sunnyvale) <feng1.ding@amd.com>; He, Jiangang <Jiangang.He@amd.com>; Chang, Abner <Abner.Chang@amd.com>; gaoliming@byosoft.com.cn <gaoliming@byosoft.com.cn>
Subject: Re: [PATCH v2] MdeModulePkg/PciBusDxe: plug device hierarchy leak upon bridge hot-unplug


[AMD Official Use Only - General]

Hi @ray.ni@intel.com<mailto:ray.ni@intel.com>,

Sorry you bother you, may I have your feedback for this patch?
If it looks good to you could you help to give me an R-b ?

Thank you.

Regards,
Neo

________________________________
From: Laszlo Ersek <lersek@redhat.com>
Sent: Sunday, February 25, 2024 7:59 AM
To: Hsueh, Hong-Chih (Neo) <Hong-Chih.Hsueh@amd.com>; devel@edk2.groups.io <devel@edk2.groups.io>
Cc: Ding, Feng (Sunnyvale) <feng1.ding@amd.com>; 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>
Subject: Re: [PATCH v2] MdeModulePkg/PciBusDxe: plug device hierarchy leak upon bridge hot-unplug

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


On 2/22/24 17:28, Neo Hsueh 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
>      //

This looks convincing to me, but I don't now nearly enough about
PciBusDxe internals (resource management in particular) to confidently
approve this patch. I can give an

Acked-by: Laszlo Ersek <lersek@redhat.com>

but the patch should not be merged until Ray provides an R-b.

Laszlo



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#118656): https://edk2.groups.io/g/devel/message/118656
Mute This Topic: https://groups.io/mt/104511503/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: 10280 bytes --]

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

* Re: [edk2-devel] [PATCH v2] MdeModulePkg/PciBusDxe: plug device hierarchy leak upon bridge hot-unplug
  2024-05-08  3:25     ` Ni, Ray
@ 2024-05-17  0:39       ` Ding, Feng (Sunnyvale) via groups.io
  2024-05-17  5:51         ` Ni, Ray
  0 siblings, 1 reply; 6+ messages in thread
From: Ding, Feng (Sunnyvale) via groups.io @ 2024-05-17  0:39 UTC (permalink / raw)
  To: Ni, Ray, Hsueh, Hong-Chih (Neo), Laszlo Ersek,
	devel@edk2.groups.io
  Cc: He, Jiangang, Chang, Abner, gaoliming@byosoft.com.cn

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

[AMD Official Use Only - AMD Internal Distribution Only]

Hi Ray,

You are right. The change is NOT necessary.

Thanks
feng

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

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

Neo,
I don't think your change is needed because of the following existing logic where RemoveAllPciDeviceOnBridge() is called to destroy/free all PCI nodes.




  if (Operation == EfiPciHotplugRequestRemove) {

    if (*NumberOfChildren == 0) {

      //

      // Remove all devices on the bridge

      //

      RemoveAllPciDeviceOnBridge (RootBridgeHandle, Bridge);

      return EFI_SUCCESS;

    }


Thanks,
Ray
________________________________
From: Hsueh, Hong-Chih (Neo) <Hong-Chih.Hsueh@amd.com<mailto:Hong-Chih.Hsueh@amd.com>>
Sent: Wednesday, May 1, 2024 2:24
To: Laszlo Ersek <lersek@redhat.com<mailto:lersek@redhat.com>>; devel@edk2.groups.io<mailto:devel@edk2.groups.io> <devel@edk2.groups.io<mailto:devel@edk2.groups.io>>; Ni, Ray <ray.ni@intel.com<mailto:ray.ni@intel.com>>
Cc: Ding, Feng (Sunnyvale) <feng1.ding@amd.com<mailto:feng1.ding@amd.com>>; He, Jiangang <Jiangang.He@amd.com<mailto:Jiangang.He@amd.com>>; Chang, Abner <Abner.Chang@amd.com<mailto:Abner.Chang@amd.com>>; gaoliming@byosoft.com.cn<mailto:gaoliming@byosoft.com.cn> <gaoliming@byosoft.com.cn<mailto:gaoliming@byosoft.com.cn>>
Subject: Re: [PATCH v2] MdeModulePkg/PciBusDxe: plug device hierarchy leak upon bridge hot-unplug


[AMD Official Use Only - General]

Hi @ray.ni@intel.com<mailto:ray.ni@intel.com>,

Sorry you bother you, may I have your feedback for this patch?
If it looks good to you could you help to give me an R-b ?

Thank you.

Regards,
Neo

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

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


On 2/22/24 17:28, Neo Hsueh 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<mailto:feng1.ding@amd.com>>
> Cc: Jiangang He <jiangang.he@amd.com<mailto:jiangang.he@amd.com>>
> Signed-off-by: Neo Hsueh <Hong-Chih.Hsueh@amd.com<mailto: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
>      //

This looks convincing to me, but I don't now nearly enough about
PciBusDxe internals (resource management in particular) to confidently
approve this patch. I can give an

Acked-by: Laszlo Ersek <lersek@redhat.com<mailto:lersek@redhat.com>>

but the patch should not be merged until Ray provides an R-b.

Laszlo


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#119051): https://edk2.groups.io/g/devel/message/119051
Mute This Topic: https://groups.io/mt/104511503/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: 15678 bytes --]

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

* Re: [edk2-devel] [PATCH v2] MdeModulePkg/PciBusDxe: plug device hierarchy leak upon bridge hot-unplug
  2024-05-17  0:39       ` Ding, Feng (Sunnyvale) via groups.io
@ 2024-05-17  5:51         ` Ni, Ray
  0 siblings, 0 replies; 6+ messages in thread
From: Ni, Ray @ 2024-05-17  5:51 UTC (permalink / raw)
  To: Ding, Feng (Sunnyvale), Hsueh, Hong-Chih (Neo), Laszlo Ersek,
	devel@edk2.groups.io
  Cc: He, Jiangang, Chang, Abner, gaoliming@byosoft.com.cn

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

Thanks for confirming.

Thanks,
Ray
________________________________
From: Ding, Feng (Sunnyvale) <feng1.ding@amd.com>
Sent: Friday, May 17, 2024 8:39
To: Ni, Ray <ray.ni@intel.com>; Hsueh, Hong-Chih (Neo) <Hong-Chih.Hsueh@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>; gaoliming@byosoft.com.cn <gaoliming@byosoft.com.cn>
Subject: RE: [PATCH v2] MdeModulePkg/PciBusDxe: plug device hierarchy leak upon bridge hot-unplug


[AMD Official Use Only - AMD Internal Distribution Only]


Hi Ray,



You are right. The change is NOT necessary.



Thanks

feng



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



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



Neo,

I don't think your change is needed because of the following existing logic where RemoveAllPciDeviceOnBridge() is called to destroy/free all PCI nodes.







  if (Operation == EfiPciHotplugRequestRemove) {



    if (*NumberOfChildren == 0) {



      //



      // Remove all devices on the bridge



      //



      RemoveAllPciDeviceOnBridge (RootBridgeHandle, Bridge);



      return EFI_SUCCESS;



    }





Thanks,

Ray

________________________________

From: Hsueh, Hong-Chih (Neo) <Hong-Chih.Hsueh@amd.com<mailto:Hong-Chih.Hsueh@amd.com>>
Sent: Wednesday, May 1, 2024 2:24
To: Laszlo Ersek <lersek@redhat.com<mailto:lersek@redhat.com>>; devel@edk2.groups.io<mailto:devel@edk2.groups.io> <devel@edk2.groups.io<mailto:devel@edk2.groups.io>>; Ni, Ray <ray.ni@intel.com<mailto:ray.ni@intel.com>>
Cc: Ding, Feng (Sunnyvale) <feng1.ding@amd.com<mailto:feng1.ding@amd.com>>; He, Jiangang <Jiangang.He@amd.com<mailto:Jiangang.He@amd.com>>; Chang, Abner <Abner.Chang@amd.com<mailto:Abner.Chang@amd.com>>; gaoliming@byosoft.com.cn<mailto:gaoliming@byosoft.com.cn> <gaoliming@byosoft.com.cn<mailto:gaoliming@byosoft.com.cn>>
Subject: Re: [PATCH v2] MdeModulePkg/PciBusDxe: plug device hierarchy leak upon bridge hot-unplug



[AMD Official Use Only - General]



Hi @ray.ni@intel.com<mailto:ray.ni@intel.com>,



Sorry you bother you, may I have your feedback for this patch?

If it looks good to you could you help to give me an R-b ?



Thank you.



Regards,

Neo



________________________________

From: Laszlo Ersek <lersek@redhat.com<mailto:lersek@redhat.com>>
Sent: Sunday, February 25, 2024 7:59 AM
To: Hsueh, Hong-Chih (Neo) <Hong-Chih.Hsueh@amd.com<mailto:Hong-Chih.Hsueh@amd.com>>; devel@edk2.groups.io<mailto:devel@edk2.groups.io> <devel@edk2.groups.io<mailto:devel@edk2.groups.io>>
Cc: Ding, Feng (Sunnyvale) <feng1.ding@amd.com<mailto:feng1.ding@amd.com>>; He, Jiangang <Jiangang.He@amd.com<mailto:Jiangang.He@amd.com>>; Chang, Abner <Abner.Chang@amd.com<mailto:Abner.Chang@amd.com>>; ray.ni@intel.com<mailto:ray.ni@intel.com> <ray.ni@intel.com<mailto:ray.ni@intel.com>>; gaoliming@byosoft.com.cn<mailto:gaoliming@byosoft.com.cn> <gaoliming@byosoft.com.cn<mailto:gaoliming@byosoft.com.cn>>
Subject: Re: [PATCH v2] MdeModulePkg/PciBusDxe: plug device hierarchy leak upon bridge hot-unplug



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


On 2/22/24 17:28, Neo Hsueh 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<mailto:feng1.ding@amd.com>>
> Cc: Jiangang He <jiangang.he@amd.com<mailto:jiangang.he@amd.com>>
> Signed-off-by: Neo Hsueh <Hong-Chih.Hsueh@amd.com<mailto: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
>      //

This looks convincing to me, but I don't now nearly enough about
PciBusDxe internals (resource management in particular) to confidently
approve this patch. I can give an

Acked-by: Laszlo Ersek <lersek@redhat.com<mailto:lersek@redhat.com>>

but the patch should not be merged until Ray provides an R-b.

Laszlo


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#118981): https://edk2.groups.io/g/devel/message/118981
Mute This Topic: https://groups.io/mt/104511503/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: 15696 bytes --]

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

end of thread, other threads:[~2024-05-17 17:54 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-22 16:28 [edk2-devel] [PATCH v2] MdeModulePkg/PciBusDxe: plug device hierarchy leak upon bridge hot-unplug Hsueh, Hong-Chih (Neo) via groups.io
2024-02-25 13:59 ` Laszlo Ersek
2024-04-30 18:24   ` Hsueh, Hong-Chih (Neo) via groups.io
2024-05-08  3:25     ` Ni, Ray
2024-05-17  0:39       ` Ding, Feng (Sunnyvale) via groups.io
2024-05-17  5:51         ` Ni, Ray

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