Page MenuHomeFreeBSD

alc (Alan Cox)
User

Projects (2)

User Details

User Since
Dec 14 2014, 5:52 AM (622 w, 3 d)

Recent Activity

Today

alc accepted D61690: riscv: Add missing barriers to cpu_switch.
Wed, Nov 18, 4:48 PM
alc added a comment to D61391: sys/arm64: Add ttl parameter to pmap_invalidate_range().

There is a new pmap_invalidate_range() in pmap_enter_largepage() that should be TLBI_TTL_UNKNOWN.

Wed, Nov 18, 10:07 AM

Yesterday

alc added a comment to D60841: diagnostic: avoid a quadratic vm_map consistency walk after fork.

I see that I have misunderstood your intent.

Once upon a time, a vm_entry had fields left and right, for membership in a tree, and fields next and prev, for membership in a linked list. This consistency code checked to ensure that everything in the list was also in the tree. Then I threaded the tree and eliminated the list, and mechanically changed the consistency checks that used next and prev to use tree operations instead. I did not consider, then, that there was no longer any point in checking everything in the list for tree membership, since the list is now the tree and they can't be inconsistent.

Since everything being checked here is set in the SPLAY_LEFT_STEP and SPLAY_RIGHT_STEP macros, this is really just a correctness test for the splay tree implementation. It is no longer a check to see whether the programmer manipulating a tree, a list, and some size fields kept them in a consistent state. So I suggest that discarding the check makes more sense than optimizing it.

Tue, Nov 17, 8:14 PM · Virtual Memory
alc committed rGfd6a3eae051e: arm64 pmap: Invalidate the TLB in pmap_enter_largepage().
Tue, Nov 17, 4:40 PM
alc closed D61549: arm64 pmap: a non-transparent large page mapping may require a TLB invalidation.
Tue, Nov 17, 4:40 PM
alc committed rGab81ea52f422: arm64 pmap: combine L3C accessed bits in pmap_mincore().
Tue, Nov 17, 3:49 AM

Sun, Nov 15

alc requested review of D61599: arm64 pmap: eliminate page table rewalks after demotions.
Sun, Nov 15, 8:03 PM

Sat, Nov 14

alc updated the diff for D61549: arm64 pmap: a non-transparent large page mapping may require a TLB invalidation.

Revise comment.

Sat, Nov 14, 10:42 PM
alc added inline comments to D61549: arm64 pmap: a non-transparent large page mapping may require a TLB invalidation.
Sat, Nov 14, 10:31 PM
alc added inline comments to D61549: arm64 pmap: a non-transparent large page mapping may require a TLB invalidation.
Sat, Nov 14, 10:03 PM
alc updated the diff for D61549: arm64 pmap: a non-transparent large page mapping may require a TLB invalidation.

Explain newpte change.

Sat, Nov 14, 9:56 PM
alc requested review of D61549: arm64 pmap: a non-transparent large page mapping may require a TLB invalidation.
Sat, Nov 14, 4:49 PM

Fri, Nov 13

alc accepted D61391: sys/arm64: Add ttl parameter to pmap_invalidate_range().
Fri, Nov 13, 5:43 PM

Thu, Nov 12

alc added inline comments to D61391: sys/arm64: Add ttl parameter to pmap_invalidate_range().
Thu, Nov 12, 6:24 PM
alc added inline comments to D61391: sys/arm64: Add ttl parameter to pmap_invalidate_range().
Thu, Nov 12, 6:22 PM

Wed, Nov 11

alc added inline comments to D61391: sys/arm64: Add ttl parameter to pmap_invalidate_range().
Wed, Nov 11, 6:29 PM
alc accepted D61390: sys/arm64: TTL fixes.

Thank you.

Wed, Nov 11, 6:20 PM

Tue, Nov 10

alc accepted D61414: pmap: Fix accounting of wired mappings of large pages.
Tue, Nov 10, 11:55 PM

Mon, Nov 9

alc committed rG3ba68f5c5dcc: arm64 pmap: combine L3C accessed bits in pmap_mincore().
Mon, Nov 9, 4:23 PM

Sun, Nov 8

