All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
To: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Catalin Marinas <catalin.marinas@arm.com>,
	Graeme Gregory <graeme.gregory@linaro.org>,
	linux-pci <linux-pci@vger.kernel.org>,
	Will Deacon <will.deacon@arm.com>,
	Leif Lindholm <leif.lindholm@linaro.org>,
	Sinan Kaya <okaya@codeaurora.org>,
	Tomasz Nowicki <tn@semihalf.com>,
	Bjorn Helgaas <bhelgaas@google.com>,
	Yinghai Lu <yinghai@kernel.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH 1/2] drivers: pci: do not disregard parent resources starting at 0x0
Date: Thu, 13 Apr 2017 10:42:58 +0100	[thread overview]
Message-ID: <20170413094258.GA12432@red-moon> (raw)
In-Reply-To: <CAKv+Gu9JrU=-SZQcTtFfOP423gVTyM1w9yF=_J1uGd74ntpwLw@mail.gmail.com>

On Thu, Apr 13, 2017 at 08:39:12AM +0100, Ard Biesheuvel wrote:
> On 12 April 2017 at 14:24, Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> wrote:
> > [+Yinghai, Bjorn]
> >
> > On Tue, Apr 11, 2017 at 05:33:12PM +0100, Ard Biesheuvel wrote:
> >> Commit f44116ae8818 ("PCI: Remove pci_find_parent_resource() use for
> >> allocation") updated the logic that iterates over all bus resources
> >> and compares them to a given resource, in order to decide whether one
> >> is the parent of the latter.
> >>
> >> This change inadvertently causes pci_find_parent_resource() to disregard
> >> resources starting at address 0x0, resulting in an error such as the one
> >> below on ARM systems whose I/O window starts at 0x0.
> >>
> >> pci_bus 0000:00: root bus resource [mem 0x10000000-0x3efeffff window]
> >> pci_bus 0000:00: root bus resource [io  0x0000-0xffff window]
> >> pci_bus 0000:00: root bus resource [mem 0x8000000000-0xffffffffff window]
> >> pci_bus 0000:00: root bus resource [bus 00-0f]
> >> pci 0000:00:01.0: PCI bridge to [bus 01]
> >> pci 0000:00:02.0: PCI bridge to [bus 02]
> >> pci 0000:00:03.0: PCI bridge to [bus 03]
> >> pci 0000:00:03.0: can't claim BAR 13 [io  0x0000-0x0fff]: no compatible bridge window
> >> pci 0000:03:01.0: can't claim BAR 0 [io  0x0000-0x001f]: no compatible bridge window
> >>
> >> While this never happens on x86, it is perfectly legal in general for a
> >> PCI MMIO or IO window to start at address 0x0, and it was supported in
> >> the code before commit f44116ae8818.
> >>
> >> So let's drop the test for res->start != 0; resource_contains() already
> >> checks whether [start, end) completely covers the resource, and so it
> >> should be redundant.
> >>
> >> Fixes: f44116ae8818 ("PCI: Remove pci_find_parent_resource() use for allocation")
> >
> > I know this code fixes IO claiming on ARM/ARM64 (well, it fixes nothing
> > because we never claim resources on ARM/ARM64 apart from kvmtool and
> > generic host bridge), my _big_ worry is that it can cause endless
> > regressions on other arches, in any case I would be really really
> > careful about adding a Fixes: tag to it.
> >
> 
> The patch is only 3 years old, and is obviously a regression given
> that the change in behavior described here occurs as a side effect.

I agree with you that res->start usage changed with f44116ae8818 but
I am not sure you can call that a regression unless we prove there
was some code relying on the previous behaviour (and it is not just
x86).

Anyway, I am happy to put these two patches (with some tweaks on patch
2) on a branch for testing on ARM64 ACPI platforms to see the best
way forward.

Thanks,
Lorenzo

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

WARNING: multiple messages have this Message-ID (diff)
From: lorenzo.pieralisi@arm.com (Lorenzo Pieralisi)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/2] drivers: pci: do not disregard parent resources starting at 0x0
Date: Thu, 13 Apr 2017 10:42:58 +0100	[thread overview]
Message-ID: <20170413094258.GA12432@red-moon> (raw)
In-Reply-To: <CAKv+Gu9JrU=-SZQcTtFfOP423gVTyM1w9yF=_J1uGd74ntpwLw@mail.gmail.com>

