numam-spdk/dpdkbuild/Makefile

205 lines
7.8 KiB
Makefile
Raw Normal View History

#
# BSD LICENSE
#
# Copyright (c) Intel Corporation.
# All rights reserved.
# Copyright (c) 2021 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
# * Neither the name of Intel Corporation nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
SPDK_ROOT_DIR := $(abspath $(CURDIR)/..)
include $(SPDK_ROOT_DIR)/mk/spdk.common.mk
.PHONY: all clean install uninstall
dpdkbuild: build dpdk with meson+ninja Makefile support in DPDK was deprecated and will be removed soon, so switch to the officially supported way of building DPDK - with meson and ninja. Two new tools. Basically, our Makefiles will invoke meson+ninja for DPDK, no other SPDK components are affected. Apparently DPDK wanted to move away from an octopus-like config system and the ideology behind meson configuration is simple now: build everything by default. Some PMDs can be explicitly disabled with meson command line, but all libraries (both static and shared versions) and test apps are built unconditionally. How long does it take to build minimal DPDK with meson? Too much. On my machine half of the total build time is spent on libraries we don't need at all. (I have some hacks up my sleeve to disable building those libraries - see the subsequent patch.) As for the official way of building a minimal DPDK, there was a patch [1] on dpdk mailing list to introduce more specific configuration, but it was rejected: > We talked about this a few times in the past, and it was actually one > of the design goals to _avoid_ replicating the octopus-like config > system of the makefiles. That's because it makes the test matrix > insanely complicated, not to mention the harm to user friendliness, > among other things. > > If someone doesn't want to use a PMD, they can just avoid installing it > - it's simple enough. > > Sorry, but from me it's a very strong NACK. Let's not follow that direction, hack the DPDK build system instead. As for advantages of meson+ninja over Makefiles? I can't find any. It's another build system that does a lot for you with some functions, magic options, and a built-in dependency system. It seems nice if you know the syntax, but it's another component that you need to learn, debug, and possibly find bugs in (there's a lot of github issues open for meson). I would compare it to CMake. As for changes in this patch: rather that explicitly disabling PMDs we don't need, specify a list of PMDs we do need and disable everything else found in ./dpdk/drivers/*. This way we won't have to disable the new PMDs as they're added to DPDK. Meson configuration also sets RTE_EAL_PMD_PATH #define to a valid directory with built PMD shared libs. When it's set, DPDK dynamically loads all shared libraries inside. The drivers there depend on DPDK shared libs and fail to load in static SPDK builds, so we disable them altogether by unsetting RTE_EAL_PMD_PATH in the meson-generated config file - just like DPDK Makefiles did. EAL checks for RTE_EAL_PMD_PATH being empty and skips loading any external PMDs then. We do it for both static and shared libs. We specify all PMDs at build time for now, so there's just no need to load them dynamically. We have three more hacks in our submodule: * disable building dpdk apps by commenting-out a line in dpdk/meson.build * disable building unnecessary libs (build everything that spdk *may* need) * build isa-l compress pmd with `-L[...] -lisal`. DPDK expects to find libisal with pkg-config. We don't want to prepare a pkg-config file, so comment-out a failing check in another meson.build file and provide isa-l through CFLAGS and LDFLAGS. We also need to make some changes to our test/external_code. First of all, -ldpdk is no more. Meson build generates a pkg-config file with all libs, but we'll switch to it in a separate patch - for now just specify all -lrte_ libs one by one. -Wl,--no-as-needed has to be added to some test cases, otherwise rte_mempool_ring isn't loaded. We don't use any APIs from this library, it only has a static constructor that provides a few callbacks used by rte_mempool_create(). Also, since DPDK now builds both static and shared libraries, we need to add -Wl,-Bstatic to force using static libswhere required. It's only needed for DPDK libs, but we use it for SPDK libs as well since there's no harm. As for performance: $ ./configure --enable-debug --with-crypto --with-reduce $ time make -j40 -C dpdkbuild all with meson: real 0m8.287s user 1m7.983s sys 0m10.548s before, with the old DPDK makefiles: real 0m20.232s user 0m55.921s sys 0m16.491s The subsequent builds are much faster too: $ time make -j40 -C dpdkbuild all meson: real 0m0.876s user 0m0.663s sys 0m0.217s makefiles: real 0m10.150s user 0m11.740s sys 0m6.772s [1] http://inbox.dpdk.org/dev/1a07d1cd59d84dce84e56c10fdabf5e5504560a6.camel@debian.org/ Change-Id: Ic65db563014100bafb12e61ee0530cc2ae64401d Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com> Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com> Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1440 Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
2020-03-23 16:55:08 +00:00
DPDK_OPTS = -Denable_docs=false
DPDK_OPTS += -Dtests=false
DPDK_CFLAGS =
dpdkbuild: build dpdk with meson+ninja Makefile support in DPDK was deprecated and will be removed soon, so switch to the officially supported way of building DPDK - with meson and ninja. Two new tools. Basically, our Makefiles will invoke meson+ninja for DPDK, no other SPDK components are affected. Apparently DPDK wanted to move away from an octopus-like config system and the ideology behind meson configuration is simple now: build everything by default. Some PMDs can be explicitly disabled with meson command line, but all libraries (both static and shared versions) and test apps are built unconditionally. How long does it take to build minimal DPDK with meson? Too much. On my machine half of the total build time is spent on libraries we don't need at all. (I have some hacks up my sleeve to disable building those libraries - see the subsequent patch.) As for the official way of building a minimal DPDK, there was a patch [1] on dpdk mailing list to introduce more specific configuration, but it was rejected: > We talked about this a few times in the past, and it was actually one > of the design goals to _avoid_ replicating the octopus-like config > system of the makefiles. That's because it makes the test matrix > insanely complicated, not to mention the harm to user friendliness, > among other things. > > If someone doesn't want to use a PMD, they can just avoid installing it > - it's simple enough. > > Sorry, but from me it's a very strong NACK. Let's not follow that direction, hack the DPDK build system instead. As for advantages of meson+ninja over Makefiles? I can't find any. It's another build system that does a lot for you with some functions, magic options, and a built-in dependency system. It seems nice if you know the syntax, but it's another component that you need to learn, debug, and possibly find bugs in (there's a lot of github issues open for meson). I would compare it to CMake. As for changes in this patch: rather that explicitly disabling PMDs we don't need, specify a list of PMDs we do need and disable everything else found in ./dpdk/drivers/*. This way we won't have to disable the new PMDs as they're added to DPDK. Meson configuration also sets RTE_EAL_PMD_PATH #define to a valid directory with built PMD shared libs. When it's set, DPDK dynamically loads all shared libraries inside. The drivers there depend on DPDK shared libs and fail to load in static SPDK builds, so we disable them altogether by unsetting RTE_EAL_PMD_PATH in the meson-generated config file - just like DPDK Makefiles did. EAL checks for RTE_EAL_PMD_PATH being empty and skips loading any external PMDs then. We do it for both static and shared libs. We specify all PMDs at build time for now, so there's just no need to load them dynamically. We have three more hacks in our submodule: * disable building dpdk apps by commenting-out a line in dpdk/meson.build * disable building unnecessary libs (build everything that spdk *may* need) * build isa-l compress pmd with `-L[...] -lisal`. DPDK expects to find libisal with pkg-config. We don't want to prepare a pkg-config file, so comment-out a failing check in another meson.build file and provide isa-l through CFLAGS and LDFLAGS. We also need to make some changes to our test/external_code. First of all, -ldpdk is no more. Meson build generates a pkg-config file with all libs, but we'll switch to it in a separate patch - for now just specify all -lrte_ libs one by one. -Wl,--no-as-needed has to be added to some test cases, otherwise rte_mempool_ring isn't loaded. We don't use any APIs from this library, it only has a static constructor that provides a few callbacks used by rte_mempool_create(). Also, since DPDK now builds both static and shared libraries, we need to add -Wl,-Bstatic to force using static libswhere required. It's only needed for DPDK libs, but we use it for SPDK libs as well since there's no harm. As for performance: $ ./configure --enable-debug --with-crypto --with-reduce $ time make -j40 -C dpdkbuild all with meson: real 0m8.287s user 1m7.983s sys 0m10.548s before, with the old DPDK makefiles: real 0m20.232s user 0m55.921s sys 0m16.491s The subsequent builds are much faster too: $ time make -j40 -C dpdkbuild all meson: real 0m0.876s user 0m0.663s sys 0m0.217s makefiles: real 0m10.150s user 0m11.740s sys 0m6.772s [1] http://inbox.dpdk.org/dev/1a07d1cd59d84dce84e56c10fdabf5e5504560a6.camel@debian.org/ Change-Id: Ic65db563014100bafb12e61ee0530cc2ae64401d Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com> Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com> Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1440 Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
2020-03-23 16:55:08 +00:00
DPDK_KMODS = false
ifeq ($(OS),FreeBSD)
DPDK_KMODS = true
endif
dpdkbuild: build dpdk with meson+ninja Makefile support in DPDK was deprecated and will be removed soon, so switch to the officially supported way of building DPDK - with meson and ninja. Two new tools. Basically, our Makefiles will invoke meson+ninja for DPDK, no other SPDK components are affected. Apparently DPDK wanted to move away from an octopus-like config system and the ideology behind meson configuration is simple now: build everything by default. Some PMDs can be explicitly disabled with meson command line, but all libraries (both static and shared versions) and test apps are built unconditionally. How long does it take to build minimal DPDK with meson? Too much. On my machine half of the total build time is spent on libraries we don't need at all. (I have some hacks up my sleeve to disable building those libraries - see the subsequent patch.) As for the official way of building a minimal DPDK, there was a patch [1] on dpdk mailing list to introduce more specific configuration, but it was rejected: > We talked about this a few times in the past, and it was actually one > of the design goals to _avoid_ replicating the octopus-like config > system of the makefiles. That's because it makes the test matrix > insanely complicated, not to mention the harm to user friendliness, > among other things. > > If someone doesn't want to use a PMD, they can just avoid installing it > - it's simple enough. > > Sorry, but from me it's a very strong NACK. Let's not follow that direction, hack the DPDK build system instead. As for advantages of meson+ninja over Makefiles? I can't find any. It's another build system that does a lot for you with some functions, magic options, and a built-in dependency system. It seems nice if you know the syntax, but it's another component that you need to learn, debug, and possibly find bugs in (there's a lot of github issues open for meson). I would compare it to CMake. As for changes in this patch: rather that explicitly disabling PMDs we don't need, specify a list of PMDs we do need and disable everything else found in ./dpdk/drivers/*. This way we won't have to disable the new PMDs as they're added to DPDK. Meson configuration also sets RTE_EAL_PMD_PATH #define to a valid directory with built PMD shared libs. When it's set, DPDK dynamically loads all shared libraries inside. The drivers there depend on DPDK shared libs and fail to load in static SPDK builds, so we disable them altogether by unsetting RTE_EAL_PMD_PATH in the meson-generated config file - just like DPDK Makefiles did. EAL checks for RTE_EAL_PMD_PATH being empty and skips loading any external PMDs then. We do it for both static and shared libs. We specify all PMDs at build time for now, so there's just no need to load them dynamically. We have three more hacks in our submodule: * disable building dpdk apps by commenting-out a line in dpdk/meson.build * disable building unnecessary libs (build everything that spdk *may* need) * build isa-l compress pmd with `-L[...] -lisal`. DPDK expects to find libisal with pkg-config. We don't want to prepare a pkg-config file, so comment-out a failing check in another meson.build file and provide isa-l through CFLAGS and LDFLAGS. We also need to make some changes to our test/external_code. First of all, -ldpdk is no more. Meson build generates a pkg-config file with all libs, but we'll switch to it in a separate patch - for now just specify all -lrte_ libs one by one. -Wl,--no-as-needed has to be added to some test cases, otherwise rte_mempool_ring isn't loaded. We don't use any APIs from this library, it only has a static constructor that provides a few callbacks used by rte_mempool_create(). Also, since DPDK now builds both static and shared libraries, we need to add -Wl,-Bstatic to force using static libswhere required. It's only needed for DPDK libs, but we use it for SPDK libs as well since there's no harm. As for performance: $ ./configure --enable-debug --with-crypto --with-reduce $ time make -j40 -C dpdkbuild all with meson: real 0m8.287s user 1m7.983s sys 0m10.548s before, with the old DPDK makefiles: real 0m20.232s user 0m55.921s sys 0m16.491s The subsequent builds are much faster too: $ time make -j40 -C dpdkbuild all meson: real 0m0.876s user 0m0.663s sys 0m0.217s makefiles: real 0m10.150s user 0m11.740s sys 0m6.772s [1] http://inbox.dpdk.org/dev/1a07d1cd59d84dce84e56c10fdabf5e5504560a6.camel@debian.org/ Change-Id: Ic65db563014100bafb12e61ee0530cc2ae64401d Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com> Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com> Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1440 Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
2020-03-23 16:55:08 +00:00
DPDK_OPTS += -Denable_kmods=$(DPDK_KMODS)
ifeq ($(CONFIG_DEBUG),y)
DPDK_OPTS += --buildtype=debug
endif
dpdkbuild: build dpdk with meson+ninja Makefile support in DPDK was deprecated and will be removed soon, so switch to the officially supported way of building DPDK - with meson and ninja. Two new tools. Basically, our Makefiles will invoke meson+ninja for DPDK, no other SPDK components are affected. Apparently DPDK wanted to move away from an octopus-like config system and the ideology behind meson configuration is simple now: build everything by default. Some PMDs can be explicitly disabled with meson command line, but all libraries (both static and shared versions) and test apps are built unconditionally. How long does it take to build minimal DPDK with meson? Too much. On my machine half of the total build time is spent on libraries we don't need at all. (I have some hacks up my sleeve to disable building those libraries - see the subsequent patch.) As for the official way of building a minimal DPDK, there was a patch [1] on dpdk mailing list to introduce more specific configuration, but it was rejected: > We talked about this a few times in the past, and it was actually one > of the design goals to _avoid_ replicating the octopus-like config > system of the makefiles. That's because it makes the test matrix > insanely complicated, not to mention the harm to user friendliness, > among other things. > > If someone doesn't want to use a PMD, they can just avoid installing it > - it's simple enough. > > Sorry, but from me it's a very strong NACK. Let's not follow that direction, hack the DPDK build system instead. As for advantages of meson+ninja over Makefiles? I can't find any. It's another build system that does a lot for you with some functions, magic options, and a built-in dependency system. It seems nice if you know the syntax, but it's another component that you need to learn, debug, and possibly find bugs in (there's a lot of github issues open for meson). I would compare it to CMake. As for changes in this patch: rather that explicitly disabling PMDs we don't need, specify a list of PMDs we do need and disable everything else found in ./dpdk/drivers/*. This way we won't have to disable the new PMDs as they're added to DPDK. Meson configuration also sets RTE_EAL_PMD_PATH #define to a valid directory with built PMD shared libs. When it's set, DPDK dynamically loads all shared libraries inside. The drivers there depend on DPDK shared libs and fail to load in static SPDK builds, so we disable them altogether by unsetting RTE_EAL_PMD_PATH in the meson-generated config file - just like DPDK Makefiles did. EAL checks for RTE_EAL_PMD_PATH being empty and skips loading any external PMDs then. We do it for both static and shared libs. We specify all PMDs at build time for now, so there's just no need to load them dynamically. We have three more hacks in our submodule: * disable building dpdk apps by commenting-out a line in dpdk/meson.build * disable building unnecessary libs (build everything that spdk *may* need) * build isa-l compress pmd with `-L[...] -lisal`. DPDK expects to find libisal with pkg-config. We don't want to prepare a pkg-config file, so comment-out a failing check in another meson.build file and provide isa-l through CFLAGS and LDFLAGS. We also need to make some changes to our test/external_code. First of all, -ldpdk is no more. Meson build generates a pkg-config file with all libs, but we'll switch to it in a separate patch - for now just specify all -lrte_ libs one by one. -Wl,--no-as-needed has to be added to some test cases, otherwise rte_mempool_ring isn't loaded. We don't use any APIs from this library, it only has a static constructor that provides a few callbacks used by rte_mempool_create(). Also, since DPDK now builds both static and shared libraries, we need to add -Wl,-Bstatic to force using static libswhere required. It's only needed for DPDK libs, but we use it for SPDK libs as well since there's no harm. As for performance: $ ./configure --enable-debug --with-crypto --with-reduce $ time make -j40 -C dpdkbuild all with meson: real 0m8.287s user 1m7.983s sys 0m10.548s before, with the old DPDK makefiles: real 0m20.232s user 0m55.921s sys 0m16.491s The subsequent builds are much faster too: $ time make -j40 -C dpdkbuild all meson: real 0m0.876s user 0m0.663s sys 0m0.217s makefiles: real 0m10.150s user 0m11.740s sys 0m6.772s [1] http://inbox.dpdk.org/dev/1a07d1cd59d84dce84e56c10fdabf5e5504560a6.camel@debian.org/ Change-Id: Ic65db563014100bafb12e61ee0530cc2ae64401d Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com> Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com> Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1440 Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
2020-03-23 16:55:08 +00:00
# the drivers we use
DPDK_DRIVERS = bus bus/pci bus/vdev mempool/ring
# Core DPDK libs
DPDK_LIBS = eal ring mempool pci
DPDK_LIBS += kvargs telemetry
# Governor required libs
DPDK_LIBS += power timer ethdev net
# common crypto/reduce drivers
ifeq ($(findstring y,$(CONFIG_CRYPTO)$(CONFIG_REDUCE)),y)
DPDK_DRIVERS += crypto/qat compress/qat common/qat
endif
ifeq ($(CONFIG_CRYPTO),y)
DPDK_DRIVERS += crypto crypto/ipsec_mb
# aesni_mb is name of the PMD in DPDK 21.08 and earlier
DPDK_DRIVERS += crypto/aesni_mb
DPDK_CFLAGS += -I$(IPSEC_MB_DIR)
DPDK_LDFLAGS += -L$(IPSEC_MB_DIR)
endif
ifeq ($(CONFIG_REDUCE),y)
DPDK_DRIVERS += compress compress/isal
ifeq ($(CONFIG_REDUCE_MLX5),y)
DPDK_DRIVERS += common/mlx5 compress/mlx5 bus/auxiliary
endif
DPDK_CFLAGS += -I$(ISAL_DIR)
dpdkbuild: build dpdk with meson+ninja Makefile support in DPDK was deprecated and will be removed soon, so switch to the officially supported way of building DPDK - with meson and ninja. Two new tools. Basically, our Makefiles will invoke meson+ninja for DPDK, no other SPDK components are affected. Apparently DPDK wanted to move away from an octopus-like config system and the ideology behind meson configuration is simple now: build everything by default. Some PMDs can be explicitly disabled with meson command line, but all libraries (both static and shared versions) and test apps are built unconditionally. How long does it take to build minimal DPDK with meson? Too much. On my machine half of the total build time is spent on libraries we don't need at all. (I have some hacks up my sleeve to disable building those libraries - see the subsequent patch.) As for the official way of building a minimal DPDK, there was a patch [1] on dpdk mailing list to introduce more specific configuration, but it was rejected: > We talked about this a few times in the past, and it was actually one > of the design goals to _avoid_ replicating the octopus-like config > system of the makefiles. That's because it makes the test matrix > insanely complicated, not to mention the harm to user friendliness, > among other things. > > If someone doesn't want to use a PMD, they can just avoid installing it > - it's simple enough. > > Sorry, but from me it's a very strong NACK. Let's not follow that direction, hack the DPDK build system instead. As for advantages of meson+ninja over Makefiles? I can't find any. It's another build system that does a lot for you with some functions, magic options, and a built-in dependency system. It seems nice if you know the syntax, but it's another component that you need to learn, debug, and possibly find bugs in (there's a lot of github issues open for meson). I would compare it to CMake. As for changes in this patch: rather that explicitly disabling PMDs we don't need, specify a list of PMDs we do need and disable everything else found in ./dpdk/drivers/*. This way we won't have to disable the new PMDs as they're added to DPDK. Meson configuration also sets RTE_EAL_PMD_PATH #define to a valid directory with built PMD shared libs. When it's set, DPDK dynamically loads all shared libraries inside. The drivers there depend on DPDK shared libs and fail to load in static SPDK builds, so we disable them altogether by unsetting RTE_EAL_PMD_PATH in the meson-generated config file - just like DPDK Makefiles did. EAL checks for RTE_EAL_PMD_PATH being empty and skips loading any external PMDs then. We do it for both static and shared libs. We specify all PMDs at build time for now, so there's just no need to load them dynamically. We have three more hacks in our submodule: * disable building dpdk apps by commenting-out a line in dpdk/meson.build * disable building unnecessary libs (build everything that spdk *may* need) * build isa-l compress pmd with `-L[...] -lisal`. DPDK expects to find libisal with pkg-config. We don't want to prepare a pkg-config file, so comment-out a failing check in another meson.build file and provide isa-l through CFLAGS and LDFLAGS. We also need to make some changes to our test/external_code. First of all, -ldpdk is no more. Meson build generates a pkg-config file with all libs, but we'll switch to it in a separate patch - for now just specify all -lrte_ libs one by one. -Wl,--no-as-needed has to be added to some test cases, otherwise rte_mempool_ring isn't loaded. We don't use any APIs from this library, it only has a static constructor that provides a few callbacks used by rte_mempool_create(). Also, since DPDK now builds both static and shared libraries, we need to add -Wl,-Bstatic to force using static libswhere required. It's only needed for DPDK libs, but we use it for SPDK libs as well since there's no harm. As for performance: $ ./configure --enable-debug --with-crypto --with-reduce $ time make -j40 -C dpdkbuild all with meson: real 0m8.287s user 1m7.983s sys 0m10.548s before, with the old DPDK makefiles: real 0m20.232s user 0m55.921s sys 0m16.491s The subsequent builds are much faster too: $ time make -j40 -C dpdkbuild all meson: real 0m0.876s user 0m0.663s sys 0m0.217s makefiles: real 0m10.150s user 0m11.740s sys 0m6.772s [1] http://inbox.dpdk.org/dev/1a07d1cd59d84dce84e56c10fdabf5e5504560a6.camel@debian.org/ Change-Id: Ic65db563014100bafb12e61ee0530cc2ae64401d Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com> Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com> Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1440 Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
2020-03-23 16:55:08 +00:00
DPDK_LDFLAGS += -L$(ISAL_DIR)/.libs -lisal
endif
# crypto & compress deps
DPDK_LIBS += reorder cryptodev
DPDK_LIBS += compressdev
DPDK_LIBS += security
# vhost and deps
DPDK_LIBS += cryptodev mbuf cmdline meter hash vhost
# raid5 deps
DPDK_LIBS += hash rcu
dpdkbuild: build dpdk with meson+ninja Makefile support in DPDK was deprecated and will be removed soon, so switch to the officially supported way of building DPDK - with meson and ninja. Two new tools. Basically, our Makefiles will invoke meson+ninja for DPDK, no other SPDK components are affected. Apparently DPDK wanted to move away from an octopus-like config system and the ideology behind meson configuration is simple now: build everything by default. Some PMDs can be explicitly disabled with meson command line, but all libraries (both static and shared versions) and test apps are built unconditionally. How long does it take to build minimal DPDK with meson? Too much. On my machine half of the total build time is spent on libraries we don't need at all. (I have some hacks up my sleeve to disable building those libraries - see the subsequent patch.) As for the official way of building a minimal DPDK, there was a patch [1] on dpdk mailing list to introduce more specific configuration, but it was rejected: > We talked about this a few times in the past, and it was actually one > of the design goals to _avoid_ replicating the octopus-like config > system of the makefiles. That's because it makes the test matrix > insanely complicated, not to mention the harm to user friendliness, > among other things. > > If someone doesn't want to use a PMD, they can just avoid installing it > - it's simple enough. > > Sorry, but from me it's a very strong NACK. Let's not follow that direction, hack the DPDK build system instead. As for advantages of meson+ninja over Makefiles? I can't find any. It's another build system that does a lot for you with some functions, magic options, and a built-in dependency system. It seems nice if you know the syntax, but it's another component that you need to learn, debug, and possibly find bugs in (there's a lot of github issues open for meson). I would compare it to CMake. As for changes in this patch: rather that explicitly disabling PMDs we don't need, specify a list of PMDs we do need and disable everything else found in ./dpdk/drivers/*. This way we won't have to disable the new PMDs as they're added to DPDK. Meson configuration also sets RTE_EAL_PMD_PATH #define to a valid directory with built PMD shared libs. When it's set, DPDK dynamically loads all shared libraries inside. The drivers there depend on DPDK shared libs and fail to load in static SPDK builds, so we disable them altogether by unsetting RTE_EAL_PMD_PATH in the meson-generated config file - just like DPDK Makefiles did. EAL checks for RTE_EAL_PMD_PATH being empty and skips loading any external PMDs then. We do it for both static and shared libs. We specify all PMDs at build time for now, so there's just no need to load them dynamically. We have three more hacks in our submodule: * disable building dpdk apps by commenting-out a line in dpdk/meson.build * disable building unnecessary libs (build everything that spdk *may* need) * build isa-l compress pmd with `-L[...] -lisal`. DPDK expects to find libisal with pkg-config. We don't want to prepare a pkg-config file, so comment-out a failing check in another meson.build file and provide isa-l through CFLAGS and LDFLAGS. We also need to make some changes to our test/external_code. First of all, -ldpdk is no more. Meson build generates a pkg-config file with all libs, but we'll switch to it in a separate patch - for now just specify all -lrte_ libs one by one. -Wl,--no-as-needed has to be added to some test cases, otherwise rte_mempool_ring isn't loaded. We don't use any APIs from this library, it only has a static constructor that provides a few callbacks used by rte_mempool_create(). Also, since DPDK now builds both static and shared libraries, we need to add -Wl,-Bstatic to force using static libswhere required. It's only needed for DPDK libs, but we use it for SPDK libs as well since there's no harm. As for performance: $ ./configure --enable-debug --with-crypto --with-reduce $ time make -j40 -C dpdkbuild all with meson: real 0m8.287s user 1m7.983s sys 0m10.548s before, with the old DPDK makefiles: real 0m20.232s user 0m55.921s sys 0m16.491s The subsequent builds are much faster too: $ time make -j40 -C dpdkbuild all meson: real 0m0.876s user 0m0.663s sys 0m0.217s makefiles: real 0m10.150s user 0m11.740s sys 0m6.772s [1] http://inbox.dpdk.org/dev/1a07d1cd59d84dce84e56c10fdabf5e5504560a6.camel@debian.org/ Change-Id: Ic65db563014100bafb12e61ee0530cc2ae64401d Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com> Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com> Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1440 Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
2020-03-23 16:55:08 +00:00
DPDK_OPTS += -Dmachine=$(TARGET_ARCHITECTURE)
ifneq ($(CONFIG_CROSS_PREFIX),)
ifeq ($(findstring mingw,$(CONFIG_CROSS_PREFIX)),mingw)
DPDK_OPTS += --cross-file $(SPDK_ROOT_DIR)/dpdk/config/x86/cross-mingw
else
dpdkbuild: build dpdk with meson+ninja Makefile support in DPDK was deprecated and will be removed soon, so switch to the officially supported way of building DPDK - with meson and ninja. Two new tools. Basically, our Makefiles will invoke meson+ninja for DPDK, no other SPDK components are affected. Apparently DPDK wanted to move away from an octopus-like config system and the ideology behind meson configuration is simple now: build everything by default. Some PMDs can be explicitly disabled with meson command line, but all libraries (both static and shared versions) and test apps are built unconditionally. How long does it take to build minimal DPDK with meson? Too much. On my machine half of the total build time is spent on libraries we don't need at all. (I have some hacks up my sleeve to disable building those libraries - see the subsequent patch.) As for the official way of building a minimal DPDK, there was a patch [1] on dpdk mailing list to introduce more specific configuration, but it was rejected: > We talked about this a few times in the past, and it was actually one > of the design goals to _avoid_ replicating the octopus-like config > system of the makefiles. That's because it makes the test matrix > insanely complicated, not to mention the harm to user friendliness, > among other things. > > If someone doesn't want to use a PMD, they can just avoid installing it > - it's simple enough. > > Sorry, but from me it's a very strong NACK. Let's not follow that direction, hack the DPDK build system instead. As for advantages of meson+ninja over Makefiles? I can't find any. It's another build system that does a lot for you with some functions, magic options, and a built-in dependency system. It seems nice if you know the syntax, but it's another component that you need to learn, debug, and possibly find bugs in (there's a lot of github issues open for meson). I would compare it to CMake. As for changes in this patch: rather that explicitly disabling PMDs we don't need, specify a list of PMDs we do need and disable everything else found in ./dpdk/drivers/*. This way we won't have to disable the new PMDs as they're added to DPDK. Meson configuration also sets RTE_EAL_PMD_PATH #define to a valid directory with built PMD shared libs. When it's set, DPDK dynamically loads all shared libraries inside. The drivers there depend on DPDK shared libs and fail to load in static SPDK builds, so we disable them altogether by unsetting RTE_EAL_PMD_PATH in the meson-generated config file - just like DPDK Makefiles did. EAL checks for RTE_EAL_PMD_PATH being empty and skips loading any external PMDs then. We do it for both static and shared libs. We specify all PMDs at build time for now, so there's just no need to load them dynamically. We have three more hacks in our submodule: * disable building dpdk apps by commenting-out a line in dpdk/meson.build * disable building unnecessary libs (build everything that spdk *may* need) * build isa-l compress pmd with `-L[...] -lisal`. DPDK expects to find libisal with pkg-config. We don't want to prepare a pkg-config file, so comment-out a failing check in another meson.build file and provide isa-l through CFLAGS and LDFLAGS. We also need to make some changes to our test/external_code. First of all, -ldpdk is no more. Meson build generates a pkg-config file with all libs, but we'll switch to it in a separate patch - for now just specify all -lrte_ libs one by one. -Wl,--no-as-needed has to be added to some test cases, otherwise rte_mempool_ring isn't loaded. We don't use any APIs from this library, it only has a static constructor that provides a few callbacks used by rte_mempool_create(). Also, since DPDK now builds both static and shared libraries, we need to add -Wl,-Bstatic to force using static libswhere required. It's only needed for DPDK libs, but we use it for SPDK libs as well since there's no harm. As for performance: $ ./configure --enable-debug --with-crypto --with-reduce $ time make -j40 -C dpdkbuild all with meson: real 0m8.287s user 1m7.983s sys 0m10.548s before, with the old DPDK makefiles: real 0m20.232s user 0m55.921s sys 0m16.491s The subsequent builds are much faster too: $ time make -j40 -C dpdkbuild all meson: real 0m0.876s user 0m0.663s sys 0m0.217s makefiles: real 0m10.150s user 0m11.740s sys 0m6.772s [1] http://inbox.dpdk.org/dev/1a07d1cd59d84dce84e56c10fdabf5e5504560a6.camel@debian.org/ Change-Id: Ic65db563014100bafb12e61ee0530cc2ae64401d Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com> Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com> Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1440 Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
2020-03-23 16:55:08 +00:00
$(error Automatic DPDK cross build is not supported. Please compile DPDK manually \
with e.g. `meson build --cross-file config/arm/arm64_armv8_linux_gcc`)
endif
endif
DPDK_CFLAGS += -fPIC
ifeq ($(CONFIG_WERROR),y)
DPDK_CFLAGS += -Werror
else
DPDK_CFLAGS += -Wno-error
endif
ifeq ($(CONFIG_CET),y)
DPDK_CFLAGS += -fcf-protection
DPDK_LDFLAGS += -fcf-protection
endif
ifdef EXTRA_DPDK_CFLAGS
$(warning EXTRA_DPDK_CFLAGS defined, possibly to work around an unsupported compiler version)
$(shell sleep 1)
endif
# Allow users to specify EXTRA_DPDK_CFLAGS if they want to build DPDK using unsupported compiler versions
DPDK_CFLAGS += $(EXTRA_DPDK_CFLAGS)
ifeq ($(CC_TYPE),gcc)
GCC_MAJOR = $(shell echo __GNUC__ | $(CC) -E -x c - | tail -n 1)
ifeq ($(shell test $(GCC_MAJOR) -ge 10 && echo 1), 1)
#1. gcc 10 complains on operations with zero size arrays in rte_cryptodev.c, so
#disable this warning
#2. gcc 10 disables fcommon by default and complains on multiple definition of
#aesni_mb_logtype_driver symbol which is defined in header file and presented in several
#translation units
DPDK_CFLAGS += -Wno-stringop-overflow -fcommon
endif
endif
# Force-disable scan-build
SUB_CC = $(patsubst %ccc-analyzer,$(DEFAULT_CC),$(CC))
DPDK_ALL_LIB_DIRS = $(shell find $(SPDK_ROOT_DIR)/dpdk/lib -mindepth 1 -maxdepth 1 -type d)
DPDK_ALL_LIBS = $(DPDK_ALL_LIB_DIRS:$(SPDK_ROOT_DIR)/dpdk/lib/%=%)
DPDK_DISABLED_LIBS = $(filter-out $(DPDK_LIBS),$(DPDK_ALL_LIBS))
ifneq ($(OS),FreeBSD)
dpdkbuild: build dpdk with meson+ninja Makefile support in DPDK was deprecated and will be removed soon, so switch to the officially supported way of building DPDK - with meson and ninja. Two new tools. Basically, our Makefiles will invoke meson+ninja for DPDK, no other SPDK components are affected. Apparently DPDK wanted to move away from an octopus-like config system and the ideology behind meson configuration is simple now: build everything by default. Some PMDs can be explicitly disabled with meson command line, but all libraries (both static and shared versions) and test apps are built unconditionally. How long does it take to build minimal DPDK with meson? Too much. On my machine half of the total build time is spent on libraries we don't need at all. (I have some hacks up my sleeve to disable building those libraries - see the subsequent patch.) As for the official way of building a minimal DPDK, there was a patch [1] on dpdk mailing list to introduce more specific configuration, but it was rejected: > We talked about this a few times in the past, and it was actually one > of the design goals to _avoid_ replicating the octopus-like config > system of the makefiles. That's because it makes the test matrix > insanely complicated, not to mention the harm to user friendliness, > among other things. > > If someone doesn't want to use a PMD, they can just avoid installing it > - it's simple enough. > > Sorry, but from me it's a very strong NACK. Let's not follow that direction, hack the DPDK build system instead. As for advantages of meson+ninja over Makefiles? I can't find any. It's another build system that does a lot for you with some functions, magic options, and a built-in dependency system. It seems nice if you know the syntax, but it's another component that you need to learn, debug, and possibly find bugs in (there's a lot of github issues open for meson). I would compare it to CMake. As for changes in this patch: rather that explicitly disabling PMDs we don't need, specify a list of PMDs we do need and disable everything else found in ./dpdk/drivers/*. This way we won't have to disable the new PMDs as they're added to DPDK. Meson configuration also sets RTE_EAL_PMD_PATH #define to a valid directory with built PMD shared libs. When it's set, DPDK dynamically loads all shared libraries inside. The drivers there depend on DPDK shared libs and fail to load in static SPDK builds, so we disable them altogether by unsetting RTE_EAL_PMD_PATH in the meson-generated config file - just like DPDK Makefiles did. EAL checks for RTE_EAL_PMD_PATH being empty and skips loading any external PMDs then. We do it for both static and shared libs. We specify all PMDs at build time for now, so there's just no need to load them dynamically. We have three more hacks in our submodule: * disable building dpdk apps by commenting-out a line in dpdk/meson.build * disable building unnecessary libs (build everything that spdk *may* need) * build isa-l compress pmd with `-L[...] -lisal`. DPDK expects to find libisal with pkg-config. We don't want to prepare a pkg-config file, so comment-out a failing check in another meson.build file and provide isa-l through CFLAGS and LDFLAGS. We also need to make some changes to our test/external_code. First of all, -ldpdk is no more. Meson build generates a pkg-config file with all libs, but we'll switch to it in a separate patch - for now just specify all -lrte_ libs one by one. -Wl,--no-as-needed has to be added to some test cases, otherwise rte_mempool_ring isn't loaded. We don't use any APIs from this library, it only has a static constructor that provides a few callbacks used by rte_mempool_create(). Also, since DPDK now builds both static and shared libraries, we need to add -Wl,-Bstatic to force using static libswhere required. It's only needed for DPDK libs, but we use it for SPDK libs as well since there's no harm. As for performance: $ ./configure --enable-debug --with-crypto --with-reduce $ time make -j40 -C dpdkbuild all with meson: real 0m8.287s user 1m7.983s sys 0m10.548s before, with the old DPDK makefiles: real 0m20.232s user 0m55.921s sys 0m16.491s The subsequent builds are much faster too: $ time make -j40 -C dpdkbuild all meson: real 0m0.876s user 0m0.663s sys 0m0.217s makefiles: real 0m10.150s user 0m11.740s sys 0m6.772s [1] http://inbox.dpdk.org/dev/1a07d1cd59d84dce84e56c10fdabf5e5504560a6.camel@debian.org/ Change-Id: Ic65db563014100bafb12e61ee0530cc2ae64401d Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com> Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com> Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1440 Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
2020-03-23 16:55:08 +00:00
SED_INPLACE_FLAG = "-i"
MESON_PREFIX = $(SPDK_ROOT_DIR)/dpdk/build
else
SED_INPLACE_FLAG = "-i ''"
MESON_PREFIX = "/"
endif
# Some ninja versions come with a (broken?) jobserver which defaults to use
# only 1 thread for the build. We workaround this by specifying -j to ninja
# with the same value as top-makefile. This is OK as long as DPDK is not built
# in parallel with anything else, which is the case for now.
dpdkbuild: build dpdk with meson+ninja Makefile support in DPDK was deprecated and will be removed soon, so switch to the officially supported way of building DPDK - with meson and ninja. Two new tools. Basically, our Makefiles will invoke meson+ninja for DPDK, no other SPDK components are affected. Apparently DPDK wanted to move away from an octopus-like config system and the ideology behind meson configuration is simple now: build everything by default. Some PMDs can be explicitly disabled with meson command line, but all libraries (both static and shared versions) and test apps are built unconditionally. How long does it take to build minimal DPDK with meson? Too much. On my machine half of the total build time is spent on libraries we don't need at all. (I have some hacks up my sleeve to disable building those libraries - see the subsequent patch.) As for the official way of building a minimal DPDK, there was a patch [1] on dpdk mailing list to introduce more specific configuration, but it was rejected: > We talked about this a few times in the past, and it was actually one > of the design goals to _avoid_ replicating the octopus-like config > system of the makefiles. That's because it makes the test matrix > insanely complicated, not to mention the harm to user friendliness, > among other things. > > If someone doesn't want to use a PMD, they can just avoid installing it > - it's simple enough. > > Sorry, but from me it's a very strong NACK. Let's not follow that direction, hack the DPDK build system instead. As for advantages of meson+ninja over Makefiles? I can't find any. It's another build system that does a lot for you with some functions, magic options, and a built-in dependency system. It seems nice if you know the syntax, but it's another component that you need to learn, debug, and possibly find bugs in (there's a lot of github issues open for meson). I would compare it to CMake. As for changes in this patch: rather that explicitly disabling PMDs we don't need, specify a list of PMDs we do need and disable everything else found in ./dpdk/drivers/*. This way we won't have to disable the new PMDs as they're added to DPDK. Meson configuration also sets RTE_EAL_PMD_PATH #define to a valid directory with built PMD shared libs. When it's set, DPDK dynamically loads all shared libraries inside. The drivers there depend on DPDK shared libs and fail to load in static SPDK builds, so we disable them altogether by unsetting RTE_EAL_PMD_PATH in the meson-generated config file - just like DPDK Makefiles did. EAL checks for RTE_EAL_PMD_PATH being empty and skips loading any external PMDs then. We do it for both static and shared libs. We specify all PMDs at build time for now, so there's just no need to load them dynamically. We have three more hacks in our submodule: * disable building dpdk apps by commenting-out a line in dpdk/meson.build * disable building unnecessary libs (build everything that spdk *may* need) * build isa-l compress pmd with `-L[...] -lisal`. DPDK expects to find libisal with pkg-config. We don't want to prepare a pkg-config file, so comment-out a failing check in another meson.build file and provide isa-l through CFLAGS and LDFLAGS. We also need to make some changes to our test/external_code. First of all, -ldpdk is no more. Meson build generates a pkg-config file with all libs, but we'll switch to it in a separate patch - for now just specify all -lrte_ libs one by one. -Wl,--no-as-needed has to be added to some test cases, otherwise rte_mempool_ring isn't loaded. We don't use any APIs from this library, it only has a static constructor that provides a few callbacks used by rte_mempool_create(). Also, since DPDK now builds both static and shared libraries, we need to add -Wl,-Bstatic to force using static libswhere required. It's only needed for DPDK libs, but we use it for SPDK libs as well since there's no harm. As for performance: $ ./configure --enable-debug --with-crypto --with-reduce $ time make -j40 -C dpdkbuild all with meson: real 0m8.287s user 1m7.983s sys 0m10.548s before, with the old DPDK makefiles: real 0m20.232s user 0m55.921s sys 0m16.491s The subsequent builds are much faster too: $ time make -j40 -C dpdkbuild all meson: real 0m0.876s user 0m0.663s sys 0m0.217s makefiles: real 0m10.150s user 0m11.740s sys 0m6.772s [1] http://inbox.dpdk.org/dev/1a07d1cd59d84dce84e56c10fdabf5e5504560a6.camel@debian.org/ Change-Id: Ic65db563014100bafb12e61ee0530cc2ae64401d Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com> Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com> Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1440 Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
2020-03-23 16:55:08 +00:00
ifeq ($(MAKE_PID),)
MAKE_PID := $(shell echo $$PPID)
endif
MAKE_NUMJOBS := $(shell ps T | sed -nE 's/[[:space:]]*$(MAKE_PID)[[:space:]].* (-j|--jobs=)( *[0-9]+).*/\1\2/p')
dpdkbuild: build dpdk with meson+ninja Makefile support in DPDK was deprecated and will be removed soon, so switch to the officially supported way of building DPDK - with meson and ninja. Two new tools. Basically, our Makefiles will invoke meson+ninja for DPDK, no other SPDK components are affected. Apparently DPDK wanted to move away from an octopus-like config system and the ideology behind meson configuration is simple now: build everything by default. Some PMDs can be explicitly disabled with meson command line, but all libraries (both static and shared versions) and test apps are built unconditionally. How long does it take to build minimal DPDK with meson? Too much. On my machine half of the total build time is spent on libraries we don't need at all. (I have some hacks up my sleeve to disable building those libraries - see the subsequent patch.) As for the official way of building a minimal DPDK, there was a patch [1] on dpdk mailing list to introduce more specific configuration, but it was rejected: > We talked about this a few times in the past, and it was actually one > of the design goals to _avoid_ replicating the octopus-like config > system of the makefiles. That's because it makes the test matrix > insanely complicated, not to mention the harm to user friendliness, > among other things. > > If someone doesn't want to use a PMD, they can just avoid installing it > - it's simple enough. > > Sorry, but from me it's a very strong NACK. Let's not follow that direction, hack the DPDK build system instead. As for advantages of meson+ninja over Makefiles? I can't find any. It's another build system that does a lot for you with some functions, magic options, and a built-in dependency system. It seems nice if you know the syntax, but it's another component that you need to learn, debug, and possibly find bugs in (there's a lot of github issues open for meson). I would compare it to CMake. As for changes in this patch: rather that explicitly disabling PMDs we don't need, specify a list of PMDs we do need and disable everything else found in ./dpdk/drivers/*. This way we won't have to disable the new PMDs as they're added to DPDK. Meson configuration also sets RTE_EAL_PMD_PATH #define to a valid directory with built PMD shared libs. When it's set, DPDK dynamically loads all shared libraries inside. The drivers there depend on DPDK shared libs and fail to load in static SPDK builds, so we disable them altogether by unsetting RTE_EAL_PMD_PATH in the meson-generated config file - just like DPDK Makefiles did. EAL checks for RTE_EAL_PMD_PATH being empty and skips loading any external PMDs then. We do it for both static and shared libs. We specify all PMDs at build time for now, so there's just no need to load them dynamically. We have three more hacks in our submodule: * disable building dpdk apps by commenting-out a line in dpdk/meson.build * disable building unnecessary libs (build everything that spdk *may* need) * build isa-l compress pmd with `-L[...] -lisal`. DPDK expects to find libisal with pkg-config. We don't want to prepare a pkg-config file, so comment-out a failing check in another meson.build file and provide isa-l through CFLAGS and LDFLAGS. We also need to make some changes to our test/external_code. First of all, -ldpdk is no more. Meson build generates a pkg-config file with all libs, but we'll switch to it in a separate patch - for now just specify all -lrte_ libs one by one. -Wl,--no-as-needed has to be added to some test cases, otherwise rte_mempool_ring isn't loaded. We don't use any APIs from this library, it only has a static constructor that provides a few callbacks used by rte_mempool_create(). Also, since DPDK now builds both static and shared libraries, we need to add -Wl,-Bstatic to force using static libswhere required. It's only needed for DPDK libs, but we use it for SPDK libs as well since there's no harm. As for performance: $ ./configure --enable-debug --with-crypto --with-reduce $ time make -j40 -C dpdkbuild all with meson: real 0m8.287s user 1m7.983s sys 0m10.548s before, with the old DPDK makefiles: real 0m20.232s user 0m55.921s sys 0m16.491s The subsequent builds are much faster too: $ time make -j40 -C dpdkbuild all meson: real 0m0.876s user 0m0.663s sys 0m0.217s makefiles: real 0m10.150s user 0m11.740s sys 0m6.772s [1] http://inbox.dpdk.org/dev/1a07d1cd59d84dce84e56c10fdabf5e5504560a6.camel@debian.org/ Change-Id: Ic65db563014100bafb12e61ee0530cc2ae64401d Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com> Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com> Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1440 Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
2020-03-23 16:55:08 +00:00
all: $(SPDK_ROOT_DIR)/dpdk/build-tmp
$(Q)# DPDK doesn't handle nested make calls, so unset MAKEFLAGS
$(Q)env -u MAKEFLAGS ninja -C $(SPDK_ROOT_DIR)/dpdk/build-tmp $(MAKE_NUMJOBS)
$(Q) \
# Meson on FreeBSD sometimes appends --prefix value to the default DESTDIR (which is e.g. \
# /usr/local) instead of replacing it. --prefix needs to be an absolute path, so we set \
# it to / and then set DESTDIR directly, so libs and headers are copied to "DESTDIR//". \
# DPDK kernel modules are set to install in $DESTDIR/boot/modules, but we move them \
# to DESTDIR/kmod to be consistent with the makefile build. \
# \
# Also use meson install --only-changed instead of ninja install so that the shared \
# libraries don't get reinstalled when they haven't been rebuilt - this avoids all of \
# our applications getting relinked even when nothing has changed.
dpdkbuild: build dpdk with meson+ninja Makefile support in DPDK was deprecated and will be removed soon, so switch to the officially supported way of building DPDK - with meson and ninja. Two new tools. Basically, our Makefiles will invoke meson+ninja for DPDK, no other SPDK components are affected. Apparently DPDK wanted to move away from an octopus-like config system and the ideology behind meson configuration is simple now: build everything by default. Some PMDs can be explicitly disabled with meson command line, but all libraries (both static and shared versions) and test apps are built unconditionally. How long does it take to build minimal DPDK with meson? Too much. On my machine half of the total build time is spent on libraries we don't need at all. (I have some hacks up my sleeve to disable building those libraries - see the subsequent patch.) As for the official way of building a minimal DPDK, there was a patch [1] on dpdk mailing list to introduce more specific configuration, but it was rejected: > We talked about this a few times in the past, and it was actually one > of the design goals to _avoid_ replicating the octopus-like config > system of the makefiles. That's because it makes the test matrix > insanely complicated, not to mention the harm to user friendliness, > among other things. > > If someone doesn't want to use a PMD, they can just avoid installing it > - it's simple enough. > > Sorry, but from me it's a very strong NACK. Let's not follow that direction, hack the DPDK build system instead. As for advantages of meson+ninja over Makefiles? I can't find any. It's another build system that does a lot for you with some functions, magic options, and a built-in dependency system. It seems nice if you know the syntax, but it's another component that you need to learn, debug, and possibly find bugs in (there's a lot of github issues open for meson). I would compare it to CMake. As for changes in this patch: rather that explicitly disabling PMDs we don't need, specify a list of PMDs we do need and disable everything else found in ./dpdk/drivers/*. This way we won't have to disable the new PMDs as they're added to DPDK. Meson configuration also sets RTE_EAL_PMD_PATH #define to a valid directory with built PMD shared libs. When it's set, DPDK dynamically loads all shared libraries inside. The drivers there depend on DPDK shared libs and fail to load in static SPDK builds, so we disable them altogether by unsetting RTE_EAL_PMD_PATH in the meson-generated config file - just like DPDK Makefiles did. EAL checks for RTE_EAL_PMD_PATH being empty and skips loading any external PMDs then. We do it for both static and shared libs. We specify all PMDs at build time for now, so there's just no need to load them dynamically. We have three more hacks in our submodule: * disable building dpdk apps by commenting-out a line in dpdk/meson.build * disable building unnecessary libs (build everything that spdk *may* need) * build isa-l compress pmd with `-L[...] -lisal`. DPDK expects to find libisal with pkg-config. We don't want to prepare a pkg-config file, so comment-out a failing check in another meson.build file and provide isa-l through CFLAGS and LDFLAGS. We also need to make some changes to our test/external_code. First of all, -ldpdk is no more. Meson build generates a pkg-config file with all libs, but we'll switch to it in a separate patch - for now just specify all -lrte_ libs one by one. -Wl,--no-as-needed has to be added to some test cases, otherwise rte_mempool_ring isn't loaded. We don't use any APIs from this library, it only has a static constructor that provides a few callbacks used by rte_mempool_create(). Also, since DPDK now builds both static and shared libraries, we need to add -Wl,-Bstatic to force using static libswhere required. It's only needed for DPDK libs, but we use it for SPDK libs as well since there's no harm. As for performance: $ ./configure --enable-debug --with-crypto --with-reduce $ time make -j40 -C dpdkbuild all with meson: real 0m8.287s user 1m7.983s sys 0m10.548s before, with the old DPDK makefiles: real 0m20.232s user 0m55.921s sys 0m16.491s The subsequent builds are much faster too: $ time make -j40 -C dpdkbuild all meson: real 0m0.876s user 0m0.663s sys 0m0.217s makefiles: real 0m10.150s user 0m11.740s sys 0m6.772s [1] http://inbox.dpdk.org/dev/1a07d1cd59d84dce84e56c10fdabf5e5504560a6.camel@debian.org/ Change-Id: Ic65db563014100bafb12e61ee0530cc2ae64401d Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com> Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com> Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1440 Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
2020-03-23 16:55:08 +00:00
$(Q)if [ "$(OS)" = "FreeBSD" ]; then \
env -u MAKEFLAGS DESTDIR=$(SPDK_ROOT_DIR)/dpdk/build ninja -C $(SPDK_ROOT_DIR)/dpdk/build-tmp $(MAKE_NUMJOBS) install > /dev/null && \
mv $(SPDK_ROOT_DIR)/dpdk/build/boot/modules $(SPDK_ROOT_DIR)/dpdk/build/kmod; \
else \
env -u MAKEFLAGS meson install -C $(SPDK_ROOT_DIR)/dpdk/build-tmp --only-changed > /dev/null; \
dpdkbuild: build dpdk with meson+ninja Makefile support in DPDK was deprecated and will be removed soon, so switch to the officially supported way of building DPDK - with meson and ninja. Two new tools. Basically, our Makefiles will invoke meson+ninja for DPDK, no other SPDK components are affected. Apparently DPDK wanted to move away from an octopus-like config system and the ideology behind meson configuration is simple now: build everything by default. Some PMDs can be explicitly disabled with meson command line, but all libraries (both static and shared versions) and test apps are built unconditionally. How long does it take to build minimal DPDK with meson? Too much. On my machine half of the total build time is spent on libraries we don't need at all. (I have some hacks up my sleeve to disable building those libraries - see the subsequent patch.) As for the official way of building a minimal DPDK, there was a patch [1] on dpdk mailing list to introduce more specific configuration, but it was rejected: > We talked about this a few times in the past, and it was actually one > of the design goals to _avoid_ replicating the octopus-like config > system of the makefiles. That's because it makes the test matrix > insanely complicated, not to mention the harm to user friendliness, > among other things. > > If someone doesn't want to use a PMD, they can just avoid installing it > - it's simple enough. > > Sorry, but from me it's a very strong NACK. Let's not follow that direction, hack the DPDK build system instead. As for advantages of meson+ninja over Makefiles? I can't find any. It's another build system that does a lot for you with some functions, magic options, and a built-in dependency system. It seems nice if you know the syntax, but it's another component that you need to learn, debug, and possibly find bugs in (there's a lot of github issues open for meson). I would compare it to CMake. As for changes in this patch: rather that explicitly disabling PMDs we don't need, specify a list of PMDs we do need and disable everything else found in ./dpdk/drivers/*. This way we won't have to disable the new PMDs as they're added to DPDK. Meson configuration also sets RTE_EAL_PMD_PATH #define to a valid directory with built PMD shared libs. When it's set, DPDK dynamically loads all shared libraries inside. The drivers there depend on DPDK shared libs and fail to load in static SPDK builds, so we disable them altogether by unsetting RTE_EAL_PMD_PATH in the meson-generated config file - just like DPDK Makefiles did. EAL checks for RTE_EAL_PMD_PATH being empty and skips loading any external PMDs then. We do it for both static and shared libs. We specify all PMDs at build time for now, so there's just no need to load them dynamically. We have three more hacks in our submodule: * disable building dpdk apps by commenting-out a line in dpdk/meson.build * disable building unnecessary libs (build everything that spdk *may* need) * build isa-l compress pmd with `-L[...] -lisal`. DPDK expects to find libisal with pkg-config. We don't want to prepare a pkg-config file, so comment-out a failing check in another meson.build file and provide isa-l through CFLAGS and LDFLAGS. We also need to make some changes to our test/external_code. First of all, -ldpdk is no more. Meson build generates a pkg-config file with all libs, but we'll switch to it in a separate patch - for now just specify all -lrte_ libs one by one. -Wl,--no-as-needed has to be added to some test cases, otherwise rte_mempool_ring isn't loaded. We don't use any APIs from this library, it only has a static constructor that provides a few callbacks used by rte_mempool_create(). Also, since DPDK now builds both static and shared libraries, we need to add -Wl,-Bstatic to force using static libswhere required. It's only needed for DPDK libs, but we use it for SPDK libs as well since there's no harm. As for performance: $ ./configure --enable-debug --with-crypto --with-reduce $ time make -j40 -C dpdkbuild all with meson: real 0m8.287s user 1m7.983s sys 0m10.548s before, with the old DPDK makefiles: real 0m20.232s user 0m55.921s sys 0m16.491s The subsequent builds are much faster too: $ time make -j40 -C dpdkbuild all meson: real 0m0.876s user 0m0.663s sys 0m0.217s makefiles: real 0m10.150s user 0m11.740s sys 0m6.772s [1] http://inbox.dpdk.org/dev/1a07d1cd59d84dce84e56c10fdabf5e5504560a6.camel@debian.org/ Change-Id: Ic65db563014100bafb12e61ee0530cc2ae64401d Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com> Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com> Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1440 Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
2020-03-23 16:55:08 +00:00
fi
$(SPDK_ROOT_DIR)/dpdk/build-tmp: $(SPDK_ROOT_DIR)/mk/cc.mk $(SPDK_ROOT_DIR)/include/spdk/config.h
$(Q)rm -rf $(SPDK_ROOT_DIR)/dpdk/build $(SPDK_ROOT_DIR)/dpdk/build-tmp
$(Q)cd "$(SPDK_ROOT_DIR)/dpdk"; CC="$(SUB_CC)" meson --prefix="$(MESON_PREFIX)" --libdir lib -Dc_args="$(DPDK_CFLAGS)" -Dc_link_args="$(DPDK_LDFLAGS)" $(DPDK_OPTS) -Denable_drivers="$(shell echo $(DPDK_DRIVERS) | sed -E "s/ +/,/g")" -Ddisable_libs="$(shell echo $(DPDK_DISABLED_LIBS) | sed -E "s/ +/,/g")" build-tmp
dpdkbuild: build dpdk with meson+ninja Makefile support in DPDK was deprecated and will be removed soon, so switch to the officially supported way of building DPDK - with meson and ninja. Two new tools. Basically, our Makefiles will invoke meson+ninja for DPDK, no other SPDK components are affected. Apparently DPDK wanted to move away from an octopus-like config system and the ideology behind meson configuration is simple now: build everything by default. Some PMDs can be explicitly disabled with meson command line, but all libraries (both static and shared versions) and test apps are built unconditionally. How long does it take to build minimal DPDK with meson? Too much. On my machine half of the total build time is spent on libraries we don't need at all. (I have some hacks up my sleeve to disable building those libraries - see the subsequent patch.) As for the official way of building a minimal DPDK, there was a patch [1] on dpdk mailing list to introduce more specific configuration, but it was rejected: > We talked about this a few times in the past, and it was actually one > of the design goals to _avoid_ replicating the octopus-like config > system of the makefiles. That's because it makes the test matrix > insanely complicated, not to mention the harm to user friendliness, > among other things. > > If someone doesn't want to use a PMD, they can just avoid installing it > - it's simple enough. > > Sorry, but from me it's a very strong NACK. Let's not follow that direction, hack the DPDK build system instead. As for advantages of meson+ninja over Makefiles? I can't find any. It's another build system that does a lot for you with some functions, magic options, and a built-in dependency system. It seems nice if you know the syntax, but it's another component that you need to learn, debug, and possibly find bugs in (there's a lot of github issues open for meson). I would compare it to CMake. As for changes in this patch: rather that explicitly disabling PMDs we don't need, specify a list of PMDs we do need and disable everything else found in ./dpdk/drivers/*. This way we won't have to disable the new PMDs as they're added to DPDK. Meson configuration also sets RTE_EAL_PMD_PATH #define to a valid directory with built PMD shared libs. When it's set, DPDK dynamically loads all shared libraries inside. The drivers there depend on DPDK shared libs and fail to load in static SPDK builds, so we disable them altogether by unsetting RTE_EAL_PMD_PATH in the meson-generated config file - just like DPDK Makefiles did. EAL checks for RTE_EAL_PMD_PATH being empty and skips loading any external PMDs then. We do it for both static and shared libs. We specify all PMDs at build time for now, so there's just no need to load them dynamically. We have three more hacks in our submodule: * disable building dpdk apps by commenting-out a line in dpdk/meson.build * disable building unnecessary libs (build everything that spdk *may* need) * build isa-l compress pmd with `-L[...] -lisal`. DPDK expects to find libisal with pkg-config. We don't want to prepare a pkg-config file, so comment-out a failing check in another meson.build file and provide isa-l through CFLAGS and LDFLAGS. We also need to make some changes to our test/external_code. First of all, -ldpdk is no more. Meson build generates a pkg-config file with all libs, but we'll switch to it in a separate patch - for now just specify all -lrte_ libs one by one. -Wl,--no-as-needed has to be added to some test cases, otherwise rte_mempool_ring isn't loaded. We don't use any APIs from this library, it only has a static constructor that provides a few callbacks used by rte_mempool_create(). Also, since DPDK now builds both static and shared libraries, we need to add -Wl,-Bstatic to force using static libswhere required. It's only needed for DPDK libs, but we use it for SPDK libs as well since there's no harm. As for performance: $ ./configure --enable-debug --with-crypto --with-reduce $ time make -j40 -C dpdkbuild all with meson: real 0m8.287s user 1m7.983s sys 0m10.548s before, with the old DPDK makefiles: real 0m20.232s user 0m55.921s sys 0m16.491s The subsequent builds are much faster too: $ time make -j40 -C dpdkbuild all meson: real 0m0.876s user 0m0.663s sys 0m0.217s makefiles: real 0m10.150s user 0m11.740s sys 0m6.772s [1] http://inbox.dpdk.org/dev/1a07d1cd59d84dce84e56c10fdabf5e5504560a6.camel@debian.org/ Change-Id: Ic65db563014100bafb12e61ee0530cc2ae64401d Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com> Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com> Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1440 Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
2020-03-23 16:55:08 +00:00
$(Q)sed $(SED_INPLACE_FLAG) 's/#define RTE_EAL_PMD_PATH .*/#define RTE_EAL_PMD_PATH ""/g' $(SPDK_ROOT_DIR)/dpdk/build-tmp/rte_build_config.h
$(Q) \
# TODO Meson build adds libbsd and/or libarchive dependency when it's available. This means any app will be \
# forced to link with -lbsd and/or -larchive, but only if it's available on the system. The clean way to \
# handle this would be to rely on DPDK's pkg-config file which will contain the -lbsd/-larchive when \
# required. For now just remove the dependencies. DPDK will fallback to its internal functions.
dpdkbuild: build dpdk with meson+ninja Makefile support in DPDK was deprecated and will be removed soon, so switch to the officially supported way of building DPDK - with meson and ninja. Two new tools. Basically, our Makefiles will invoke meson+ninja for DPDK, no other SPDK components are affected. Apparently DPDK wanted to move away from an octopus-like config system and the ideology behind meson configuration is simple now: build everything by default. Some PMDs can be explicitly disabled with meson command line, but all libraries (both static and shared versions) and test apps are built unconditionally. How long does it take to build minimal DPDK with meson? Too much. On my machine half of the total build time is spent on libraries we don't need at all. (I have some hacks up my sleeve to disable building those libraries - see the subsequent patch.) As for the official way of building a minimal DPDK, there was a patch [1] on dpdk mailing list to introduce more specific configuration, but it was rejected: > We talked about this a few times in the past, and it was actually one > of the design goals to _avoid_ replicating the octopus-like config > system of the makefiles. That's because it makes the test matrix > insanely complicated, not to mention the harm to user friendliness, > among other things. > > If someone doesn't want to use a PMD, they can just avoid installing it > - it's simple enough. > > Sorry, but from me it's a very strong NACK. Let's not follow that direction, hack the DPDK build system instead. As for advantages of meson+ninja over Makefiles? I can't find any. It's another build system that does a lot for you with some functions, magic options, and a built-in dependency system. It seems nice if you know the syntax, but it's another component that you need to learn, debug, and possibly find bugs in (there's a lot of github issues open for meson). I would compare it to CMake. As for changes in this patch: rather that explicitly disabling PMDs we don't need, specify a list of PMDs we do need and disable everything else found in ./dpdk/drivers/*. This way we won't have to disable the new PMDs as they're added to DPDK. Meson configuration also sets RTE_EAL_PMD_PATH #define to a valid directory with built PMD shared libs. When it's set, DPDK dynamically loads all shared libraries inside. The drivers there depend on DPDK shared libs and fail to load in static SPDK builds, so we disable them altogether by unsetting RTE_EAL_PMD_PATH in the meson-generated config file - just like DPDK Makefiles did. EAL checks for RTE_EAL_PMD_PATH being empty and skips loading any external PMDs then. We do it for both static and shared libs. We specify all PMDs at build time for now, so there's just no need to load them dynamically. We have three more hacks in our submodule: * disable building dpdk apps by commenting-out a line in dpdk/meson.build * disable building unnecessary libs (build everything that spdk *may* need) * build isa-l compress pmd with `-L[...] -lisal`. DPDK expects to find libisal with pkg-config. We don't want to prepare a pkg-config file, so comment-out a failing check in another meson.build file and provide isa-l through CFLAGS and LDFLAGS. We also need to make some changes to our test/external_code. First of all, -ldpdk is no more. Meson build generates a pkg-config file with all libs, but we'll switch to it in a separate patch - for now just specify all -lrte_ libs one by one. -Wl,--no-as-needed has to be added to some test cases, otherwise rte_mempool_ring isn't loaded. We don't use any APIs from this library, it only has a static constructor that provides a few callbacks used by rte_mempool_create(). Also, since DPDK now builds both static and shared libraries, we need to add -Wl,-Bstatic to force using static libswhere required. It's only needed for DPDK libs, but we use it for SPDK libs as well since there's no harm. As for performance: $ ./configure --enable-debug --with-crypto --with-reduce $ time make -j40 -C dpdkbuild all with meson: real 0m8.287s user 1m7.983s sys 0m10.548s before, with the old DPDK makefiles: real 0m20.232s user 0m55.921s sys 0m16.491s The subsequent builds are much faster too: $ time make -j40 -C dpdkbuild all meson: real 0m0.876s user 0m0.663s sys 0m0.217s makefiles: real 0m10.150s user 0m11.740s sys 0m6.772s [1] http://inbox.dpdk.org/dev/1a07d1cd59d84dce84e56c10fdabf5e5504560a6.camel@debian.org/ Change-Id: Ic65db563014100bafb12e61ee0530cc2ae64401d Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com> Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com> Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1440 Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
2020-03-23 16:55:08 +00:00
$(Q)sed $(SED_INPLACE_FLAG) 's/#define RTE_USE_LIBBSD .*//g' $(SPDK_ROOT_DIR)/dpdk/build-tmp/rte_build_config.h
$(Q)sed $(SED_INPLACE_FLAG) 's/#define RTE_HAS_LIBARCHIVE .*//g' $(SPDK_ROOT_DIR)/dpdk/build-tmp/rte_build_config.h
clean:
dpdkbuild: build dpdk with meson+ninja Makefile support in DPDK was deprecated and will be removed soon, so switch to the officially supported way of building DPDK - with meson and ninja. Two new tools. Basically, our Makefiles will invoke meson+ninja for DPDK, no other SPDK components are affected. Apparently DPDK wanted to move away from an octopus-like config system and the ideology behind meson configuration is simple now: build everything by default. Some PMDs can be explicitly disabled with meson command line, but all libraries (both static and shared versions) and test apps are built unconditionally. How long does it take to build minimal DPDK with meson? Too much. On my machine half of the total build time is spent on libraries we don't need at all. (I have some hacks up my sleeve to disable building those libraries - see the subsequent patch.) As for the official way of building a minimal DPDK, there was a patch [1] on dpdk mailing list to introduce more specific configuration, but it was rejected: > We talked about this a few times in the past, and it was actually one > of the design goals to _avoid_ replicating the octopus-like config > system of the makefiles. That's because it makes the test matrix > insanely complicated, not to mention the harm to user friendliness, > among other things. > > If someone doesn't want to use a PMD, they can just avoid installing it > - it's simple enough. > > Sorry, but from me it's a very strong NACK. Let's not follow that direction, hack the DPDK build system instead. As for advantages of meson+ninja over Makefiles? I can't find any. It's another build system that does a lot for you with some functions, magic options, and a built-in dependency system. It seems nice if you know the syntax, but it's another component that you need to learn, debug, and possibly find bugs in (there's a lot of github issues open for meson). I would compare it to CMake. As for changes in this patch: rather that explicitly disabling PMDs we don't need, specify a list of PMDs we do need and disable everything else found in ./dpdk/drivers/*. This way we won't have to disable the new PMDs as they're added to DPDK. Meson configuration also sets RTE_EAL_PMD_PATH #define to a valid directory with built PMD shared libs. When it's set, DPDK dynamically loads all shared libraries inside. The drivers there depend on DPDK shared libs and fail to load in static SPDK builds, so we disable them altogether by unsetting RTE_EAL_PMD_PATH in the meson-generated config file - just like DPDK Makefiles did. EAL checks for RTE_EAL_PMD_PATH being empty and skips loading any external PMDs then. We do it for both static and shared libs. We specify all PMDs at build time for now, so there's just no need to load them dynamically. We have three more hacks in our submodule: * disable building dpdk apps by commenting-out a line in dpdk/meson.build * disable building unnecessary libs (build everything that spdk *may* need) * build isa-l compress pmd with `-L[...] -lisal`. DPDK expects to find libisal with pkg-config. We don't want to prepare a pkg-config file, so comment-out a failing check in another meson.build file and provide isa-l through CFLAGS and LDFLAGS. We also need to make some changes to our test/external_code. First of all, -ldpdk is no more. Meson build generates a pkg-config file with all libs, but we'll switch to it in a separate patch - for now just specify all -lrte_ libs one by one. -Wl,--no-as-needed has to be added to some test cases, otherwise rte_mempool_ring isn't loaded. We don't use any APIs from this library, it only has a static constructor that provides a few callbacks used by rte_mempool_create(). Also, since DPDK now builds both static and shared libraries, we need to add -Wl,-Bstatic to force using static libswhere required. It's only needed for DPDK libs, but we use it for SPDK libs as well since there's no harm. As for performance: $ ./configure --enable-debug --with-crypto --with-reduce $ time make -j40 -C dpdkbuild all with meson: real 0m8.287s user 1m7.983s sys 0m10.548s before, with the old DPDK makefiles: real 0m20.232s user 0m55.921s sys 0m16.491s The subsequent builds are much faster too: $ time make -j40 -C dpdkbuild all meson: real 0m0.876s user 0m0.663s sys 0m0.217s makefiles: real 0m10.150s user 0m11.740s sys 0m6.772s [1] http://inbox.dpdk.org/dev/1a07d1cd59d84dce84e56c10fdabf5e5504560a6.camel@debian.org/ Change-Id: Ic65db563014100bafb12e61ee0530cc2ae64401d Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com> Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com> Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1440 Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
2020-03-23 16:55:08 +00:00
$(Q)rm -rf $(SPDK_ROOT_DIR)/dpdk/build $(SPDK_ROOT_DIR)/dpdk/build-tmp
install:
@:
uninstall:
@: