public inbox for fio@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Add Zhaoxin support to enable tsc_reliable and arch_random features
@ 2025-05-21  2:04 Runa Guo-oc
  2025-05-21 13:20 ` Jens Axboe
  2025-05-21 17:49 ` fiotestbot
  0 siblings, 2 replies; 10+ messages in thread
From: Runa Guo-oc @ 2025-05-21  2:04 UTC (permalink / raw)
  To: fio, axboe, vincentfu
  Cc: cobechen, tonywwang, xanderchen, louisqi, runaguo, leoliu

Signed-off-by: Runa Guo-oc <RunaGuo-oc@zhaoxin.com>
---
 arch/arch-x86-common.h | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/arch/arch-x86-common.h b/arch/arch-x86-common.h
index f32835cc..fbbbd62e 100644
--- a/arch/arch-x86-common.h
+++ b/arch/arch-x86-common.h
@@ -56,6 +56,33 @@ static inline void arch_init_amd(void)
 	tsc_reliable = (edx & (1U << 8)) != 0;
 }
 
+static inline void arch_init_zhaoxin(void)
+{
+	unsigned int eax, ebx, ecx = 0, edx;
+
+	/*
+	 * Check for TSC
+	 */
+	eax = 1;
+	do_cpuid(&eax, &ebx, &ecx, &edx);
+	if (!(edx & (1U << 4)))
+		return;
+
+	/*
+	 * Check for constant rate and synced (across cores) TSC
+	 */
+	eax = 0x80000007;
+	do_cpuid(&eax, &ebx, &ecx, &edx);
+	tsc_reliable = (edx & (1U << 8)) != 0;
+
+	/*
+	 * Check for FDRAND
+	 */
+	eax = 0x1;
+	do_cpuid(&eax, &ebx, &ecx, &edx);
+	arch_random = (ecx & (1U << 30)) != 0;
+}
+
 static inline void arch_init(char *envp[])
 {
 	unsigned int level;
@@ -72,6 +99,8 @@ static inline void arch_init(char *envp[])
 		arch_init_intel();
 	else if (!strcmp(str, "AuthenticAMD") || !strcmp(str, "HygonGenuine"))
 		arch_init_amd();
+	else if (!strcmp(str, "  Shanghai  ") || !strcmp(str, "CentaurHauls"))
+		arch_init_zhaoxin();
 }
 
 #endif
-- 
2.17.1


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

* Re: [PATCH] Add Zhaoxin support to enable tsc_reliable and arch_random features
  2025-05-21  2:04 Runa Guo-oc
@ 2025-05-21 13:20 ` Jens Axboe
  2025-05-21 17:49 ` fiotestbot
  1 sibling, 0 replies; 10+ messages in thread
From: Jens Axboe @ 2025-05-21 13:20 UTC (permalink / raw)
  To: Runa Guo-oc, fio, vincentfu
  Cc: cobechen, tonywwang, xanderchen, louisqi, runaguo, leoliu

On 5/20/25 8:04 PM, Runa Guo-oc wrote:
> Signed-off-by: Runa Guo-oc <RunaGuo-oc@zhaoxin.com>

This is literally the same as the intel one, why duplicate all
of that? Just do:

diff --git a/arch/arch-x86-common.h b/arch/arch-x86-common.h
index f32835cce33b..ac26126ae84a 100644
--- a/arch/arch-x86-common.h
+++ b/arch/arch-x86-common.h
@@ -68,7 +68,8 @@ static inline void arch_init(char *envp[])
 			 (unsigned int *) &str[4]);
 
 	str[12] = '\0';
-	if (!strcmp(str, "GenuineIntel"))
+	if (!strcmp(str, "GenuineIntel") || !strcmp(str, "  Shanghai  ") ||
+	    !strcmp(str, "CentaurHauls"))
 		arch_init_intel();
 	else if (!strcmp(str, "AuthenticAMD") || !strcmp(str, "HygonGenuine"))
 		arch_init_amd();

-- 
Jens Axboe

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

* Re: [PATCH] Add Zhaoxin support to enable tsc_reliable and arch_random features
  2025-05-21  2:04 Runa Guo-oc
  2025-05-21 13:20 ` Jens Axboe
@ 2025-05-21 17:49 ` fiotestbot
  1 sibling, 0 replies; 10+ messages in thread
From: fiotestbot @ 2025-05-21 17:49 UTC (permalink / raw)
  To: fio

