DPDK patches and discussions
 help / color / mirror / Atom feed
From: Omkar Maslekar <omkar.maslekar@intel.com>
To: dev@dpdk.org
Cc: bruce.richardson@intel.com, ciara.loftus@intel.com,
	omkar.maslekar@intel.com
Subject: [dpdk-dev] [PATCH] EAL: An addition of cache line demote (CLDEMOTE) in rte_prefetch.h
Date: Wed,  9 Sep 2020 18:16:54 -0700	[thread overview]
Message-ID: <1599700614-22809-2-git-send-email-omkar.maslekar@intel.com> (raw)
In-Reply-To: <1599700614-22809-1-git-send-email-omkar.maslekar@intel.com>

rte_cldemote is similar to a prefetch hint - in reverse. cldemote(addr)
enables software to hint to hardware that line is likely to be shared.
Useful in core-to-core communications where cache-line is likely to be
shared. ARM and PPC implementation is provided with NOP and can be added
if any equivalent instructions could be used for implementation on those
architectures.

Signed-off-by: Omkar Maslekar <omkar.maslekar@intel.com>
---
 doc/guides/rel_notes/release_20_11.rst        | 26 ++++----------------------
 lib/librte_eal/arm/include/rte_prefetch_32.h  |  5 +++++
 lib/librte_eal/arm/include/rte_prefetch_64.h  |  5 +++++
 lib/librte_eal/include/generic/rte_prefetch.h |  7 +++++++
 lib/librte_eal/ppc/include/rte_prefetch.h     |  5 +++++
 lib/librte_eal/x86/include/rte_prefetch.h     |  9 +++++++++
 6 files changed, 35 insertions(+), 22 deletions(-)

diff --git a/doc/guides/rel_notes/release_20_11.rst b/doc/guides/rel_notes/release_20_11.rst
index df227a1..c4a4362 100644
--- a/doc/guides/rel_notes/release_20_11.rst
+++ b/doc/guides/rel_notes/release_20_11.rst
@@ -27,29 +27,11 @@ New Features
 .. This section should contain new features added in this release.
    Sample format:
 
-   * **Add a title in the past tense with a full stop.**
+Added new instruction CLDEMOTE in rte_prefetch.h.
 
-     Add a short 1-2 sentence description in the past tense.
-     The description should be enough to allow someone scanning
-     the release notes to understand the new feature.
-
-     If the feature adds a lot of sub-features you can use a bullet list
-     like this:
-
-     * Added feature foo to do something.
-     * Enhanced feature bar to do something else.
-
-     Refer to the previous release notes for examples.
-
-     Suggested order in release notes items:
-     * Core libs (EAL, mempool, ring, mbuf, buses)
-     * Device abstraction libs and PMDs
-       - ethdev (lib, PMDs)
-       - cryptodev (lib, PMDs)
-       - eventdev (lib, PMDs)
-       - etc
-     * Other libs
-     * Apps, Examples, Tools (if significant)
+     Added a hardware hint CLDEMOTE which is similar to prefetch in reverse.
+     CLDEMOTES moves the cache line to the last shared cache, where it expects
+     sharing to be efficient.
 
      This section is a comment. Do not overwrite or remove it.
      Also, make sure to start the actual text at the margin.
diff --git a/lib/librte_eal/arm/include/rte_prefetch_32.h b/lib/librte_eal/arm/include/rte_prefetch_32.h
index e53420a..ad91edd 100644
--- a/lib/librte_eal/arm/include/rte_prefetch_32.h
+++ b/lib/librte_eal/arm/include/rte_prefetch_32.h
@@ -33,6 +33,11 @@ static inline void rte_prefetch_non_temporal(const volatile void *p)
 	rte_prefetch0(p);
 }
 
+static inline void rte_cldemote(const volatile void *p)
+{
+	RTE_SET_USED(p);
+}
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/lib/librte_eal/arm/include/rte_prefetch_64.h b/lib/librte_eal/arm/include/rte_prefetch_64.h
index fc2b391..35d278a 100644
--- a/lib/librte_eal/arm/include/rte_prefetch_64.h
+++ b/lib/librte_eal/arm/include/rte_prefetch_64.h
@@ -32,6 +32,11 @@ static inline void rte_prefetch_non_temporal(const volatile void *p)
 	asm volatile ("PRFM PLDL1STRM, [%0]" : : "r" (p));
 }
 
+static inline void rte_cldemote(const volatile void *p)
+{
+	RTE_SET_USED(p);
+}
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/lib/librte_eal/include/generic/rte_prefetch.h b/lib/librte_eal/include/generic/rte_prefetch.h
index 6e47bdf..89ec69c 100644
--- a/lib/librte_eal/include/generic/rte_prefetch.h
+++ b/lib/librte_eal/include/generic/rte_prefetch.h
@@ -51,4 +51,11 @@
  */
 static inline void rte_prefetch_non_temporal(const volatile void *p);
 
