Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1372159

Re: [RFC v5 1/7] PCI: Ignore resource_alignment if PCI_PROBE_ONLY was set

From Yongji Xie <xyjxie@linux.vnet.ibm.com>
Newsgroups linux.kernel
Subject Re: [RFC v5 1/7] PCI: Ignore resource_alignment if PCI_PROBE_ONLY was set
Date 2016-04-06 05:00 +0200
Message-ID <rkLRg-5Al-1@gated-at.bofh.it> (permalink)
References <rkzwK-4pv-3@gated-at.bofh.it> <rkzwM-4pv-35@gated-at.bofh.it> <rkJZ8-3Wx-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 2016/4/6 8:48, Gavin Shan wrote:
> On Tue, Apr 05, 2016 at 09:43:29PM +0800, Yongji Xie wrote:
>> The resource_alignment will releases memory
>> resources allocated by firmware so that kernel
>> can reassign new resources later on. But this
>> will cause the problem that no resources can be
>> allocated by kernel if PCI_PROBE_ONLY was set,
>> e.g. on pSeries platform because PCI_PROBE_ONLY
>> force kernel to use firmware setup and not to
>> reassign any resources.
>>
>> To solve this problem, this patch ignores
>> resource_alignment if PCI_PROBE_ONLY was set.
>>
>> Signed-off-by: Yongji Xie <xyjxie@linux.vnet.ibm.com>
>> ---
>> drivers/pci/pci.c |    6 ++++++
>> 1 file changed, 6 insertions(+)
>>
>> diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
>> index 602eb42..1db9267 100644
>> --- a/drivers/pci/pci.c
>> +++ b/drivers/pci/pci.c
>> @@ -4607,6 +4607,12 @@ static resource_size_t pci_specified_resource_alignment(struct pci_dev *dev)
>> 	spin_lock(&resource_alignment_lock);
>> 	p = resource_alignment_param;
>> 	while (*p) {
>> +		if (pci_has_flag(PCI_PROBE_ONLY)) {
>> +			printk(KERN_ERR "PCI: Ignore resource_alignment parameter: %s with"
>> +					" PCI_PROBE_ONLY set\n", p);
>> +			*p = 0;
>> +			break;
> It seems no "*p = 0" isn't required if I don't miss anything. If the check
> on flag PCI_PROBE_ONLY is moved before the spin_lock(), it would save a bit
> CPU cycles at least. Also, the logic looks more clear.

I used "*p = 0" in case that the warning is called
in every pci_device_add().

And the warning should be called only when users
use resource_alignment parameter. So we test
while(*p) before we call the warning.

Thanks,
Yongji

>> +		}
>> 		count = 0;
>> 		if (sscanf(p, "%d%n", &align_order, &count) == 1 &&
>> 							p[count] == '@') {
> Thanks,
> Gavin
>
>> -- 
>> 1.7.9.5
>>

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[RFC v5 0/7] vfio-pci: Allow to mmap sub-page MMIO BARs and MSI-X table Yongji Xie <xyjxie@linux.vnet.ibm.com> - 2016-04-05 15:50 +0200
  [RFC v5 3/7] PCI: Add a new option for resource_alignment to reassign alignment Yongji Xie <xyjxie@linux.vnet.ibm.com> - 2016-04-05 15:50 +0200
    Re: [RFC v5 3/7] PCI: Add a new option for resource_alignment to  reassign alignment Gavin Shan <gwshan@linux.vnet.ibm.com> - 2016-04-06 03:50 +0200
  [RFC v5 2/7] PCI: Do not Use IORESOURCE_STARTALIGN to identify bridge resources Yongji Xie <xyjxie@linux.vnet.ibm.com> - 2016-04-05 15:50 +0200
    Re: [RFC v5 2/7] PCI: Do not Use IORESOURCE_STARTALIGN to identify  bridge resources Gavin Shan <gwshan@linux.vnet.ibm.com> - 2016-04-06 03:00 +0200
      Re: [RFC v5 2/7] PCI: Do not Use IORESOURCE_STARTALIGN to identify  bridge resources Yongji Xie <xyjxie@linux.vnet.ibm.com> - 2016-04-06 04:20 +0200
  [RFC v5 1/7] PCI: Ignore resource_alignment if PCI_PROBE_ONLY was set Yongji Xie <xyjxie@linux.vnet.ibm.com> - 2016-04-05 15:50 +0200
    Re: [RFC v5 1/7] PCI: Ignore resource_alignment if PCI_PROBE_ONLY  was set Gavin Shan <gwshan@linux.vnet.ibm.com> - 2016-04-06 03:00 +0200
      Re: [RFC v5 1/7] PCI: Ignore resource_alignment if PCI_PROBE_ONLY was  set Yongji Xie <xyjxie@linux.vnet.ibm.com> - 2016-04-06 05:00 +0200
  [RFC v5 4/7] PCI: Add support for enforcing all MMIO BARs to be page aligned Yongji Xie <xyjxie@linux.vnet.ibm.com> - 2016-04-05 15:50 +0200
  [RFC v5 5/7] vfio-pci: Allow to mmap sub-page MMIO BARs if the mmio page is exclusive Yongji Xie <xyjxie@linux.vnet.ibm.com> - 2016-04-05 15:50 +0200

csiph-web