Page MenuHomeFreeBSD

alc (Alan Cox)
User

Projects

User Details

User Since
Dec 14 2014, 5:52 AM (616 w, 1 d)

Recent Activity

Sun, Oct 4

alc added inline comments to D60280: uiomove_object_page: a failed copy can still dirty the page.
Sun, Oct 4, 7:05 AM
alc added a comment to D60280: uiomove_object_page: a failed copy can still dirty the page.
In D60280#1383381, @kib wrote:
In D60280#1383380, @kib wrote:

We can compare the old and new uio_resid then.

For this to work, uiomove_phys() should also avoid crossing userspace page boundaries, not just phys page boundaries.

Sun, Oct 4, 12:17 AM
alc added a comment to D60280: uiomove_object_page: a failed copy can still dirty the page.
In D60280#1383380, @kib wrote:

We can compare the old and new uio_resid then.

Sun, Oct 4, 12:09 AM

Sat, Oct 3

alc added a comment to D60271: arm64: avoid full icache flushes on PIPT icaches.

Here is Claude's summary of a log that I collected on the DevKit:

Sat, Oct 3, 7:33 PM
alc added a comment to D60280: uiomove_object_page: a failed copy can still dirty the page.

I've been reviewing places where we already sync the icache or might need to.

Sat, Oct 3, 5:56 PM
alc requested review of D60280: uiomove_object_page: a failed copy can still dirty the page.
Sat, Oct 3, 5:54 PM
alc added a comment to D60271: arm64: avoid full icache flushes on PIPT icaches.
In D60271#1383042, @alc wrote:

Do any of you have access to a machine with IDC, but not DIC, e.g., an older Ampere I think? The results on a small Cortex-X1/A78 system are at best inclusive.

I think this is what you're looking for?

CPU  0: ARM Neoverse-N1 r3p1 affinity: 18  0  0
                   Cache Type = <IDC,64 byte CWG,64 byte ERG,64 byte D-cacheline,PIPT I-cache,64 byte I-cacheline>
 Instruction Set Attributes 0 = <DP,RDM,Atomic,CRC32,SHA2,SHA1,AES+PMULL>
 Instruction Set Attributes 1 = <RCPC-8.3,DCPoP>
 Instruction Set Attributes 2 = <>
         Processor Features 0 = <CSV3,CSV2,RAS,GIC,AdvSIMD+HP,FP+HP,EL3,EL2,EL1,EL0 32>
         Processor Features 1 = <MTE_frac,PSTATE.SSBS MSR>
         Processor Features 2 = <>
Trying to mount root from zfs:zroot/ROOT/bhyve []...
      Memory Model Features 0 = <TGran4,TGran64,TGran16,SNSMem,BigEnd,16bit ASID,256TB PA>
      Memory Model Features 1 = <XNX,PAN+ATS1E1,LO,HPD+TTPBHA,VH,16bit VMID,HAF+DS>
      Memory Model Features 2 = <EVT-8.2,32bit CCIDX,48bit VA,UAO,CnP>
      Memory Model Features 3 = <>
      Memory Model Features 4 = <>
             Debug Features 0 = <DoubleLock,SPE,2 CTX BKPTs,4 Watchpoints,6 Breakpoints,PMUv3p1,Debugv8p2>
             Debug Features 1 = <>
         Auxiliary Features 0 = <>
         Auxiliary Features 1 = <>

It's an Ampere Altra, not sure offhand which one. I can test this patch on it this weekend if you tell me what exactly you'd like to try.

Sat, Oct 3, 7:19 AM

Fri, Oct 2

alc added a comment to D60271: arm64: avoid full icache flushes on PIPT icaches.

Do any of you have access to a machine with IDC, but not DIC, e.g., an older Ampere I think? The results on a small Cortex-X1/A78 system are at best inclusive.

Fri, Oct 2, 10:52 PM
alc added a comment to D60271: arm64: avoid full icache flushes on PIPT icaches.

@andrew, Is this what you were asking for? A 16 processor AWS a1.4xlarge, which is Cortex A72-based, sees a small reduction in system time using arm64_pipt_icache_sync_range(). Specifically, the reduction is about 0.75%.

Fri, Oct 2, 10:39 PM
alc requested review of D60271: arm64: avoid full icache flushes on PIPT icaches.
Fri, Oct 2, 10:22 PM

Wed, Sep 30

alc added inline comments to D60090: arm64/pmap: Add support for FEAT_TTL.
Wed, Sep 30, 4:04 PM

Sat, Sep 26

alc committed rGce0268cc1ef4: arm64 pmap: Eliminate redundant icache synchronization (authored by alc).
arm64 pmap: Eliminate redundant icache synchronization
Sat, Sep 26, 3:43 PM
alc committed rGf29a09d97737: vm_page: Replace PGA_EXECUTABLE with PGA_PMAP_PRIV1 (authored by alc).
vm_page: Replace PGA_EXECUTABLE with PGA_PMAP_PRIV1
Sat, Sep 26, 3:43 PM
alc closed D59865: arm64 pmap: Avoid redundant icache synchronization using PGA_EXECUTABLE.
Sat, Sep 26, 3:42 PM
alc closed D59995: vm_page: Replace PGA_EXECUTABLE with PGA_MACHDEP0004.
Sat, Sep 26, 3:42 PM

Fri, Sep 25

alc added a comment to D59865: arm64 pmap: Avoid redundant icache synchronization using PGA_EXECUTABLE.

Do we have somewhere we can document the contract with userspace & when it needs to manage the cache? e.g. removing write & enabling execute on a page will cause the kernel to sync the cache, but having both together means userspace needs to perform a sync operation.

Fri, Sep 25, 4:52 PM
alc added inline comments to D59865: arm64 pmap: Avoid redundant icache synchronization using PGA_EXECUTABLE.
Fri, Sep 25, 4:47 PM
alc added a comment to D59865: arm64 pmap: Avoid redundant icache synchronization using PGA_EXECUTABLE.

Here is a link to the paper I published a while back on PTE coalescing. At that time, the changes in Linux to exploit small folios were just beginning to get merged.

Fri, Sep 25, 4:30 PM
alc added a comment to D59865: arm64 pmap: Avoid redundant icache synchronization using PGA_EXECUTABLE.

I've also tested the prior version of this patch on a 32-core machine (c6g.8xlarge), where icache coherence is maintained by the hardware and the sync operation is simply a dsb and an isb. I just wanted to make sure that the patch didn't negatively effect performance on such machines. I compared 18 buildworld runs on HEAD with 22 runs using this patch. The kernel was -NODEBUG, MALLOC PRODUCTION was enabled, and LLVM assertions were disabled. System time actually fell by 7.8 seconds, from 2,060 to 2,052 seconds, because we avoided a couple hundred million dsb and isb instructions at the cost of the flag maintenance. That is 0.4%, which is four times larger than the random error you would expect. User time fell by 21 seconds, or 0.05%, which is probably real but too small to assert a similar claim relative to the random error. Wall-clock time did not change measurably.

Fri, Sep 25, 4:09 PM
alc updated the diff for D59865: arm64 pmap: Avoid redundant icache synchronization using PGA_EXECUTABLE.

PGA_ICACHE_SYNCED and KASSERTs

Fri, Sep 25, 6:03 AM
alc updated the diff for D59995: vm_page: Replace PGA_EXECUTABLE with PGA_MACHDEP0004.

Rename PGA_MACHDEP0004 to PGA_PMAP_PRIV1.

Fri, Sep 25, 3:59 AM

Thu, Sep 24

alc requested review of D59995: vm_page: Replace PGA_EXECUTABLE with PGA_MACHDEP0004.
Thu, Sep 24, 5:40 PM

Wed, Sep 23

alc added inline comments to D59865: arm64 pmap: Avoid redundant icache synchronization using PGA_EXECUTABLE.
Wed, Sep 23, 4:47 PM
alc added inline comments to D59865: arm64 pmap: Avoid redundant icache synchronization using PGA_EXECUTABLE.
Wed, Sep 23, 4:32 PM
alc accepted D59908: vm_page: Fix the error path in vm_page_alloc_contig_domain().
Wed, Sep 23, 5:40 AM

Sun, Sep 20

