All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Laight <david.laight.linux@gmail.com>
To: Alex Williamson <alex.williamson@redhat.com>
Cc: Oleg Nesterov <oleg@redhat.com>,
	bhelgaas@google.com, linux-pci@vger.kernel.org,
	linux-kernel@vger.kernel.org, mitchell.augustin@canonical.com,
	ilpo.jarvinen@linux.intel.com
Subject: Re: [PATCH v2] PCI: Batch BAR sizing operations
Date: Mon, 10 Feb 2025 22:11:07 +0000	[thread overview]
Message-ID: <20250210221107.60d608ba@pumpkin> (raw)
In-Reply-To: <20250210134848.78a1ab4a.alex.williamson@redhat.com>

On Mon, 10 Feb 2025 13:48:48 -0700
Alex Williamson <alex.williamson@redhat.com> wrote:

> On Mon, 10 Feb 2025 21:08:19 +0100
> Oleg Nesterov <oleg@redhat.com> wrote:
> 
> > On 02/10, Oleg Nesterov wrote:  
> > >
> > > On 02/10, Alex Williamson wrote:    
> > > >
> > > > --- a/drivers/pci/probe.c
> > > > +++ b/drivers/pci/probe.c
> > > > @@ -345,7 +345,8 @@ static void pci_read_bases(struct pci_dev *dev, unsigned int howmany, int rom)

You probably need __always_inline to have any chance of a compile-time
test of howmany.

> > > >  	unsigned int pos, reg;
> > > >  	u16 orig_cmd;
> > > >
> > > > -	BUILD_BUG_ON(howmany > PCI_STD_NUM_BARS);
> > > > +	if (__builtin_constant_p(howmany))
> > > > +		BUILD_BUG_ON(howmany > PCI_STD_NUM_BARS);    
> > >
> > > Or just
> > >
> > > 	BUILD_BUG_ON(__builtin_constant_p(howmany) && howmany > PCI_STD_NUM_BARS);

	statically_true(howmany > PCI_STD_NUM_BARS)

> > >
> > > I dunno... Works for me in any case.
> > >
> > > I don't know if this is "right" solution though,    
> > 
> > I mean, atm I simply don't know if with the newer compiler
> > __builtin_constant_p(howmany) will be true in this case.  
> 
> That I can confirm.  With gcc 14.2.1, if I change the call in
> pci_setup_device() to use 7 rather than 6 for howmany, the build fails.
> If you confirm this resolves the build on older gcc, it seems like a
> valid fix.  I installed a VM with Fedora 23, which uses gcc 3.5.1, but
> I haven't yet been able to successfully build any kernel with it.  I'll
> post a patch if you want to provide a Tested-by.  Thanks,

Far too old a version to be supported.

	David

> 
> Alex
> 
> 


  reply	other threads:[~2025-02-10 22:11 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-20 18:21 [PATCH v2] PCI: Batch BAR sizing operations Alex Williamson
2025-01-20 22:44 ` Bjorn Helgaas
2025-01-21 19:01   ` Mitchell Augustin
2025-01-23 12:15 ` Ilpo Järvinen
2025-02-09 15:45 ` Oleg Nesterov
2025-02-10 16:36   ` Alex Williamson
2025-02-10 19:56     ` Oleg Nesterov
2025-02-10 20:08       ` Oleg Nesterov
2025-02-10 20:48         ` Alex Williamson
2025-02-10 22:11           ` David Laight [this message]
2025-02-10 22:46             ` Oleg Nesterov

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=20250210221107.60d608ba@pumpkin \
    --to=david.laight.linux@gmail.com \
    --cc=alex.williamson@redhat.com \
    --cc=bhelgaas@google.com \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=mitchell.augustin@canonical.com \
    --cc=oleg@redhat.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.