Re: [PATCH 06/20] PCI/sysfs: Convert PCI resource files to static attributes

Krzysztof Wilczyński <[email protected]>
Newsgroups org.kernel.vger.linux-alpha,org.kernel.vger.linux-pci,org.ozlabs.lists.linuxppc-dev
Message-ID <20260410111338.GB1750802@rocinante>
Hello,

> > -	/* Expose the PCI resources from this device as files */
> > -	for (i = 0; i < PCI_STD_NUM_BARS; i++) {
> > +	if (!pci_resource_len(pdev, bar))
> > +		return 0;
> 
> I know it's same as in the previous code but I dislike assuming len != 0 
> implies resource has been assigned. While it currently holds, I'd want to 
> change that eventually.
> 
> The current behavior causes issue e.g. if IOV resource fails to assign, it 
> is reset (making its len 0 among other thing) and since IOV resource are 
> optional that is fine from kernel's perspective. But resetting the 
> resource means we also lose access to that resource because its type gets 
> cleared so from kernel perspective the VF BAR stops to exist. Losing it 
> means the user cannot solve the issue by e.g. resizing some other BAR 
> smaller to make space to allow the VF BARs to assign successfully.
> 
> So I think this code would actually want to check resource_assigned() 
> which implies also non-zero size.

Makes sense.

I will update the code to use resource_assigned().  Since we are working on
this code anyway, it would be only prudent to also do the right thing.

> AFAICT, this change looks fine (despite the diff being very messy).

Thank you!

	Krzysztof
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.