From: Bjorn Helgaas <helgaas@kernel.org>
To: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>,
linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/1] PCI: Don't print stale information about resource
Date: Wed, 24 Sep 2025 18:48:28 -0500 [thread overview]
Message-ID: <20250924234828.GA2143336@bhelgaas> (raw)
In-Reply-To: <20250924135641.3399-1-ilpo.jarvinen@linux.intel.com>
On Wed, Sep 24, 2025 at 04:56:41PM +0300, Ilpo Järvinen wrote:
> pbus_size_mem() logs the bridge window resource using pci_info() before
> the start and end fields of the resource have been updated which then
> prints stale information.
>
> Set resource addresses earlier to make understanding logs easier.
> Regrettably, this results in setting the addresses multiple times but
> that seems unavoidable.
>
> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Applied to pci/resource for v6.18, thanks!
> ---
>
> Based on top of pci/resource branch.
>
> drivers/pci/setup-bus.c | 15 ++++++++++-----
> 1 file changed, 10 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c
> index d264f16772b9..362ad108794d 100644
> --- a/drivers/pci/setup-bus.c
> +++ b/drivers/pci/setup-bus.c
> @@ -1317,6 +1317,7 @@ static void pbus_size_mem(struct pci_bus *bus, unsigned long type,
> resource_size_t children_add_align = 0;
> resource_size_t add_align = 0;
> resource_size_t relaxed_align;
> + resource_size_t old_size;
>
> if (!b_res)
> return;
> @@ -1387,20 +1388,24 @@ static void pbus_size_mem(struct pci_bus *bus, unsigned long type,
> }
> }
>
> + old_size = resource_size(b_res);
> win_align = window_alignment(bus, b_res->flags);
> min_align = calculate_mem_align(aligns, max_order);
> min_align = max(min_align, win_align);
> - size0 = calculate_memsize(size, min_size, 0, 0, resource_size(b_res), min_align);
> + size0 = calculate_memsize(size, min_size, 0, 0, old_size, min_align);
>
> - if (size0)
> + if (size0) {
> + resource_set_range(b_res, min_align, size0);
> b_res->flags &= ~IORESOURCE_DISABLED;
> + }
>
> if (bus->self && size0 &&
> !pbus_upstream_space_available(bus, b_res, size0, min_align)) {
> relaxed_align = 1ULL << (max_order + __ffs(SZ_1M));
> relaxed_align = max(relaxed_align, win_align);
> min_align = min(min_align, relaxed_align);
> - size0 = calculate_memsize(size, min_size, 0, 0, resource_size(b_res), win_align);
> + size0 = calculate_memsize(size, min_size, 0, 0, old_size, win_align);
> + resource_set_range(b_res, min_align, size0);
> pci_info(bus->self, "bridge window %pR to %pR requires relaxed alignment rules\n",
> b_res, &bus->busn_res);
> }
> @@ -1408,7 +1413,7 @@ static void pbus_size_mem(struct pci_bus *bus, unsigned long type,
> if (realloc_head && (add_size > 0 || children_add_size > 0)) {
> add_align = max(min_align, add_align);
> size1 = calculate_memsize(size, min_size, add_size, children_add_size,
> - resource_size(b_res), add_align);
> + old_size, add_align);
>
> if (bus->self && size1 &&
> !pbus_upstream_space_available(bus, b_res, size1, add_align)) {
> @@ -1416,7 +1421,7 @@ static void pbus_size_mem(struct pci_bus *bus, unsigned long type,
> relaxed_align = max(relaxed_align, win_align);
> min_align = min(min_align, relaxed_align);
> size1 = calculate_memsize(size, min_size, add_size, children_add_size,
> - resource_size(b_res), win_align);
> + old_size, win_align);
> pci_info(bus->self,
> "bridge window %pR to %pR requires relaxed alignment rules\n",
> b_res, &bus->busn_res);
>
> base-commit: 43b4f7cd064b2ae11742f33e2af195adae00c617
> --
> 2.39.5
>
prev parent reply other threads:[~2025-09-24 23:48 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-24 13:56 [PATCH 1/1] PCI: Don't print stale information about resource Ilpo Järvinen
2025-09-24 23:48 ` Bjorn Helgaas [this message]
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=20250924234828.GA2143336@bhelgaas \
--to=helgaas@kernel.org \
--cc=bhelgaas@google.com \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.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