Module Name: src
Committed By: ad
Date: Sun Feb 23 18:57:28 UTC 2020
Modified Files:
src/sys/arch/x86/x86: x86_tlb.c
Log Message:
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.
To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/x86/x86/x86_tlb.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/arch/x86/x86/x86_tlb.c
diff -u src/sys/arch/x86/x86/x86_tlb.c:1.16 src/sys/arch/x86/x86/x86_tlb.c:1.17
--- src/sys/arch/x86/x86/x86_tlb.c:1.16 Sat Feb 22 20:12:40 2020
+++ src/sys/arch/x86/x86/x86_tlb.c Sun Feb 23 18:57:28 2020
@@ -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 @@ typedef struct {
#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)));