From owner-freebsd-current@freebsd.org Fri May 8 16:15:09 2020 Return-Path: Delivered-To: freebsd-current@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 2BCA42DB7D7 for ; Fri, 8 May 2020 16:15:09 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 49Jb5S6WN2z4126; Fri, 8 May 2020 16:15:08 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id 048GF1jD069320 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Fri, 8 May 2020 19:15:04 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 048GF1jD069320 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id 048GF1TY069319; Fri, 8 May 2020 19:15:01 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 8 May 2020 19:15:00 +0300 From: Konstantin Belousov To: Andriy Gapon Cc: FreeBSD Current Subject: Re: CHANGE_PV_LIST_LOCK_TO_PHYS is not correct when !NUMA ? Message-ID: <20200508161500.GC44519@kib.kiev.ua> References: <0d7db402-621e-cc6b-2918-2078f63e2a9b@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <0d7db402-621e-cc6b-2918-2078f63e2a9b@FreeBSD.org> X-Spam-Status: No, score=-0.9 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED,PLING_QUERY autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on tom.home X-Rspamd-Queue-Id: 49Jb5S6WN2z4126 X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-6.00 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[] X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.32 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 May 2020 16:15:09 -0000 On Fri, May 08, 2020 at 06:53:24PM +0300, Andriy Gapon wrote: > > I have a reproducible panic with a custom kernel without option NUMA while using > amdgpu driver from linuxkpi-based drm: > > panic: address 41ec00000 beyond the last segment > > I did some quick debugging and the panic happens when Xorg server tries to > access a frame buffer (or something like that). There is a page fault that gets > satisfied by ttm with a fictitious page. > > The stack trace is: > #11 0xffffffff808031a3 in panic (fmt=0xffffffff8119a998 > "5\003ʀ\377\377\377\377") at /usr/devel/git/motil/sys/kern/kern_shutdown.c:839 > #12 0xffffffff80bbc552 in pmap_enter (pmap=, va=34504441856, > m=, prot=, flags=, psind= out>) at /usr/devel/git/motil/sys/amd64/amd64/pmap.c:6035 > #13 0xffffffff80b288be in vm_fault_populate (fs=) at > /usr/devel/git/motil/sys/vm/vm_fault.c:519 > #14 vm_fault_allocate (fs=) at > /usr/devel/git/motil/sys/vm/vm_fault.c:1032 > #15 vm_fault (map=, vaddr=, fault_type= out>, fault_flags=, m_hold=) at > /usr/devel/git/motil/sys/vm/vm_fault.c:1342 > #16 0xffffffff80b26e7e in vm_fault_trap (map=0xfffffe0017cd39e8, > vaddr=, fault_type=, fault_flags=0, > signo=0xfffffe00a810dbc4, ucode=0xfffffe00a810dbc0) at > /usr/devel/git/motil/sys/vm/vm_fault.c:589 > #17 0xffffffff80bcf89c in trap_pfault (frame=0xfffffe00a810dc00, > usermode=, signo=, ucode=0xffffffff80853250 > ) at /usr/devel/git/motil/sys/amd64/amd64/trap.c:821 > #18 0xffffffff80bceeec in trap (frame=0xfffffe00a810dc00) at > /usr/devel/git/motil/sys/amd64/amd64/trap.c:34 > > > The line number in pmap_enter() is incorrect, I guess because of optimizations. > The assert seems to be reached via pmap_enter -> CHANGE_PV_LIST_LOCK_TO_PHYS -> > PHYS_TO_PV_LIST_LOCK -> pa_index(). > > The panic in correct in that the page is fictitious and its physical address is > beyond the end of real physical memory. > It seems that NUMA PHYS_TO_PV_LIST_LOCK() is aware of such pages, but !NUMA one > is not. I think you can remove this assert. pa_index() is always taken by % NVP_LIST_LOCKS, because fictitious mappings are not promoted. Try that and commit if it works for you.