Linux PCI subsystem development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
	linux-pci@vger.kernel.org
Subject: Re: [PATCH v5 14/14] PCI: Add debug printing to window sizing
Date: Fri, 06 Nov 2026 15:37:29 +0000	[thread overview]
Message-ID: <sashiko-outbox-201705@kernel.org> (raw)
In-Reply-To: <20261106134341.39493-15-ilpo.jarvinen@linux.intel.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] PCI: inverted range printed for zero-sized window in
  __pbus_size_mem()
--

commit 75a33ac81964888053244c6e6481c6c66d89219a
Author: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>

PCI: Add debug printing to window sizing

This commit adds a pci_dbg() print in __pbus_size_mem() to log the
calculated bridge window size, alignment, non-aligning resource counts,
gap, and partial blocks.

> diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c
> index 86c9557bc2fb4..22da18347488c 100644
> --- a/drivers/pci/setup-bus.c
> +++ b/drivers/pci/setup-bus.c

[ ... ]

> @@ -1379,7 +1379,28 @@ static resource_size_t __pbus_size_mem(struct pci_bus *bus,
>  	*head_align = calculate_head_align(aligns, max_order);
>  	*head_align = max(*head_align, win_align);
>  
> -	return ALIGN(max(winsize + gap, min_size), win_align);
> +	final_winsize = ALIGN(max(winsize + gap, min_size), win_align);
> +
> +	if (bus->self) {
> +		int idx = pci_resource_num(bus->self, b_res);
> +		const char *r_name = pci_resource_name(bus->self, idx);
> +		struct resource print_res = *b_res; /* b_res update is delayed */
> +
> +		resource_set_range(&print_res, *head_align, final_winsize);
> +		if (final_winsize) {
> +			print_res.flags &= ~(IORESOURCE_UNSET |
> +					     IORESOURCE_DISABLED);
> +		} else {
> +			print_res.flags |= IORESOURCE_DISABLED;
> +		}

[Severity: Low]
Should the else branch also set IORESOURCE_UNSET on print_res when
final_winsize is 0?

When final_winsize is 0, resource_set_range() sets print_res.start to
*head_align and print_res.end to *head_align - 1.  If b_res does not
already have IORESOURCE_UNSET set (for example when initialized by
pci_bridge_check_ranges() during hotplug or !preserve_config probing),
%pR formats print_res as an inverted range such as
[mem 0x00100000-0x000fffff disabled] instead of
[mem size 0x00000000 disabled].

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261106134341.39493-1-ilpo.jarvinen@linux.intel.com?part=14

  reply	other threads:[~2026-11-06 15:37 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-06 13:43 [PATCH v5 00/14] PCI: Resource placement algorithm fixes Ilpo Järvinen
2026-11-06 13:43 ` [PATCH v5 01/14] resource: Mark free space assigned Ilpo Järvinen
2026-11-06 13:52   ` sashiko-bot
2026-11-06 13:43 ` [PATCH v5 02/14] parisc/PCI: Clean up resource debug print & use dynamic debug Ilpo Järvinen
2026-11-06 13:55   ` sashiko-bot
2026-11-06 13:43 ` [PATCH v5 03/14] PCI: Don't size or assign disabled BARs Ilpo Järvinen
2026-11-06 14:00   ` sashiko-bot
2026-11-06 13:43 ` [PATCH v5 04/14] PCI: Use __ffs64() for resource_size_t typed align Ilpo Järvinen
2026-11-06 14:10   ` sashiko-bot
2026-11-06 13:43 ` [PATCH v5 05/14] PCI: Prevent zero align from reaching __ffs64() Ilpo Järvinen
2026-11-06 14:16   ` sashiko-bot
2026-11-06 13:43 ` [PATCH v5 06/14] linux/log2.h: Add 64-bit roundup/down_pow_of_two_u64() variants Ilpo Järvinen
2026-11-06 14:19   ` sashiko-bot
2026-11-06 13:43 ` [PATCH v5 07/14] PCI: Derive aligns[] array size in a define Ilpo Järvinen
2026-11-06 14:22   ` sashiko-bot
2026-11-06 13:43 ` [PATCH v5 08/14] PCI: Honor alignment overrides Ilpo Järvinen
2026-11-06 14:38   ` sashiko-bot
2026-11-06 13:43 ` [PATCH v5 09/14] PCI: Place resources to either edge of the window Ilpo Järvinen
2026-11-06 14:55   ` sashiko-bot
2026-11-06 13:43 ` [PATCH v5 10/14] PCI: Separate align/raw size calculation from pbus_size_mem() Ilpo Järvinen
2026-11-06 14:57   ` sashiko-bot
2026-11-06 13:43 ` [PATCH v5 11/14] PCI: Calculate bridge window with optional sizes from scratch Ilpo Järvinen
2026-11-06 15:06   ` sashiko-bot
2026-11-06 13:43 ` [PATCH v5 12/14] PCI: Move size/align calculation fully into __pbus_size_mem() Ilpo Järvinen
2026-11-06 15:10   ` sashiko-bot
2026-11-06 13:43 ` [PATCH v5 13/14] PCI: Fix composite resource sizing Ilpo Järvinen
2026-11-06 15:26   ` sashiko-bot
2026-11-06 13:43 ` [PATCH v5 14/14] PCI: Add debug printing to window sizing Ilpo Järvinen
2026-11-06 15:37   ` sashiko-bot [this message]
2026-11-06 15:26 ` [PATCH v5 00/14] PCI: Resource placement algorithm fixes Nikolas Joshua Britton
2026-11-06 16:43   ` Ilpo Järvinen
2026-11-08  1:51 ` Doug Calobrisi
2026-11-09 23:27 ` Bjorn Helgaas
2026-11-10  9:47   ` Ilpo Järvinen
2026-11-10 20:06     ` Mario Limonciello

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=sashiko-outbox-201705@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=linux-pci@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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