Message ID | 20220728152640.547725-1-david.marchand@redhat.com (mailing list archive) |
---|---|
Headers |
Return-Path: <dev-bounces@dpdk.org> X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 73513A00C5; Thu, 28 Jul 2022 17:26:48 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5CD1040151; Thu, 28 Jul 2022 17:26:48 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id C6BF44014F for <dev@dpdk.org>; Thu, 28 Jul 2022 17:26:46 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1659022006; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=LUgJLkE6xFaa9UaHGFBl20fowYZqNvIxhS+xQ5swk+o=; b=QH62J9KF4uAJ992nFA2+Xa3zdJYGgbEafHDM3CtzLS0CX3j6IRU2CEjHgumlOre6wnwFje b09e5fFB2XYcbeLVWWKnYgy9nxQBI09wxFkJJcXXfvwsenNfEynekYHjkm8zY31FAzLTdp s1X4Zpeb5NfTUWcOTbeDGZggWns10is= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-510-izwklWgxO1uRQ6pnUVeJUg-1; Thu, 28 Jul 2022 11:26:44 -0400 X-MC-Unique: izwklWgxO1uRQ6pnUVeJUg-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A0A9310AF7F2 for <dev@dpdk.org>; Thu, 28 Jul 2022 15:26:44 +0000 (UTC) Received: from fchome.redhat.com (unknown [10.40.195.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id D4F271415118 for <dev@dpdk.org>; Thu, 28 Jul 2022 15:26:43 +0000 (UTC) From: David Marchand <david.marchand@redhat.com> To: dev@dpdk.org Subject: [RFC v3 00/26] Bus and device cleanup for 22.11 Date: Thu, 28 Jul 2022 17:26:14 +0200 Message-Id: <20220728152640.547725-1-david.marchand@redhat.com> In-Reply-To: <20220628144643.1213026-1-david.marchand@redhat.com> References: <20220628144643.1213026-1-david.marchand@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.7 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=david.marchand@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions <dev.dpdk.org> List-Unsubscribe: <https://mails.dpdk.org/options/dev>, <mailto:dev-request@dpdk.org?subject=unsubscribe> List-Archive: <http://mails.dpdk.org/archives/dev/> List-Post: <mailto:dev@dpdk.org> List-Help: <mailto:dev-request@dpdk.org?subject=help> List-Subscribe: <https://mails.dpdk.org/listinfo/dev>, <mailto:dev-request@dpdk.org?subject=subscribe> Errors-To: dev-bounces@dpdk.org |
Series |
Bus and device cleanup for 22.11
|
|
Message
David Marchand
July 28, 2022, 3:26 p.m. UTC
This is a PoC for hiding the rte_bus, rte_driver and rte_device objects. And mark associated driver only API as internal. A good amount of the patches are preparation work on rte_bus.h, rte_dev.h, rte_devargs.h and rte_eal.h headers, removing dependencies between them. PCI bus specific handling are removed from testpmd, unit tests and examples. After this series, driver-only API headers for registering to buses are not exported anymore, unless the enable_driver_sdk meson option is selected. New accessors for rte_bus, rte_driver and rte_device have been added, marked with an experimental tag first when introducing them, and later in the series marked as stable since external users will want to use those drop-in replacements right away. A check is added to ensure we won't pollute app/ and examples/ again, though some unit tests are left intentionnally untouched as they test some internals of DPDK. Comments welcome. Changes since RFC v2: - added check for additions of include .*_(driver|pmd)\.h in apps and examples, - dropped legacy/debug testpmd commands to read PCI BAR0 registers, - dropped patches on bbdev, ethdev, rawdev driver headers for now, - reordered patches and separated changes per bus type to ease review, - added more accessor for device, - introduced rte_dev_bus_info to provide a Bus specific description of a device, a first use is for providing a PCI device vendor / device identifiers that are otherwise unavailable through a generic existing API, Changes since RFC v1: - added two more cleanups (new patch 3 and 4) for unit test and examples relying on PCI specific info, - went on with masking rte_driver and rte_device too,
Comments
> On Jul 28, 2022, at 8:26 AM, David Marchand <david.marchand@redhat.com> wrote: > > This is a PoC for hiding the rte_bus, rte_driver and rte_device objects. > And mark associated driver only API as internal. > > A good amount of the patches are preparation work on rte_bus.h, > rte_dev.h, rte_devargs.h and rte_eal.h headers, removing dependencies > between them. > > PCI bus specific handling are removed from testpmd, unit tests and > examples. > > After this series, driver-only API headers for registering to buses are > not exported anymore, unless the enable_driver_sdk meson option is > selected. > > New accessors for rte_bus, rte_driver and rte_device have been added, > marked with an experimental tag first when introducing them, and later > in the series marked as stable since external users will want to use > those drop-in replacements right away. > > A check is added to ensure we won't pollute app/ and examples/ again, > though some unit tests are left intentionnally untouched as they test > some internals of DPDK. > > Comments welcome. Hi David, I certainly understand wanting to hide those objects to avoid ABI maintenance. SPDK is using fields directly from some of those structures today, but I think all of them could be replaced with associated helper functions. This was discussed a bit late last year related to Chenbo’s earlier patch set: https://www.mail-archive.com/dev@dpdk.org/msg222560.html It looks like SPDK never got back to the DPDK project on exactly what APIs we would need, to see if DPDK could still support a minimal API without requiring the enable_driver_sdk flag. I’m generating an exact list, but it would be rendered moot depending on the next question... Can we keep rte_pci_register(), or a new variation of it that keeps the rte_pci_driver structure hidden? Hiding rte_pci_register() would mean SPDK can no longer work with a packaged DPDK. Or the DPDK packages would need to set enable_driver_sdk which I suspect is not the intent. If you’re open to this, we (SPDK) can make a proposal on exactly what we would need to keep SPDK working with a standard DPDK build. Thanks, Jim
Hello, On Fri, Aug 5, 2022 at 1:19 AM Harris, James R <james.r.harris@intel.com> wrote: > Can we keep rte_pci_register(), or a new variation of it that keeps the > rte_pci_driver structure hidden? Hiding rte_pci_register() would mean > SPDK can no longer work with a packaged DPDK. Or the DPDK packages > would need to set enable_driver_sdk which I suspect is not the intent. What do you think if SPDK maintains a copy of the internal headers? The internal API are not supposed to change that often, but we (DPDK) won't guarantee it. This would still put some maintenance burden on SPDK but I think it is a good compromise. I did a PoC this morning and put patches in my forked repo: https://github.com/david-marchand/spdk/commits/master
> From: David Marchand <david.marchand@redhat.com> > > Hello, > > On Fri, Aug 5, 2022 at 1:19 AM Harris, James R <james.r.harris@intel.com> > wrote: > > Can we keep rte_pci_register(), or a new variation of it that keeps > > the rte_pci_driver structure hidden? Hiding rte_pci_register() would > > mean SPDK can no longer work with a packaged DPDK. Or the DPDK > > packages would need to set enable_driver_sdk which I suspect is not the > intent. > > What do you think if SPDK maintains a copy of the internal headers? > > The internal API are not supposed to change that often, but we (DPDK) won't > guarantee it. > This would still put some maintenance burden on SPDK but I think it is a good > compromise. > Would these internal symbols be considered part of the public/official ABI? When SPDK goes to dynamically load a shared DPDK library, how can we detect whether it's a version that we support linking against? > I did a PoC this morning and put patches in my forked repo: > https://github.com/david-marchand/spdk/commits/master > > > -- > David Marchand
On Mon, Aug 29, 2022 at 7:12 PM Walker, Benjamin <benjamin.walker@intel.com> wrote: > > > Can we keep rte_pci_register(), or a new variation of it that keeps > > > the rte_pci_driver structure hidden? Hiding rte_pci_register() would > > > mean SPDK can no longer work with a packaged DPDK. Or the DPDK > > > packages would need to set enable_driver_sdk which I suspect is not the > > intent. > > > > What do you think if SPDK maintains a copy of the internal headers? > > > > The internal API are not supposed to change that often, but we (DPDK) won't > > guarantee it. > > This would still put some maintenance burden on SPDK but I think it is a good > > compromise. > > > > Would these internal symbols be considered part of the public/official ABI? When What do you mean by "public/official"? If you mean the "stable" ABI (as described in the ABI policy document and for which compatibility is preserved across minor versions of the ABI), the answer is no: internal symbols are not part of it. > SPDK goes to dynamically load a shared DPDK library, how can we detect > whether it's a version that we support linking against? The runtime version of a DPDK library is available via rte_version(). As for the PCI drivers that SPDK wants to register in DPDK, what do you think if SPDK people added and maintained a "generic" PCI driver in DPDK. This driver would expose a new API (which can not re-expose internal structures, like rte_pci_driver and consorts) and ensure its ABI is maintained in the long term. This makes me think of pci-stub, but in DPDK. I did not think too much about it and I don't understand what SPDK requires, but is there something wrong with this approach?
> On Aug 30, 2022, at 8:09 AM, David Marchand <david.marchand@redhat.com> wrote: > > On Mon, Aug 29, 2022 at 7:12 PM Walker, Benjamin > <benjamin.walker@intel.com> wrote: >>>> Can we keep rte_pci_register(), or a new variation of it that keeps >>>> the rte_pci_driver structure hidden? Hiding rte_pci_register() would >>>> mean SPDK can no longer work with a packaged DPDK. Or the DPDK >>>> packages would need to set enable_driver_sdk which I suspect is not the >>> intent. >>> >>> What do you think if SPDK maintains a copy of the internal headers? >>> >>> The internal API are not supposed to change that often, but we (DPDK) won't >>> guarantee it. >>> This would still put some maintenance burden on SPDK but I think it is a good >>> compromise. >>> >> >> Would these internal symbols be considered part of the public/official ABI? When > > What do you mean by "public/official"? > If you mean the "stable" ABI (as described in the ABI policy document > and for which compatibility is preserved across minor versions of the > ABI), the answer is no: internal symbols are not part of it. > > >> SPDK goes to dynamically load a shared DPDK library, how can we detect >> whether it's a version that we support linking against? > > The runtime version of a DPDK library is available via rte_version(). > > > As for the PCI drivers that SPDK wants to register in DPDK, what do > you think if SPDK people added and maintained a "generic" PCI driver > in DPDK. > This driver would expose a new API (which can not re-expose internal > structures, like rte_pci_driver and consorts) and ensure its ABI is > maintained in the long term. > This makes me think of pci-stub, but in DPDK. > > I did not think too much about it and I don't understand what SPDK > requires, but is there something wrong with this approach? The stub driver idea is interesting. In the past we’ve needed access to more than what a stub driver would provide - for example, to work around kernel vfio + pci bugs when we probe 24 NVMe SSDs behind a PCIe switch that is hot-inserted, or conversely handling hot removal of that same switch. So I’m worried that even if we do the stub driver, we end up running into a case where we need these header file copies anyways. Not ruling the stub driver out, but I think it's a longer-term goal, not something we would have ready for 22.11 obviously. So sticking with the internal header copies for now, this works fine for LTS and non-LTS releases. What about stable releases (i.e. 22.11.1)? IIUC, these header files could change in a stable release since they are no longer part of the ABI? -Jim
On Thu, Sep 22, 2022 at 12:29 AM Harris, James R <james.r.harris@intel.com> wrote: > > On Aug 30, 2022, at 8:09 AM, David Marchand <david.marchand@redhat.com> wrote: > > > > On Mon, Aug 29, 2022 at 7:12 PM Walker, Benjamin > > <benjamin.walker@intel.com> wrote: > >>>> Can we keep rte_pci_register(), or a new variation of it that keeps > >>>> the rte_pci_driver structure hidden? Hiding rte_pci_register() would > >>>> mean SPDK can no longer work with a packaged DPDK. Or the DPDK > >>>> packages would need to set enable_driver_sdk which I suspect is not the > >>> intent. > >>> > >>> What do you think if SPDK maintains a copy of the internal headers? > >>> > >>> The internal API are not supposed to change that often, but we (DPDK) won't > >>> guarantee it. > >>> This would still put some maintenance burden on SPDK but I think it is a good > >>> compromise. > >>> > >> > >> Would these internal symbols be considered part of the public/official ABI? When > > > > What do you mean by "public/official"? > > If you mean the "stable" ABI (as described in the ABI policy document > > and for which compatibility is preserved across minor versions of the > > ABI), the answer is no: internal symbols are not part of it. > > > > > >> SPDK goes to dynamically load a shared DPDK library, how can we detect > >> whether it's a version that we support linking against? > > > > The runtime version of a DPDK library is available via rte_version(). > > > > > > As for the PCI drivers that SPDK wants to register in DPDK, what do > > you think if SPDK people added and maintained a "generic" PCI driver > > in DPDK. > > This driver would expose a new API (which can not re-expose internal > > structures, like rte_pci_driver and consorts) and ensure its ABI is > > maintained in the long term. > > This makes me think of pci-stub, but in DPDK. > > > > I did not think too much about it and I don't understand what SPDK > > requires, but is there something wrong with this approach? > > The stub driver idea is interesting. In the past we’ve needed access to more > than what a stub driver would provide - for example, to work around kernel > vfio + pci bugs when we probe 24 NVMe SSDs behind a PCIe switch that is > hot-inserted, or conversely handling hot removal of that same switch. So > I’m worried that even if we do the stub driver, we end up running into a > case where we need these header file copies anyways. Not ruling the stub > driver out, but I think it's a longer-term goal, not something we would have > ready for 22.11 obviously. > > So sticking with the internal header copies for now, this works fine > for LTS and non-LTS releases. What about stable releases (i.e. 22.11.1)? > IIUC, these header files could change in a stable release since they are > no longer part of the ABI? In theory, yes they can change. But this is a price to pay, as no one seems willing to invest and maintain a stable API for PCI drivers. I just noticed that some parts of the cleanups I had proposed have been merged in SPDK. Next time, I prefer getting some feedback from SPDK community before my SoB is applied (or stripped) on modified patches. Thanks.
> On Sep 23, 2022, at 12:13 AM, David Marchand <david.marchand@redhat.com> wrote: > > On Thu, Sep 22, 2022 at 12:29 AM Harris, James R > <james.r.harris@intel.com> wrote: >> >> >> So sticking with the internal header copies for now, this works fine >> for LTS and non-LTS releases. What about stable releases (i.e. 22.11.1)? >> IIUC, these header files could change in a stable release since they are >> no longer part of the ABI? > > In theory, yes they can change. > But this is a price to pay, as no one seems willing to invest and > maintain a stable API for PCI drivers. Understood. SPDK is preparing for this possibility, just wanted to confirm it was necessary. > I just noticed that some parts of the cleanups I had proposed have > been merged in SPDK. > Next time, I prefer getting some feedback from SPDK community before > my SoB is applied (or stripped) on modified patches. My apologies David. The RTE_DEV_FOREACH cleanup was a nice one and an obvious improvement. I believe it was applied without any modifications (except for fuzz offsets) but still should have given you a heads-up. -Jim