From owner-svn-src-head@freebsd.org Tue Oct 8 14:59:51 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 277A712BED3; Tue, 8 Oct 2019 14:59:51 +0000 (UTC) (envelope-from mjg@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 46ngVv0DdJz441p; Tue, 8 Oct 2019 14:59:51 +0000 (UTC) (envelope-from mjg@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 DF8B119B6; Tue, 8 Oct 2019 14:59:50 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x98Exoam049052; Tue, 8 Oct 2019 14:59:50 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x98ExouA049051; Tue, 8 Oct 2019 14:59:50 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201910081459.x98ExouA049051@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Tue, 8 Oct 2019 14:59:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353307 - head/sys/amd64/amd64 X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/amd64/amd64 X-SVN-Commit-Revision: 353307 X-SVN-Commit-Repository: base 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.29 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, 08 Oct 2019 14:59:51 -0000 Author: mjg Date: Tue Oct 8 14:59:50 2019 New Revision: 353307 URL: https://svnweb.freebsd.org/changeset/base/353307 Log: amd64 pmap: allocate pv table entries for gaps in PA This matches the state prior to r353149 and fixes crashes with DRM modules. Reported and tested by: cy, garga, Krasznai Andras Fixes: r353149 ("amd64 pmap: implement per-superpage locks") Sponsored by: The FreeBSD Foundation Modified: head/sys/amd64/amd64/pmap.c Modified: head/sys/amd64/amd64/pmap.c ============================================================================== --- head/sys/amd64/amd64/pmap.c Tue Oct 8 14:54:35 2019 (r353306) +++ head/sys/amd64/amd64/pmap.c Tue Oct 8 14:59:50 2019 (r353307) @@ -1864,26 +1864,14 @@ pmap_init_pv_table(void) highest = -1; s = 0; for (i = 0; i < vm_phys_nsegs; i++) { - start = vm_phys_segs[i].start / NBPDR; end = vm_phys_segs[i].end / NBPDR; domain = vm_phys_segs[i].domain; if (highest >= end) continue; - if (start < highest) { - start = highest + 1; - pvd = &pv_table[start]; - } else { - /* - * The lowest address may land somewhere in the middle - * of our page. Simplify the code by pretending it is - * at the beginning. - */ - pvd = pa_to_pmdp(vm_phys_segs[i].start); - pvd = (struct pmap_large_md_page *)trunc_page(pvd); - start = pvd - pv_table; - } + start = highest + 1; + pvd = &pv_table[start]; pages = end - start + 1; s = round_page(pages * sizeof(*pvd));