Path: csiph.com!goblin2!goblin.stu.neva.ru!weretis.net!feeder4.news.weretis.net!news.mixmin.net!aioe.org!gothmog.csi.it!bofh.it!news.nic.it!robomod From: Yinghai Lu Newsgroups: linux.kernel Subject: [PATCH v11 34/60] PCI: Add debug printout during releasing partial assigned resources Date: Fri, 08 Apr 2016 02:30:03 +0200 Message-ID: References: X-Mailer: git-send-email 1.8.4.5 X-Source-IP: aserv0021.oracle.com [141.146.126.233] Sender: robomod@news.nic.it List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Approved: robomod@news.nic.it Lines: 44 Organization: linux.* mail to news gateway X-Original-Cc: Wei Yang , TJ , Yijing Wang , Khalid Aziz , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, Yinghai Lu X-Original-Date: Thu, 7 Apr 2016 17:15:47 -0700 X-Original-Message-ID: <1460074573-7481-35-git-send-email-yinghai@kernel.org> X-Original-References: <1460074573-7481-1-git-send-email-yinghai@kernel.org> X-Original-Sender: linux-kernel-owner@vger.kernel.org Xref: csiph.com linux.kernel:1373872 We try to assign required+optional at first, and we only accept the result if all resources get allocated. Otherwise will release assigned in the list, and try to assign required and expand to optional. We have to do that to make sure any required has priority over any optional. When that happens, we only print out "assigned" info, that is confusing as it looks like same range is assigned to two peer resources at the same time. Add printout for releasing so we have whole picture in debug messages. Signed-off-by: Yinghai Lu --- drivers/pci/setup-bus.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c index f9e6a00..b22eb5f 100644 --- a/drivers/pci/setup-bus.c +++ b/drivers/pci/setup-bus.c @@ -525,9 +525,17 @@ static void __assign_resources_sorted(struct list_head *head, free_list(&local_fail_head); /* Release assigned resource */ - list_for_each_entry(dev_res, head, list) - if (dev_res->res->parent) - release_resource(dev_res->res); + list_for_each_entry(dev_res, head, list) { + struct resource *res = dev_res->res; + + if (res->parent) { + dev_printk(KERN_DEBUG, &dev_res->dev->dev, + "BAR %d: released %pR\n", + (int)(res - &dev_res->dev->resource[0]), + res); + release_resource(res); + } + } /* Restore start/end/flags from saved list */ list_for_each_entry(save_res, &save_head, list) { struct resource *res = save_res->res; -- 1.8.4.5