Page MenuHomeFreeBSD

aokblast (ShengYi Hung)
AoK_Blast

Projects

User Details

User Since
Jun 21 2022, 7:17 PM (200 w, 2 d)

Recent Activity

Thu, Apr 16

aokblast committed rGe48e97945899: hwpstate_amd: Cache cpuid (authored by aokblast).
hwpstate_amd: Cache cpuid
Thu, Apr 16, 8:44 AM
aokblast closed D56305: hwpstate_amd: Cache cpuid.
Thu, Apr 16, 8:44 AM

Tue, Apr 14

aokblast added a comment to D56312: svm_msr: Allow reading and writing MSR_AMD_CPUID01 and 07..

Are these MSRs documented anywhere? Why is it always correct to return 0 when reading?

The MSR involved isn’t publicly documented; it’s only used to disable RDSEED across the Linux kernel (see the reference here: https://elixir.bootlin.com/linux/v6.19.11/source/arch/x86/kernel/cpu/amd.c#L1043
).
The logic is straightforward: it reads the MSR, checks whether the relevant bit is enabled, and clears it if so. If the bit isn’t set, it does nothing.
I haven’t been able to test this yet since it requires a Linux 6.19+ kernel. I’m still waiting for feedback from the reporter.

Then, don't we want to honour the MSR by ensuring that CPUID_STDEXT_RDSEED is not returned in x86_emulate_cpuid()?

Tue, Apr 14, 5:03 AM
aokblast committed rG43d632779b7d: x86: Mark LOCORE to prevent build failure on i386 platform (authored by aokblast).
x86: Mark LOCORE to prevent build failure on i386 platform
Tue, Apr 14, 4:59 AM
aokblast closed D56377: x86: Mark LOCORE to prevent build failure on i386 platform.
Tue, Apr 14, 4:59 AM
aokblast added a comment to D56330: x86: Add zen identifier helper function.

Put #ifndef _LOCORE around the proto.

With _LOCORE I had the same build error. I was able to proceed by using LOCORE instead.

diff --git a/sys/x86/include/cputypes.h b/sys/x86/include/cputypes.h
index ed26304a89ac..0b6f0f3746a9 100644
--- a/sys/x86/include/cputypes.h
+++ b/sys/x86/include/cputypes.h
@@ -54,7 +54,9 @@
 #define CPU_AMD_UNKNOWN                0xffffffff
 
 #ifdef _KERNEL
+#ifndef LOCORE
 u_int  ident_zen_cpu(void);
 #endif
+#endif
 
 #endif /* !_X86_CPUTYPES_H_ */
--------------------------------------------------------------
>>> Kernel build for GENERIC completed on Mon Apr 13 16:27:27 UTC 2026
--------------------------------------------------------------
>>> Kernel(s)  GENERIC built in 144 seconds, ncpu: 32, make -j32
--------------------------------------------------------------
Tue, Apr 14, 4:58 AM
aokblast updated the diff for D56377: x86: Mark LOCORE to prevent build failure on i386 platform.

Use correct name

Tue, Apr 14, 4:49 AM

Mon, Apr 13

aokblast requested review of D56377: x86: Mark LOCORE to prevent build failure on i386 platform.
Mon, Apr 13, 2:47 PM
aokblast added a comment to D56330: x86: Add zen identifier helper function.
Mon, Apr 13, 2:08 PM
aokblast added a comment to D56330: x86: Add zen identifier helper function.

As reported by https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=294468, cputypes.h is used in ASM code on i386 build so we cannot put the function declaration inside cputypes.h. machine/cpu.h also has this issue. @kib, is there any place you think that we can put?

Mon, Apr 13, 2:06 PM
aokblast added a reviewer for D55497: linuxkpi: Fix DMA_BIDIRECTIONAL mapping: bz.
Mon, Apr 13, 11:45 AM

Sun, Apr 12

aokblast added a comment to D56312: svm_msr: Allow reading and writing MSR_AMD_CPUID01 and 07..

Are these MSRs documented anywhere? Why is it always correct to return 0 when reading?

Sun, Apr 12, 2:25 PM

Sat, Apr 11

