DPDK patches and discussions
 help / color / mirror / Atom feed
From: vic_yf <642290071@qq.com>
To: dev <dev@dpdk.org>
Subject: [dpdk-dev] why uses the cldemote  here in dpdk21.02?
Date: Wed, 19 May 2021 14:09:26 +0800	[thread overview]
Message-ID: <tencent_4608304D03D03F22EE2D5A1947F4F2348609@qq.com> (raw)

Hi,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; when I read the&nbsp; dpdk dlb eventdev driver code, I find that it&nbsp; used the cldemote instruction in the dlb_recv_qe(). But I don't understand why it used there?&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; The cldemote instruction means to move the cache line to the more remote cache, which helps to  accelerate core-to-core communication. But who will be use the memory of  cache_line_base?



&gt;static __rte_always_inline int dlb_recv_qe(struct dlb_port *qm_port, struct dlb_dequeue_qe *qe, 	    uint8_t *offset) 

&gt;{
&gt; 

&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cq_addr = dlb_port[qm_port-&gt;id][PORT_TYPE(qm_port)].cq_base; 

&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cq_addr = &amp;cq_addr[qm_port-&gt;cq_idx]; 

&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cache_line_base = (void *)(((uintptr_t)cq_addr) &amp; ~0x3F); 

&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; *offset = ((uintptr_t)cq_addr &amp; 0x30) &gt;&gt; 4; 

&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* Load the next CQ cache line from memory. Pack these reads as tight 

&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * as possible to reduce the chance that DLB invalidates the line while 

&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * the CPU is reading it. Read the cache line backwards to ensure that 

&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * if QE[N] (N &gt; 0) is valid, then QEs[0:N-1] are too. 

&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; *
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * (Valid QEs start at &amp;qe[offset]) 

&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; */ 

&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; qes[3] = _mm_load_si128((__m128i *)&amp;cache_line_base[6]);
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; qes[2] = _mm_load_si128((__m128i *)&amp;cache_line_base[4]); 

&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; qes[1] = _mm_load_si128((__m128i *)&amp;cache_line_base[2]); 

&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; qes[0] = _mm_load_si128((__m128i *)&amp;cache_line_base[0]); 

&gt;
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* Evict the cache line ASAP */ 

&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; rte_cldemote(cache_line_base);


Thanks.

                 reply	other threads:[~2021-05-20  8:01 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=tencent_4608304D03D03F22EE2D5A1947F4F2348609@qq.com \
    --to=642290071@qq.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).