alc requested review of D59865: arm64 pmap: Avoid redundant icache synchronization using PGA_EXECUTABLE.
Sun, Sep 20, 10:31 PM

Wed, Sep 9

alc added a comment to D59476: arm64: busdma_bounce: Only use bufzone if it can meet requested alignment.

Tested. It works.

Wed, Sep 9, 6:24 AM

Tue, Sep 8

alc added a comment to D59476: arm64: busdma_bounce: Only use bufzone if it can meet requested alignment.

Yes, this will work. I will actually test it later today.

Tue, Sep 8, 4:36 PM

Mon, Sep 7

alc committed rG37321270b630: amd64/arm64 pmap: consistently clear PGA_WRITEABLE (authored by alc).
amd64/arm64 pmap: consistently clear PGA_WRITEABLE
Mon, Sep 7, 5:50 PM
alc closed D59466: amd64/arm64 pmap: consistently clear PGA_WRITEABLE on fictitious, managed pages.
Mon, Sep 7, 5:50 PM
alc added inline comments to D59466: amd64/arm64 pmap: consistently clear PGA_WRITEABLE on fictitious, managed pages.
Mon, Sep 7, 4:20 PM
alc added inline comments to D59466: amd64/arm64 pmap: consistently clear PGA_WRITEABLE on fictitious, managed pages.
Mon, Sep 7, 4:07 PM
alc updated the diff for D59466: amd64/arm64 pmap: consistently clear PGA_WRITEABLE on fictitious, managed pages.

Introduce pmap_page_is_mapped_locked().

Mon, Sep 7, 8:31 AM

Sun, Sep 6

alc added a comment to D56599: arm64: VM/PMAP changes for CCA guest support.

I recently updated my Microsoft Dev Kit, and because of this change I'm seeing:

bus_dmamem_alloc failed to align memory properly.

The warning stems from an allocation by the nvme driver:

KDB: stack backtrace:
db_trace_self() at db_trace_self
db_trace_self_wrapper() at db_trace_self_wrapper+0x44
bounce_bus_dmamem_alloc() at bounce_bus_dmamem_alloc+0x258
nvme_ctrlr_start() at nvme_ctrlr_start+0xbc8
nvme_ctrlr_start_config_hook() at nvme_ctrlr_start_config_hook+0x5ec
run_interrupt_driven_config_hooks() at run_interrupt_driven_config_hooks+0x94
boot_run_interrupt_driven_config_hooks() at boot_run_interrupt_driven_config_hooks+0x30
mi_startup() at mi_startup+0x1ec
virtdone() at virtdone+0x70

An added printf reports:

vaddr: 0xffffa000847d3f40, paddr: 1047d3f40, alignment: 1000

In this case, the misalignment appears to be harmless because page size alignment isn't actually needed.

Sun, Sep 6, 8:33 PM
alc requested review of D59466: amd64/arm64 pmap: consistently clear PGA_WRITEABLE on fictitious, managed pages.
Sun, Sep 6, 6:33 PM

Sep 4 2026

alc committed rG57407179be43: arm64 pmap: correct the condition for flushing the icache (authored by alc).
arm64 pmap: correct the condition for flushing the icache
Sep 4 2026, 5:23 AM
alc closed D59265: arm64 pmap: correct the condition for determining when to flush the icache.
Sep 4 2026, 5:23 AM

Aug 31 2026

alc added a comment to D59265: arm64 pmap: correct the condition for determining when to flush the icache.

I'm testing this patch on an EC2 a1.4xlarge (16x Cortex A72) machine to see the greatest impact. (This is the entire machine, so there isn't any variance due to other VMs on the machine.) I added a COUNTER_U64 to track icache flushes by the pmap. As expected, this patch results in an increased icache flush count, since we were not flushing on creating executable superpage mappings. During a -j16 buildworld on a -NODEBUG kernel, PRODUCTION malloc, and LLVM with assertions disabled, the number of flushes goes from ~190M to ~230M and wall clock time goes from ~2:09:10 to ~2:10:00. In particular, system time increased by ~6%.

Aug 31 2026, 12:40 AM

Aug 29 2026

alc added a comment to D59265: arm64 pmap: correct the condition for determining when to flush the icache.

