From owner-svn-src-head@FreeBSD.ORG Mon May 11 19:55:03 2015 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9C9D1E7; Mon, 11 May 2015 19:55:03 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7E98E1393; Mon, 11 May 2015 19:55:03 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4BJt3KY049707; Mon, 11 May 2015 19:55:03 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4BJt24F049697; Mon, 11 May 2015 19:55:02 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201505111955.t4BJt24F049697@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Mon, 11 May 2015 19:55:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r282780 - in head/sys/arm: arm include X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 May 2015 19:55:03 -0000 Author: alc Date: Mon May 11 19:55:01 2015 New Revision: 282780 URL: https://svnweb.freebsd.org/changeset/base/282780 Log: Retire pmap_lazyfix(). This function only existed in the new armv6 pmap because the i386 pmap on which the new armv6 pmap is based had it, and in r281707 pmap_lazyfix() was removed from the i386 pmap. Discussed with: kib Submitted by: Michal Meloun (via Svatopluk Kraus) Modified: head/sys/arm/arm/mp_machdep.c head/sys/arm/arm/pmap-v6-new.c head/sys/arm/arm/swtch.S head/sys/arm/include/pmap-v6.h head/sys/arm/include/smp.h Modified: head/sys/arm/arm/mp_machdep.c ============================================================================== --- head/sys/arm/arm/mp_machdep.c Mon May 11 19:20:30 2015 (r282779) +++ head/sys/arm/arm/mp_machdep.c Mon May 11 19:55:01 2015 (r282780) @@ -309,12 +309,6 @@ ipi_handler(void *arg) CTR1(KTR_SMP, "%s: IPI_TLB", __func__); cpufuncs.cf_tlb_flushID(); break; -#ifdef ARM_NEW_PMAP - case IPI_LAZYPMAP: - CTR1(KTR_SMP, "%s: IPI_LAZYPMAP", __func__); - pmap_lazyfix_action(); - break; -#endif default: panic("Unknown IPI 0x%0x on cpu %d", ipi, curcpu); } Modified: head/sys/arm/arm/pmap-v6-new.c ============================================================================== --- head/sys/arm/arm/pmap-v6-new.c Mon May 11 19:20:30 2015 (r282779) +++ head/sys/arm/arm/pmap-v6-new.c Mon May 11 19:55:01 2015 (r282780) @@ -2166,104 +2166,6 @@ pmap_pinit(pmap_t pmap) return (1); } -#ifdef SMP -/* - * Deal with a SMP shootdown of other users of the pmap that we are - * trying to dispose of. This can be a bit hairy. - */ -static cpuset_t *lazymask; -static ttb_entry_t lazyttb; -static volatile u_int lazywait; - -void -pmap_lazyfix_action(void) -{ - -#ifdef COUNT_IPIS - (*ipi_lazypmap_counts[PCPU_GET(cpuid)])++; -#endif - spinlock_enter(); - if (cp15_ttbr_get() == lazyttb) { - cp15_ttbr_set(curthread->td_pcb->pcb_pagedir); - } - CPU_CLR_ATOMIC(PCPU_GET(cpuid), lazymask); - atomic_store_rel_int(&lazywait, 1); - spinlock_exit(); - -} - -static void -pmap_lazyfix_self(u_int cpuid) -{ - - spinlock_enter(); - if (cp15_ttbr_get() == lazyttb) { - cp15_ttbr_set(curthread->td_pcb->pcb_pagedir); - } - CPU_CLR_ATOMIC(cpuid, lazymask); - spinlock_exit(); -} - -static void -pmap_lazyfix(pmap_t pmap) -{ - cpuset_t mymask, mask; - u_int cpuid, spins; - int lsb; - - mask = pmap->pm_active; - while (!CPU_EMPTY(&mask)) { - spins = 50000000; - - /* Find least significant set bit. */ - lsb = CPU_FFS(&mask); - MPASS(lsb != 0); - lsb--; - CPU_SETOF(lsb, &mask); - mtx_lock_spin(&smp_ipi_mtx); - - lazyttb = pmap_ttb_get(pmap); - cpuid = PCPU_GET(cpuid); - - /* Use a cpuset just for having an easy check. */ - CPU_SETOF(cpuid, &mymask); - if (!CPU_CMP(&mask, &mymask)) { - lazymask = &pmap->pm_active; - pmap_lazyfix_self(cpuid); - } else { - atomic_store_rel_int((u_int *)&lazymask, - (u_int)&pmap->pm_active); - atomic_store_rel_int(&lazywait, 0); - ipi_selected(mask, IPI_LAZYPMAP); - while (lazywait == 0) { - if (--spins == 0) - break; - } - } - mtx_unlock_spin(&smp_ipi_mtx); - if (spins == 0) - printf("%s: spun for 50000000\n", __func__); - mask = pmap->pm_active; - } -} -#else /* SMP */ -/* - * Cleaning up on uniprocessor is easy. For various reasons, we're - * unlikely to have to even execute this code, including the fact - * that the cleanup is deferred until the parent does a wait(2), which - * means that another userland process has run. - */ -static void -pmap_lazyfix(pmap_t pmap) -{ - - if (!CPU_EMPTY(&pmap->pm_active)) { - cp15_ttbr_set(curthread->td_pcb->pcb_pagedir); - CPU_ZERO(&pmap->pm_active); - } -} -#endif /* SMP */ - #ifdef INVARIANTS static boolean_t pt2tab_user_is_empty(pt2_entry_t *tab) @@ -2292,8 +2194,9 @@ pmap_release(pmap_t pmap) pmap->pm_stats.resident_count)); KASSERT(pt2tab_user_is_empty(pmap->pm_pt2tab), ("%s: has allocated user PT2(s)", __func__)); + KASSERT(CPU_EMPTY(&pmap->pm_active), + ("%s: pmap %p is active on some CPU(s)", __func__, pmap)); - pmap_lazyfix(pmap); mtx_lock_spin(&allpmaps_lock); LIST_REMOVE(pmap, pm_list); mtx_unlock_spin(&allpmaps_lock); Modified: head/sys/arm/arm/swtch.S ============================================================================== --- head/sys/arm/arm/swtch.S Mon May 11 19:20:30 2015 (r282779) +++ head/sys/arm/arm/swtch.S Mon May 11 19:55:01 2015 (r282780) @@ -624,14 +624,6 @@ ENTRY(cpu_switch) cmp r0, r1 /* Switching to the TTB? */ beq sw0 /* same TTB, skip */ -#if 1 /* Lazy context switch */ - /* Don't switch mapping for kernel threads */ - ldr r1, =pmap_kern_ttb - ldr r1, [r1] /* r1 = kernel TTB */ - cmp r0, r1 /* Switching to kernel TTB? */ - beq sw0 /* kernel TTB, skip */ -#endif - #ifdef INVARIANTS cmp r0, #0 /* new thread? */ beq badsw4 /* no, panic */ Modified: head/sys/arm/include/pmap-v6.h ============================================================================== --- head/sys/arm/include/pmap-v6.h Mon May 11 19:20:30 2015 (r282779) +++ head/sys/arm/include/pmap-v6.h Mon May 11 19:55:01 2015 (r282780) @@ -193,7 +193,6 @@ void pmap_unmapdev(vm_offset_t, vm_size_ void pmap_kenter_device(vm_offset_t, vm_size_t, vm_paddr_t); void pmap_kremove_device(vm_offset_t, vm_size_t); void pmap_set_pcb_pagedir(pmap_t , struct pcb *); -void pmap_lazyfix_action(void); void pmap_tlb_flush(pmap_t , vm_offset_t ); void pmap_tlb_flush_range(pmap_t , vm_offset_t , vm_size_t ); Modified: head/sys/arm/include/smp.h ============================================================================== --- head/sys/arm/include/smp.h Mon May 11 19:20:30 2015 (r282779) +++ head/sys/arm/include/smp.h Mon May 11 19:55:01 2015 (r282780) @@ -14,7 +14,6 @@ #define IPI_HARDCLOCK 6 #define IPI_TLB 7 #define IPI_CACHE 8 -#define IPI_LAZYPMAP 9 void init_secondary(int cpu); void mpentry(void);