DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Morten Brørup" <mb@smartsharesystems.com>
To: "Konstantin Ananyev" <konstantin.ananyev@huawei.com>, <dev@dpdk.org>
Cc: "Konstantin Ananyev" <konstantin.v.ananyev@yandex.ru>,
	"Wathsala Vithanage" <wathsala.vithanage@arm.com>
Subject: SORING cache guards
Date: Tue, 21 Apr 2026 12:46:20 +0200	[thread overview]
Message-ID: <98CBD80474FA8B44BF855DF32C47DC35F65804@smartserver.smartshare.dk> (raw)

Konstantin,

Suggestion:

I'm not sure about this, but shouldn't the arrays in the SORING be padded by cache guards?

/*
 * Calculate size offsets for SORING internal data layout.
 */
static size_t
soring_get_szofs(uint32_t esize, uint32_t msize, uint32_t count,
	uint32_t stages, size_t *elst_ofs, size_t *state_ofs,
	size_t *stage_ofs)
{
	size_t sz;
	const struct rte_soring * const r = NULL;

	sz = sizeof(r[0]) + (size_t)count * esize;
	sz = RTE_ALIGN(sz, RTE_CACHE_LINE_SIZE);
+	sz += RTE_CACHE_GUARD_LINES * RTE_CACHE_LINE_SIZE;

	if (elst_ofs != NULL)
		*elst_ofs = sz;

-	sz = sz + (size_t)count * msize;
+	sz += (size_t)count * msize;
	sz = RTE_ALIGN(sz, RTE_CACHE_LINE_SIZE);
+	sz += RTE_CACHE_GUARD_LINES * RTE_CACHE_LINE_SIZE;

	if (state_ofs != NULL)
		*state_ofs = sz;

	sz += sizeof(r->state[0]) * count;
	sz = RTE_ALIGN(sz, RTE_CACHE_LINE_SIZE);
+	sz += RTE_CACHE_GUARD_LINES * RTE_CACHE_LINE_SIZE;

	if (stage_ofs != NULL)
		*stage_ofs = sz;

	sz += sizeof(r->stage[0]) * stages;
	sz = RTE_ALIGN(sz, RTE_CACHE_LINE_SIZE);
+	sz += RTE_CACHE_GUARD_LINES * RTE_CACHE_LINE_SIZE;

	return sz;
}

Such a change would break the ABI, so it should be announced in advance.

I'll leave it up to you to provide patches, if you agree. ;-)

-Morten


                 reply	other threads:[~2026-04-21 10:46 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=98CBD80474FA8B44BF855DF32C47DC35F65804@smartserver.smartshare.dk \
    --to=mb@smartsharesystems.com \
    --cc=dev@dpdk.org \
    --cc=konstantin.ananyev@huawei.com \
    --cc=konstantin.v.ananyev@yandex.ru \
    --cc=wathsala.vithanage@arm.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