From: Shuai Xue <xueshuai@linux.alibaba.com>
To: Jonathan Cameron <Jonathan.Cameron@Huawei.com>,
Bjorn Helgaas <helgaas@kernel.org>
Cc: chengyou@linux.alibaba.com, kaishen@linux.alibaba.com,
helgaas@kernel.org, yangyicong@huawei.com, will@kernel.org,
baolin.wang@linux.alibaba.com, robin.murphy@arm.com,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, linux-pci@vger.kernel.org,
rdunlap@infradead.org, mark.rutland@arm.com,
zhuo.song@linux.alibaba.com
Subject: Re: [PATCH v6 0/4] drivers/perf: add Synopsys DesignWare PCIe PMU driver support
Date: Mon, 24 Jul 2023 20:13:26 +0800 [thread overview]
Message-ID: <3dba0c90-9673-eadd-4f82-353ae48567a7@linux.alibaba.com> (raw)
In-Reply-To: <20230724101807.000012bf@Huawei.com>
On 2023/7/24 17:18, Jonathan Cameron wrote:
> Really a question for Bjorn I think, but here is my 2 cents...
>
> The problem here is that we need to do that fundamental redesign of the
> way the PCI ports drivers work. I'm not sure there is a path to merging
> this until that is done. The bigger problem is that I'm not sure anyone
> is actively looking at that yet. I'd like to look at this (as I have
> the same problem for some other drivers), but it is behind various
> other things on my todo list.
>
> Bjorn might be persuaded on a temporary solution, but that would come
> with some maintenance problems, particularly when we try to do it
> 'right' in the future. Maybe adding another service driver would be
> a stop gap as long as we know we won't keep doing so for ever. Not sure.
Thank you for your reply, and got your point, :)
+ Bjorn
>>>> The approach used here is to separately walk the PCI topology and
>>>> register the devices. It can 'maybe' get away with that because no
>>>> interrupts and I assume resets have no nasty impacts on it because
>>>> the device is fairly simple. In general that's not going to work.
>>>> CXL does a similar trick (which I don't much like, but too late
>>>> now), but we've also run into the problem of how to get interrupts
>>>> if not the main driver.
>>>
>>> Yes, this is a real problem. I think the "walk all PCI devices
>>> looking for one we like" approach is terrible because it breaks a lot
>>> of driver model assumptions (no device ID to autoload module via udev,
>>> hotplug doesn't work, etc), but we don't have a good alternative right
>>> now.
>>>
>>> I think portdrv is slightly better because at least it claims the
>>> device in the usual way and gives a way for service drivers to
>>> register with it. But I don't really like that either because it
>>> created a new weird /sys/bus/pci_express hierarchy full of these
>>> sub-devices that aren't really devices, and it doesn't solve the
>>> module load and hotplug issues.
>>>
>>> I would like to have portdrv be completely built into the PCI core and
>>> not claim Root Ports or Switch Ports. Then those devices would be
>>> available via the usual driver model for driver loading and binding
>>> and for hotplug.
>>
>> Let me see if I understand this correctly as I can think of a few options
>> that perhaps are inline with what you are thinking.
>>
>> 1) All the portdrv stuff converted to normal PCI core helper functions
>> that a driver bound to the struct pci_dev can use.
>> 2) Driver core itself provides a bunch of extra devices alongside the
>> struct pci_dev one to which additional drivers can bind? - so kind
>> of portdrv handling, but squashed into the PCI device topology?
>> 3) Have portdrv operated under the hood, so all the services etc that
>> it provides don't require a driver to be bound at all. Then
>> allow usual VID/DID based driver binding.
>>
>> If 1 - we are going to run into class device restrictions and that will
>> just move where we have to handle the potential vendor specific parts.
>> We probably don't want that to be a hydra with all the functionality
>> and lookups etc driven from there, so do we end up with sub devices
>> of that new PCI port driver with a discover method based on either
>> vsec + VID or DVSEC with devices created under the main pci_dev.
>> That would have to include nastiness around interrupt discovery for
>> those sub devices. So ends up roughly like port_drv.
>>
>> I don't think 2 solves anything.
>>
>> For 3 - interrupts and ownership of facilities is going to be tricky
>> as initially those need to be owned by the PCI core (no device driver bound)
>> and then I guess handed off to the driver once it shows up? Maybe that
>> driver should call a pci_claim_port() that gives it control of everything
>> and pci_release_port() that hands it all back to the core. That seems
>> racey.
>
> Yes, 3 is the option I want to explore. That's what we already do for
> things like ASPM. Agreed, interrupts is a potential issue. I think
> the architected parts of config space should be implicitly owned by
> the PCI core, with interfaces à la pci_disable_link_state() if drivers
> need them.
>
> Bjorn
> https://lore.kernel.org/lkml/ZGUAWxoEngmqFcLJ@bhelgaas/
@Bjorn Is there a path to merging this patch set until your explore is done?
And are you still actively looking at that yet?
I am not quite familiar with PCI core, but I would like to help work on that.
Thank you.
Best Regards,
Shuai
next prev parent reply other threads:[~2023-07-24 12:13 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-06 7:49 Shuai Xue
2023-06-06 7:49 ` [PATCH v6 1/4] docs: perf: Add description for Synopsys DesignWare PCIe PMU driver Shuai Xue
2023-07-27 8:57 ` Jonathan Cameron
2023-07-27 12:52 ` Shuai Xue
2023-07-28 10:18 ` Jonathan Cameron
2023-06-06 7:49 ` [PATCH v6 2/4] PCI: Add Alibaba Vendor ID to linux/pci_ids.h Shuai Xue
2023-06-06 15:31 ` Bjorn Helgaas
2023-06-07 0:42 ` Shuai Xue
2023-06-06 7:49 ` [PATCH v6 3/4] drivers/perf: add DesignWare PCIe PMU driver Shuai Xue
2023-06-06 15:14 ` Yicong Yang
2023-07-27 9:39 ` Jonathan Cameron
2023-07-28 12:41 ` Shuai Xue
2023-07-28 15:20 ` Jonathan Cameron
2023-08-01 11:46 ` Yicong Yang
2023-08-04 1:39 ` Shuai Xue
2023-08-04 2:28 ` Yicong Yang
2023-08-04 3:09 ` Shuai Xue
2023-10-09 13:08 ` Shuai Xue
2023-10-10 7:35 ` Yicong Yang
2023-10-10 7:45 ` Shuai Xue
2023-07-28 1:31 ` Shuai Xue
2023-06-06 7:49 ` [PATCH v6 4/4] MAINTAINERS: add maintainers for " Shuai Xue
2023-06-16 8:39 ` [PATCH v6 0/4] drivers/perf: add Synopsys DesignWare PCIe PMU driver support Shuai Xue
2023-07-10 12:04 ` Shuai Xue
2023-07-24 2:34 ` Shuai Xue
2023-07-24 9:18 ` Jonathan Cameron
2023-07-24 12:13 ` Shuai Xue [this message]
2023-07-25 20:59 ` Bjorn Helgaas
2023-07-27 3:45 ` Shuai Xue
2023-07-28 13:39 ` Will Deacon
2023-07-31 7:30 ` Shuai Xue
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=3dba0c90-9673-eadd-4f82-353ae48567a7@linux.alibaba.com \
--to=xueshuai@linux.alibaba.com \
--cc=Jonathan.Cameron@Huawei.com \
--cc=baolin.wang@linux.alibaba.com \
--cc=chengyou@linux.alibaba.com \
--cc=helgaas@kernel.org \
--cc=kaishen@linux.alibaba.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=rdunlap@infradead.org \
--cc=robin.murphy@arm.com \
--cc=will@kernel.org \
--cc=yangyicong@huawei.com \
--cc=zhuo.song@linux.alibaba.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
Powered by JetHome