DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* SORING cache guards
@ 2026-04-21 10:46 Morten Brørup
  0 siblings, 0 replies; only message in thread
From: Morten Brørup @ 2026-04-21 10:46 UTC (permalink / raw)
  To: Konstantin Ananyev, dev; +Cc: Konstantin Ananyev, Wathsala Vithanage

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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-04-21 10:46 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-21 10:46 SORING cache guards Morten Brørup

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox