From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id CE449A09D9; Wed, 11 Nov 2020 15:36:47 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id CF4CFF64; Wed, 11 Nov 2020 15:36:45 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by dpdk.org (Postfix) with ESMTP id 4DBF7DED for ; Wed, 11 Nov 2020 15:36:43 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1605105401; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=VoHS8soKBYMNBJ/lHb4mym+e2I0KPF/HdYCIZf5a2kA=; b=IM0DW/p1FvsiuDLA0gS6pkBWdJhhVLazBTb3/GHJyXMsNkqdN+gkiCr/GmYYHdpVSCBAHQ ALDZuK8fWy8mZ9E5+4Zm7NMNWtqe1upENB9Cl4vgj1vaPuDHMxVkc6B0EBndrGMR6Q2ZRC 9FMGVSyDEfNWCL0JZQSTWZh3Uiz4JNk= Received: from mail-vs1-f70.google.com (mail-vs1-f70.google.com [209.85.217.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-592-GxMT9EoYNZOuJn-P3Ip9bA-1; Wed, 11 Nov 2020 09:36:37 -0500 X-MC-Unique: GxMT9EoYNZOuJn-P3Ip9bA-1 Received: by mail-vs1-f70.google.com with SMTP id u22so686487vsg.4 for ; Wed, 11 Nov 2020 06:36:37 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=VoHS8soKBYMNBJ/lHb4mym+e2I0KPF/HdYCIZf5a2kA=; b=Kct06qIgZ9pSRvk/IiCpiPxLwucd2R7c3iPDL1FIsGpQqyBu6bGsUr38vfSi97LPls aEWh/9B/k8iLjEWkmF3/25YaquAgHUjcVoztqm8YTRT7thEqGTVKYsDOkknCTLDjvAN3 srj9S8N463BjNb8y36CyQdAxDGwRZYhwZnKZs+zEiHskj1rJy+FMgGKxo/iQelu3CzXq X9ABzUR5BBYLy/kDrNZjCXL6ZTMw4ITDo1V8t0vDTuOIgWhGiL/O3j4vUtsIRZwJq2Q2 WUG37Fxns1rgMZSnjodWwbz2TAjq5fd5syEahpHaOe9/ogp7yrpVnrnkyksTAv7UY7nP WswA== X-Gm-Message-State: AOAM532u78ZEUgRlyLXUH4pDlLRD4TXL8Ir5eyKbARlWp0tWpwmvfz4q 6F7b1oeu94i1Gk3y4Fcu3GqWehi8uwRd6AX3GFqNbJsG3/i0Tc/nh0j70TKEiUOINDtHEAWRcZ1 1iOjPsStxfkMHBbU/B1I= X-Received: by 2002:a05:6102:2362:: with SMTP id o2mr10372995vsa.5.1605105396654; Wed, 11 Nov 2020 06:36:36 -0800 (PST) X-Google-Smtp-Source: ABdhPJzjV4bi/9wcijjMGcyD5iCZ3Q27ldSW9btqwpKg/GuOVHbaRaQcclF3Vc55GJoxlGjlMu+U4bLNhtNp3GZi4NE= X-Received: by 2002:a05:6102:2362:: with SMTP id o2mr10372971vsa.5.1605105396399; Wed, 11 Nov 2020 06:36:36 -0800 (PST) MIME-Version: 1.0 References: <20201111111957.46090-1-Cheng1.jiang@intel.com> In-Reply-To: <20201111111957.46090-1-Cheng1.jiang@intel.com> From: David Marchand Date: Wed, 11 Nov 2020 15:36:25 +0100 Message-ID: To: Cheng Jiang Cc: Maxime Coquelin , "Xia, Chenbo" , dev , "Fu, Patrick" , "Yang, YvonneX" , Jiayu Hu , Thomas Monjalon , "Yigit, Ferruh" Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dmarchan@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Subject: Re: [dpdk-dev] [PATCH v1] examples/vhost: fix ioat dependency issue X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Wed, Nov 11, 2020 at 12:29 PM Cheng Jiang wrote: > > Fix vhost-switch compiling issue when ioat dependency is missing. > Change 'RTE_x86' check into 'RTE_RAW_IOAT' check in meson build file > and update Makefile. Still failing for me. 98b4c65506 - (HEAD) examples/vhost: fix ioat dependency issue (28 seconds ago) a8adac0bc0 - (origin/main) doc: add instructions for building 32-bit DPDK (5 days ago) Please try the reproducer I gave: rm -f build/vhost-switch build/vhost-switch-static build/vhost-switch-shared test -d build && rmdir -p build || true cc -O3 -I/home/dmarchan/dpdk/installdir/usr/local/include -include rte_config.h -march=native -I/usr/usr/include -DALLOW_EXPERIMENTAL_API main.c virtio_net.c -o build/vhost-switch-shared -pthread -Wl,--as-needed -L/home/dmarchan/dpdk/installdir/usr/local/lib64 -lrte_node -lrte_graph -lrte_bpf -lrte_flow_classify -lrte_pipeline -lrte_table -lrte_port -lrte_fib -lrte_ipsec -lrte_vhost -lrte_stack -lrte_security -lrte_sched -lrte_reorder -lrte_rib -lrte_regexdev -lrte_rawdev -lrte_pdump -lrte_power -lrte_member -lrte_lpm -lrte_latencystats -lrte_kni -lrte_jobstats -lrte_ip_frag -lrte_gso -lrte_gro -lrte_eventdev -lrte_efd -lrte_distributor -lrte_cryptodev -lrte_compressdev -lrte_cfgfile -lrte_bitratestats -lrte_bbdev -lrte_acl -lrte_timer -lrte_hash -lrte_metrics -lrte_cmdline -lrte_pci -lrte_ethdev -lrte_meter -lrte_net -lrte_mbuf -lrte_mempool -lrte_rcu -lrte_ring -lrte_eal -lrte_telemetry -lrte_kvargs -lbsd /usr/bin/ld: /tmp/ccqE1W9S.o: in function `new_device': main.c:(.text+0x173): undefined reference to `ioat_transfer_data_cb' /usr/bin/ld: main.c:(.text+0x178): undefined reference to `ioat_check_completed_copies_cb' /usr/bin/ld: /tmp/ccqE1W9S.o: in function `main': main.c:(.text.startup+0x25e): undefined reference to `open_ioat' collect2: error: ld returned 1 exit status make: *** [Makefile:39: build/vhost-switch-shared] Error 1 There are at least two problems: - the code in main.c unconditionally expects the ioat stuff to be available (this is why the link fails above), - the Makefile unconditionally compiles ioat.c, which you fixed with this patch, There is a potential additional problem: I would expect a need for linking against the rte_raw_ioat driver, but we are "lucky" that all that is used in this example are inlines. So I guess it works without adding anything to LDFLAGS_SHARED. > > Signed-off-by: Cheng Jiang > --- > examples/vhost/Makefile | 5 +++++ > examples/vhost/ioat.h | 2 +- > examples/vhost/meson.build | 2 +- > 3 files changed, 7 insertions(+), 2 deletions(-) > > diff --git a/examples/vhost/Makefile b/examples/vhost/Makefile > index cec59d0e0f..505e443217 100644 > --- a/examples/vhost/Makefile > +++ b/examples/vhost/Makefile > @@ -5,7 +5,12 @@ > APP = vhost-switch > > # all source are stored in SRCS-y > +IOAT_PATH = $(shell pkg-config --cflags-only-I libdpdk | sed -e "s/^..//")/rte_ioat_rawdev.h > +ifeq ($(IOAT_PATH), $(wildcard $(IOAT_PATH))) > +SRCS-y := main.c virtio_net.c ioat.c > +else > SRCS-y := main.c virtio_net.c > +endif I'd rather rely on the driver define since the C code relies on it: Something like: PC_FILE := $(shell $(PKGCONF) --path libdpdk 2>/dev/null) CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk) LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk) LDFLAGS_STATIC = $(shell $(PKGCONF) --static --libs libdpdk) + +HAS_RAW_IOAT=$(shell echo RTE_RAW_IOAT | $(CPP) $(CFLAGS) -P - | tail -1) +ifeq ($(HAS_RAW_IOAT), 1) +SRCS-y += ioat.c +endif > > # Build using pkg-config variables if possible > ifneq ($(shell pkg-config --exists libdpdk && echo 0),0) > diff --git a/examples/vhost/ioat.h b/examples/vhost/ioat.h > index 9664fcc3ac..d6d0f7c18a 100644 > --- a/examples/vhost/ioat.h > +++ b/examples/vhost/ioat.h > @@ -24,7 +24,7 @@ struct dma_for_vhost { > uint16_t nr; > }; > > -#ifdef RTE_ARCH_X86 > +#ifdef RTE_RAW_IOAT > int open_ioat(const char *value); main.c should check for RTE_RAW_IOAT before including ioat.h. And then in this header, you can remove this stub too. > #else > static int open_ioat(const char *value __rte_unused) -- David Marchand