alc added inline comments to D60090: arm64/pmap: Add support for FEAT_TTL.
Sun, Nov 8, 8:45 AM
alc added inline comments to D60090: arm64/pmap: Add support for FEAT_TTL.
Sun, Nov 8, 8:01 AM
alc committed rG77fa63fa43fc: arm64 pmap: demote L3C pages in pmap_clear_modify().
Sun, Nov 8, 4:26 AM

Sun, Nov 1

alc committed rG6d7960628f82: arm64 pmap: demote L3C pages in pmap_clear_modify().
Sun, Nov 1, 9:00 PM

Thu, Oct 29

alc committed rGacab75276db8: arm64: a local TLB invalidation suffices when enabling write access.
Thu, Oct 29, 8:40 AM
alc committed rG6e8786bafd16: amd64/arm64 pmap: consistently clear PGA_WRITEABLE.
Thu, Oct 29, 8:40 AM

Tue, Oct 20

alc added a comment to D60841: diagnostic: avoid a quadratic vm_map consistency walk after fork.

@dougm needs to look at this.

Tue, Oct 20, 5:11 PM · Virtual Memory

Oct 19 2026

alc committed rG993f846e482a: arm64: Fix and rename midr_check_var_part_range().
Oct 19 2026, 5:06 PM

Oct 18 2026

alc committed rG976de6053426: arm64 pmap: optimize TLB management by pmap_update_entry().
Oct 18 2026, 6:43 PM
alc committed rGdbec277b5f70: arm64 pmap: correct the condition for flushing the icache.
Oct 18 2026, 5:15 PM

Oct 12 2026

alc committed rG39d6e2226484: arm64: Fix and rename midr_check_var_part_range().
Oct 12 2026, 6:38 PM
alc closed D60624: arm64: Fix midr_check_var_part_range().
Oct 12 2026, 6:38 PM
alc committed rGdb5459b4b598: arm64 vfp: eliminate nested critical sections.
Oct 12 2026, 12:48 AM
alc committed rGe4ac63ef407e: arm64: close a race in SVE register management.
Oct 12 2026, 12:43 AM

Oct 11 2026

alc requested review of D60624: arm64: Fix midr_check_var_part_range().
Oct 11 2026, 6:38 PM

Oct 10 2026

alc added inline comments to D60090: arm64/pmap: Add support for FEAT_TTL.
Oct 10 2026, 4:02 PM

Oct 9 2026

alc committed rGa66236edbf71: arm64: avoid full icache flushes on PIPT icaches.
Oct 9 2026, 1:34 AM
alc closed D60271: arm64: avoid full icache flushes on PIPT icaches.
Oct 9 2026, 1:34 AM

Oct 7 2026

alc committed rG7dd9a8125f70: arm64: a local TLB invalidation suffices when enabling write access.
Oct 7 2026, 2:24 PM
alc closed D60417: arm64 pmap_fault: a local TLB invalidation suffices when enabling write access.
Oct 7 2026, 2:24 PM
alc added a comment to D60417: arm64 pmap_fault: a local TLB invalidation suffices when enabling write access.
In D60417#1385873, @alc wrote:

pmap_enter() should similarly be using a local invalidation when it is upgrading a R/O mapping to R/W. Comparing the amd64 and arm64 pmap_enter()s is what led me to discover all of this.

amd64 will do a (targeted) remote invalidation when upgrading a R/O mapping, I believe. Do you mean that it too should only issue a local invalidation in that case?

Oh, amd64 doesn't issue an invalidation at all in that case. arm64 can't get away with that but a local invalidation there makes more sense.

Oct 7 2026, 2:46 AM

Oct 6 2026

alc added a comment to D60417: arm64 pmap_fault: a local TLB invalidation suffices when enabling write access.

pmap_enter() should similarly be using a local invalidation when it is upgrading a R/O mapping to R/W. Comparing the amd64 and arm64 pmap_enter()s is what led me to discover all of this.

Oct 6 2026, 7:09 PM
alc requested review of D60417: arm64 pmap_fault: a local TLB invalidation suffices when enabling write access.
Oct 6 2026, 6:53 PM
alc added a comment to D60271: arm64: avoid full icache flushes on PIPT icaches.
In D60271#1383119, @alc wrote:

Yes. I would test GENERIC-NODEBUG kernels without and with this patch. I have /etc/src.conf:

WITHOUT_LLVM_ASSERTIONS=yes
#
WITH_CLEAN=yes
WITH_MALLOC_PRODUCTION=yes

I run:

#!/bin/csh
cd /usr/src
rm -fr /usr/obj/usr/src
while ( 1 )
    date
    sysctl vm.pmap vm.reserv vm.stats.vm.v_vm_faults
    time make -j16 buildworld > & /dev/null 
    rm -fr /usr/obj/usr/src
end

with -j adjusted for the machine and the script's output redirected to a log.

Unpatched output: https://reviews.freebsd.org/P717
Patched output: https://reviews.freebsd.org/P718

Timings from an unpatched kernel:

936.90 real     45789.09 user      3280.64 sys
933.97 real     45789.59 user      3314.96 sys
935.05 real     45774.25 user      3334.41 sys
934.40 real     45794.90 user      3302.60 sys
932.76 real     45846.53 user      3315.03 sys
933.13 real     45788.78 user      3318.50 sys

and a patched kernel:

938.43 real     45847.32 user      3243.15 sys
933.22 real     45670.20 user      3268.07 sys
933.84 real     45820.26 user      3269.70 sys
933.28 real     45730.27 user      3252.91 sys
939.21 real     45792.15 user      3287.05 sys
930.78 real     45835.46 user      3260.92 sys

which indicates that the change slightly reduced system CPU time.

Oct 6 2026, 6:28 PM
alc added a comment to D60271: arm64: avoid full icache flushes on PIPT icaches.
In D60271#1383040, @alc wrote:

@andrew, Is this what you were asking for?

Yes

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%.

My previous attempts at implementing this have had the opposite effect.

I have an Orion-O6 with IDC & no DIC + PIPT cache, but can't test for a day or two when I'm back in the office.

Oct 6 2026, 6:21 PM
alc committed rGd8dfbeb57017: uiomove_object_page: a failed copy can still dirty the page.
Oct 6 2026, 4:34 AM
alc closed D60280: uiomove_object_page: a failed copy can still dirty the page.
Oct 6 2026, 4:33 AM

Oct 4 2026

alc added inline comments to D60280: uiomove_object_page: a failed copy can still dirty the page.
Oct 4 2026, 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.

Oct 4 2026, 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.

Oct 4 2026, 12:09 AM

Oct 3 2026

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:

Oct 3 2026, 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.

Oct 3 2026, 5:56 PM
alc requested review of D60280: uiomove_object_page: a failed copy can still dirty the page.
Oct 3 2026, 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.

Oct 3 2026, 7:19 AM

Oct 2 2026

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.

Oct 2 2026, 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%.

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

Sep 30 2026

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

Sep 26 2026

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

Sep 25 2026

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.

Sep 25 2026, 4:52 PM
alc added inline comments to D59865: arm64 pmap: Avoid redundant icache synchronization using PGA_EXECUTABLE.
Sep 25 2026, 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.

Sep 25 2026, 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.

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

PGA_ICACHE_SYNCED and KASSERTs

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

Rename PGA_MACHDEP0004 to PGA_PMAP_PRIV1.

Sep 25 2026, 3:59 AM

Sep 24 2026

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

Sep 23 2026

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

Sep 20 2026

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

Sep 9 2026

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

Tested. It works.

Sep 9 2026, 6:24 AM

Sep 8 2026

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.

Sep 8 2026, 4:36 PM

Sep 7 2026

alc committed rG37321270b630: amd64/arm64 pmap: consistently clear PGA_WRITEABLE.
Sep 7 2026, 5:50 PM
alc closed D59466: amd64/arm64 pmap: consistently clear PGA_WRITEABLE on fictitious, managed pages.
Sep 7 2026, 5:50 PM
alc added inline comments to D59466: amd64/arm64 pmap: consistently clear PGA_WRITEABLE on fictitious, managed pages.
Sep 7 2026, 4:20 PM
alc added inline comments to D59466: amd64/arm64 pmap: consistently clear PGA_WRITEABLE on fictitious, managed pages.
Sep 7 2026, 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().

Sep 7 2026, 8:31 AM

Sep 6 2026

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.

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

Sep 4 2026

alc committed rG57407179be43: 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().
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.
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