aokblast committed rG5f5cc3c67ae8: compat/linprocfs: Update /proc/partitions output (authored by ankohuu_outlook.com).
compat/linprocfs: Update /proc/partitions output
Sat, Apr 11, 2:12 PM

Fri, Apr 10

aokblast updated the diff for D56267: wpa: Fix permission leakage when updating configuration file.

Move the check beforehead

Fri, Apr 10, 2:45 PM
aokblast committed rG2358492b0347: x86: Add zen identifier helper function (authored by aokblast).
x86: Add zen identifier helper function
Fri, Apr 10, 1:52 PM
aokblast closed D56330: x86: Add zen identifier helper function.
Fri, Apr 10, 1:52 PM
aokblast added inline comments to D56330: x86: Add zen identifier helper function.
Fri, Apr 10, 12:51 PM
aokblast updated the diff for D56330: x86: Add zen identifier helper function.

Move function prototype

Fri, Apr 10, 12:45 PM
aokblast updated the diff for D56330: x86: Add zen identifier helper function.

Loop the whole array and put the macro to other file

Fri, Apr 10, 11:24 AM
aokblast added inline comments to D56330: x86: Add zen identifier helper function.
Fri, Apr 10, 11:06 AM
aokblast added a comment to D56330: x86: Add zen identifier helper function.

This was also a requirement for https://reviews.freebsd.org/D56332 and should be useless now. However, amdtemp driver now hardcode this zen detection logic in the amdtemp.c file, we can use ident_zen_cpu to refactor the amdtemp code.

Fri, Apr 10, 11:03 AM
aokblast added a comment to D56331: ucode: Add ucode match helper function.
In D56331#1288977, @kib wrote:

Can you explain why is it needed?

Fri, Apr 10, 10:58 AM
aokblast updated the diff for D56330: x86: Add zen identifier helper function.

Use structure instead of ifdef.

Fri, Apr 10, 10:55 AM
aokblast accepted D56320: Status/2026Q1/cppc.adoc: Add report.

LGTM

Fri, Apr 10, 2:28 AM

Thu, Apr 9

aokblast abandoned D56332: rdseed: Disable rdseed on zen5.

I came across this in a Bugzilla report. As described in the commit message, it may pollute the system entropy pool. Although the microcode fix is already included in the latest AGESA release from earlier this year—so systems with updated BIOS firmware should be unaffected, not all users regularly update their BIOS, and not all vendors have distributed the patch.

Given that, I think this issue is still worth taking a closer look.

Per https://www.amd.com/en/resources/product-security/bulletin/amd-sb-7055.html (and the linked thread), only rdseed with a 16-bit or 32-bit operand is affected, but here it's a 64-bit output.

Thu, Apr 9, 3:49 PM
aokblast added inline comments to D56331: ucode: Add ucode match helper function.
Thu, Apr 9, 3:36 PM
aokblast added a comment to D56332: rdseed: Disable rdseed on zen5.

I came across this in a Bugzilla report. As described in the commit message, it may pollute the system entropy pool. Although the microcode fix is already included in the latest AGESA release from earlier this year—so systems with updated BIOS firmware should be unaffected, not all users regularly update their BIOS, and not all vendors have distributed the patch.

Thu, Apr 9, 2:49 PM
aokblast added a reviewer for D56332: rdseed: Disable rdseed on zen5: secteam.
Thu, Apr 9, 2:41 PM
aokblast added a comment to D56320: Status/2026Q1/cppc.adoc: Add report.

I feel like the grammar is wrong but since I am not a native English speaker....

Thu, Apr 9, 2:31 PM
aokblast added inline comments to D56330: x86: Add zen identifier helper function.
Thu, Apr 9, 2:23 PM
aokblast requested review of D56332: rdseed: Disable rdseed on zen5.
Thu, Apr 9, 1:31 PM
aokblast requested review of D56331: ucode: Add ucode match helper function.
Thu, Apr 9, 1:31 PM
aokblast requested review of D56330: x86: Add zen identifier helper function.
Thu, Apr 9, 1:30 PM

Wed, Apr 8

aokblast committed rG16aa49f6d1bb: compat/linprocfs: Fix auxv sbuf leak (authored by ankohuu_outlook.com).
compat/linprocfs: Fix auxv sbuf leak
Wed, Apr 8, 3:32 PM
aokblast requested review of D56312: svm_msr: Allow reading and writing MSR_AMD_CPUID01 and 07..
Wed, Apr 8, 3:11 PM
aokblast updated the diff for D56311: x86/specialreg: Add MSR_AMD_CPUID01 MSR..

Remove unneeded change

Wed, Apr 8, 3:08 PM
aokblast requested review of D56311: x86/specialreg: Add MSR_AMD_CPUID01 MSR..
Wed, Apr 8, 3:06 PM
aokblast requested review of D56305: hwpstate_amd: Cache cpuid.
Wed, Apr 8, 12:59 PM
aokblast committed rG095cbb1bb7f7: hwpstate_amd: Expose nodes as much as possible in legacy pstate (authored by aokblast).
hwpstate_amd: Expose nodes as much as possible in legacy pstate
Wed, Apr 8, 7:49 AM
aokblast closed D55606: hwpstate_amd: Expose node as much as possible.
Wed, Apr 8, 7:49 AM

Tue, Apr 7

aokblast added a comment to D56022: libc: Remove redundant code in thread atexit code.
In D56022#1282431, @kib wrote:
In D56022#1281980, @kib wrote:

No. Perhaps it is simpler to show code than to try to explain it, See D56053.

The example you provided would not work with my patch, it requires increasing the CXA_DTORS_ITERATIONS. Not sure if we want this.

If it breaks the valid C++ code, we should rethink about it. The T value can be somehow greater than CXA_DTORS_ITERATIONS if the user wants.

I do not disagree but there are also some robustness requirements as part of the implementation quality. So I am unsire, this is why I initially said that 'I am on edge' proposing this. Hanging in the system state (thread exiting) due to user bug is not robust.

That said, your patch should remove walk_cb_nocall(). And perhaps cxa_thread_walk() could drop the argument, simply inlining walk_cb_call.

Tue, Apr 7, 2:36 PM
aokblast updated the diff for D56022: libc: Remove redundant code in thread atexit code.

Remove more unused code

Tue, Apr 7, 2:31 PM
aokblast added a reviewer for D56291: [OpenSSL] Add missing header file (openssl/ml_kem.h): fluffy.
Tue, Apr 7, 1:27 PM
aokblast added a comment to D56267: wpa: Fix permission leakage when updating configuration file.
In D56267#1287651, @bz wrote:

I wonder multiple things:
(a) is this a problem with umask for the wpa_supplicant process and could be fixed in the startup script for the general FreeBSD case for as long as a user does not run things manually?

No, other wpa consumer, like the wutui from GSoC 2025 can trigger this.

(b) should the code not check the original config file permissions and apply these? (generic solution?)

Yes, you are right. Fix it now! Thanks!

(c) if there is no file, hard coding these as for android would need #ifdef around.

Ok.

Tue, Apr 7, 12:27 PM
aokblast updated the diff for D56267: wpa: Fix permission leakage when updating configuration file.

Apply permission by honoring original permission

Tue, Apr 7, 12:25 PM
aokblast updated the diff for D55628: hwpstate_intel: Use ipi instead of thread_lock + sched_bind.

Minor fixes

Tue, Apr 7, 12:21 PM

Mon, Apr 6

aokblast updated the diff for D55592: acpi: Add acpi_fan.

Fix FPS parse

Mon, Apr 6, 1:05 PM
aokblast updated the diff for D55592: acpi: Add acpi_fan.

Fixup for sysctl node

Mon, Apr 6, 12:52 PM
aokblast added a reviewer for D56267: wpa: Fix permission leakage when updating configuration file: bz.
Mon, Apr 6, 6:35 AM
aokblast requested review of D56267: wpa: Fix permission leakage when updating configuration file.
Mon, Apr 6, 6:35 AM

Mon, Mar 30

aokblast added inline comments to D55628: hwpstate_intel: Use ipi instead of thread_lock + sched_bind.
Mon, Mar 30, 7:20 AM
aokblast committed rGe6eba5076929: vmm: Add missing AVX instructions for AVX512 in cpuid stdext (authored by aokblast).
vmm: Add missing AVX instructions for AVX512 in cpuid stdext
Mon, Mar 30, 7:20 AM
aokblast closed D56021: vmm: Add missing AVX instructions for AVX512 in cpuid stdext.
Mon, Mar 30, 7:20 AM
aokblast added a comment to D56053: cxa_thread_call_dtors(): restore limit on the number of destructors called.

