numam-dpdk/app/test/test_prefetch.c
Omkar Maslekar 4ffc2276e2 eal: add cache line demotion API
rte_cldemote is similar to a prefetch hint - in reverse.
On x86, cldemote(addr) enables software to hint to hardware that line is
likely to be shared. This is quite useful in core-to-core communications
where cache-line is likely to be shared.
ARM and PPC implementation is provided with NOP and can be added if any
equivalent instructions could be used for implementation on those
architectures.

Signed-off-by: Omkar Maslekar <omkar.maslekar@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: David Christensen <drc@linux.vnet.ibm.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
2020-10-16 14:11:45 +02:00

39 lines
605 B
C

/* SPDX-License-Identifier: BSD-3-Clause
* Copyright(c) 2010-2014 Intel Corporation
*/
#include <stdio.h>
#include <stdint.h>
#include <rte_prefetch.h>
#include "test.h"
/*
* Prefetch test
* =============
*
* - Just test that the macro can be called and validate the compilation.
* The test always return success.
*/
static int
test_prefetch(void)
{
int a;
rte_prefetch0(&a);
rte_prefetch1(&a);
rte_prefetch2(&a);
rte_prefetch0_write(&a);
rte_prefetch1_write(&a);
rte_prefetch2_write(&a);
rte_cldemote(&a);
return 0;
}
REGISTER_TEST_COMMAND(prefetch_autotest, test_prefetch);