From owner-svn-src-head@freebsd.org Tue Apr 26 14:38:19 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B6C9FB1C36B; Tue, 26 Apr 2016 14:38:19 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 8F52C1EF0; Tue, 26 Apr 2016 14:38:19 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u3QEcIiH028347; Tue, 26 Apr 2016 14:38:18 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u3QEcIQ9028345; Tue, 26 Apr 2016 14:38:18 GMT (envelope-from br@FreeBSD.org) Message-Id: <201604261438.u3QEcIQ9028345@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Tue, 26 Apr 2016 14:38:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r298641 - in head/sys/riscv: include riscv 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.21 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: Tue, 26 Apr 2016 14:38:19 -0000 Author: br Date: Tue Apr 26 14:38:18 2016 New Revision: 298641 URL: https://svnweb.freebsd.org/changeset/base/298641 Log: Rework the list of all pmaps: embed the list link into pmap. Modified: head/sys/riscv/include/pmap.h head/sys/riscv/riscv/pmap.c Modified: head/sys/riscv/include/pmap.h ============================================================================== --- head/sys/riscv/include/pmap.h Tue Apr 26 14:31:48 2016 (r298640) +++ head/sys/riscv/include/pmap.h Tue Apr 26 14:38:18 2016 (r298641) @@ -74,18 +74,12 @@ struct pv_addr { vm_paddr_t pv_pa; }; -/* An entry in the list of all pmaps */ -struct pmap_list_entry { - SLIST_ENTRY(pmap_list_entry) pmap_link; - struct pmap *pmap; -}; - struct pmap { struct mtx pm_mtx; struct pmap_statistics pm_stats; /* pmap statictics */ pd_entry_t *pm_l1; TAILQ_HEAD(,pv_chunk) pm_pvchunk; /* list of mappings in pmap */ - struct pmap_list_entry *p_entry; /* Place in the list of all pmaps */ + LIST_ENTRY(pmap) pm_list; /* List of all pmaps */ }; typedef struct pv_entry { Modified: head/sys/riscv/riscv/pmap.c ============================================================================== --- head/sys/riscv/riscv/pmap.c Tue Apr 26 14:31:48 2016 (r298640) +++ head/sys/riscv/riscv/pmap.c Tue Apr 26 14:38:18 2016 (r298641) @@ -207,9 +207,9 @@ __FBSDID("$FreeBSD$"); #define VM_PAGE_TO_PV_LIST_LOCK(m) \ PHYS_TO_PV_LIST_LOCK(VM_PAGE_TO_PHYS(m)) -/* The list of all the pmaps */ -static SLIST_HEAD(, pmap_list_entry) pmap_list = - SLIST_HEAD_INITIALIZER(pmap_list); +/* The list of all the user pmaps */ +LIST_HEAD(pmaplist, pmap); +static struct pmaplist allpmaps; static MALLOC_DEFINE(M_VMPMAP, "pmap", "PMAP L1"); @@ -416,7 +416,6 @@ static void pmap_distribute_l1(struct pmap *pmap, vm_pindex_t l1index, pt_entry_t entry) { - struct pmap_list_entry *p_entry; struct pmap *user_pmap; pd_entry_t *l1; @@ -424,8 +423,7 @@ pmap_distribute_l1(struct pmap *pmap, vm if (pmap != kernel_pmap) return; - SLIST_FOREACH(p_entry, &pmap_list, pmap_link) { - user_pmap = p_entry->pmap; + LIST_FOREACH(user_pmap, &allpmaps, pm_list) { l1 = &user_pmap->pm_l1[l1index]; if (entry) pmap_load_store(l1, entry); @@ -569,6 +567,8 @@ pmap_bootstrap(vm_offset_t l1pt, vm_padd */ rw_init(&pvh_global_lock, "pmap pv global"); + LIST_INIT(&allpmaps); + /* Assume the address we were loaded to is a valid physical address */ min_pa = KERNBASE - kern_delta; @@ -1177,7 +1177,6 @@ pmap_pinit0(pmap_t pmap) int pmap_pinit(pmap_t pmap) { - struct pmap_list_entry *p_entry; vm_paddr_t l1phys; vm_page_t l1pt; @@ -1199,12 +1198,8 @@ pmap_pinit(pmap_t pmap) /* Install kernel pagetables */ memcpy(pmap->pm_l1, kernel_pmap->pm_l1, PAGE_SIZE); - p_entry = malloc(sizeof(struct pmap_list_entry), M_VMPMAP, M_WAITOK); - p_entry->pmap = pmap; - pmap->p_entry = p_entry; - - /* Add to the list of all pmaps */ - SLIST_INSERT_HEAD(&pmap_list, p_entry, pmap_link); + /* Add to the list of all user pmaps */ + LIST_INSERT_HEAD(&allpmaps, pmap, pm_list); return (1); } @@ -1374,12 +1369,11 @@ pmap_release(pmap_t pmap) atomic_subtract_int(&vm_cnt.v_wire_count, 1); vm_page_free_zero(m); + /* Remove pmap from the allpmaps list */ + LIST_REMOVE(pmap, pm_list); + /* Remove kernel pagetables */ bzero(pmap->pm_l1, PAGE_SIZE); - - /* Remove pmap from the all pmaps list */ - SLIST_REMOVE(&pmap_list, pmap->p_entry, - pmap_list_entry, pmap_link); } #if 0