Seems ok, but I'm not sure if it's sufficient for the LLVM test case that @aokblast was looking at.

Mon, Mar 30, 7:11 AM
aokblast updated the diff for D55629: hwpstate_intel: Use 8bit scale instead of percentage scale.

Minor fixes

Mon, Mar 30, 7:09 AM
aokblast updated the diff for D55628: hwpstate_intel: Use ipi instead of thread_lock + sched_bind.

Fixes

Mon, Mar 30, 7:07 AM

Thu, Mar 26

aokblast added inline comments to D56021: vmm: Add missing AVX instructions for AVX512 in cpuid stdext.
Thu, Mar 26, 3:15 PM
aokblast retitled D56021: vmm: Add missing AVX instructions for AVX512 in cpuid stdext from vmm: Add more AVX instruction for AVX512 in cpuid stdext2 to vmm: Add missing AVX instructions for AVX512 in cpuid stdext.
Thu, Mar 26, 3:07 PM
aokblast updated the diff for D56021: vmm: Add missing AVX instructions for AVX512 in cpuid stdext.

Fix also in stdext and stdext3

Thu, Mar 26, 3:06 PM

Mar 24 2026

aokblast added a comment to D56022: libc: Remove redundant code in thread atexit code.
In D56022#1281980, @kib wrote:

No. Perhaps it is simpler to show code than to try to explain it, See D56053.

The example you provided would not work with my patch, it requires increasing the CXA_DTORS_ITERATIONS. Not sure if we want this.

Mar 24 2026, 11:50 AM

Mar 23 2026

aokblast added a comment to D56022: libc: Remove redundant code in thread atexit code.
In D56022#1281611, @kib wrote:

I am on edge of proposing to count the number of the list members, and still do the walk_cb_nocall if the number of members does not go to zero after e.g. CXA_DTORS_ITERATIONS times initial list length for dtor removals.

Do you mean something like

Mar 23 2026, 11:39 AM

Mar 22 2026

aokblast added a reviewer for D55891: libsys: Implement safe aux vec initialization: dim.
Mar 22 2026, 7:27 AM
aokblast added reviewers for D56022: libc: Remove redundant code in thread atexit code: kib, markj.
Mar 22 2026, 5:19 AM
aokblast updated the diff for D56022: libc: Remove redundant code in thread atexit code.

Also remove the define

Mar 22 2026, 5:17 AM
aokblast requested review of D56022: libc: Remove redundant code in thread atexit code.
Mar 22 2026, 5:07 AM
aokblast committed rGc25976f0a9a3: libc: Fix cxa_thread_atexit{,nothr} test. (authored by aokblast).
libc: Fix cxa_thread_atexit{,nothr} test.
Mar 22 2026, 2:49 AM
aokblast closed D55893: libc: Fix cxa_thread_atexit test..
Mar 22 2026, 2:48 AM
aokblast added inline comments to D55826: libc: Fix dtor order in __cxa_thread_atexit.
Mar 22 2026, 2:43 AM
aokblast requested review of D56021: vmm: Add missing AVX instructions for AVX512 in cpuid stdext.
Mar 22 2026, 2:37 AM
aokblast closed D55604: hwpstate_amd: Refactor by brancless version.
Mar 22 2026, 2:36 AM
aokblast committed rG191f47bcd650: hwpstate_amd: Refactor the cpufreq code by using delegation pattenr (authored by aokblast).
hwpstate_amd: Refactor the cpufreq code by using delegation pattenr
Mar 22 2026, 2:36 AM

Mar 20 2026

aokblast added inline comments to D55893: libc: Fix cxa_thread_atexit test..
Mar 20 2026, 5:23 AM
aokblast updated the diff for D55893: libc: Fix cxa_thread_atexit test..

Rename macro

Mar 20 2026, 2:58 AM
aokblast added a comment to D55893: libc: Fix cxa_thread_atexit test..

BTW, is it possible to create a test case for commit 9d26b82826d9?

