From owner-freebsd-current@freebsd.org Fri Oct 18 11:26:30 2019 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 8CE9414D5BC for ; Fri, 18 Oct 2019 11:26:30 +0000 (UTC) (envelope-from contact@evilham.com) Received: from yggdrasil.evilham.com (yggdrasil.evilham.com [46.19.33.155]) (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 46vkJ42s73z4RvF; Fri, 18 Oct 2019 11:26:28 +0000 (UTC) (envelope-from contact@evilham.com) Received: from yggdrasil.evilham.com (unknown [IPv6:2a0a:e5c1:121:1::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by yggdrasil.evilham.com (Postfix) with ESMTPSA id 46vkHw3vn6z3wmp; Fri, 18 Oct 2019 13:26:20 +0200 (CEST) From: Evilham To: FreeBSD Current Cc: markj@freebsd.org Subject: Re: DRM-current-kmod is still a problem at r353339 References: <7ca3b30a-81f6-f79d-1486-7fd29765646f@acm.org> <99c89ca0-462c-f4c7-fa07-6f61e9d39d66@acm.org> <3bb2e410-51dd-bc3f-7660-41a4683551b3@daemonic.se> <20191017195347.GB6447@raichu> In-reply-to: <20191017195347.GB6447@raichu> Date: Fri, 18 Oct 2019 13:26:16 +0200 Message-ID: <5f647d3d-472c-4eb3-bd0e-5db4b9b365ce@yggdrasil.evilham.com> MIME-Version: 1.0 Content-Type: text/plain; format=flowed X-Rspamd-Queue-Id: 46vkJ42s73z4RvF X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=pass (policy=none) header.from=evilham.com; spf=pass (mx1.freebsd.org: domain of contact@evilham.com designates 46.19.33.155 as permitted sender) smtp.mailfrom=contact@evilham.com X-Spamd-Result: default: False [-3.52 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+mx]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; IP_SCORE(-0.72)[asn: 196752(-3.59), country: NL(0.02)]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; RCPT_COUNT_TWO(0.00)[2]; DMARC_POLICY_ALLOW(-0.50)[evilham.com,none]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:196752, ipnet:46.19.32.0/21, country:NL]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[] X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.29 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, 18 Oct 2019 11:26:30 -0000 Hey, thanks for the patch and the CC, coincidentally I had some time to look into this again. On dj., oct. 17 2019, markj@freebsd.org wrote: > I believe it was the recent work on the vm page busy state, > r353539 > specifically. This patch should fix it; we don't yet have a > __FreeBSD_version number bump on which to gate the patch. > > diff --git a/linuxkpi/gplv2/src/linux_page.c > b/linuxkpi/gplv2/src/linux_page.c > index e2b85c45c..060ae85ed 100644 > --- a/linuxkpi/gplv2/src/linux_page.c > +++ b/linuxkpi/gplv2/src/linux_page.c > @@ -239,7 +239,7 @@ retry: > page = vm_page_lookup(devobj, i); > if (page == NULL) > continue; > - if (vm_page_sleep_if_busy(page, "linuxkpi")) > + if (!vm_page_busy_acquire(page, VM_ALLOC_WAITFAIL)) > goto retry; > cdev_pager_free_page(devobj, page); > } I can confirm this works now on AMD Ryzen 7 PRO 2700U w/ Radeon Vega Mobile Gfx :-D. Took the liberty of adding to the end of this message some schematic steps to upgrade world+kernel+drm-devel-kmod in a setup with poudriere+boot environments, I hope they are helpful for someone else. If not using poudriere/boot environments, those bits can be skipped. Now I have trick questions: What is the upgrade plan here? What would happen when 13 is released and people upgrade from 12? I mean, AFAIU one first upgrades world+kernel, then upgrades ports; in cases where drm-kmod is used, that seems to leave the system in an "unusable" state between those steps (there is single-user-mode which allows removal or upgrade of drm-kmod, but regular boot crashes) and since this is a compile-time patch, there doesn't seem to be an easy way to solve that. I saw Mark has a PR to apply the patch to 12.1 as well, but I think that will have the same upgrade path issue? Am I thinking too far ahead here or is there something I'm missing? The mentioned steps: 1. Built world and kernel from HEAD, in this case: FreeBSD 13.0-CURRENT #4 7f37066f607-c263595(master) 2. Created a boot environment so I can go back to it if things don't work out 3. Removed drm-devel-kmod 4. Installed world and kernel 5. Rebooted into a system without graphics, but with the new world and kernel 6. Destroyed my poudriere jail 7. Re-created it (drm-devel-kmod didn't build without steps 6 and 7) 8. Patched poudriere's ports directory: graphics/drm-devel-kmod as follows: --- Makefile (revision 514712) +++ Makefile (working copy) @@ -2,7 +2,7 @@ # $FreeBSD$ PORTNAME= drm-devel-kmod -PORTVERSION= 5.0.g20190828 +PORTVERSION= 5.0.g20191017 CATEGORIES= graphics kld MAINTAINER= x11@FreeBSD.org @@ -28,7 +28,7 @@ USE_GITHUB= yes GH_ACCOUNT= FreeBSDDesktop GH_PROJECT= kms-drm -GH_TAGNAME= dc414a9 +GH_TAGNAME= 761ef739 9. Ran make makesum in graphics/drm-devel-kmod 10. Added the patch Mark mentioned before to graphics/drm-devel-kmod: # cat files/patch-linuxkpi_gplv2_src_linux__page.c --- linuxkpi/gplv2/src/linux_page.c.orig 2019-08-27 19:58:24 UTC +++ linuxkpi/gplv2/src/linux_page.c @@ -239,7 +239,7 @@ retry: page = vm_page_lookup(devobj, i); if (page == NULL) continue; - if (vm_page_sleep_if_busy(page, "linuxkpi")) + if (!vm_page_busy_acquire(page, VM_ALLOC_WAITFAIL)) goto retry; cdev_pager_free_page(devobj, page); } 11. Built the port in poudriere 12. Installed drm-devel-kmod 13. Reboot and profit Thank you again for looking into this! -- Evilham