DPDK patches and discussions
 help / color / mirror / Atom feed
From: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
To: Thomas Monjalon <thomas@monjalon.net>
Cc: dev@dpdk.org,
	Harini Ramakrishnan <harini.ramakrishnan@microsoft.com>,
	Omar Cardona <ocardona@microsoft.com>,
	Pallavi Kadam <pallavi.kadam@intel.com>,
	Ranjit Menon <ranjit.menon@intel.com>,
	John McNamara <john.mcnamara@intel.com>,
	Marko Kovacevic <marko.kovacevic@intel.com>,
	Tal Shnaiderman <talshn@mellanox.com>
Subject: Re: [dpdk-dev] [PATCH 6/6] doc: guide for Windows build using MinGW-w64
Date: Mon, 10 Feb 2020 00:39:37 +0300	[thread overview]
Message-ID: <20200210003937.7dcdcc82@Sovereign> (raw)
In-Reply-To: <3267218.V25eIC5XRa@xps>

> I think the strategy should be to progress on both GCC and Clang
> at the same time.

Remembered another issue: thread-local storage (TLS) with shared libraries.
Windows PE doesn't support TLS via special sections, so compilers use TLS
emulation layer. With static libraries, there are no issues described below.

The first aspect is a build-time issue of MinGW. When linking to DPDK shared
libraries, errors occur:

	undefined reference to `__emutls_v.per_lcore__rte_errno'
	undefined reference to `__emutls_v.per_lcore__rte_lcore_id'

DPDK declares per_lcore__XXX in a map file, but GCC places __thread symbols
in __emutls_v section, so the proper name to export becomes __emutls_v.XXX.
This can be worked around by using an additional version script with MinGW,
as I do in my port [0], however, the proper solution would be fixing the bug
on MinGW side [1]. MinGW already converts TLS variable names when generating
DEF files with `-Wl,--output-def` option (not used by DPDK, just a hint).

The second aspect is performance. Per [2], Win32 API TLS functions are ~10%
slower than non-emulated access on Linux, and MinGW emulation layer slows
access by another 20% (30% total). Clang emulation code is similar to
MinGW's [3], although I wasn't able to find any benchmarks. As a DPDK user, I
know that rte_lcore_id() is heavily used on the data-path, so this is severe.
My opinion is, for the first time Windows port should use whatever TLS
implementation the compiler provides, then attempt optimization. It should be
possible, because we don't need a general-purpose TLS, but only TLS for EAL
threads.

[0]: https://github.com/PlushBeaver/dpdk/blob/windows/lib/meson.build#L174
[1]: https://sourceforge.net/p/mingw-w64/bugs/827/
[2]:
https://sourceforge.net/p/mingw-w64/mailman/mingw-w64-public/thread/d72aad95-b6aa-af03-667b-5898456a5a63@gmx.com/
[3]:
https://github.com/llvm-mirror/compiler-rt/blob/master/lib/builtins/emutls.c


> Please Dmitry, would you like to review Pallavi's patches
> in order to make them coexist with yours?

Done. There are no logical conflicts, if code conflicts occur after merging
Pallivi's patchset, I'll resolve them before sending v3.

-- 
Dmitry Kozlyuk

  reply	other threads:[~2020-02-09 21:39 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-31  3:07 [dpdk-dev] [PATCH 0/6] MinGW-w64 support Dmitry Kozlyuk
2020-01-31  3:07 ` [dpdk-dev] [PATCH 1/6] eal: introduce portable format attribute Dmitry Kozlyuk
2020-01-31  3:07 ` [dpdk-dev] [PATCH 2/6] eal: use " Dmitry Kozlyuk
2020-01-31  3:07 ` [dpdk-dev] [PATCH 3/6] cmdline: " Dmitry Kozlyuk
2020-01-31  3:07 ` [dpdk-dev] [PATCH 4/6] build: MinGW-w64 support for Meson Dmitry Kozlyuk
2020-02-04 22:08   ` Thomas Monjalon
2020-02-04 23:21     ` Dmitry Kozlyuk
2020-02-05  0:41       ` Thomas Monjalon
2020-02-05 14:30         ` Bruce Richardson
2020-02-05 20:41           ` Dmitry Kozlyuk
2020-02-06 10:59             ` Bruce Richardson
2020-02-07 19:27               ` Dmitry Kozlyuk
2020-01-31  3:07 ` [dpdk-dev] [PATCH 5/6] build: add cross-file for MinGW-w64 Dmitry Kozlyuk
2020-02-04 22:14   ` Thomas Monjalon
2020-02-04 23:23     ` Dmitry Kozlyuk
2020-01-31  3:07 ` [dpdk-dev] [PATCH 6/6] doc: guide for Windows build using MinGW-w64 Dmitry Kozlyuk
2020-02-04 22:34   ` Thomas Monjalon
2020-02-04 23:57     ` Dmitry Kozlyuk
2020-02-05  2:20       ` Thomas Monjalon
2020-02-09 21:39         ` Dmitry Kozlyuk [this message]
2020-02-17  6:27           ` Dmitry Kozlyuk
2020-04-29 13:57             ` Thomas Monjalon
2020-02-05  1:49 ` [dpdk-dev] [EXTERNAL] [PATCH 0/6] MinGW-w64 support Narcisa Ana Maria Vasile
2020-02-05  5:43   ` Dmitry Kozlyuk
2020-02-05  9:26     ` David Marchand
2020-02-05 20:59       ` Dmitry Kozlyuk
2020-02-05 21:02         ` Narcisa Ana Maria Vasile
2020-02-05 21:21           ` Dmitry Kozlyuk

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=20200210003937.7dcdcc82@Sovereign \
    --to=dmitry.kozliuk@gmail.com \
    --cc=dev@dpdk.org \
    --cc=harini.ramakrishnan@microsoft.com \
    --cc=john.mcnamara@intel.com \
    --cc=marko.kovacevic@intel.com \
    --cc=ocardona@microsoft.com \
    --cc=pallavi.kadam@intel.com \
    --cc=ranjit.menon@intel.com \
    --cc=talshn@mellanox.com \
    --cc=thomas@monjalon.net \
    /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).