On 10/13/2025 7:51 AM, Sivaprasad Tummala wrote:
Previously, the AMD power monitor implementation did not enable the
timeout, causing the lcore to remain in a wait state until an external
monitoring event occurred or an interrupt was received.

This patch enables the timeout-based exit condition, allowing
the lcore to automatically wake up after the specified period.
The maximum supported timeout value is 2^32 - 1.

Fixes: c7ed1ce04704 ("eal/x86: add power intrinsics for AMD")
Cc: [email protected]

Signed-off-by: Sivaprasad Tummala <[email protected]>

v2:
1. fixed asm compilation error.
---
  lib/eal/x86/rte_power_intrinsics.c | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/eal/x86/rte_power_intrinsics.c 
b/lib/eal/x86/rte_power_intrinsics.c
index 489ad3983f..8a5f222aea 100644
--- a/lib/eal/x86/rte_power_intrinsics.c
+++ b/lib/eal/x86/rte_power_intrinsics.c
@@ -89,14 +89,14 @@ static void amd_monitorx(volatile void *addr)
static void amd_mwaitx(const uint64_t timeout)
  {
-       RTE_SET_USED(timeout);
  #if defined(RTE_TOOLCHAIN_MSVC) || defined(__MWAITX__)
-       _mm_mwaitx(0, 0, 0);
+       _mm_mwaitx(2, 0, (uint32_t)timeout);
  #else
        asm volatile(".byte 0x0f, 0x01, 0xfb;"
                        : /* ignore rflags */
                        : "a"(0), /* enter C1 */
-                       "c"(0)); /* no time-out */
+                       "b"((uint32_t)timeout),
+                       "c"(2)); /* enable time-out */
  #endif
  }

Acked-by: Anatoly Burakov <[email protected]>

--
Thanks,
Anatoly

Reply via email to