Yes, I think we can have some tests for this. But I think we should do it after re-org the tests. At least for now we can rely on the llvm testcase as I run it biweekly with latest CURRENT.

Mar 20 2026, 2:57 AM
aokblast updated the diff for D55604: hwpstate_amd: Refactor by brancless version.

Style and commit msg fix

Mar 20 2026, 2:53 AM
aokblast updated the diff for D55606: hwpstate_amd: Expose node as much as possible.

Return void

Mar 20 2026, 2:19 AM

Mar 19 2026

aokblast added a reviewer for D55604: hwpstate_amd: Refactor by brancless version: markj.
Mar 19 2026, 6:27 AM

Mar 18 2026

aokblast updated the diff for D55893: libc: Fix cxa_thread_atexit test..

Skip the again test

Mar 18 2026, 4:21 PM

Mar 17 2026

aokblast added a comment to D55893: libc: Fix cxa_thread_atexit test..
In D55893#1278882, @kib wrote:
In D55893#1278865, @kib wrote:

No, I mean to keep this test, adjusted.
Create a global static var that is incremented on each again() call, and do not call __cxa_thread_atexit() if the counter greater than some value.
As an additional check, you might assert that the counter indeed counted to the specified value.

In D55893#1278865, @kib wrote:

No, I mean to keep this test, adjusted.
Create a global static var that is incremented on each again() call, and do not call __cxa_thread_atexit() if the counter greater than some value.
As an additional check, you might assert that the counter indeed counted to the specified value.

What about the nothr case? Since there is only one main thread. The dtos will be called after the ATF_TEST_CASE_BODY, which means we are unable to use assert since the main thread is destroyed.

I think that this is the right concern, and the right answer would be to significantly reorg the test. Since we are testing something that checks C runtime behavior outside the scope of normal execution (inside the main) for ATF, we need to create a helper program.
The test should spawn that program and check the effects of it, instead of trying to do everything inline.

Mar 17 2026, 3:45 PM
aokblast updated the summary of D55893: libc: Fix cxa_thread_atexit test..
Mar 17 2026, 2:58 PM
aokblast added a comment to D55893: libc: Fix cxa_thread_atexit test..
In D55893#1278865, @kib wrote:

No, I mean to keep this test, adjusted.
Create a global static var that is incremented on each again() call, and do not call __cxa_thread_atexit() if the counter greater than some value.
As an additional check, you might assert that the counter indeed counted to the specified value.

In D55893#1278865, @kib wrote:

No, I mean to keep this test, adjusted.
Create a global static var that is incremented on each again() call, and do not call __cxa_thread_atexit() if the counter greater than some value.
As an additional check, you might assert that the counter indeed counted to the specified value.

What about the nothr case? Since there is only one main thread. The dtos will be called after the ATF_TEST_CASE_BODY, which means we are unable to use assert since the main thread is destroyed.

Mar 17 2026, 2:57 PM
aokblast updated the diff for D55893: libc: Fix cxa_thread_atexit test..

Formatting

Mar 17 2026, 2:56 PM
aokblast updated the diff for D55893: libc: Fix cxa_thread_atexit test..

Adjust the testcase insteada of deleting the testcase.

Mar 17 2026, 2:55 PM
aokblast added a comment to D55893: libc: Fix cxa_thread_atexit test..
In D55893#1278865, @kib wrote:

No, I mean to keep this test, adjusted.
Create a global static var that is incremented on each again() call, and do not call __cxa_thread_atexit() if the counter greater than some value.
As an additional check, you might assert that the counter indeed counted to the specified value.

Mar 17 2026, 2:48 PM
aokblast added reviewers for D55893: libc: Fix cxa_thread_atexit test.: kib, markj.
Mar 17 2026, 7:48 AM
aokblast requested review of D55893: libc: Fix cxa_thread_atexit test..
Mar 17 2026, 7:48 AM
aokblast added a comment to D55891: libsys: Implement safe aux vec initialization.

Reference user: https://github.com/llvm/llvm-project/pull/186961
Raw __elf_aux_vec usage: https://github.com/llvm/llvm-project/blob/main/compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cpp#L72

Mar 17 2026, 6:45 AM
aokblast requested review of D55891: libsys: Implement safe aux vec initialization.
Mar 17 2026, 6:40 AM

