From: Stephen Hemminger <stephen@networkplumber.org>
To: Wencheng Li <liwencheng@phytium.com.cn>
Cc: dev@dpdk.org
Subject: Re: [PATCH v11 2/3] net/macb: add NEON vectorized Rx/Tx
Date: Tue, 28 Oct 2025 06:40:30 -0700 [thread overview]
Message-ID: <20251028064030.6ffe334c@phoenix> (raw)
In-Reply-To: <1761640350-80578-1-git-send-email-liwencheng@phytium.com.cn>
On Tue, 28 Oct 2025 08:32:30 +0000
Wencheng Li <liwencheng@phytium.com.cn> wrote:
> +static inline uint8x8_t macb_mbuf_initializer(struct macb_rx_queue *rxq)
> +{
> + uint64x1_t mbuf_initializer;
> + uint8x8_t rearm_data_vec;
> + volatile struct rte_mbuf mbuf = {
> + .buf_addr = 0,
> + .data_off = RTE_PKTMBUF_HEADROOM + MACB_RX_DATA_OFFSET,
> + .nb_segs = 1,
> + .port = rxq->port_id,
> + };
> +
> + mbuf_initializer = vdup_n_u64(0);
> + rte_atomic_store_explicit(&mbuf.refcnt, 1, rte_memory_order_relaxed);
> +
> + /* prevent compiler reordering: rearm_data covers previous fields */
> + rte_compiler_barrier();
> + mbuf_initializer =
> + vset_lane_u64(*(volatile uint64_t *)(&mbuf.rearm_data), mbuf_initializer, 0);
Why is a variable on stack marked volatile.
My understanding is that volatile is for cases where data is accessed
from two contexts (threads or signals). This is not the case for on-stack
variable.
The compiler barrier should be enough protection to prevent reordering.
And setting same variable twice seems wrong as well.
next prev parent reply other threads:[~2025-10-28 13:40 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-02 6:59 [PATCH v4 3/4] " liwencheng
2025-04-07 6:39 ` [PATCH v5 " liwencheng
2025-04-08 6:21 ` [PATCH v6 2/3] " liwencheng
2025-04-18 3:26 ` [PATCH v7 " Wencheng Li
2025-06-04 7:01 ` [PATCH v8 " Wencheng Li
2025-06-06 9:07 ` [PATCH v9 " Wencheng Li
2025-08-20 4:33 ` [PATCH v10 " Wencheng Li
2025-10-28 8:32 ` [PATCH v11 " Wencheng Li
2025-10-28 13:40 ` Stephen Hemminger [this message]
2025-10-26 18:02 ` [PATCH v4 3/4] " Stephen Hemminger
2025-10-26 18:17 ` Stephen Hemminger
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=20251028064030.6ffe334c@phoenix \
--to=stephen@networkplumber.org \
--cc=dev@dpdk.org \
--cc=liwencheng@phytium.com.cn \
/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).