Age | Commit message (Collapse) | Author |
|
Since the data is not necessarily aligned, use unaligned types to read
it, in order to avoid undefined behavior.
Fixes GCC undefined sanitizer errors:
hash_crc32.h:35:24: runtime error: load of misaligned address 0x0000005e12d4 for type 'const uint64_t', which requires 8 byte alignment
hash_crc32.h:40:14: runtime error: load of misaligned address 0x0000005ff879 for type 'const uint32_t', which requires 4 byte alignment
hash_crc32.h:51:47: runtime error: load of misaligned address 0x0000005e67af for type 'const uint16_t', which requires 2 byte alignment
Signed-off-by: Jere Leppänen <jere.leppanen@nokia.com>
Reviewed-by: Janne Peltonen <janne.peltonen@nokia.com>
|
|
Update all implementation files to use the new shorter copyright format:
/* SPDX-License-Identifier: BSD-3-Clause
* Copyright (c) <YEAR> <COPYRIGHT HOLDER>
*/
Inherited DPDK copyright messages have also been updated to utilize SPDX
format and now list the original source files.
Signed-off-by: Matias Elo <matias.elo@nokia.com>
Reviewed-by: Tuomas Taipale <tuomas.taipale@nokia.com>
|
|
Use _odp_strcpy() instead of strncpy().
Signed-off-by: Jere Leppänen <jere.leppanen@nokia.com>
Reviewed-by: Matias Elo <matias.elo@nokia.com>
|
|
Speed up TSC frequency measurement and thus ODP startup by reducing the
measurement duration. Make the result more accurate despite the decreased
duration by using a busyloop instead of nanosleep and by taking the median
of several measurements.
Using a busyloop instead of nanosleep also fixes the measurement in (old)
systems that have constant but not invariant TSC which may stop or change
frequency in C-states.
Signed-off-by: Janne Peltonen <janne.peltonen@nokia.com>
Reviewed-by: Tuomas Taipale <tuomas.taipale@nokia.com>
|
|
Implement the new load and store synchronization barriers with
x86 and aarch64 instructions. The default implementation falls
back to the strongest GCC built-in (__sync_synchronize()), which
would be the strong enough on x86 (mfence), but too weak on
aarch64 (dmb).
Signed-off-by: Petri Savolainen <petri.savolainen@nokia.com>
Reviewed-by: Matias Elo <matias.elo@nokia.com>
Reviewed-by: Jere Leppänen <jere.leppanen@nokia.com>
|
|
INVTSC x86 CPU flag may not be always available with VMs. So, try also to
find 'constant_tsc' flag from /proc/cpuinfo.
Signed-off-by: Matias Elo <matias.elo@nokia.com>
Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
|
|
Refactor time codebase to enable more optimized architecture specific
implementations. After this commit x86 and aarch64 architectures are
assumed to always have support for HW time. The fallback to POSIX time
functions has been removed from these architectures for improved
performance.
Signed-off-by: Matias Elo <matias.elo@nokia.com>
Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
|
|
Update x86 CPU flags code from DPDK v23.03. DPDK copyright has been updated
to the currently used format.
Signed-off-by: Matias Elo <matias.elo@nokia.com>
Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
|
|
Prefix implementation internal debug macro names with underscore.
Signed-off-by: Matias Elo <matias.elo@nokia.com>
Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
|
|
Implement crypto random data using rdrand, and true random data using
rdseed, via compiler builtin functions.
Add architecture-specific file for crypto random and true random
functions.
Signed-off-by: Jere Leppänen <jere.leppanen@nokia.com>
Reviewed-by: Janne Peltonen <janne.peltonen@nokia.com>
|
|
Refactor CPU ABI and implementation files to follow common project inlining
style. odp_cpu_pause() function is now defined only once per architecture.
After this clean-up it's simpler for an implementation to add inlined
versions of CPU module functions.
Signed-off-by: Matias Elo <matias.elo@nokia.com>
Reviewed-by: Jere Leppänen <jere.leppanen@nokia.com>
|
|
Fix conversion warning "uint32_t {aka unsigned int}' from 'long long
unsigned int' may alter its value".
Signed-off-by: Matias Elo <matias.elo@nokia.com>
Reviewed-by: Jere Leppänen <jere.leppanen@nokia.com>
|
|
Implemented strict versions of local and global time stamp read
functions. Moved time register read code into inline functions
on ARMv8.
Signed-off-by: Petri Savolainen <petri.savolainen@nokia.com>
Reviewed-by: Matias Elo <matias.elo@nokia.com>
Reviewed-by: Jere Leppänen <jere.leppanen@nokia.com>
|
|
Use x86 SSE 4.2 crc32 instructions via gcc builtin functions, if
available. These instructions support crc32c only.
Signed-off-by: Jere Leppänen <jere.leppanen@nokia.com>
Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
|
|
The _ODP_UNALIGNED pre-processor macro is defined as 1 if the CPU
features efficient unaligned memory access, 0 otherwise.
Signed-off-by: Jere Leppänen <jere.leppanen@nokia.com>
Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
|
|
Rename some symbols that are global in the static library, in order to
avoid clashes with application code. The prefix "_odp_" is added to
the existing names.
This patch renames most of the global symbols, a few more still remain
to be renamed.
Signed-off-by: Jere Leppänen <jere.leppanen@nokia.com>
Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
|
|
Implement the new odp_system_info() function.
Signed-off-by: Petri Savolainen <petri.savolainen@nokia.com>
Reviewed-by: Matias Elo <matias.elo@nokia.com>
Reviewed-by: Govindarajan Mohandoss <Govindarajan.Mohandoss@arm.com>
|
|
Rename internal define CONFIG_NUM_CPU to CONFIG_NUM_CPU_IDS to avoid
confusion.
Signed-off-by: Matias Elo <matias.elo@nokia.com>
Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
|
|
Previously, config.h header was not included in install dir. This caused a
compilation failure when an application tried to include ODP helper
headers.
config.h has been moved to include/odp subdirectory to avoid naming
conflicts and unnecessary includes have been removed.
Signed-off-by: Matias Elo <matias.elo@nokia.com>
Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
Reported-by: Mikko Parpala <mikko.parpala@nokia.com>
|
|
Some systems may have /proc interface not mounted, let
odp linux generic run there with dummy values.
https://bugs.linaro.org/show_bug.cgi?id=3989
Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org>
|
|
Signed-off-by: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org>
Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org>
Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
|
|
Usually, maximum CPU frequency is found from a cpufreq file.
Read that file first, if it's not found use cpuinfo instead.
If max freq cannot be found, use hard coded value and print
a warning.
Signed-off-by: Petri Savolainen <petri.savolainen@linaro.org>
Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org>
Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
|
|
Rename and move number of CPUs define into the config header
file.
Signed-off-by: Petri Savolainen <petri.savolainen@linaro.org>
Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org>
Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
|
|
Inline cpu HW time counter read function on x86. Time global
data structure is visible to applications, but Posix types
(timespec) or header files are not.
Signed-off-by: Petri Savolainen <petri.savolainen@linaro.org>
Reviewed-by: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org>
Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
|
|
Moved cpu cycle and pause functions into
arch/x86/odp_arch_cpu_inlines.h.
Uncommented pause function in spec file and removed it
from ABI file. It's safer for ABI compat mode to not have
code included into ABI spec files.
Other architectures use the default odp_arch_cpu_inlines.h,
which does not change the current implementation.
Signed-off-by: Petri Savolainen <petri.savolainen@linaro.org>
Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org>
Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
|
|
Add global init function to check e.g. if CPU cycle counter
instruction is available on x86.
Signed-off-by: Petri Savolainen <petri.savolainen@linaro.org>
Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org>
Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
|
|
odp_internal.h contained code for three different purposes. Split
file into three different headers, so that it's no more a place
for random type/function prototype additions.
New files are:
* odp_init_internal.h which holds global/local init function
prototypes
* odp_global_data.h which defines global data structure
* odp_sysinfo_internal.h which contains system info internal
function prototypes
Signed-off-by: Petri Savolainen <petri.savolainen@linaro.org>
Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org>
Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
|
|
update Copyrights with the same script in rebased branch.
Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
|
|
Using simple commands:
find . -not -path .git -type f -exec \
sed -i -E 's/ (201[0-9]), Linaro/ \1-2018, Linaro/g' {} +
find . -not -path .git -type f -exec \
sed -i -E 's/ (201[0-9])(-201[0-9]), Linaro/ \1-2018, Linaro/g' {} +
Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org>
|
|
_ODP_CACHE_LINE_SIZE is only used to define ODP_CACHE_LINE_SIZE. Drop
interim define and make cpu.h directly define ODP_CACHE_LINE_SIZE.
Signed-off-by: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org>
Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org>
Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
|
|
Signed-off-by: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org>
Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org>
Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
|
|
There were changes in master branch on the way architecture files are
treated. Update api-next after merging in master to follow those
changes.
Signed-off-by: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org>
Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
|
|
Signed-off-by: Brian Brooks <brian.brooks@arm.com>
Signed-off-by: Ola Liljedahl <ola.liljedahl@arm.com>
Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
Reviewed-and-tested-by: Yi He <yi.he@linaro.org>
Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
|
|
CPU cycle functions were mixed over odp_cpu_cycles.c and
odp_cpu_arch.c files. Implement all three cpu cycle API
functions in odp_cpu_cycles.c. odp_cpu_arch.c is deleted.
Signed-off-by: Petri Savolainen <petri.savolainen@linaro.org>
Reviewed-by: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org>
Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org>
Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
|
|
Rename odp_time_internal.h to odp_arch_time_internal.h, and
move it under arch directory. This header specifies internal
CPU arch specific time counter functions. All architectures
must implement these functions.
Signed-off-by: Petri Savolainen <petri.savolainen@linaro.org>
Reviewed-by: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org>
Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org>
Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
|
|
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org>
Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
|
|
PR#171 broke some of the functionality we had on getting cpu speed.
This patch reverts parts of that commit adding a fallback when
/sys/devices/system/cpu/cpuX/cpufreq/ is not available.
Solves https://bugs.linaro.org/show_bug.cgi?id=3249
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org>
Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
|
|
Rewrite ARCH-specific files so that there is no significant code
duplication between different arch files and default files set.
Signed-off-by: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org>
Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org>
Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
|
|
When CPU frequency info under /sys is available,
use the real value instead of default value.
Signed-off-by: Kelvin Cheung <keguang.zhang@gmail.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
|
|
It is quite logical to enable nostdinc option non global level instead
of defining it only for some of the tests.
Signed-off-by: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org>
Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
|
|
Signed-off-by: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org>
Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
|
|
Add short warm up round and measure over a longer period of
time (250ms vs 100ms).
Signed-off-by: Petri Savolainen <petri.savolainen@linaro.org>
Reviewed-and-tested-by: Bill Fischofer <bill.fischofer@linaro.org>
Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
|
|
Use 64 bit HW time counter when available. It is used on
x86 when invariant TSC CPU flag indicates that TSC frequency
is constant. Otherwise, the system time is used as before. Direct
HW time counter usage avoids system call, and related latency
and performance issues.
Signed-off-by: Petri Savolainen <petri.savolainen@linaro.org>
Reviewed-and-tested-by: Bill Fischofer <bill.fischofer@linaro.org>
Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
|
|
Print API, impl name, CPU model/freq, cache line size and
CPU count by default. Print CPU flags in case of x86.
Signed-off-by: Petri Savolainen <petri.savolainen@linaro.org>
Reviewed-and-tested-by: Bill Fischofer <bill.fischofer@linaro.org>
Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
|
|
When building on x86 CPU flags can be used to determine which
CPU features are supported. CPU flag definitions and the code
to read the flags is from DPDK.
Signed-off-by: Petri Savolainen <petri.savolainen@linaro.org>
Reviewed-and-tested-by: Bill Fischofer <bill.fischofer@linaro.org>
Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
|
|
Define the ODP API for cache line size to the cache line size defined
in the internal architecture directories. Prefix internal cache line
size identifier with '_odp'.
Signed-off-by: Brian Brooks <brian.brooks@linaro.org>
Reviewed-by: Christophe Milard <christophe.milard@linaro.org>
Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
|
|
A little bit code clean up to drop odp_ prefix from internal things
and rename huge_pages to default_huge_pages internal struct.
Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
Reviewed-by: Bill Fischofer <bll.fischofer@linaro.org>
|
|
Previously, the sysinfo cpuinfo parser assumed that every CPU model has
an @ sign, after which comes the maximum CPU frequency. However, many
environments such as virtualized KVM environments have CPU models not
having @ sign such as "Intel Xeon E312xx (Sandy Bridge)".
The result of the missing @ sign was that the ODP program crashed.
The fix is to not assume the @ sign is always there. This may leave
cpu_hz_max uninitialized, but then again this is already what is done if
the string after @ does not conform to the pattern.
Signed-off-by: Juha-Matti Tilli <juha-matti.tilli@nokia.com>
Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org>
Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
|
|
Currently all ODP_CACHE_LINE_SIZE macros for different architectures are
held in one header file, they should be moved to their own arch file.
This patch moves ODP_CACHE_LINE_SIZE for x86.
Signed-off-by: Mike Holmes <mike.holmes@linaro.org>
Signed-off-by: Hongbo Zhang <hongbo.zhang@linaro.org>
Reviewed-and-tested-by: Bill Fischofer <bill.fischofer@linaro.org>
Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
|
|
Fix build error while building an application against ODP
/media/data/src/install-odp-api-next/include/odp/api/cpu.h:20:26: fatal
error: odp/cpu_arch.h: No such file or directory
#include <odp/cpu_arch.h>
compilation terminated.
Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
Reviewed-by: Christophe Milard <christophe.milard@linaro.org>
Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
|