Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/uvm/pmap In pmap_pte_reserve ensure we're atomically swa...



details:   https://anonhg.NetBSD.org/src/rev/a1022a8991a1
branches:  trunk
changeset: 372112:a1022a8991a1
user:      skrll <skrll%NetBSD.org@localhost>
date:      Thu Oct 27 06:49:51 2022 +0000

description:
In pmap_pte_reserve ensure we're atomically swapping out an invalid entry
otherwise concurrent updates might both think they've updated the entry.

diffstat:

 sys/uvm/pmap/pmap_segtab.c |  7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diffs (28 lines):

diff -r 2975ef7f5ee3 -r a1022a8991a1 sys/uvm/pmap/pmap_segtab.c
--- a/sys/uvm/pmap/pmap_segtab.c        Thu Oct 27 06:20:41 2022 +0000
+++ b/sys/uvm/pmap/pmap_segtab.c        Thu Oct 27 06:49:51 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmap_segtab.c,v 1.29 2022/10/26 07:35:20 skrll Exp $   */
+/*     $NetBSD: pmap_segtab.c,v 1.30 2022/10/27 06:49:51 skrll Exp $   */
 
 /*-
  * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
 
 #include <sys/cdefs.h>
 
-__KERNEL_RCSID(0, "$NetBSD: pmap_segtab.c,v 1.29 2022/10/26 07:35:20 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap_segtab.c,v 1.30 2022/10/27 06:49:51 skrll Exp $");
 
 /*
  *     Manages physical address maps.
@@ -1161,8 +1161,7 @@
                pd_entry_t npde = pte_pde_ptpage(pa, pmap == pmap_kernel());
 #endif
 #if defined(PMAP_HWPAGEWALKER) && defined(PMAP_MAP_PDETABPAGE)
-               pd_entry_t opde = *pde_p;
-               opde = pte_pde_cas(pde_p, opde, npde);
+               pd_entry_t opde = pte_pde_cas(pde_p, pte_invalid_pde(), npde);
                if (__predict_false(pte_pde_valid_p(opde))) {
                        pmap_ptpage_free(pmap, ppg, __func__);
                        ppg = pmap_pde_to_ptpage(opde);



Home | Main Index | Thread Index | Old Index