Page MenuHomeFreeBSD

zishun.yi.dev_gmail.com (Zishun Yi)
Animal

Projects

User Details

User Since
Jan 15 2026, 1:06 PM (25 w, 1 d)

Recent Activity

Sat, Jul 4

zishun.yi.dev_gmail.com updated the summary of D57381: riscv: add KASAN support.
Sat, Jul 4, 12:10 PM
zishun.yi.dev_gmail.com added a comment to D57381: riscv: add KASAN support.

@zishun.yi.dev_gmail.com could you please rebase this patch so that it applies to the latest main? I don't really like the diff to riscv/include/atomic.h, and would like to explore different approaches. (Really I'd like to get rid of all of these interceptors entirely, but the best way to do that is probably to reimplement atomic.h using C11 atomics...)

Sat, Jul 4, 12:07 PM
zishun.yi.dev_gmail.com requested review of D58037: subr_asan: let architectures restrict which atomic interceptors are generated.
Sat, Jul 4, 12:00 PM
zishun.yi.dev_gmail.com updated the diff for D57381: riscv: add KASAN support.
  • Address mhorne@'s comments, thanks for testing, and it's great to know that KASAN already caught a real bug!
  • Rebase to origin/main
  • Move the MI interceptor code to a separate parent revision.
Sat, Jul 4, 11:57 AM

Fri, Jun 26

zishun.yi.dev_gmail.com updated the diff for D57520: netlink.4: Document missing socket options.

clarify cmsg

Fri, Jun 26, 11:57 AM
zishun.yi.dev_gmail.com updated the summary of D57520: netlink.4: Document missing socket options.
Fri, Jun 26, 5:27 AM
zishun.yi.dev_gmail.com updated the diff for D57519: netlink: Add sync path in user-kernel interface.

move NETLINK_GET_STRICT_CHK and NETLINK_MSG_INFO to another revision.

Fri, Jun 26, 5:22 AM
zishun.yi.dev_gmail.com updated the diff for D57520: netlink.4: Document missing socket options.

remove NETLINK_SND_SYNC.

Fri, Jun 26, 5:20 AM
zishun.yi.dev_gmail.com reclaimed D57520: netlink.4: Document missing socket options.
Fri, Jun 26, 5:19 AM
zishun.yi.dev_gmail.com added a comment to D57807: netlink: return ENOBUFS on RX overflow.

What are the actual applications that depend on that?

Fri, Jun 26, 4:34 AM
zishun.yi.dev_gmail.com added a comment to D57807: netlink: return ENOBUFS on RX overflow.

Can you please elaborate what software expects this and what problems the patch tries to address?

Linux actually has a specific netlink socket flag, NETLINK_NO_ENOBUFS, which suggests that a lot of Linux software depends on the default ENOBUFS behavior.
As obiwac@ mentioned, our initial thought was to align this behavior with Linux, especially in preparation for the synchronous Netlink patch I plan to introduce.

Fri, Jun 26, 3:48 AM

Thu, Jun 25

zishun.yi.dev_gmail.com requested review of D57842: linuxkpi: Correct nents passed to dma_{un,}map_sg_attrs.
Thu, Jun 25, 1:30 PM
zishun.yi.dev_gmail.com updated the summary of D57842: linuxkpi: Correct nents passed to dma_{un,}map_sg_attrs.
Thu, Jun 25, 1:29 PM
zishun.yi.dev_gmail.com updated the diff for D57519: netlink: Add sync path in user-kernel interface.

Add a test to check the recv buffer, as suggested by obiwac@.

Thu, Jun 25, 10:12 AM
zishun.yi.dev_gmail.com abandoned D57520: netlink.4: Document missing socket options.

Include this in the revision where I add this flag.

Thu, Jun 25, 9:58 AM
zishun.yi.dev_gmail.com updated the diff for D57807: netlink: return ENOBUFS on RX overflow.

change the commit order.

Thu, Jun 25, 9:57 AM
zishun.yi.dev_gmail.com updated the diff for D57519: netlink: Add sync path in user-kernel interface.
  • change the commit order.
  • include the manual change.
Thu, Jun 25, 9:53 AM

Wed, Jun 24

zishun.yi.dev_gmail.com requested review of D57807: netlink: return ENOBUFS on RX overflow.
Wed, Jun 24, 6:59 AM
zishun.yi.dev_gmail.com updated the diff for D57519: netlink: Add sync path in user-kernel interface.

Address some of obiwac@'s comments.

Wed, Jun 24, 6:56 AM

Tue, Jun 23

zishun.yi.dev_gmail.com updated the diff for D55497: linuxkpi: Fix DMA_BIDIRECTIONAL mapping.

rebase

