From nobody Sun Jun 20 08:36:40 2021 X-Original-To: current@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 89BB111D4F6D for ; Sun, 20 Jun 2021 08:36:46 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (turbocat.net [88.99.82.50]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4G75cG2y4zz4fL6; Sun, 20 Jun 2021 08:36:46 +0000 (UTC) (envelope-from hps@selasky.org) Received: from hps2020.home.selasky.org (unknown [178.17.145.105]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 02B2A2601EF; Sun, 20 Jun 2021 10:36:43 +0200 (CEST) Subject: Re: Kernel/driver hacking: panic: Assertion vm_object_busied((m->object)) failed at /usr/src/sys/vm/vm_page.c:5455 To: Neel Chauhan Cc: Mark Johnston , current@freebsd.org References: <8bd27c2a72ebfa9299bca7d930297faf@FreeBSD.org> <389e4560afdc211e9915746b11a0d0d0@FreeBSD.org> <61de965123274866935935bded6c3d58@FreeBSD.org> From: Hans Petter Selasky Message-ID: <6df7b46d-26ca-b897-66fd-b6a441475348@selasky.org> Date: Sun, 20 Jun 2021 10:36:40 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:78.0) Gecko/20100101 Thunderbird/78.10.2 List-Id: Discussions about the use of FreeBSD-current List-Archive: https://lists.freebsd.org/archives/freebsd-current List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-current@freebsd.org MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4G75cG2y4zz4fL6 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-Spam: Yes X-ThisMailContainsUnwantedMimeParts: N On 6/20/21 7:32 AM, Neel Chauhan wrote: > On 2021-06-18 20:03, Neel Chauhan wrote: >> Apparently, the vm_start values is for some reason coming as 0 when it >> is passed into vm_fault_cpu(). That's why it's giving these errors: of >> course the address at 0 is mapped, it is (probably) used by the >> kernel. > > An update: The vm_start 0 seems to be expected. I checked the values > with printf()s. > > I have posted this on Twitter, and am considering hiring a kernel > consultant to help if I am unable to do this on my own. > > So I am guessing this line (Line 231) is incorrect: > >     pa = sg_dma_address(sgl); > > Source: > https://github.com/neelchauhan/drm-kmod/blob/d0eee96973ee0772e977b813678f92c5becf0507/drivers/gpu/drm/i915/intel_freebsd.c#L231 Hi Neel, sg_dma_address() is zero, because the memory hasn't been loaded. You need to handle two cases there: When r->iobase is -1 and when it is not. I suspect you should add r->iobase to the sg_dma_address() only and only when it is non -1. Also, there is a superfluous "pa = " in the beginning of the function. --HPS