Mar 16 2026

aokblast added a comment to D55826: libc: Fix dtor order in __cxa_thread_atexit.
In D55826#1278383, @kib wrote:

@aokblast this commit breaks the following tests in CI:

lib/libc/stdlib/cxa_thread_atexit_nothr_test:cxx__thread_inf_dtors
lib/libc/stdlib/cxa_thread_atexit_test:cxx__thread_inf_dtors
lib/libc/stdlib/cxa_thread_atexit_test:cxx__thread_local_add_while_calling_dtors
lib/libc/stdlib/cxa_thread_atexit_test:cxx__thread_local_after
lib/libc/stdlib/cxa_thread_atexit_test:cxx__thread_local_before

See https://ci.freebsd.org/view/Test/job/FreeBSD-main-amd64-test/28044/testReport/.

I don't think the test actually make sense with my change.
The following code in the test makes it unables to terminate

static void                                                                                                                                        
again(void *arg)                                                                                                                                   
{                                                                                                                                                  
                                                                                                                                                   
    __cxa_thread_atexit(again, arg, &output);                                                                                                      
}

This makes again(void *) called himself and create a infinite loop. In my opnion, the user of the __cxa_thread_atexit should take the responsibility on the infinite loop instead of setting the hard limit on iteration.

I just take a look at the original commit which add this test and would like to ask @kib and @dim on their opinions.

Should we remove the again function or if there is any suggestions on this?

Indeed this test is perhaps not too useful as is. Might be, it should limit the number of registrations, then it would make some reasonable checks.
I do think that your change that broke the test is right.

Mar 16 2026, 4:28 PM
aokblast added a comment to D55826: libc: Fix dtor order in __cxa_thread_atexit.

Also, thanks for your remind:). @siva

Mar 16 2026, 3:53 PM
aokblast updated subscribers of D55826: libc: Fix dtor order in __cxa_thread_atexit.

@aokblast this commit breaks the following tests in CI:

lib/libc/stdlib/cxa_thread_atexit_nothr_test:cxx__thread_inf_dtors
lib/libc/stdlib/cxa_thread_atexit_test:cxx__thread_inf_dtors
lib/libc/stdlib/cxa_thread_atexit_test:cxx__thread_local_add_while_calling_dtors
lib/libc/stdlib/cxa_thread_atexit_test:cxx__thread_local_after
lib/libc/stdlib/cxa_thread_atexit_test:cxx__thread_local_before

See https://ci.freebsd.org/view/Test/job/FreeBSD-main-amd64-test/28044/testReport/.

Mar 16 2026, 3:53 PM

Mar 14 2026

aokblast committed rG9d26b82826d9: libc: Fix dtor order in __cxa_thread_atexit (authored by aokblast).
libc: Fix dtor order in __cxa_thread_atexit
Mar 14 2026, 4:32 AM
aokblast committed rG728ae49a6b81: kern_time: Honor the precise option when counting diff (authored by aokblast).
kern_time: Honor the precise option when counting diff
Mar 14 2026, 4:32 AM
aokblast closed D55826: libc: Fix dtor order in __cxa_thread_atexit.
Mar 14 2026, 4:31 AM
aokblast closed D55824: kern_time: Honor the precise option when counting diff.
Mar 14 2026, 4:31 AM

Mar 13 2026

aokblast added a reviewer for D55826: libc: Fix dtor order in __cxa_thread_atexit: lwhsu.
Mar 13 2026, 10:31 AM
aokblast added a reviewer for D55824: kern_time: Honor the precise option when counting diff: lwhsu.
Mar 13 2026, 10:31 AM

Mar 12 2026

aokblast updated the diff for D55606: hwpstate_amd: Expose node as much as possible.

Minor fixes

Mar 12 2026, 3:42 PM
aokblast added a comment to D55826: libc: Fix dtor order in __cxa_thread_atexit.

I think we need to refactor these stuff to dynamic array in the future. It makes no sense to use linked_list if we only need to push and pop from the top.

Mar 12 2026, 3:07 PM
aokblast updated the diff for D55826: libc: Fix dtor order in __cxa_thread_atexit.

Style fix

Mar 12 2026, 2:50 PM