Tue, Jun 23, 8:56 AM
zishun.yi.dev_gmail.com requested review of D57766: linuxkpi: add dma_sync_sg_for_{cpu, device}.
Tue, Jun 23, 8:49 AM
zishun.yi.dev_gmail.com updated the diff for D55497: linuxkpi: Fix DMA_BIDIRECTIONAL mapping.

Based on the code flow I mentioned above, I found that the DMA_TO_DEVICE and
DMA_FROM_DEVICE directions in dma_sync_single_for_device might be reversed.

Tue, Jun 23, 7:42 AM

Mon, Jun 22

zishun.yi.dev_gmail.com added a comment to D55497: linuxkpi: Fix DMA_BIDIRECTIONAL mapping.

I re-read the manual today:

BUS_DMASYNC_PREREAD    Perform any synchronization required prior
                       to an update of host memory by the device.
Mon, Jun 22, 3:48 PM
zishun.yi.dev_gmail.com added a comment to D55497: linuxkpi: Fix DMA_BIDIRECTIONAL mapping.
In D55497#1320154, @bz wrote:

Isn't this closer to what I once had and hselasky said I should change?

IMO, hselasky said we cannot pass multiple flags to the non-bidirectional DMA cases. I think that is correct.
But I guess his thought was that some USB controllers might access the DMA buffer after the dma_sync_single_for_cpu, so he added the PREREAD flag. However, under Linux semantics, the device should not access the DMA buffer after the dma_sync_single_for_cpu.

Mon, Jun 22, 3:36 PM

Sat, Jun 20

zishun.yi.dev_gmail.com updated the diff for D57519: netlink: Add sync path in user-kernel interface.

do sync conversion in setsockopt handler, tearing down the taskqueue and returning an error if some messages are pending procesding.

Sat, Jun 20, 2:12 PM
zishun.yi.dev_gmail.com added a comment to D57519: netlink: Add sync path in user-kernel interface.

Do you see a use case for setting sync mode mid-session? If not, i’d suggest doing conversion in setsockopt handler, tearing down the async thread and returning an error if some messages are pending procesding.

I think you're right, it's weird to set sync mid-session. I will change it later

Sat, Jun 20, 7:14 AM
zishun.yi.dev_gmail.com updated the summary of D57519: netlink: Add sync path in user-kernel interface.
Sat, Jun 20, 4:14 AM
zishun.yi.dev_gmail.com updated the diff for D57519: netlink: Add sync path in user-kernel interface.
  • Move some logic in sync path to a separate function.
  • Move the lock acquisition inside the branch
Sat, Jun 20, 4:04 AM
zishun.yi.dev_gmail.com added a comment to D57519: netlink: Add sync path in user-kernel interface.

Thank you for working on this!
Added a bit of comments on the MR itself, also a bit more generic questions:

  1. What is the proposed processing mechanism in sync case? Can we clearly state the logic in the description?

For example, if the caller sent multiple nettlink messages on a single send / write call - do we assume the caller should have allocated enough RX buffer for all of the replies? Or put it differently - what should happen when we don't have enough space in the receive buffer to (a) get all of the reply, (b) to send netlink header with error and (c) when we, say, processed and replied to 2 netlink messages out of 5?

Linux is sync. Its behavior is this send() will succeed and process all requests (5, for example). But it drops the replies that exceed the receive buffer(3 replies). And will return ENOBUFS in the next recv() to indicate we have dropped some replies.
In other words, the success of send() does not depend on whether the receive buffer is full. So I align with its behavior, the corresponding part is the nl_dropped_bytes in nl_soreceive().

Sat, Jun 20, 3:21 AM

Fri, Jun 19

zishun.yi.dev_gmail.com updated the test plan for D57519: netlink: Add sync path in user-kernel interface.
Fri, Jun 19, 10:26 AM
zishun.yi.dev_gmail.com updated the diff for D57519: netlink: Add sync path in user-kernel interface.
  • Can pass the test
  • Add SB_WAIT
  • Remove timeout
  • Refactor nl_process_nbuf_sync. The difference from nl_process_nbuf is that

the sync version removes nlmsg_ignore_limit and returns the actual error.

  • Make recv return ENOBUF when it sees nl_dropped_messages.
Fri, Jun 19, 9:21 AM
zishun.yi.dev_gmail.com updated the diff for D57519: netlink: Add sync path in user-kernel interface.

Add the test mentioned in my previous comment, but without changing the kernel
code yet, so it currently fails as expected.

Fri, Jun 19, 5:44 AM
zishun.yi.dev_gmail.com added a comment to D57519: netlink: Add sync path in user-kernel interface.