+/**
+ * Demote a cache line into the last shared cache level.
+ * @param p
+ *   Address to demote
+ */
+static inline void rte_cldemote(const volatile void *p);
+
 #endif /* _RTE_PREFETCH_H_ */
diff --git a/lib/librte_eal/ppc/include/rte_prefetch.h b/lib/librte_eal/ppc/include/rte_prefetch.h
index 9ba07c8..3fe9655 100644
--- a/lib/librte_eal/ppc/include/rte_prefetch.h
+++ b/lib/librte_eal/ppc/include/rte_prefetch.h
@@ -34,6 +34,11 @@ static inline void rte_prefetch_non_temporal(const volatile void *p)
 	rte_prefetch0(p);
 }
 
+static inline void rte_cldemote(const volatile void *p)
+{
+	RTE_SET_USED(p);
+}
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/lib/librte_eal/x86/include/rte_prefetch.h b/lib/librte_eal/x86/include/rte_prefetch.h
index 384c6b3..029d06e 100644
--- a/lib/librte_eal/x86/include/rte_prefetch.h
+++ b/lib/librte_eal/x86/include/rte_prefetch.h
@@ -32,6 +32,15 @@ static inline void rte_prefetch_non_temporal(const volatile void *p)
 	asm volatile ("prefetchnta %[p]" : : [p] "m" (*(const volatile char *)p));
 }
 
+/*
+ * we're using raw byte codes for now as only the newest compiler
+ * versions support this instruction natively.
+ */
+static inline void rte_cldemote(const volatile void *p)
+{
+	asm volatile(".byte 0x0f, 0x1c, 0x06" :: "S" (p));
+}
+
 #ifdef __cplusplus
 }
 #endif
-- 
1.8.3.1


  reply	other threads:[~2020-09-10  1:17 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-10  1:16 Omkar Maslekar
2020-09-10  1:16 ` Omkar Maslekar [this message]
2020-09-10  8:55   ` Bruce Richardson
2020-09-10 23:30     ` Maslekar, Omkar
2020-09-10 22:04   ` David Christensen
2020-09-11 16:51 ` [dpdk-dev] [PATCH v2] " Omkar Maslekar
2020-09-11 16:51   ` Omkar Maslekar
2020-09-11 21:22 ` [dpdk-dev] [PATCH v3] " Omkar Maslekar
2020-09-11 21:22   ` Omkar Maslekar
2020-09-22  1:59 ` [dpdk-dev] [PATCH v4] eal: add cache-line demote support Omkar Maslekar
2020-09-22  1:59   ` Omkar Maslekar
2020-09-22  8:28     ` Bruce Richardson
2020-09-22 21:53       ` Maslekar, Omkar
2020-10-01  0:28 ` [dpdk-dev] [PATCH v5] " Omkar Maslekar
2020-10-01  0:28   ` Omkar Maslekar
2020-10-08  7:09     ` David Marchand
2020-10-08  9:02       ` Bruce Richardson
2020-10-12  9:41         ` David Marchand
2020-10-08 13:12     ` Jerin Jacob
2020-10-12 10:19 ` [dpdk-dev] [PATCH v6] " Omkar Maslekar
2020-10-12 10:19   ` Omkar Maslekar
2020-10-12 19:31     ` David Christensen
2020-10-13  2:59     ` Ruifeng Wang
2020-10-13 16:20       ` Bruce Richardson
2020-10-14  1:55         ` Ruifeng Wang
2020-10-14  7:14         ` David Marchand
2020-10-14  7:51           ` Ruifeng Wang
2020-10-13  9:43 ` [dpdk-dev] [PATCH v7] " Omkar Maslekar
2020-10-13  9:43   ` Omkar Maslekar
2020-10-14  7:24     ` Ruifeng Wang
2020-10-15  8:01     ` David Marchand
2020-10-15 14:41       ` Maslekar, Omkar
2020-10-15 20:32         ` David Marchand
2020-10-15 15:18 ` [dpdk-dev] [PATCH v8] " Omkar Maslekar
2020-10-15 15:18   ` Omkar Maslekar
2020-10-15 23:20 ` [dpdk-dev] [PATCH v9] " Omkar Maslekar
2020-10-15 23:20   ` Omkar Maslekar
2020-10-16 12:14     ` David Marchand

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=1599700614-22809-2-git-send-email-omkar.maslekar@intel.com \
    --to=omkar.maslekar@intel.com \
    --cc=bruce.richardson@intel.com \
    --cc=ciara.loftus@intel.com \
    --cc=dev@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).