I uncovered this while resurrecting an old patch for reducing the number of icache flushes. If all goes well, I will post that in a week or two.

Aug 29 2026, 6:40 PM
alc added a comment to D59105: arm64: Use .arch armv8-4.a with GNU as for extensions to tlbi.

I'm curious as to why this isn't also a problem for the uses of .arch_extension in arm64/vfp.c, arm64/mte.c, and include/atomic.h?

Aug 29 2026, 5:26 PM
alc updated the summary of D59265: arm64 pmap: correct the condition for determining when to flush the icache.
Aug 29 2026, 5:17 PM
alc requested review of D59265: arm64 pmap: correct the condition for determining when to flush the icache.
Aug 29 2026, 4:56 PM
alc committed rGb2e6b6545ee6: arm64 pmap: optimize TLB management by pmap_update_entry() (authored by alc).
arm64 pmap: optimize TLB management by pmap_update_entry()
Aug 29 2026, 6:35 AM
alc closed D58917: arm64 pmap: optimize TLB management by pmap_update_entry().
Aug 29 2026, 6:35 AM

Aug 18 2026

alc updated the diff for D58917: arm64 pmap: optimize TLB management by pmap_update_entry().

Revise a comment.

Aug 18 2026, 7:48 PM
alc added a comment to D58917: arm64 pmap: optimize TLB management by pmap_update_entry().
In D58917#1352088, @kib wrote:

Does arm64 use recursive mapping? If yes, could the function be used on recursive mapping?

Aug 18 2026, 7:28 PM
alc updated the summary of D58917: arm64 pmap: optimize TLB management by pmap_update_entry().
Aug 18 2026, 7:12 PM
alc added inline comments to D58917: arm64 pmap: optimize TLB management by pmap_update_entry().
Aug 18 2026, 6:47 PM
alc added inline comments to D58917: arm64 pmap: optimize TLB management by pmap_update_entry().
Aug 18 2026, 6:39 PM
alc updated the summary of D58917: arm64 pmap: optimize TLB management by pmap_update_entry().
Aug 18 2026, 5:30 PM
alc requested review of D58917: arm64 pmap: optimize TLB management by pmap_update_entry().
Aug 18 2026, 5:29 PM
alc committed rG189ee41b6cc3: arm64 vfp: eliminate nested critical sections (authored by alc).
arm64 vfp: eliminate nested critical sections
Aug 18 2026, 6:57 AM
alc closed D58859: arm64 vfp: eliminate nested critical sections.
Aug 18 2026, 6:57 AM

Aug 15 2026

alc updated the diff for D58859: arm64 vfp: eliminate nested critical sections.

Move td = curthread; out of the critical section.

Aug 15 2026, 10:54 PM
alc added inline comments to D58859: arm64 vfp: eliminate nested critical sections.
Aug 15 2026, 10:27 PM
alc requested review of D58859: arm64 vfp: eliminate nested critical sections.
Aug 15 2026, 4:49 PM

Aug 14 2026

alc committed rG6fa9c2b1d282: arm64: close a race in SVE register management (authored by alc).
arm64: close a race in SVE register management
Aug 14 2026, 9:01 PM
alc closed D58723: arm64: close a race in SVE register management.
Aug 14 2026, 9:00 PM
alc committed rG554978566508: arm64 pmap: use range-based TLBI instructions (authored by alc).
arm64 pmap: use range-based TLBI instructions
Aug 14 2026, 8:18 PM
alc closed D58708: arm64 pmap: use range-based TLBI instructions.
Aug 14 2026, 8:18 PM
alc added a member for Src Committers: alc.
Aug 14 2026, 5:45 PM

Aug 11 2026

alc accepted D58766: vm_object: Augment an assertion in vm_object_split().
Aug 11 2026, 8:43 AM

Aug 10 2026

alc added a comment to D58708: arm64 pmap: use range-based TLBI instructions.
In D58708#1347933, @alc wrote:

I ran a dozen -j8 buildworlds, each starting from an empty /usr/obj, with MALLOC_PRODUCTION enabled and LLVM assertions disabled on a GENERIC-NODEBUG kernel. Here is Claude's analysis of the data:

