From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id F172CD801DE for ; Wed, 21 Feb 2024 20:05:15 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=83ALcQqMJr906PJtSXddOVxQGdufB+Rcmmr4y9h/3lQ=; c=relaxed/simple; d=groups.io; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From:In-Reply-To:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Language:Content-Type:Content-Transfer-Encoding; s=20140610; t=1708545914; v=1; b=h15OHFaMRoOJrP/z597LjhtHn0bFHtbsg/ylGErxZ0aErSJiKsztnj8RuaWlBdYXwdFXyNfS Z71tptD2QBXC0Kyz8833vwc3XD4JkEIlvKItXGJ/c/MsBvMyj72KhhqdxUjbqWEDY4XHrYW5iK+ mdIuvcJGC3XRM0o+VYcRlLaY= X-Received: by 127.0.0.2 with SMTP id dn5ZYY7687511xbUz5Z2iSnq; Wed, 21 Feb 2024 12:05:14 -0800 X-Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.groups.io with SMTP id smtpd.web10.1060.1708545913987824524 for ; Wed, 21 Feb 2024 12:05:14 -0800 X-Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-54-xnRkHbhlOxOSMiEYfkI8Bw-1; Wed, 21 Feb 2024 15:05:09 -0500 X-MC-Unique: xnRkHbhlOxOSMiEYfkI8Bw-1 X-Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1CB64106D063; Wed, 21 Feb 2024 20:05:09 +0000 (UTC) X-Received: from [10.39.192.46] (unknown [10.39.192.46]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3D4F5C185C0; Wed, 21 Feb 2024 20:05:07 +0000 (UTC) Message-ID: Date: Wed, 21 Feb 2024 21:05:06 +0100 MIME-Version: 1.0 Subject: Re: [edk2-devel] [PATCH] MdeModulePkg/PciBusDxe: plug device hierarchy leak upon bridge hot-unplug 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" References: <76e2a0274cd2620ee43a5942c307d63c6c095d3b.1707258489.git.Hong-Chih.Hsueh@amd.com> <200b9430-0263-e76e-afca-d4ea14f23612@redhat.com> From: "Laszlo Ersek" In-Reply-To: X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,lersek@redhat.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: 0oh4KA9UnHFDWN76AvHYlyABx7686176AA= Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=h15OHFaM; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=redhat.com (policy=none) 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) > *Sent:* Thursday, February 8, 2024 5:09 PM > *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 > > *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 > Sent: Wednesday, February 7, 2024 12:51 PM > To: devel@edk2.groups.io; Hsueh, Hong-Chih (Neo) > Cc: Ding, Feng (Sunnyvale) ; He, Jiangang > ; Chang, Abner ; > 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 >> Cc: Jiangang He >> Signed-off-by: Neo Hsueh >> --- >>  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] -=-=-=-=-=-=-=-=-=-=-=-