Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/x86/x86 Adjustment to previous: TP_SET_DONE() was w...



details:   https://anonhg.NetBSD.org/src/rev/a9c9a80186f2
branches:  trunk
changeset: 745163:a9c9a80186f2
user:      ad <ad%NetBSD.org@localhost>
date:      Sun Feb 23 18:57:28 2020 +0000

description:
Adjustment to previous: TP_SET_DONE() was wiping out the VA to shoot,
instead of ORing the flag into the array element.  This caused the CPU
initiating the shootdown to occasionally miss an INVLPG.

diffstat:

 sys/arch/x86/x86/x86_tlb.c |  10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diffs (31 lines):

diff -r 061e7a8283ee -r a9c9a80186f2 sys/arch/x86/x86/x86_tlb.c
--- a/sys/arch/x86/x86/x86_tlb.c        Sun Feb 23 16:27:09 2020 +0000
+++ b/sys/arch/x86/x86/x86_tlb.c        Sun Feb 23 18:57:28 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: x86_tlb.c,v 1.16 2020/02/22 20:12:40 maxv Exp $        */
+/*     $NetBSD: x86_tlb.c,v 1.17 2020/02/23 18:57:28 ad Exp $  */
 
 /*-
  * Copyright (c) 2008-2020 The NetBSD Foundation, Inc.
@@ -40,7 +40,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: x86_tlb.c,v 1.16 2020/02/22 20:12:40 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: x86_tlb.c,v 1.17 2020/02/23 18:57:28 ad Exp $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -99,7 +99,11 @@
 
 #define        TP_SET_USERPMAP(tp)     ((tp)->tp_store[TP_USERPMAP] |= 1)
 #define        TP_SET_GLOBAL(tp)       ((tp)->tp_store[TP_GLOBAL] |= 1)
-#define        TP_SET_DONE(tp)         atomic_store_relaxed(&(tp)->tp_store[TP_DONE], 1)
+#define        TP_SET_DONE(tp) \
+do { \
+       uintptr_t v = atomic_load_relaxed(&(tp)->tp_store[TP_DONE]); \
+       atomic_store_relaxed(&(tp)->tp_store[TP_DONE], v | 1); \
+} while (/* CONSTCOND */ 0);
 
 #define        TP_CLEAR(tp)            memset(__UNVOLATILE(tp), 0, sizeof(*(tp)));
 



Home | Main Index | Thread Index | Old Index