[-- Attachment #1: Type: text/plain, Size: 144 bytes --]


The result of fio's continuous integration tests was: success

For more details see https://github.com/fiotestbot/fio/actions/runs/15164633006

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

* [PATCH] Add Zhaoxin support to enable tsc_reliable and arch_random features
@ 2025-05-22  4:37 Runa Guo-oc
  2025-05-22  6:49 ` fiotestbot
  2025-05-22  8:07 ` Sitsofe Wheeler
  0 siblings, 2 replies; 10+ messages in thread
From: Runa Guo-oc @ 2025-05-22  4:37 UTC (permalink / raw)
  To: fio, axboe, vincentfu
  Cc: cobechen, tonywwang, xanderchen, louisqi, runaguo, leoliu

Signed-off-by: Runa Guo-oc <RunaGuo-oc@zhaoxin.com>
---
 arch/arch-x86-common.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/arch-x86-common.h b/arch/arch-x86-common.h
index f32835cc..bd329c32 100644
--- a/arch/arch-x86-common.h
+++ b/arch/arch-x86-common.h
@@ -68,7 +68,8 @@ static inline void arch_init(char *envp[])
 			 (unsigned int *) &str[4]);
 
 	str[12] = '\0';
-	if (!strcmp(str, "GenuineIntel"))
+	if (!strcmp(str, "GenuineIntel")) || (!strcmp(str, "  Shanghai  ") ||
+	    !strcmp(str, "CentaurHauls"))
 		arch_init_intel();
 	else if (!strcmp(str, "AuthenticAMD") || !strcmp(str, "HygonGenuine"))
 		arch_init_amd();
-- 
2.17.1


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

* Re: [PATCH] Add Zhaoxin support to enable tsc_reliable and arch_random features
  2025-05-22  4:37 [PATCH] Add Zhaoxin support to enable tsc_reliable and arch_random features Runa Guo-oc
@ 2025-05-22  6:49 ` fiotestbot
  2025-05-22  8:07 ` Sitsofe Wheeler
  1 sibling, 0 replies; 10+ messages in thread
From: fiotestbot @ 2025-05-22  6:49 UTC (permalink / raw)
  To: fio

