The resctrl selftest currently fails on Hygon CPUs that support Platform
QoS features, printing the error:
"# Can not get vendor info..."
This occurs because vendor detection is missing for Hygon CPUs.
Fix this by extending the CPU vendor detection logic to include
Hygon's vendor ID.
Signed-off-by: Xiaochen Shen <shenxiaochen@open-hieco.net>
---
tools/testing/selftests/resctrl/resctrl.h | 1 +
tools/testing/selftests/resctrl/resctrl_tests.c | 2 ++
2 files changed, 3 insertions(+)
diff --git a/tools/testing/selftests/resctrl/resctrl.h b/tools/testing/selftests/resctrl/resctrl.h
index cd3adfc14969..df2a59e0141e 100644
--- a/tools/testing/selftests/resctrl/resctrl.h
+++ b/tools/testing/selftests/resctrl/resctrl.h
@@ -38,6 +38,7 @@
*/
#define ARCH_INTEL 1
#define ARCH_AMD 2
+#define ARCH_HYGON 3
#define END_OF_TESTS 1
diff --git a/tools/testing/selftests/resctrl/resctrl_tests.c b/tools/testing/selftests/resctrl/resctrl_tests.c
index 5154ffd821c4..9bf35f3beb6b 100644
--- a/tools/testing/selftests/resctrl/resctrl_tests.c
+++ b/tools/testing/selftests/resctrl/resctrl_tests.c
@@ -42,6 +42,8 @@ static int detect_vendor(void)
vendor_id = ARCH_INTEL;
else if (s && !strcmp(s, ": AuthenticAMD\n"))
vendor_id = ARCH_AMD;
+ else if (s && !strcmp(s, ": HygonGenuine\n"))
+ vendor_id = ARCH_HYGON;
fclose(inf);
free(res);
--
2.47.3
Hi Xiaochen, On 12/4/25 4:38 AM, Xiaochen Shen wrote: > The resctrl selftest currently fails on Hygon CPUs that support Platform > QoS features, printing the error: > > "# Can not get vendor info..." > > This occurs because vendor detection is missing for Hygon CPUs. > > Fix this by extending the CPU vendor detection logic to include > Hygon's vendor ID. > > Signed-off-by: Xiaochen Shen <shenxiaochen@open-hieco.net> > --- > tools/testing/selftests/resctrl/resctrl.h | 1 + > tools/testing/selftests/resctrl/resctrl_tests.c | 2 ++ > 2 files changed, 3 insertions(+) > > diff --git a/tools/testing/selftests/resctrl/resctrl.h b/tools/testing/selftests/resctrl/resctrl.h > index cd3adfc14969..df2a59e0141e 100644 > --- a/tools/testing/selftests/resctrl/resctrl.h > +++ b/tools/testing/selftests/resctrl/resctrl.h > @@ -38,6 +38,7 @@ > */ > #define ARCH_INTEL 1 > #define ARCH_AMD 2 > +#define ARCH_HYGON 3 The comment before these defines attempts to provide guidance but it is clearly still quite subtle that these values are required to be unique bits. Consider for example their usage in test_vendor_specific_check(): return get_vendor() & test->vendor_specific This should either be 4 or a better solution is probably to switch all of these to use BIT() (linux/bits.h is available via tools/include that is already in include path). Reinette
Hi Reinette, On 12/5/2025 7:48 AM, Reinette Chatre wrote: >> #define ARCH_INTEL 1 >> #define ARCH_AMD 2 >> +#define ARCH_HYGON 3 > The comment before these defines attempts to provide guidance but it is clearly still > quite subtle that these values are required to be unique bits. Consider for example > their usage in test_vendor_specific_check(): > return get_vendor() & test->vendor_specific > > This should either be 4 or a better solution is probably to switch all of these to use > BIT() (linux/bits.h is available via tools/include that is already in include path). > > Reinette Thank you. How about this code change? +#include <linux/bits.h> ... -#define ARCH_INTEL 1 -#define ARCH_AMD 2 +#define ARCH_INTEL BIT(0) +#define ARCH_AMD BIT(1) +#define ARCH_HYGON BIT(2) Best regards, Xiaochen Shen
© 2016 - 2025 Red Hat, Inc.