From: Ola Liljedahl <Ola.Liljedahl@arm.com>
To: Jerin Jacob <jerin.jacob@caviumnetworks.com>,
Jan Viktorin <viktorin@rehivetech.com>,
"Gavin Hu (Arm Technology China)" <Gavin.Hu@arm.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>,
"thomas@monjalon.net" <thomas@monjalon.net>
Subject: Re: [dpdk-dev] [PATCH] eal/armv7: add support for rte pause
Date: Sun, 7 Oct 2018 21:09:25 +0000 [thread overview]
Message-ID: <C059DF2C-08BD-47A1-98FF-362CAA609C99@arm.com> (raw)
In-Reply-To: <20181007063127.27960-1-jerin.jacob@caviumnetworks.com>
On 07/10/2018, 08:32, "Jerin Jacob" <jerin.jacob@caviumnetworks.com> wrote:
Add support for rte_pause() implementation for armv7.
Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
---
The reference implementation for Linux's cpu_relax() for armv7 is at
https://elixir.bootlin.com/linux/latest/source/arch/arm/include/asm/processor.h#L100
---
lib/librte_eal/common/include/arch/arm/rte_pause_32.h | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/lib/librte_eal/common/include/arch/arm/rte_pause_32.h b/lib/librte_eal/common/include/arch/arm/rte_pause_32.h
index d4768c7a9..9b856e0cf 100644
--- a/lib/librte_eal/common/include/arch/arm/rte_pause_32.h
+++ b/lib/librte_eal/common/include/arch/arm/rte_pause_32.h
@@ -9,11 +9,13 @@
extern "C" {
#endif
-#include <rte_common.h>
+#include <rte_atomic.h>
+
#include "generic/rte_pause.h"
static inline void rte_pause(void)
{
+rte_compiler_barrier();
The compiler barrier is not mandated by the DPDK documentation for rte_pause():
http://doc.dpdk.org/api/rte__pause_8h.html
You have to go all the way to the source and GCC documentation to discover that for GCC, rte_pause calls _mm_pause() which in turn is implemented using __builtin_ia32_pause().
https://gcc.gnu.org/onlinedocs/gcc-4.9.2/gcc/X86-Built-in-Functions.html
void __builtin_ia32_pause (void)
Generates the pause machine instruction with a compiler memory barrier.
If you are using C11 atomic operations e.g. for polling a location, the atomic operations will be able to provide the required semantics (e.g. don't merge atomic loads from different iterations of a loop, optionally provide acquire and/or release (or stronger) ordering. A compiler barrier here interferes with the (possibly weaker) barriers from the atomic operations. We could use a C11-version of rte_pause() that doesn't have the compiler barrier. But actually, we want support for WFE, x86 also has something similar now, MONITOR/MWAIT?.
-- Ola
}
#ifdef __cplusplus
--
2.19.0
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
next prev parent reply other threads:[~2018-10-07 21:09 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-07 6:31 Jerin Jacob
2018-10-07 21:09 ` Ola Liljedahl [this message]
2018-10-08 6:27 ` Jerin Jacob
2018-10-08 8:25 ` Ola Liljedahl
2018-10-08 8:41 ` Jerin Jacob
2018-10-08 10:51 ` Ola Liljedahl
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=C059DF2C-08BD-47A1-98FF-362CAA609C99@arm.com \
--to=ola.liljedahl@arm.com \
--cc=Gavin.Hu@arm.com \
--cc=dev@dpdk.org \
--cc=jerin.jacob@caviumnetworks.com \
--cc=thomas@monjalon.net \
--cc=viktorin@rehivetech.com \
/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).