Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/rmind-uvmplock]: src/sys/arch/x86/x86 - pmap_tlb_shootdown: fix a bug wh...
details: https://anonhg.NetBSD.org/src/rev/88bc12c6b6aa
branches: rmind-uvmplock
changeset: 753076:88bc12c6b6aa
user: rmind <rmind%NetBSD.org@localhost>
date: Tue Mar 08 23:41:09 2011 +0000
description:
- pmap_tlb_shootdown: fix a bug when state for full TLB flush can be
reverted to a single page invalidation(s).
- pmap_tlb_init: clear pmap_tlb_packet and pmap_tlb_mailbox structs.
diffstat:
sys/arch/x86/x86/pmap_tlb.c | 21 +++++++++++++++------
1 files changed, 15 insertions(+), 6 deletions(-)
diffs (58 lines):
diff -r 19edcb68d58c -r 88bc12c6b6aa sys/arch/x86/x86/pmap_tlb.c
--- a/sys/arch/x86/x86/pmap_tlb.c Tue Mar 08 23:27:50 2011 +0000
+++ b/sys/arch/x86/x86/pmap_tlb.c Tue Mar 08 23:41:09 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap_tlb.c,v 1.1.2.3 2010/07/02 02:11:21 rmind Exp $ */
+/* $NetBSD: pmap_tlb.c,v 1.1.2.4 2011/03/08 23:41:09 rmind Exp $ */
/*-
* Copyright (c) 2008, 2010 The NetBSD Foundation, Inc.
@@ -40,7 +40,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap_tlb.c,v 1.1.2.3 2010/07/02 02:11:21 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap_tlb.c,v 1.1.2.4 2011/03/08 23:41:09 rmind Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
@@ -59,9 +59,9 @@
/*
* TLB shootdown state.
*/
-static struct evcnt pmap_tlb_evcnt __aligned(64);
-struct pmap_tlb_packet pmap_tlb_packet __aligned(64);
-struct pmap_tlb_mailbox pmap_tlb_mailbox __aligned(64);
+static struct evcnt pmap_tlb_evcnt __cacheline_aligned;
+struct pmap_tlb_packet pmap_tlb_packet __cacheline_aligned;
+struct pmap_tlb_mailbox pmap_tlb_mailbox __cacheline_aligned;
/*
* TLB shootdown statistics.
@@ -93,6 +93,10 @@
void
pmap_tlb_init(void)
{
+ int i = 0;
+
+ memset(&pmap_tlb_packet, 0, sizeof(struct pmap_tlb_packet));
+ memset(&pmap_tlb_mailbox, 0, sizeof(struct pmap_tlb_mailbox));
evcnt_attach_dynamic(&pmap_tlb_evcnt, EVCNT_TYPE_INTR,
NULL, "TLB", "shootdown");
@@ -177,9 +181,14 @@
CTASSERT(PG_G == (uint16_t)PG_G);
tp->tp_pte |= (uint16_t)pte;
- if (tp->tp_count < TP_MAXVA && va != (vaddr_t)-1LL) {
+ if (tp->tp_count == (uint16_t)-1) {
+ /*
+ * Already flushing everything.
+ */
+ } else if (tp->tp_count < TP_MAXVA && va != (vaddr_t)-1LL) {
/* Flush a single page. */
tp->tp_va[tp->tp_count++] = va;
+ KASSERT(tp->tp_count > 0);
} else {
/* Flush everything. */
tp->tp_count = (uint16_t)-1;
Home |
Main Index |
Thread Index |
Old Index