From: Brian Norris <briannorris@chromium.org>
To: Shawn Lin <shawn.lin@rock-chips.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>,
linux-kernel@vger.kernel.org,
Jeffy Chen <jeffy.chen@rock-chips.com>,
Wenrui Li <wenrui.li@rock-chips.com>,
linux-pci@vger.kernel.org, linux-rockchip@lists.infradead.org
Subject: Re: [PATCH v2 3/5] PCI: rockchip: add remove() support
Date: Fri, 10 Mar 2017 11:40:12 -0800 [thread overview]
Message-ID: <20170310194011.GA16352@google.com> (raw)
In-Reply-To: <5cec190e-4eee-fc55-7039-2336ba5253f3@rock-chips.com>
On Fri, Mar 10, 2017 at 12:20:54PM +0800, Shawn Lin wrote:
> On 2017/3/10 11:22, Shawn Lin wrote:
> >On 2017/3/10 10:46, Brian Norris wrote:
> >>Currently, if we try to unbind the platform device, the remove will
> >>succeed, but the removal won't undo most of the registration, leaving
> >>partially-configured PCI devices in the system.
> >>
> >>This allows, for example, a simple 'lspci' to crash the system, as it
> >>will try to touch the freed (via devm_*) driver structures.
> >>
> >>So let's implement device remove().
> >>
> >
> >As this patchset seems to be merged together so I think the following
> >warning will be ok? if my git-am robot only pick your patch 1->compile->
> >patch 2->compile->patch 3 then
> >
> >drivers/pci/host/pcie-rockchip.c: In function 'rockchip_pcie_remove':
> >drivers/pci/host/pcie-rockchip.c:1435:2: error: implicit declaration of
> >function 'pci_unmap_iospace' [-Werror=implicit-function-declaration]
> > pci_unmap_iospace(rockchip->io);
I'm not sure what you're doing here, but when I test patches 1-3, this
all compiles fine for me. Maybe you're testing an old kernel that does
not have pci_unmap_iospace()?
> >but I guess you may need to move your patch 4 ahead of patch 3?
No. Patch 4 is only necessary for building modules that can use those
functions; your PCIe driver doesn't build as a module until patch 5.
I'm going to guess that you're testing your hacky vendor tree, and not
pure upstream.
> Well, I am not sure if something is wrong here.
>
> But when booting up the system for the first time, we got
> [ 0.527263] PCI host bridge /pcie@f8000000 ranges:
> [ 0.527293] MEM 0xfa000000..0xfa5fffff -> 0xfa000000
> [ 0.527308] IO 0xfa600000..0xfa6fffff -> 0xfa600000
> [ 0.527544] rockchip-pcie f8000000.pcie: PCI host bridge to bus 0000:0
>
> so the hierarchy(lspci -t) looks like:
> lspci -t
> -[0000:00]---00.0-[01]----00.0
>
> and lspci
> 0000:00:00.0 Class 0604: Device 1d87:0100
> 0001:01:00.0 Class 0108: Device 8086:f1a5 (rev 03)
>
> but if I did unbind and bind, the bus number is different.
>
> lspci
> 0001:00:00.0 Class 0604: Device 1d87:0100
> 0001:01:00.0 Class 0108: Device 8086:f1a5 (rev 03)
>
> lspci -t
> -+-[0001:00]---00.0-[01]----00.0
> \-[0000:00]-
>
> This hierarchy looks wrong to me.
That looks like it's somewhat an artifact of lspci's tree view, which
manufactures the 0000:00 root.
I might comment on your "RFT" patch too but... it does touch on the
problem (that the domain numbers don't get reused), but I don't think
it's a good idea. What if we add another domain after the Rockchip
PCIe domain? You'll clobber all the domain allocations the first time
you remove the Rockchip one. Instead, if we want to actually stabilize
this indexing across hotplug, we need the core PCI code to take care of
this for us. e.g., maybe use one of the existing indexing ID mechanisms
in the kernel, like IDR?
Anyway, other than the bad lspci -t output, is there any actual bug
here? I didn't think the domain numbers were actually so special.
Brian
next prev parent reply other threads:[~2017-03-10 19:40 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-10 2:46 [PATCH v2 1/5] PCI: rockchip: fix sign issues for current limits Brian Norris
2017-03-10 2:46 ` [PATCH v2 2/5] PCI: rockchip: make 'return 0' more obvious in probe() Brian Norris
2017-03-10 2:46 ` [PATCH v2 3/5] PCI: rockchip: add remove() support Brian Norris
2017-03-10 3:22 ` Shawn Lin
2017-03-10 4:20 ` Shawn Lin
2017-03-10 19:40 ` Brian Norris [this message]
2017-03-13 2:26 ` Shawn Lin
2017-03-20 22:29 ` Brian Norris
2017-03-24 14:25 ` Bjorn Helgaas
2017-03-24 17:22 ` Brian Norris
2017-03-30 23:28 ` Bjorn Helgaas
2017-03-31 0:26 ` Brian Norris
2017-03-31 5:17 ` Bjorn Helgaas
2017-03-31 16:40 ` Brian Norris
2017-04-11 18:18 ` Brian Norris
2017-03-10 2:46 ` [PATCH v2 4/5] PCI: export pci_remap_iospace() and pci_unmap_iospace() Brian Norris
2017-03-10 2:46 ` [PATCH v2 5/5] PCI: rockchip: modularize Brian Norris
2017-03-23 22:27 ` [PATCH v2 1/5] PCI: rockchip: fix sign issues for current limits Bjorn Helgaas
2017-03-23 22:33 ` Brian Norris
2017-03-24 1:24 ` Shawn Lin
2017-04-21 19:03 ` Bjorn Helgaas
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=20170310194011.GA16352@google.com \
--to=briannorris@chromium.org \
--cc=bhelgaas@google.com \
--cc=jeffy.chen@rock-chips.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=shawn.lin@rock-chips.com \
--cc=wenrui.li@rock-chips.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).