[-- Attachment #1: Type: text/plain, Size: 144 bytes --]


The result of fio's continuous integration tests was: failure

For more details see https://github.com/fiotestbot/fio/actions/runs/15179641974

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

* Re: [PATCH] Add Zhaoxin support to enable tsc_reliable and arch_random features
  2025-05-22  4:37 [PATCH] Add Zhaoxin support to enable tsc_reliable and arch_random features Runa Guo-oc
  2025-05-22  6:49 ` fiotestbot
@ 2025-05-22  8:07 ` Sitsofe Wheeler
  1 sibling, 0 replies; 10+ messages in thread
From: Sitsofe Wheeler @ 2025-05-22  8:07 UTC (permalink / raw)
  To: Runa Guo-oc
  Cc: fio, axboe, vincentfu, cobechen, tonywwang, xanderchen, louisqi,
	runaguo, leoliu

Hi,

On Thu, 22 May 2025 at 06:55, Runa Guo-oc <RunaGuo-oc@zhaoxin.com> wrote:
>
> Signed-off-by: Runa Guo-oc <RunaGuo-oc@zhaoxin.com>
> ---
>  arch/arch-x86-common.h | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
<snip>

On Thu, 22 May 2025 at 07:51, <fiotestbot@gmail.com> wrote:
>
>
> The result of fio's continuous integration tests was: failure
>
> For more details see https://github.com/fiotestbot/fio/actions/runs/15179641974

The bot has a point:

crc/../arch/arch-x86-common.h: In function ‘arch_init’:
135crc/../arch/arch-x86-common.h:71:43: error: expected expression
before ‘||’ token
136 71 | if (!strcmp(str, "GenuineIntel")) || (!strcmp(str, " Shanghai ") ||
137 | ^~
138crc/../arch/arch-x86-common.h:71:43: error: expected expression
before ‘||’ token
139 71 | if (!strcmp(str, "GenuineIntel")) || (!strcmp(str, " Shanghai ") ||
140 | ^~
141

Have you compiled and run this change to check it does what you expect?

-- 
Sitsofe

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

* [PATCH] Add Zhaoxin support to enable tsc_reliable and arch_random features
@ 2025-05-22 10:40 Runa Guo-oc
  2025-05-23  7:38 ` fiotestbot
  2025-05-23 15:46 ` Jens Axboe
  0 siblings, 2 replies; 10+ messages in thread
From: Runa Guo-oc @ 2025-05-22 10:40 UTC (permalink / raw)
  To: fio, axboe, vincentfu
  Cc: cobechen, tonywwang, xanderchen, louisqi, runaguo, leoliu

Signed-off-by: Runa Guo-oc <RunaGuo-oc@zhaoxin.com>
---
 arch/arch-x86-common.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/arch-x86-common.h b/arch/arch-x86-common.h
index f32835cc..ac26126a 100644
--- a/arch/arch-x86-common.h
+++ b/arch/arch-x86-common.h
@@ -68,7 +68,8 @@ static inline void arch_init(char *envp[])
 			 (unsigned int *) &str[4]);
 
 	str[12] = '\0';
-	if (!strcmp(str, "GenuineIntel"))
+	if (!strcmp(str, "GenuineIntel") || !strcmp(str, "  Shanghai  ") ||
+	    !strcmp(str, "CentaurHauls"))
 		arch_init_intel();
 	else if (!strcmp(str, "AuthenticAMD") || !strcmp(str, "HygonGenuine"))
 		arch_init_amd();
-- 
2.17.1


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

* Re: [PATCH] Add Zhaoxin support to enable tsc_reliable and arch_random features
  2025-05-22 10:40 Runa Guo-oc
@ 2025-05-23  7:38 ` fiotestbot
  2025-05-23 13:19   ` Vincent Fu
  2025-05-23 15:46 ` Jens Axboe
  1 sibling, 1 reply; 10+ messages in thread
From: fiotestbot @ 2025-05-23  7:38 UTC (permalink / raw)
  To: fio

[-- Attachment #1: Type: text/plain, Size: 146 bytes --]


The result of fio's continuous integration tests was: cancelled

For more details see https://github.com/fiotestbot/fio/actions/runs/15200130502

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

* Re: [PATCH] Add Zhaoxin support to enable tsc_reliable and arch_random features
  2025-05-23  7:38 ` fiotestbot
@ 2025-05-23 13:19   ` Vincent Fu
  0 siblings, 0 replies; 10+ messages in thread
From: Vincent Fu @ 2025-05-23 13:19 UTC (permalink / raw)
  To: fio

On 5/23/25 3:38 AM, fiotestbot@gmail.com wrote:
> 
> The result of fio's continuous integration tests was: cancelled
> 
> For more details see https://github.com/fiotestbot/fio/actions/runs/15200130502

The first test attempt was cancelled because Test 13 had not completed 
after nearly 6 hours. This is a longstanding issue that occurs from time 
to time and unrelated to this patch. I re-ran the failing platform and 
this second attempt passed.

Vincent

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

* Re: [PATCH] Add Zhaoxin support to enable tsc_reliable and arch_random features
  2025-05-22 10:40 Runa Guo-oc
  2025-05-23  7:38 ` fiotestbot
@ 2025-05-23 15:46 ` Jens Axboe
  1 sibling, 0 replies; 10+ messages in thread
From: Jens Axboe @ 2025-05-23 15:46 UTC (permalink / raw)
  To: fio, vincentfu, Runa Guo-oc
  Cc: cobechen, tonywwang, xanderchen, louisqi, runaguo, leoliu


On Thu, 22 May 2025 18:40:32 +0800, Runa Guo-oc wrote:
> 


Applied, thanks!

[1/1] Add Zhaoxin support to enable tsc_reliable and arch_random features
      commit: c348db31ccce60f2808dd84c1f43f36a1556141a

Best regards,
-- 
Jens Axboe




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

end of thread, other threads:[~2025-05-23 15:46 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-22  4:37 [PATCH] Add Zhaoxin support to enable tsc_reliable and arch_random features Runa Guo-oc
2025-05-22  6:49 ` fiotestbot
2025-05-22  8:07 ` Sitsofe Wheeler
  -- strict thread matches above, loose matches on Subject: below --
2025-05-22 10:40 Runa Guo-oc
2025-05-23  7:38 ` fiotestbot
2025-05-23 13:19   ` Vincent Fu
2025-05-23 15:46 ` Jens Axboe
2025-05-21  2:04 Runa Guo-oc
2025-05-21 13:20 ` Jens Axboe
2025-05-21 17:49 ` fiotestbot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox