DPDK usage discussions
 help / color / mirror / Atom feed
From: David Marchand <david.marchand@redhat.com>
To: "Templin (US), Fred L" <Fred.L.Templin@boeing.com>
Cc: "users@dpdk.org" <users@dpdk.org>,
	Stephen Hemminger <stephen@networkplumber.org>
Subject: Re: [dpdk-users] dpdk-20.11 and shared libraries
Date: Tue, 27 Apr 2021 08:41:42 +0200	[thread overview]
Message-ID: <CAJFAV8yUiOURfqwf3rus5A0=D8rMgYVCNTb9ia4E3FuS6sPyhg@mail.gmail.com> (raw)
In-Reply-To: <3e2a222c70864e73965adbe64b5c72a2@boeing.com>

On Tue, Apr 20, 2021 at 6:25 PM Templin (US), Fred L
<Fred.L.Templin@boeing.com> wrote:
>
> Hi, I have put a lot of time into learning about dpdk-20.11 but I have not yet found
> documentation on how to use it with shared libraries.  In dpdk-20.11, the examples
> are all built as "static" by default meaning that the entire kitchen sink of all DPDK
> libraries are linked in during the "ld" phase and the resulting binary is huge. When
> built as "static", the examples all appear to work fine as everything is loaded by
> default at runtime.
>
> When I build the examples as "shared", however, the story is completely different.
> Examples that run fine as "static" do not work at all when built as "shared". It is
> clear that somehow the build procedure is not giving adequate instructions to the
> loader so that all necessary libraries will be ready to go at runtime.
>
> I believe what needs to happen is that initialization code needs to be added to the
> example "main.c" modules to initialize functions that will be needed by lower levels
> but that are not being picked up on by the loader. But, I can find no documentation
> for how to do this. In my next message, I will send a code example of what I have
> tried so far.

I suppose you are testing with a local build (i.e. a dpdk not
installed system wide).

Example with my build env:
$ $HOME/builds/build-gcc-shared/examples/dpdk-helloworld --no-huge -m
512 --vdev net_null0
EAL: Detected 28 lcore(s)
EAL: Detected 1 NUMA nodes
EAL: Detected shared linkage of DPDK
EAL: failed to parse device "net_null0"
EAL: Unable to parse device 'net_null0'
PANIC in main():
Cannot init EAL
5: [/home/dmarchan/builds/build-gcc-shared/examples/dpdk-helloworld()
[0x40116e]]
4: [/usr/lib64/libc.so.6(__libc_start_main+0xf2) [0x7f7ece854082]]
3: [/home/dmarchan/builds/build-gcc-shared/examples/dpdk-helloworld()
[0x4010b6]]
2: [/home/dmarchan/builds/build-gcc-shared/examples/../lib/librte_eal.so.21(__rte_panic+0xbe)
[0x7f7eceb828cc]]
1: [/home/dmarchan/builds/build-gcc-shared/examples/../lib/librte_eal.so.21(rte_dump_stack+0x1b)
[0x7f7eceba26cb]]
Aborted (core dumped)

You have several solutions.
You can simply install dpdk system wide.

Or, try to pass -d <your_driver.so> in EAL cmdline options.
$ LD_LIBRARY_PATH=$HOME/builds/build-gcc-shared/install/usr/local/lib64
$HOME/builds/build-gcc-shared/examples/dpdk-helloworld --no-huge -m
512 -d $HOME/builds/build-gcc-shared/install/usr/local/lib64/dpdk/pmds-21.2/librte_net_null.so
--vdev net_null0
EAL: Detected 28 lcore(s)
EAL: Detected 1 NUMA nodes
EAL: Detected shared linkage of DPDK
EAL: Multi-process socket /run/user/1001/dpdk/rte/mp_socket
EAL: Selected IOVA mode 'VA'
EAL: VFIO support initialized
TELEMETRY: No legacy callbacks, legacy socket not created
hello from core 1
hello from core 2
hello from core 3
hello from core 4
hello from core 5
hello from core 6
hello from core 7
hello from core 8
hello from core 9
hello from core 10
hello from core 11
hello from core 12
hello from core 13
hello from core 14
hello from core 15
hello from core 16
hello from core 17
hello from core 18
hello from core 19
hello from core 20
hello from core 21
hello from core 22
hello from core 23
hello from core 24
hello from core 25
hello from core 26
hello from core 27
hello from core 0


Or you can also pass a directory to this option and EAL will try to
load any driver in this directory.


-- 
David Marchand


      parent reply	other threads:[~2021-04-27  6:41 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-20 16:24 Templin (US), Fred L
2021-04-20 16:45 ` Templin (US), Fred L
2021-04-27  6:41 ` David Marchand [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAJFAV8yUiOURfqwf3rus5A0=D8rMgYVCNTb9ia4E3FuS6sPyhg@mail.gmail.com' \
    --to=david.marchand@redhat.com \
    --cc=Fred.L.Templin@boeing.com \
    --cc=stephen@networkplumber.org \
    --cc=users@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).