Page MenuHomeFreeBSD

alc (Alan Cox)
User

Projects

User Details

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

Recent Activity

Today

alc added a comment to D20380: Fixes for some corner cases of amd64 demotions..
In D20380#440729, @kib wrote:
In D20380#440728, @alc wrote:

Everything here looks good to me.

Does this mean 'clean to commit' ? I think testing with D20266 can wait for D20266 itself.

Mon, May 27, 6:19 AM
alc added inline comments to D20266: Simplify flow of pmap_demote_pde_locked() and add more comprehensive debugging checks..
Mon, May 27, 6:17 AM

Yesterday

alc added a comment to D20380: Fixes for some corner cases of amd64 demotions..

Everything here looks good to me.

Sun, May 26, 6:49 PM
alc added a comment to D20380: Fixes for some corner cases of amd64 demotions..
In D20380#440650, @kib wrote:
In D20380#440642, @alc wrote:
In D20380#440609, @kib wrote:

I am not sure why do check that KERNend != round_2mpage() before rounding, IMO it simply less lines to not do that.

Are you asking about this snippet?

if (*firstaddr < round_2mpage(KERNend))
        *firstaddr = round_2mpage(KERNend);

Yes.

Sun, May 26, 4:36 PM
alc added a comment to D20380: Fixes for some corner cases of amd64 demotions..
In D20380#440609, @kib wrote:
In D20380#440605, @alc wrote:

I _think_ that what you mean is that we should connect all preallocated page tables to directories, but only pre-promote to the rounded KERNend, and store in radix only page tables pages which were shadowed by the manual promotion.

Yes, except that the way that the loop is written, we don't need to round KERNend for correctness. I would only round it if you think that doing so makes it less likely that someone will misinterpret the code. Here are all of the changes that I would make.

I do not think that the check needs changing.
Also I see that indeed page table pages do not need non-zero initialization after we switched to PG_PROMOTED test.
I am not sure why do check that KERNend != round_2mpage() before rounding, IMO it simply less lines to not do that.

Sun, May 26, 4:21 AM

Sat, May 25

alc added a comment to D20380: Fixes for some corner cases of amd64 demotions..

I _think_ that what you mean is that we should connect all preallocated page tables to directories, but only pre-promote to the rounded KERNend, and store in radix only page tables pages which were shadowed by the manual promotion.

Yes, except that the way that the loop is written, we don't need to round KERNend for correctness. I would only round it if you think that doing so makes it less likely that someone will misinterpret the code. Here are all of the changes that I would make.

Index: amd64/amd64/pmap.c
===================================================================
--- amd64/amd64/pmap.c  (revision 348267)
+++ amd64/amd64/pmap.c  (working copy)
@@ -1338,7 +1338,6 @@ static void
 create_pagetables(vm_paddr_t *firstaddr)
 {
        int i, j, ndm1g, nkpdpe, nkdmpde;
-       pt_entry_t *pt_p;
        pd_entry_t *pd_p;
        pdp_entry_t *pdp_p;
        pml4_entry_t *p4_p;
@@ -1399,20 +1398,21 @@ create_pagetables(vm_paddr_t *firstaddr)
        KPTphys = allocpages(firstaddr, nkpt);
        KPDphys = allocpages(firstaddr, nkpdpe);
Sat, May 25, 9:41 PM

Fri, May 24

alc accepted D20386: Make pmap_kextract() operational over the large map..
Fri, May 24, 10:59 PM
alc added inline comments to D20386: Make pmap_kextract() operational over the large map..
Fri, May 24, 10:38 PM
alc added inline comments to D20370: Eliminate code duplication around clip_start.
Fri, May 24, 8:46 PM
alc added inline comments to D20266: Simplify flow of pmap_demote_pde_locked() and add more comprehensive debugging checks..
Fri, May 24, 8:31 PM
alc added inline comments to D20266: Simplify flow of pmap_demote_pde_locked() and add more comprehensive debugging checks..
Fri, May 24, 8:25 PM
alc added inline comments to D20380: Fixes for some corner cases of amd64 demotions..
Fri, May 24, 4:35 PM

Thu, May 23

alc added a comment to D20380: Fixes for some corner cases of amd64 demotions..

I think that the changes within pmap_demote_pde_locked(), including the two given in my comments, are correct and should be committed. The same changes should also be made to the i386 pmap.

Thu, May 23, 7:43 PM
alc added a comment to D20266: Simplify flow of pmap_demote_pde_locked() and add more comprehensive debugging checks..

Can you separate the pmap_demote_pde_locked() changes from the create_pagetables()/pmap_init() changes, i.e., create a separate patch.

Thu, May 23, 6:08 AM

Wed, May 22

alc added inline comments to D20266: Simplify flow of pmap_demote_pde_locked() and add more comprehensive debugging checks..
Wed, May 22, 8:01 PM
alc added inline comments to D20266: Simplify flow of pmap_demote_pde_locked() and add more comprehensive debugging checks..
Wed, May 22, 7:50 PM
alc added inline comments to D20266: Simplify flow of pmap_demote_pde_locked() and add more comprehensive debugging checks..
Wed, May 22, 7:15 PM
alc added inline comments to D20266: Simplify flow of pmap_demote_pde_locked() and add more comprehensive debugging checks..
Wed, May 22, 7:09 PM
alc added inline comments to D20266: Simplify flow of pmap_demote_pde_locked() and add more comprehensive debugging checks..
Wed, May 22, 7:07 PM
alc added a comment to D20266: Simplify flow of pmap_demote_pde_locked() and add more comprehensive debugging checks..

Also, I never intended for promotion and demotion on the kernel pmap to create an inconsistency in how we maintain the wire count on kernel page table pages. Switching to testing (oldpte & PG_PROMOTED) == 0 would allow for eliminating that inconsistency.

Index: amd64/amd64/pmap.c
===================================================================
--- amd64/amd64/pmap.c  (revision 348078)
+++ amd64/amd64/pmap.c  (working copy)
@@ -4537,8 +4537,10 @@ pmap_demote_pde_locked(pmap_t pmap, pd_entry_t *pd
                            " in pmap %p", va, pmap);
                        return (FALSE);
                }
