Some venerable AMD processors do not support querying extended features
(EAX=7) with cpuid.
In this case, it is not a programmatic error and the runtime check should
simply return the isa is unsupported.

Reported-by: Davide Repetto <r...@idp.it>
Reported-at: https://bugzilla.redhat.com/show_bug.cgi?id=2211747
Fixes: b366fa2f4947 ("dpif-netdev: Call cpuid for x86 isa availability.")
Signed-off-by: David Marchand <david.march...@redhat.com>
---
 lib/cpu.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/cpu.c b/lib/cpu.c
index 0292f715ec..fbbea40053 100644
--- a/lib/cpu.c
+++ b/lib/cpu.c
@@ -37,7 +37,9 @@ static bool x86_has_isa(uint32_t leaf, enum x86_reg reg, 
uint32_t bit)
 {
     uint32_t regs[4];
 
-    ovs_assert(__get_cpuid_max(leaf & X86_LEAF_MASK, NULL) >= leaf);
+    if (__get_cpuid_max(leaf & X86_LEAF_MASK, NULL) < leaf) {
+        return false;
+    }
 
     __cpuid_count(leaf, 0, regs[EAX], regs[EBX], regs[ECX], regs[EDX]);
     return (regs[reg] & ((uint32_t) 1 << bit)) != 0;
-- 
2.40.1

_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to