On Thu, Apr 13, 2017 at 08:39:12AM +0100, Ard Biesheuvel wrote:
> On 12 April 2017 at 14:24, Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> wrote:
> > [+Yinghai, Bjorn]
> >
> > On Tue, Apr 11, 2017 at 05:33:12PM +0100, Ard Biesheuvel wrote:
> >> Commit f44116ae8818 ("PCI: Remove pci_find_parent_resource() use for
> >> allocation") updated the logic that iterates over all bus resources
> >> and compares them to a given resource, in order to decide whether one
> >> is the parent of the latter.
> >>
> >> This change inadvertently causes pci_find_parent_resource() to disregard
> >> resources starting at address 0x0, resulting in an error such as the one
> >> below on ARM systems whose I/O window starts at 0x0.
> >>
> >> pci_bus 0000:00: root bus resource [mem 0x10000000-0x3efeffff window]
> >> pci_bus 0000:00: root bus resource [io  0x0000-0xffff window]
> >> pci_bus 0000:00: root bus resource [mem 0x8000000000-0xffffffffff window]
> >> pci_bus 0000:00: root bus resource [bus 00-0f]
> >> pci 0000:00:01.0: PCI bridge to [bus 01]
> >> pci 0000:00:02.0: PCI bridge to [bus 02]
> >> pci 0000:00:03.0: PCI bridge to [bus 03]
> >> pci 0000:00:03.0: can't claim BAR 13 [io  0x0000-0x0fff]: no compatible bridge window
> >> pci 0000:03:01.0: can't claim BAR 0 [io  0x0000-0x001f]: no compatible bridge window
> >>
> >> While this never happens on x86, it is perfectly legal in general for a
> >> PCI MMIO or IO window to start at address 0x0, and it was supported in
> >> the code before commit f44116ae8818.
> >>
> >> So let's drop the test for res->start != 0; resource_contains() already
> >> checks whether [start, end) completely covers the resource, and so it
> >> should be redundant.
> >>
> >> Fixes: f44116ae8818 ("PCI: Remove pci_find_parent_resource() use for allocation")
> >
> > I know this code fixes IO claiming on ARM/ARM64 (well, it fixes nothing
> > because we never claim resources on ARM/ARM64 apart from kvmtool and
> > generic host bridge), my _big_ worry is that it can cause endless
> > regressions on other arches, in any case I would be really really
> > careful about adding a Fixes: tag to it.
> >
> 
> The patch is only 3 years old, and is obviously a regression given
> that the change in behavior described here occurs as a side effect.

I agree with you that res->start usage changed with f44116ae8818 but
I am not sure you can call that a regression unless we prove there
was some code relying on the previous behaviour (and it is not just
x86).

Anyway, I am happy to put these two patches (with some tweaks on patch
2) on a branch for testing on ARM64 ACPI platforms to see the best
way forward.

Thanks,
Lorenzo

  reply	other threads:[~2017-04-13  9:42 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-11 16:33 [PATCH 0/2] arm64: acpi/pci: allow the firmware BAR configuration to be preserved Ard Biesheuvel
2017-04-11 16:33 ` Ard Biesheuvel
2017-04-11 16:33 ` [PATCH 1/2] drivers: pci: do not disregard parent resources starting at 0x0 Ard Biesheuvel
2017-04-11 16:33   ` Ard Biesheuvel
2017-04-11 18:30   ` Ard Biesheuvel
2017-04-11 18:30     ` Ard Biesheuvel
2017-04-12 13:24   ` Lorenzo Pieralisi
2017-04-12 13:24     ` Lorenzo Pieralisi
2017-04-13  7:39     ` Ard Biesheuvel
2017-04-13  7:39       ` Ard Biesheuvel
2017-04-13  9:42       ` Lorenzo Pieralisi [this message]
2017-04-13  9:42         ` Lorenzo Pieralisi
2017-04-11 16:33 ` [PATCH 2/2] arm64: acpi/pci: invoke _DSM whether to preserve firmware PCI setup Ard Biesheuvel
2017-04-11 16:33   ` Ard Biesheuvel
2017-04-12 17:26   ` Lorenzo Pieralisi
2017-04-12 17:26     ` Lorenzo Pieralisi
2017-04-12 18:03     ` Sinan Kaya
2017-04-12 18:03       ` Sinan Kaya
2017-05-17 21:53       ` Bjorn Helgaas
2017-05-17 21:53         ` Bjorn Helgaas
2017-05-17 21:56 ` [PATCH 0/2] arm64: acpi/pci: allow the firmware BAR configuration to be preserved Bjorn Helgaas
2017-05-17 21:56   ` Bjorn Helgaas
2017-05-18 10:59   ` Ard Biesheuvel
2017-05-18 10:59     ` Ard Biesheuvel
2017-05-18 14:05     ` Bjorn Helgaas
2017-05-18 14:05       ` Bjorn Helgaas
2017-05-18 15:10       ` Ard Biesheuvel
2017-05-18 15:10         ` Ard Biesheuvel
2017-05-18 15:47         ` Lorenzo Pieralisi
2017-05-18 15:47           ` Lorenzo Pieralisi
2017-05-18 16:51           ` Ard Biesheuvel
2017-05-18 16:51             ` Ard Biesheuvel
2017-05-18 17:46             ` Lorenzo Pieralisi
2017-05-18 17:46               ` Lorenzo Pieralisi
2017-06-01 15:04               ` Ard Biesheuvel
2017-06-01 15:04                 ` Ard Biesheuvel
2017-06-01 16:15                 ` Lorenzo Pieralisi
2017-06-01 16:15                   ` Lorenzo Pieralisi
2017-06-01 16:18                   ` Ard Biesheuvel
2017-06-01 16:18                     ` Ard Biesheuvel
2017-06-01 17:38                     ` Lorenzo Pieralisi
2017-06-01 17:38                       ` Lorenzo Pieralisi
2017-06-06  8:59                     ` Lorenzo Pieralisi
2017-06-06  8:59                       ` Lorenzo Pieralisi
2017-06-06  9:14                       ` Ard Biesheuvel
2017-06-06  9:14                         ` Ard Biesheuvel
2017-06-06 10:02                         ` Lorenzo Pieralisi
2017-06-06 10:02                           ` Lorenzo Pieralisi
2017-06-07 13:45                           ` Ard Biesheuvel
2017-06-07 13:45                             ` Ard Biesheuvel
2017-06-12 16:55                             ` Lorenzo Pieralisi
2017-06-12 16:55                               ` Lorenzo Pieralisi
2017-06-12 17:00                               ` Ard Biesheuvel
2017-06-12 17:00                                 ` Ard Biesheuvel

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=20170413094258.GA12432@red-moon \
    --to=lorenzo.pieralisi@arm.com \
    --cc=ard.biesheuvel@linaro.org \
    --cc=bhelgaas@google.com \
    --cc=catalin.marinas@arm.com \
    --cc=graeme.gregory@linaro.org \
    --cc=leif.lindholm@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=okaya@codeaurora.org \
    --cc=tn@semihalf.com \
    --cc=will.deacon@arm.com \
    --cc=yinghai@kernel.org \
    /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.