Module Name:    src
Committed By:   matt
Date:           Thu Jun 11 15:15:27 UTC 2015

Modified Files:
        src/sys/arch/mips/mips: pmap_tlb.c

Log Message:
Fix a type from kcpuset transition.
Deal with kcpuset_ffs return value a little more cleanly.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/mips/mips/pmap_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/mips/mips/pmap_tlb.c
diff -u src/sys/arch/mips/mips/pmap_tlb.c:1.9 src/sys/arch/mips/mips/pmap_tlb.c:1.10
--- src/sys/arch/mips/mips/pmap_tlb.c:1.9	Wed Jun 10 22:31:00 2015
+++ src/sys/arch/mips/mips/pmap_tlb.c	Thu Jun 11 15:15:27 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap_tlb.c,v 1.9 2015/06/10 22:31:00 matt Exp $	*/
+/*	$NetBSD: pmap_tlb.c,v 1.10 2015/06/11 15:15:27 matt Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include <sys/cdefs.h>
 
-__KERNEL_RCSID(0, "$NetBSD: pmap_tlb.c,v 1.9 2015/06/10 22:31:00 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap_tlb.c,v 1.10 2015/06/11 15:15:27 matt Exp $");
 
 /*
  * Manages address spaces in a TLB.
@@ -560,13 +560,14 @@ pmap_tlb_shootdown_bystanders(pmap_t pm)
 		/*
 		 * Skip this TLB if there are no active mappings for it.
 		 */
-		if (!kcpuset_intersecting_p(pm_active, ti->ti_kcpuset) == 0)
+		if (!kcpuset_intersecting_p(pm_active, ti->ti_kcpuset))
 			continue;
 		struct pmap_asid_info * const pai = PMAP_PAI(pm, ti);
 		kcpuset_remove(pm_active, ti->ti_kcpuset);
 		TLBINFO_LOCK(ti);
 		cpuid_t j = kcpuset_ffs_intersecting(pm->pm_onproc, ti->ti_kcpuset);
-		if (j != 0) {
+		// post decrement since ffs returns bit + 1 or 0 if no bit
+		if (j-- > 0) {
 			if (kernel_p) {
 				ti->ti_tlbinvop =
 				    TLBINV_KERNEL_MAP(ti->ti_tlbinvop);
@@ -598,7 +599,7 @@ pmap_tlb_shootdown_bystanders(pmap_t pm)
 			 * change now that we have released the lock but we
 			 * can tolerate spurious shootdowns.
 			 */
-			cpu_send_ipi(cpu_lookup(j-1), IPI_SHOOTDOWN);
+			cpu_send_ipi(cpu_lookup(j), IPI_SHOOTDOWN);
 			ipi_sent = true;
 			continue;
 		}

Reply via email to