On 11-Oct-20 11:07 AM, Jerin Jacob wrote:
On Fri, Oct 9, 2020 at 9:32 PM Anatoly Burakov
<anatoly.bura...@intel.com> wrote:

Currently, it is not possible to check support for intrinsics that
are platform-specific, cannot be abstracted in a generic way, or do not
have support on all architectures. The CPUID flags can be used to some
extent, but they are only defined for their platform, while intrinsics
will be available to all code as they are in generic headers.

This patch introduces infrastructure to check support for certain
platform-specific intrinsics, and adds support for checking support for
IA power management-related intrinsics for UMWAIT/UMONITOR and TPAUSE.

Signed-off-by: Anatoly Burakov <anatoly.bura...@intel.com>
---
  .../arm/include/rte_power_intrinsics.h        |  8 ++++++
  lib/librte_eal/arm/rte_cpuflags.c             |  6 +++++
  lib/librte_eal/include/generic/rte_cpuflags.h | 26 +++++++++++++++++++
  .../include/generic/rte_power_intrinsics.h    |  8 ++++++
  .../ppc/include/rte_power_intrinsics.h        |  8 ++++++
  lib/librte_eal/ppc/rte_cpuflags.c             |  6 +++++
  lib/librte_eal/rte_eal_version.map            |  1 +
  .../x86/include/rte_power_intrinsics.h        |  8 ++++++
  lib/librte_eal/x86/rte_cpuflags.c             | 12 +++++++++
  9 files changed, 83 insertions(+)

diff --git a/lib/librte_eal/arm/include/rte_power_intrinsics.h 
b/lib/librte_eal/arm/include/rte_power_intrinsics.h
index 4aad44a0b9..055ec5877a 100644
--- a/lib/librte_eal/arm/include/rte_power_intrinsics.h
+++ b/lib/librte_eal/arm/include/rte_power_intrinsics.h
@@ -17,6 +17,10 @@ extern "C" {
  /**
   * This function is not supported on ARM.
   *
+ * @warning It is responsibility of the user to check if this function is
+ *   supported at runtime using `rte_cpu_get_features()` API call. Failing to 
do
+ *   so may result in an illegal CPU instruction error.

See below

+ *
   * @param p
   *   Address to monitor for changes. Must be aligned on an 64-byte boundary.
   * @param expected_value
@@ -43,6 +47,10 @@ static inline void rte_power_monitor(const volatile void *p,
  /**
   * This function is not supported on ARM.
   *
+ * @warning It is responsibility of the user to check if this function is
+ *   supported at runtime using `rte_cpu_get_features()` API call. Failing to 
do
+ *   so may result in an illegal CPU instruction error.
+ *
See below

This patch looks to me.

Since rte_power_monitor() API is public API, I think, only in the
generic header file, you need to have
these warnings and API documentation rather than repeating everywhere.


Great, will fix in v6 so. Thanks!

--
Thanks,
Anatoly

Reply via email to