-               if (va < VM_MAXUSER_ADDRESS)
+               if (va < VM_MAXUSER_ADDRESS) {
+                       mpte->wire_count = NPTEPG;
                        pmap_resident_count_inc(pmap, 1);
+               }
        }
        mptepa = VM_PAGE_TO_PHYS(mpte);
        firstpte = (pt_entry_t *)PHYS_TO_DMAP(mptepa);
@@ -4553,10 +4555,8 @@ pmap_demote_pde_locked(pmap_t pmap, pd_entry_t *pd
        /*
         * If the page table page is new, initialize it.
         */
-       if (mpte->wire_count == 1) {
-               mpte->wire_count = NPTEPG;
+       if ((oldpde & PG_PROMOTED) == 0)
                pmap_fill_ptp(firstpte, newpte);
-       }
        KASSERT((*firstpte & PG_FRAME) == (newpte & PG_FRAME),
            ("pmap_demote_pde: firstpte and newpte map different physical"
            " addresses"));
Wed, May 22, 5:11 PM
alc added inline comments to D20266: Simplify flow of pmap_demote_pde_locked() and add more comprehensive debugging checks..
Wed, May 22, 4:53 PM

Sat, May 18

alc accepted D17826: Use atomic_fcmpset in pmap_promote_pde()..
Sat, May 18, 8:24 PM
alc added a comment to D19923: Switch to use shared vnode locks for text files during image activation..

What remains here has already been committed, but with LK_SHARED passed to vn_lock(). This can be closed.

Sat, May 18, 7:51 PM
alc added a comment to D20266: Simplify flow of pmap_demote_pde_locked() and add more comprehensive debugging checks..

What are the errors that Peter reported?

Sat, May 18, 6:24 PM

Fri, May 17

alc accepted D17226: Implement M_NEXTFIT..

I did a careful review of these changes a while ago, and I'm convinced that all of the issues that we discussed last fall are dealt with.

Fri, May 17, 10:29 PM
alc accepted D20250: Build arm64 kernel with inline ffs, fls.
Fri, May 17, 4:36 AM

Thu, May 16

alc added a comment to D20256: Simplify vm_reserv_break.
In D20256#437068, @pho wrote:

I ran tests for 18 hours, including a buildworld.
Last vm.reserv.broken value was 247091.
No problems seen.

Thu, May 16, 7:51 PM
alc added inline comments to D20250: Build arm64 kernel with inline ffs, fls.
Thu, May 16, 5:24 PM

Tue, May 14

alc added a comment to D19826: reduce accesses to vm_map entries off the search path in updating max_free.

I think that it would be worthwhile to write a test program that creates and destroys a large number of anonymous mappings and then, in particular, profile that program for data cache misses with pmcstat. The one tricky thing about writing this program is that you would need to ensure that the anonymous mappings can't coalesce by ensuring that there is always a gap between two mappings.

Tue, May 14, 5:35 PM

Tue, Apr 30

alc added a comment to D20062: sendfile: allocate pages from the local NUMA domain when SF_NOCACHE is set.

I think that there is a better approach than what you are attempting here. Once you have the patch that you describe as "My patch to alter the behavior of SO_REUSEPORT_LB listen sockets ...", the thread executing sendfile(2) will be running on the same domain as the socket. Recall Kostik's first comment, "Vm objects can have domain policies assigned, and object policy trumps a thread policy, if present." In other words, if you don't define an object policy, the page allocations will be governed by the thread's policy. A thread policy that says allocate from the local domain should achieve your desired outcome.

Tue, Apr 30, 5:46 PM

Mon, Apr 29

alc added inline comments to D20062: sendfile: allocate pages from the local NUMA domain when SF_NOCACHE is set.
Mon, Apr 29, 5:00 PM

Sun, Apr 28

alc added inline comments to D19923: Switch to use shared vnode locks for text files during image activation..
Sun, Apr 28, 4:38 PM

Mar 23 2019

alc accepted D19688: ASLR: check for max_addr after applying randomization, not before..
Mar 23 2019, 4:24 PM

Feb 25 2019

alc accepted D19337: Improve vmem tuning for platforms without a direct map..
Feb 25 2019, 5:05 PM
alc added inline comments to D19337: Improve vmem tuning for platforms without a direct map..
Feb 25 2019, 4:26 PM

Feb 19 2019

alc accepted D19211: pkru(3).
Feb 19 2019, 3:45 AM

Feb 18 2019

alc added inline comments to D19211: pkru(3).
Feb 18 2019, 4:40 PM
alc accepted D19225: amd64: cleanup pmap_init_pat()..
Feb 18 2019, 4:08 AM
alc added inline comments to D19211: pkru(3).
Feb 18 2019, 3:56 AM

Feb 17 2019

alc added a comment to D19211: pkru(3).

I question if there shouldn't be an explicit statement somewhere in this man page that this feature can be used by an application to implement memory "safety" mechanisms, but not "security". Because the RDPKRU and WRPKRU instructions are not privileged, a compromised application could always change the access rights. This is different from the protection key mechanisms on other architectures such as 32-bit ARM.

Feb 17 2019, 5:52 PM

Feb 6 2019

alc accepted D19092: contigmalloc: handle M_EXEC.
Feb 6 2019, 5:15 PM

Dec 12 2018

alc added inline comments to D17226: Implement M_NEXTFIT..
Dec 12 2018, 5:45 PM
alc added inline comments to D17226: Implement M_NEXTFIT..
Dec 12 2018, 5:13 PM

Dec 10 2018

alc added inline comments to D17226: Implement M_NEXTFIT..
Dec 10 2018, 5:21 PM

Dec 9 2018

alc committed rS341766: blst_leaf_alloc updates bighint for a leaf when an allocation is successful.
blst_leaf_alloc updates bighint for a leaf when an allocation is successful
Dec 9 2018, 5:55 PM
alc closed D18474: Stop updating leaf hint after last block allocation when cursor affected resul.
Dec 9 2018, 5:55 PM

Dec 8 2018

alc accepted D18474: Stop updating leaf hint after last block allocation when cursor affected resul.

Ask Peter to test this patch.

Dec 8 2018, 4:38 AM
alc added inline comments to D18474: Stop updating leaf hint after last block allocation when cursor affected resul.
Dec 8 2018, 4:05 AM
alc added inline comments to D18474: Stop updating leaf hint after last block allocation when cursor affected resul.
Dec 8 2018, 3:46 AM

Dec 7 2018

alc added inline comments to D18474: Stop updating leaf hint after last block allocation when cursor affected resul.
Dec 7 2018, 5:02 PM

Dec 5 2018

alc committed rS341602: Terminate a blist_alloc search when a blst_meta_alloc call fails with.
Terminate a blist_alloc search when a blst_meta_alloc call fails with
Dec 5 2018, 6:29 PM
alc closed D17999: Avoid testing bighint in blist_alloc.
Dec 5 2018, 6:29 PM

Dec 2 2018

alc added inline comments to D17999: Avoid testing bighint in blist_alloc.
Dec 2 2018, 8:06 PM

Nov 29 2018

alc accepted D18374: Adjust v_freecnt when blacklisting pages..
Nov 29 2018, 3:37 PM

Nov 28 2018

alc added inline comments to D17226: Implement M_NEXTFIT..
Nov 28 2018, 7:38 AM
alc added inline comments to D17226: Implement M_NEXTFIT..
Nov 28 2018, 7:17 AM

Nov 27 2018

alc accepted D18345: Fix assert condition in pmap_large_unmap().
Nov 27 2018, 8:37 PM
alc added inline comments to D18345: Fix assert condition in pmap_large_unmap().
Nov 27 2018, 5:15 PM

Nov 26 2018

alc added inline comments to D17226: Implement M_NEXTFIT..
Nov 26 2018, 4:40 PM

Nov 25 2018

alc accepted D17227: Use M_NEXTFIT in memguard..
Nov 25 2018, 6:22 PM
alc accepted D18329: Avoid unneeded check in vmspace_alloc()..
Nov 25 2018, 5:50 PM

Nov 24 2018

alc committed rS340914: blist_meta_alloc assumes that mask=scan->bm_bitmap is nonzero. But if the.
blist_meta_alloc assumes that mask=scan->bm_bitmap is nonzero. But if the
Nov 24 2018, 9:52 PM
alc closed D18058: Handle the possiblity that the cursor has already passed the free blocks of a meta-node..
Nov 24 2018, 9:52 PM
alc added a comment to D18058: Handle the possiblity that the cursor has already passed the free blocks of a meta-node..
In D18058#388822, @pho wrote:

D18058.id50652.diff ran the stress2/misc/stealer.sh test scenario for 11 hours before freezing up: https://people.freebsd.org/~pho/stress/log/dougm015.txt

Nov 24 2018, 9:42 PM
alc added a comment to D18058: Handle the possiblity that the cursor has already passed the free blocks of a meta-node..
In D18058#389007, @dougm_rice.edu wrote:

Allow bighint to be updated for a meta-node where the cursor lies ahead of all nonempty children, or even when there are no nonempty children, since blist_alloc depends on a reduction of the root bighint to allow a failed allocation to finish.
Alternatively, we could change the test in blist_alloc to depend on something other than bighint. This is the only case where having a too-large bighint breaks things.

Nov 24 2018, 9:42 PM

Nov 21 2018

alc added inline comments to D17226: Implement M_NEXTFIT..
Nov 21 2018, 6:53 PM
alc added inline comments to D17227: Use M_NEXTFIT in memguard..
Nov 21 2018, 6:32 PM
alc accepted D18058: Handle the possiblity that the cursor has already passed the free blocks of a meta-node..

Yes, this is clearly a bug. Hopefully, it is the one that Peter is tripping over.

Nov 21 2018, 5:11 PM

Nov 19 2018

alc added inline comments to D13671: Collection of fixes for OOM handling of some corner cases..
Nov 19 2018, 5:28 PM
alc committed rS340637: Use swp_pager_isondev() throughout. Submitted by: ota@j.email.ne.jp.
Use swp_pager_isondev() throughout. Submitted by: ota@j.email.ne.jp
Nov 19 2018, 5:17 PM
alc closed D16712: inline swp_pager_isondev() function and use it 2 other places.
Nov 19 2018, 5:17 PM
alc added a comment to D16712: inline swp_pager_isondev() function and use it 2 other places.
In D16712#385630, @alc wrote:
In D16712#385624, @kib wrote:

Prefer to remove the inline keyword.

Okay, I'm going to commit this change in a few hours without the inline keyword.

Nov 19 2018, 5:04 PM

Nov 18 2018

alc added a comment to D16712: inline swp_pager_isondev() function and use it 2 other places.
In D16712#385624, @kib wrote:

Prefer to remove the inline keyword.

Nov 18 2018, 11:11 PM
alc added inline comments to D13671: Collection of fixes for OOM handling of some corner cases..
Nov 18 2018, 8:57 PM
alc committed rS340546: Tidy up vm_map_simplify_entry() and its recently introduced helper.
Tidy up vm_map_simplify_entry() and its recently introduced helper
Nov 18 2018, 1:27 AM
alc closed D17635: Avoid duplicate set_max_free after unlink.
Nov 18 2018, 1:27 AM

Nov 17 2018

alc added a comment to D17635: Avoid duplicate set_max_free after unlink.

I like the introduction of the #define, but I'd to rename it to have the suffix _MASK. The point being that when a reader sees a use case as opposed to the definition the reader doesn't think that it's yet another flag.

Nov 17 2018, 6:30 PM

Nov 16 2018

alc added inline comments to D17635: Avoid duplicate set_max_free after unlink.
Nov 16 2018, 6:47 PM
alc added a comment to D5603: ASLR.

On a somewhat related note, the version of jemalloc that we use in HEAD and 12.x is frequently allocating small, unaligned chunks from the kernel. In contrast, older versions were (always?) allocating large, aligned chunks. You can see the effects here: P196. Clang reads source files using mmap(2), and between most mapped files there is a sliver of anonymous heap. For "buildworld", I estimate that this has reduced superpage promotions by 1/3. The explicit clustering of anonymous memory allocations by this patch likely cures this problem.

Nov 16 2018, 6:32 PM
alc added inline comments to D17980: simplify next_leaf.
Nov 16 2018, 6:19 PM
alc added a comment to D5603: ASLR.

ASR has a measurable performance hit; ASLR does not.

I'd be quite interested in the detail here if you can provide a link or reference to this.

How expensive is pulling from the entropy pool at least once, at most five times, per call to mmap?

Nov 16 2018, 5:56 PM
alc added a comment to D17635: Avoid duplicate set_max_free after unlink.

Later today, I'm going to commit the bits here that are orthogonal to the main point of this patch. In other words, the bits that migrated here from an earlier, abandoned review that Kostik had asked about last week (if I recall correctly).

Nov 16 2018, 5:26 PM
alc added inline comments to D17635: Avoid duplicate set_max_free after unlink.
Nov 16 2018, 5:15 PM

Nov 15 2018

alc accepted D17981: arm64 pmap: Handle kernel mappings in pmap_remove_l2()..
Nov 15 2018, 9:51 PM
alc accepted D17981: arm64 pmap: Handle kernel mappings in pmap_remove_l2()..

Aside from my one comment, this looks fine. Once that comment is addressed, consider this change "Accepted" by me.

Nov 15 2018, 5:11 AM
alc added inline comments to D17981: arm64 pmap: Handle kernel mappings in pmap_remove_l2()..
Nov 15 2018, 5:07 AM

Nov 10 2018

alc accepted D12635: Allow allocations across meta boundaries.
Nov 10 2018, 8:22 PM
alc added a comment to D17937: Avoid calling pmap_enter(psind = 1) on the kernel_pmap..

arm64 is missing code from pmap_remove_l2() that reinstalls the (empty) page table page in the kernel pmap.

Nov 10 2018, 7:27 PM
alc added a comment to D17937: Avoid calling pmap_enter(psind = 1) on the kernel_pmap..

In regards to

mt = PHYS_TO_VM_PAGE(*pde & PG_FRAME);

the earlier call to pmap_remove_pde() and its helper function, pmap_remove_kernel_pde(), reinstalled the page table page that mt references, so this is correct code.

Nov 10 2018, 7:19 PM
alc added inline comments to D12635: Allow allocations across meta boundaries.
Nov 10 2018, 7:05 PM
alc added inline comments to D12635: Allow allocations across meta boundaries.
Nov 10 2018, 5:39 PM

Nov 9 2018

alc added inline comments to D17826: Use atomic_fcmpset in pmap_promote_pde()..
Nov 9 2018, 3:49 AM

Nov 7 2018

alc updated subscribers of D17897: Fix a use-after-free in swp_pager_meta_free()..
Nov 7 2018, 10:43 PM

Nov 6 2018

alc accepted D17827: Remove execute permissions from mappings in exec_map and pipe_map..
Nov 6 2018, 8:26 PM

Nov 5 2018

alc added inline comments to D17826: Use atomic_fcmpset in pmap_promote_pde()..
Nov 5 2018, 7:12 AM

Nov 4 2018

alc added inline comments to D17826: Use atomic_fcmpset in pmap_promote_pde()..
Nov 4 2018, 6:10 PM

Oct 28 2018

alc added inline comments to D14005: initializing map->header.eflags allows skipping some &map->header tests.
Oct 28 2018, 7:33 PM
alc accepted D14005: initializing map->header.eflags allows skipping some &map->header tests.

I would also suggest mentioning the use of this new flag in the comment at the top of the struct vm_map definition where we talk about min and max offset.

Oct 28 2018, 6:57 PM
alc added inline comments to D14005: initializing map->header.eflags allows skipping some &map->header tests.
Oct 28 2018, 6:44 PM
alc added reviewers for D14005: initializing map->header.eflags allows skipping some &map->header tests: kib, markj.
Oct 28 2018, 6:23 PM