I wonder where these (ranged) invalidations are coming from, as I don't see very many when building on amd64. I guess they are mostly caused by break-before-make sequences triggered by L3C and L2 superpage promotion and demotion. I noticed that on amd64, munmap() will not trigger a ranged invalidation when unmapping a run of PTEs, we just call pmap_invalidate_all(). On arm64 this doesn't appear to be the case, it will use ranged invalidations. I wonder what fraction of ranged invalidations come from munmap() vs. promotion/demotion.

Aug 10 2026, 5:12 PM

Aug 9 2026

alc added inline comments to D58708: arm64 pmap: use range-based TLBI instructions.
Aug 9 2026, 7:36 PM
alc added a comment to D58723: arm64: close a race in SVE register management.

I'm waiting to hear if @andrew has any comments or questions.

Aug 9 2026, 7:11 PM
alc added a comment to D58708: arm64 pmap: use range-based TLBI instructions.

As an aside, as the appearance of the word "harness" in the previous comment suggests, when I had Claude reviewing the changes, it actually built a user-space test harness containing the loop to check that every page in the range would be the target of an invalidation. And, it temporarily introduced a few bugs in the loop to check that those bugs were detected. Just thought this was interesting.

Aug 9 2026, 5:59 PM
alc added a comment to D58708: arm64 pmap: use range-based TLBI instructions.

I ran a dozen -j8 buildworlds, each starting from an empty /usr/obj, with MALLOC_PRODUCTION enabled and LLVM assertions disabled on a GENERIC-NODEBUG kernel. Here is Claude's analysis of the data:

The change is a win.
		before		after		delta
sys		1,070.67	1,012.58	−58.1 s (−5.43%)
user		23,801.46	23,816.08	+14.6 s (+0.06%)
user+sys	24,872.13	24,828.66	−43.5 s (−0.17%)
wall		3,221.63 (53:41.63)	3,214.40 (53:34.40)	−7.2 s (−0.22%)
Aug 9 2026, 5:32 PM
alc added a comment to D58723: arm64: close a race in SVE register management.

Possibly vfp_restore_state_common() should rely on its caller to enter a critical section (with an assert).

Aug 9 2026, 12:58 AM
alc updated the summary of D58723: arm64: close a race in SVE register management.
Aug 9 2026, 12:39 AM

Aug 8 2026

alc added a comment to D58708: arm64 pmap: use range-based TLBI instructions.

While the conversion from a macro to an inline pmap_s1_invalidate_loop() had no real effect, just a couple instructions changed, pmap_s1_invalidate_strided() is not being inlined in some places due to its size. In that case, we are not benefiting from final_only always being a constant, but I think that is something for a different patch to deal with.

Aug 8 2026, 8:37 PM
alc added inline comments to D58708: arm64 pmap: use range-based TLBI instructions.
Aug 8 2026, 8:02 AM
alc updated the diff for D58708: arm64 pmap: use range-based TLBI instructions.

Convert macro to __always_inline function.

Aug 8 2026, 7:53 AM
alc requested review of D58723: arm64: close a race in SVE register management.
Aug 8 2026, 6:42 AM

Aug 7 2026

alc added inline comments to D58708: arm64 pmap: use range-based TLBI instructions.
Aug 7 2026, 9:40 PM
alc updated the summary of D58708: arm64 pmap: use range-based TLBI instructions.
Aug 7 2026, 8:59 PM
alc requested review of D58708: arm64 pmap: use range-based TLBI instructions.
Aug 7 2026, 8:57 PM

Aug 1 2026

alc accepted D58580: atomic: Implement atomic_{set,clear}_8 in _atomic_subword.h.
Aug 1 2026, 9:57 PM

Jul 17 2026

alc accepted D58312: uma: Enqueue full buckets in FIFO order when KASAN is configured.
Jul 17 2026, 7:05 PM
alc accepted D58261: vm_page: Fix dequeue on arches with weak ordering.

I'm surprised that we didn't see this on arm64.

Jul 17 2026, 12:15 AM

Jun 22 2026

alc accepted D57743: device_pager: Avoid double-insertion of pages into the pager list.
Jun 22 2026, 5:46 PM

May 7 2026