After investigating the behavior of netlink send when the buffer is full, I found:
FreeBSD async send path behavior:

  • Send buffer full: Deadlocks (this indicates the recv buffer is also full).
  • Recv buffer full: Send doesn't depend on it, so it will never block. It just keeps filling the send buffer.

Linux send path behavior:

  • Send buffer will never fill up because of sync.
  • Recv buffer full: Send doesn't depend on it, so it will never block, but it will fail on the next recv.

Therefore, I think the FreeBSD sync send path behavior should be:

  • Send buffer full: Deadlock.
  • Recv buffer full: Same as linux
Fri, Jun 19, 4:23 AM

Wed, Jun 17

zishun.yi.dev_gmail.com added inline comments to D57612: linuxkpi ioctl handler: restore the user data pointer.
Wed, Jun 17, 8:36 AM
zishun.yi.dev_gmail.com added a comment to D57612: linuxkpi ioctl handler: restore the user data pointer.

Hi, I think this is a good change overall. I actually tried to solve the same problem before in D55328, but I ended up abandoning it because my use case no longer required it.

Wed, Jun 17, 2:39 AM

Fri, Jun 12

zishun.yi.dev_gmail.com updated the diff for D57519: netlink: Add sync path in user-kernel interface.

fix potential deadlock

Fri, Jun 12, 6:58 AM

Jun 10 2026

zishun.yi.dev_gmail.com requested review of D57520: netlink.4: Document missing socket options.
Jun 10 2026, 8:36 AM
zishun.yi.dev_gmail.com requested review of D57519: netlink: Add sync path in user-kernel interface.
Jun 10 2026, 8:36 AM

Jun 8 2026

zishun.yi.dev_gmail.com updated the summary of D57381: riscv: add KASAN support.
Jun 8 2026, 8:38 AM

Jun 7 2026

zishun.yi.dev_gmail.com updated the diff for D57381: riscv: add KASAN support.

Fixed hart boot hang on riscv smp caused by KASAN, by initializing the tp register earlier in the assembly stage.

Jun 7 2026, 9:12 AM

Jun 4 2026

zishun.yi.dev_gmail.com added a comment to D57381: riscv: add KASAN support.

Hi, glad to see this review.

I will take a detailed look next week, and I hope to test it out as well.

Jun 4 2026, 5:19 PM

Jun 2 2026

zishun.yi.dev_gmail.com updated the diff for D57381: riscv: add KASAN support.

Address review feedback.

Jun 2 2026, 5:14 PM
zishun.yi.dev_gmail.com added inline comments to D57381: riscv: add KASAN support.
Jun 2 2026, 3:48 PM
zishun.yi.dev_gmail.com abandoned D57379: riscv: Implement 8-bit and 16-bit atomic operations.

As suggested by @jrtc27, KASAN shouldn't intercept unsupported riscv atomic functions.

Jun 2 2026, 11:10 AM
zishun.yi.dev_gmail.com updated the diff for D57381: riscv: add KASAN support.

Prevent KASAN from intercepting atomic functions that are unsupported by the
architecture. The specific changes can be summarized as follows:

  • Use ARCH_SUPPORT_ATOMIC_*_WIDTH x-macros to control the generation of interceptor functions in subr_asan.c.
  • Use #undef in machine/atomic.h to undefine the macros that are forcibly defined by sys/atomic_san.h but lack actual MD implementations.
Jun 2 2026, 11:03 AM

Jun 1 2026

zishun.yi.dev_gmail.com added a comment to D57379: riscv: Implement 8-bit and 16-bit atomic operations.

Having said that, what is the use case you have for these? Generally speaking you shouldn't be using sub-word atomics unless absolutely needed, since performance will be worse.

Ah, I didn't actually consider the performance before.
I added these to simplify the KASAN porting. KASAN needs to intercept these defines, but riscv doesn't have these definitions, so adding them ensures the KASAN common code won't be polluted by arch-specific code.

KASAN should just not intercept things that don't exist

Jun 1 2026, 6:21 PM
zishun.yi.dev_gmail.com updated the diff for D57378: riscv: bus: provide bus_space_set_{multi,region}_stream definitions.

Fix segment order

Jun 1 2026, 6:14 PM
zishun.yi.dev_gmail.com added a comment to D57379: riscv: Implement 8-bit and 16-bit atomic operations.

Having said that, what is the use case you have for these? Generally speaking you shouldn't be using sub-word atomics unless absolutely needed, since performance will be worse.

Jun 1 2026, 6:02 PM
zishun.yi.dev_gmail.com added a comment to D57379: riscv: Implement 8-bit and 16-bit atomic operations.

Surely these belong in atomic_subword.h or similar? They're not at all specific to RISC-V, and other architectures lack various of these.

