From owner-svn-src-stable@freebsd.org Tue Jun 4 17:24:27 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 52A8815B8087; Tue, 4 Jun 2019 17:24:27 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E7243741B7; Tue, 4 Jun 2019 17:24:26 +0000 (UTC) (envelope-from markj@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C29E120ACF; Tue, 4 Jun 2019 17:24:26 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x54HOQJ2097583; Tue, 4 Jun 2019 17:24:26 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x54HOQsH097582; Tue, 4 Jun 2019 17:24:26 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201906041724.x54HOQsH097582@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 4 Jun 2019 17:24:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r348636 - stable/12/sys/riscv/riscv X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/sys/riscv/riscv X-SVN-Commit-Revision: 348636 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: E7243741B7 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.97)[-0.973,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Jun 2019 17:24:27 -0000 Author: markj Date: Tue Jun 4 17:24:26 2019 New Revision: 348636 URL: https://svnweb.freebsd.org/changeset/base/348636 Log: MFC r342735: Synchronize access to the allpmaps list. Modified: stable/12/sys/riscv/riscv/pmap.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/riscv/riscv/pmap.c ============================================================================== --- stable/12/sys/riscv/riscv/pmap.c Tue Jun 4 17:23:58 2019 (r348635) +++ stable/12/sys/riscv/riscv/pmap.c Tue Jun 4 17:24:26 2019 (r348636) @@ -228,6 +228,7 @@ CTASSERT((DMAP_MIN_ADDRESS & ~L1_OFFSET) == DMAP_MIN_ CTASSERT((DMAP_MAX_ADDRESS & ~L1_OFFSET) == DMAP_MAX_ADDRESS); static struct rwlock_padalign pvh_global_lock; +static struct mtx_padalign allpmaps_lock; /* * Data for the pv entry allocation mechanism @@ -380,10 +381,12 @@ pmap_distribute_l1(struct pmap *pmap, vm_pindex_t l1in if (pmap != kernel_pmap) return; + mtx_lock(&allpmaps_lock); LIST_FOREACH(user_pmap, &allpmaps, pm_list) { l1 = &user_pmap->pm_l1[l1index]; pmap_store(l1, entry); } + mtx_unlock(&allpmaps_lock); } static pt_entry_t * @@ -636,9 +639,10 @@ pmap_init(void) int i; /* - * Initialize the pv chunk list mutex. + * Initialize the pv chunk and pmap list mutexes. */ mtx_init(&pv_chunks_mutex, "pmap pv chunk list", NULL, MTX_DEF); + mtx_init(&allpmaps_lock, "allpmaps", NULL, MTX_DEF); /* * Initialize the pool of pv list locks. @@ -1132,7 +1136,9 @@ pmap_pinit(pmap_t pmap) memcpy(pmap->pm_l1, kernel_pmap->pm_l1, PAGE_SIZE); /* Add to the list of all user pmaps */ + mtx_lock(&allpmaps_lock); LIST_INSERT_HEAD(&allpmaps, pmap, pm_list); + mtx_unlock(&allpmaps_lock); return (1); } @@ -1296,7 +1302,9 @@ pmap_release(pmap_t pmap) vm_page_free_zero(m); /* Remove pmap from the allpmaps list */ + mtx_lock(&allpmaps_lock); LIST_REMOVE(pmap, pm_list); + mtx_unlock(&allpmaps_lock); /* Remove kernel pagetables */ bzero(pmap->pm_l1, PAGE_SIZE);