linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jiang Liu <liuj97@gmail.com>
To: Taku Izumi <izumi.taku@jp.fujitsu.com>, Yinghai Lu <yinghai@kernel.org>
Cc: Jiang Liu <jiang.liu@huawei.com>,
	Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>,
	Bjorn Helgaas <bhelgaas@google.com>,
	Don Dutile <ddutile@redhat.com>,
	Keping Chen <chenkeping@huawei.com>,
	linux-pci@vger.kernel.org, Jiang Liu <liuj97@gmail.com>
Subject: [PATCH] PCI, x86: avoid redundant insert_resource() call in pci_mmcfg_insert_resources()
Date: Wed,  2 May 2012 22:41:46 +0800	[thread overview]
Message-ID: <1335969706-13604-1-git-send-email-jiang.liu@huawei.com> (raw)
In-Reply-To: <20120427151726.870d6966.izumi.taku@jp.fujitsu.com>

From: Jiang Liu <jiang.liu@huawei.com>

For hot-pluggable host bridges present at boot time, pci_mmconfig_insert() will
insert resources used by MMCFG items for those host bridges. So avoid redundant
call to insert_resource() when pci_mmcfg_insert_resources() is called later.

Reported-By: Taku Izumi <izumi.taku@jp.fujitsu.com>
Signed-off-by: Jiang Liu <liuj97@gmail.com>
---
 arch/x86/pci/mmconfig-shared.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/arch/x86/pci/mmconfig-shared.c b/arch/x86/pci/mmconfig-shared.c
index f4d9ff9..7bba722 100644
--- a/arch/x86/pci/mmconfig-shared.c
+++ b/arch/x86/pci/mmconfig-shared.c
@@ -371,8 +371,13 @@ static void __init pci_mmcfg_insert_resources(void)
 {
 	struct pci_mmcfg_region *cfg;
 
+	/*
+	 * Insert resources for MMCFG items if the resource hasn't been
+	 * inserted by pci_mmconfig_insert() yet.
+	 */
 	list_for_each_entry(cfg, &pci_mmcfg_list, list)
-		insert_resource(&iomem_resource, &cfg->res);
+		if (!cfg->res.parent)
+			insert_resource(&iomem_resource, &cfg->res);
 
 	/* Mark that the resources have been inserted. */
 	pci_mmcfg_resources_inserted = 1;
-- 
1.7.9.5


  reply	other threads:[~2012-05-02 14:43 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-26 10:37 [PATCH 0/6][RFC] pci, x86: change the way to add MMCFG region on x86 Taku Izumi
2012-04-26 10:39 ` [PATCH 1/6] PCI, x86: split out pci_mmcfg_check_reserved() for code reuse Taku Izumi
2012-04-26 16:16   ` Yinghai Lu
2012-04-26 10:40 ` [PATCH 2/6] PCI, x86: split out pci_mmconfig_alloc() " Taku Izumi
2012-04-26 10:41 ` [PATCH 3/6] PCI, x86: use RCU list to protect mmconfig list Taku Izumi
2012-04-26 10:42 ` [PATCH 4/6] PCI, x86: introduce pci_mmcfg_arch_map()/pci_mmcfg_arch_unmap() Taku Izumi
2012-04-26 10:42 ` [PATCH 5/6] PCI, x86: introduce pci_mmcongi_add() / pci_mmconfig_delete() Taku Izumi
2012-04-26 13:59   ` Jiang Liu
2012-04-26 14:07   ` Jiang Liu
2012-04-26 10:42 ` [PATCH 6/6] PCI, x86: change the way to add MMCFG region on x86 Taku Izumi
2012-04-26 15:04   ` Jiang Liu
2012-04-27  6:17     ` Taku Izumi
2012-05-02 14:41       ` Jiang Liu [this message]
2012-04-26 16:21 ` [PATCH 0/6][RFC] pci, " Yinghai Lu
2012-05-02 23:43 ` Bjorn Helgaas

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=1335969706-13604-1-git-send-email-jiang.liu@huawei.com \
    --to=liuj97@gmail.com \
    --cc=bhelgaas@google.com \
    --cc=chenkeping@huawei.com \
    --cc=ddutile@redhat.com \
    --cc=izumi.taku@jp.fujitsu.com \
    --cc=jiang.liu@huawei.com \
    --cc=kaneshige.kenji@jp.fujitsu.com \
    --cc=linux-pci@vger.kernel.org \
    --cc=yinghai@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;
as well as URLs for NNTP newsgroup(s).