alc added inline comments to D56863: vm_map_growstack(): give a hint to user that stack was blown out.
May 7 2026, 5:07 PM

Apr 23 2026

alc added a comment to D56518: vm: Add flags for unprotected allocations.

Just out of curiosity, where are the pmap changes?

Apr 23 2026, 5:07 AM

Apr 21 2026

alc added a comment to D56432: vm_page: Fix PG_ZERO handling in vm_page_grab_*().
In D56432#1294556, @kib wrote:

Effectively, you agree that we can drop the support and disable passing VM_ALLOC_ZERO to vm_page_grab_unlocked?

After kern_kexec is fixed, yes. But now I am trying to understand what that code is doing, and failing.

In D56432#1292906, @kib wrote:

I thought what could be a use for such call, and I really do not see how it can be useful. Both vnode and swap objects might have the page content on the volume, so the invalid page we found on the queue cannot be safely zeroed without consulting pager first. In the end, the decision to zero such page belongs to the caller.

For other object types, like OBJT_PHYS in kern_kexec.c, it is still somewhat useful since we do not have a vm_page_alloc_pages(), so pages have to be allocated one-by-one. But yes, also note that vm_page_grab_valid() does not handle VM_ALLOC_ZERO.

Apr 21 2026, 5:18 PM

Apr 20 2026

alc accepted D56458: amd64: fix INVLPGB range invalidation.

I'm going to plan to commit this within the next day or so. I think linux's use of "stride" instead of size or shift for their naming of the bit is very telling, and their general range invalidation function seems to specifically just use PTE stride as well.

Apr 20 2026, 4:29 PM

Apr 17 2026

alc added inline comments to D56432: vm_page: Fix PG_ZERO handling in vm_page_grab_*().
Apr 17 2026, 7:11 PM

Apr 16 2026

alc accepted D56416: pkru.3: Note that the kernel may not respect PKRU protections.
Apr 16 2026, 4:41 PM
alc added inline comments to D56416: pkru.3: Note that the kernel may not respect PKRU protections.
Apr 16 2026, 3:46 PM
alc accepted D56415: pkru.3: Remove a qualifier.
Apr 16 2026, 2:57 AM

Mar 31 2026

alc accepted D56185: pmap: Do not use PMAP_LOCK_INIT with kernel_pmap.

"... pmap locks, than witness ..." -> "... pmap locks, then witness ..."

Mar 31 2026, 3:20 PM

Mar 23 2026

alc accepted D55536: vm_fault: Avoid creating clean, writeable superpage mappings.
Mar 23 2026, 4:27 PM

Mar 5 2026

alc accepted D55619: arm64: Use a canonical address when TBI is enabled.
Mar 5 2026, 8:23 AM

Feb 28 2026

alc added a comment to D55536: vm_fault: Avoid creating clean, writeable superpage mappings.

@markj Do we know if there is actually a mix of clean and dirty pages being mapped?

Feb 28 2026, 6:23 PM

Feb 27 2026

alc added inline comments to D55536: vm_fault: Avoid creating clean, writeable superpage mappings.
Feb 27 2026, 6:25 PM

Jan 7 2026

alc accepted D54570: vm_object.h: tweak OBJ_ONEMAPPING comment even more.
Jan 7 2026, 4:42 PM

Jan 6 2026

alc accepted D54438: linker: Reset DMAP protections in link_elf_unload_file().
Jan 6 2026, 4:19 PM

Jan 5 2026

alc added inline comments to D54438: linker: Reset DMAP protections in link_elf_unload_file().
Jan 5 2026, 11:36 PM

Jan 1 2026

alc added inline comments to D54438: linker: Reset DMAP protections in link_elf_unload_file().
Jan 1 2026, 6:07 PM

Dec 29 2025

alc accepted D54365: libc: add glibc-compatible tdestroy(3).
Dec 29 2025, 4:46 PM
alc added a comment to D54365: libc: add glibc-compatible tdestroy(3).

Specifically, for now, I would commit the version in Diff 168641.

Dec 29 2025, 4:43 PM
alc accepted D54365: libc: add glibc-compatible tdestroy(3).

At this point, I would go back to the simpler, O(n) version, and commit that.

Dec 29 2025, 4:37 PM