dev.dpdk.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] eal/x86: enable timeout in AMD power monitor
@ 2025-10-13  3:16 Sivaprasad Tummala
  2025-10-13  5:51 ` [PATCH v2] " Sivaprasad Tummala
  0 siblings, 1 reply; 2+ messages in thread
From: Sivaprasad Tummala @ 2025-10-13  3:16 UTC (permalink / raw)
  To: david.hunt, anatoly.burakov, jerinj, radu.nicolau, gakhil,
	cristian.dumitrescu, ferruh.yigit, konstantin.ananyev
  Cc: dev, stable

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: stable@dpdk.org

Signed-off-by: Sivaprasad Tummala <sivaprasad.tummala@amd.com>
---
 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..010254548d 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
 }
 
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [PATCH v2] eal/x86: enable timeout in AMD power monitor
  2025-10-13  3:16 [PATCH] eal/x86: enable timeout in AMD power monitor Sivaprasad Tummala
@ 2025-10-13  5:51 ` Sivaprasad Tummala
  0 siblings, 0 replies; 2+ messages in thread
From: Sivaprasad Tummala @ 2025-10-13  5:51 UTC (permalink / raw)
  To: david.hunt, anatoly.burakov, jerinj, radu.nicolau, gakhil,
	cristian.dumitrescu, ferruh.yigit, konstantin.ananyev
  Cc: dev, stable

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: stable@dpdk.org

Signed-off-by: Sivaprasad Tummala <sivaprasad.tummala@amd.com>

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
 }
 
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-10-13  5:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-13  3:16 [PATCH] eal/x86: enable timeout in AMD power monitor Sivaprasad Tummala
2025-10-13  5:51 ` [PATCH v2] " Sivaprasad Tummala

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).