From: Yongji Xie <elohimes@gmail.com>
To: bhelgaas@google.com
Cc: linux-pci@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
alex.williamson@redhat.com, gwshan@linux.vnet.ibm.com,
aik@ozlabs.ru, benh@kernel.crashing.org, mpe@ellerman.id.au,
paulus@samba.org, zhong@linux.vnet.ibm.com
Subject: Re: [PATCH v9 3/3] PCI: Don't extend device's size when using default alignment for all devices
Date: Sat, 25 Mar 2017 20:46:32 +0800 [thread overview]
Message-ID: <1490445992-4102-1-git-send-email-elohimes@gmail.com> (raw)
In-Reply-To: <20170323215558.GC23612@bhelgaas-glaptop.roam.corp.google.com>
On Thu, Mar 23, 2017 at 04:55:58PM -0500, Bjorn Helgaas wrote:
>
> On Wed, Feb 15, 2017 at 02:45:06PM +0800, Yongji Xie wrote:
>> Currently we reassign the alignment by extending resources' size in
>> pci_reassigndev_resource_alignment(). This could potentially break
>> some drivers when the driver uses the size to locate register
>> whose length is related to the size. Some examples as below:
>
> I understand the motivation to stop changing the resource size. That
> makes good sense.
>
>> - misc\Hpilo.c:
>
> This isn't Windows; please use regular Linux forward slashes here.
>
Will fix it.
>> off = pci_resource_len(pdev, bar) - 0x2000;
>>
>> - net\ethernet\chelsio\cxgb4\cxgb4_uld.h:
>> (pci_resource_len((pdev), 2) - roundup_pow_of_two((vres)->ocq.size))
>>
>> - infiniband\hw\nes\Nes_hw.c:
>> num_pds = pci_resource_len(nesdev->pcidev, BAR_1) >> PAGE_SHIFT;
>>
>> This risk could be easily prevented before because we only had one way
>> (kernel parameter resource_alignment) to touch those codes. And even
>> some users may be happy to see the extended size.
>>
>> But now we define a default alignment for all devices which would also
>> touch those codes. It would be hard to prevent the risk in this case. So
>> this patch tries to use START_ALIGNMENT to identify the resource's
>> alignment without extending the size when the alignment reassigning is
>> caused by the default alignment.
>
> But I don't understand the new START_ALIGNMENT case.
>
The START_ALIGNMENT case will be used when we have default alignment
for PCI devices, which can identify the resource's alignment without
extending the size. If we don't use START_ALIGNMENT for default alignment,
resources' size would be extended by default, that means the system's
default action could potentially break drivers, it looks unreasonable.
>> Signed-off-by: Yongji Xie <xyjxie@linux.vnet.ibm.com>
>> ---
>> drivers/pci/pci.c | 34 ++++++++++++++++++++++++----------
>> 1 files changed, 24 insertions(+), 10 deletions(-)
>>
>> diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
>> index 2622e9b..0017e5e 100644
>> --- a/drivers/pci/pci.c
>> +++ b/drivers/pci/pci.c
>> @@ -4958,7 +4958,8 @@ void pci_ignore_hotplug(struct pci_dev *dev)
>> * RETURNS: Resource alignment if it is specified.
>> * Zero if it is not specified.
>
> Since there's function doc, please update it to reflect the new
> "resize" return parameter.
>
Will do it.
> What does "resize" mean? I can't figure it out from your code.
"resize" means we will update the resource'alignment by extending the
resource's size. This would happen when we use kernel parameter to identify
resource's alignment. If the resource's alignment is identified by the default
alignment function(macro) rather than kernel parameter, "resize" should be
false, which means we update the resource'alignment without extending the
resource's size.
Thanks,
Yongji
prev parent reply other threads:[~2017-03-25 12:46 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-15 6:45 [PATCH v9 0/3] PCI: Introduce a way to enforce all MMIO BARs not to share PAGE_SIZE Yongji Xie
2017-02-15 6:45 ` [PATCH v9 1/3] PCI: A fix for caculating bridge window's size and alignment Yongji Xie
2017-02-15 6:45 ` [PATCH v9 2/3] PCI: Add a macro to set default alignment for all PCI devices Yongji Xie
2017-03-23 20:53 ` Bjorn Helgaas
2017-03-23 21:57 ` Bjorn Helgaas
2017-03-25 12:36 ` Yongji Xie
2017-03-27 10:17 ` Michael Ellerman
2017-03-27 10:25 ` Benjamin Herrenschmidt
2017-03-30 23:13 ` Bjorn Helgaas
2017-02-15 6:45 ` [PATCH v9 3/3] PCI: Don't extend device's size when using default alignment for all devices Yongji Xie
2017-03-23 21:55 ` Bjorn Helgaas
2017-03-25 12:46 ` Yongji Xie [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=1490445992-4102-1-git-send-email-elohimes@gmail.com \
--to=elohimes@gmail.com \
--cc=aik@ozlabs.ru \
--cc=alex.williamson@redhat.com \
--cc=benh@kernel.crashing.org \
--cc=bhelgaas@google.com \
--cc=gwshan@linux.vnet.ibm.com \
--cc=linux-pci@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mpe@ellerman.id.au \
--cc=paulus@samba.org \
--cc=zhong@linux.vnet.ibm.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).