Jun 1 2026, 5:58 PM
zishun.yi.dev_gmail.com updated the summary of D57378: riscv: bus: provide bus_space_set_{multi,region}_stream definitions.
Jun 1 2026, 5:22 PM
zishun.yi.dev_gmail.com added a comment to D57380: riscv: add a GENERIC-KASAN config.

I guess it's okay to merge this into D57381? See f115c0612131d8f939f6f357f57bdd85bd6a59de for amd64.

Jun 1 2026, 5:14 PM
zishun.yi.dev_gmail.com added inline comments to D57379: riscv: Implement 8-bit and 16-bit atomic operations.
Jun 1 2026, 5:10 PM
zishun.yi.dev_gmail.com added a comment to D57378: riscv: bus: provide bus_space_set_{multi,region}_stream definitions.

I would like to know what this is for. Code looks okay, but I wonder why we need these aliases. Could you elaborate more in the commit message and revision summary?

Jun 1 2026, 4:46 PM
zishun.yi.dev_gmail.com requested review of D57381: riscv: add KASAN support.
Jun 1 2026, 10:16 AM
zishun.yi.dev_gmail.com requested review of D57380: riscv: add a GENERIC-KASAN config.
Jun 1 2026, 10:16 AM
zishun.yi.dev_gmail.com requested review of D57379: riscv: Implement 8-bit and 16-bit atomic operations.
Jun 1 2026, 10:16 AM
zishun.yi.dev_gmail.com requested review of D57378: riscv: bus: provide bus_space_set_{multi,region}_stream definitions.
Jun 1 2026, 10:16 AM

May 22 2026

zishun.yi.dev_gmail.com abandoned D55328: linuxkpi: Support flexible array members in ioctl.

To support the FAM cmd for udmabuf, I first decided to improve the linuxkpi ioctl through this patch, but due to some hacks in this patch and the suggestion from my GSoC mentor Aymeric, I decided to enhance the native FreeBSD ioctl call stack - to let the native FreeBSD ioctl support FAM.

May 22 2026, 8:51 AM

May 20 2026

zishun.yi.dev_gmail.com added a comment to D57129: amd64/vmparam: Fix KASAN shadow map size in comment.

Sigh. I realized just after pushing this that the address range is wrong, not the comment:

(kgdb) p/x kva_layout
$1 = {kva_min = 0xffff800000000000, kva_max = 0xfffffffffffff000, dmap_low = 0xfffff80000000000, dmap_high = 0xfffffc0000000000, 
  lm_low = 0xffff808000000000, lm_high = 0xfffff78000000000, km_low = 0xfffffe0000000000, km_high = 0xfffffffffffff000, rec_pt = 0xffff800000000000, 
  kasan_shadow_low = 0xfffff78000000000, kasan_shadow_high = 0xfffff80000000000, kmsan_shadow_low = 0xfffffc0000000000, 
  kmsan_shadow_high = 0xfffffe0000000000, kmsan_origin_low = 0xfffff60000000000, kmsan_origin_high = 0xfffff80000000000}

512GB makes sense, as that's one PML4 entry.

... but only 256GB is used, since the kernel map is 2TB and the shadow map scale is 1:8, as you noted. So this is ok after all, ignore me. :)

May 20 2026, 2:59 PM
zishun.yi.dev_gmail.com requested review of D57129: amd64/vmparam: Fix KASAN shadow map size in comment.
May 20 2026, 2:26 PM

May 12 2026

zishun.yi.dev_gmail.com added a watcher for linuxkpi: zishun.yi.dev_gmail.com.
May 12 2026, 8:37 AM
zishun.yi.dev_gmail.com added a member for riscv: zishun.yi.dev_gmail.com.
May 12 2026, 8:35 AM

Feb 25 2026

zishun.yi.dev_gmail.com requested review of D55497: linuxkpi: Fix DMA_BIDIRECTIONAL mapping.
Feb 25 2026, 5:28 AM

Feb 18 2026

zishun.yi.dev_gmail.com updated zishun.yi.dev_gmail.com.
Feb 18 2026, 2:52 AM
zishun.yi.dev_gmail.com added reviewers for D55328: linuxkpi: Support flexible array members in ioctl: obiwac, zlei, bz.
Feb 18 2026, 2:45 AM

Feb 17 2026

zishun.yi.dev_gmail.com updated zishun.yi.dev_gmail.com.
Feb 17 2026, 2:17 PM
zishun.yi.dev_gmail.com added inline comments to D55328: linuxkpi: Support flexible array members in ioctl.
Feb 17 2026, 2:00 PM
zishun.yi.dev_gmail.com requested review of D55328: linuxkpi: Support flexible array members in ioctl.
Feb 17 2026, 1:46 PM