Skip to contentSkip to conversation

SORING cache guards

DISCUSSION Morten Brørup 1 participant 1 message Apr 21

lore
Share & tools
lore
#0 lore 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