Date: Wed, 16 Jun 2021 20:10:11 +0200 From: Hans Petter Selasky <hps@selasky.org> To: Neel Chauhan <nc@FreeBSD.org> Cc: current@freebsd.org, Jeff Roberson <jeff@freebsd.org> Subject: Re: Kernel/driver hacking: panic: Assertion vm_object_busied((m->object)) failed at /usr/src/sys/vm/vm_page.c:5455 Message-ID: <e89496cd-6356-fbb4-5ef7-3ee470e9b85d@selasky.org> In-Reply-To: <faa2032dde20ffbdc012bda307bce1f0@FreeBSD.org> References: <e542a0c737f24d15df0fadd985e94938@neelc.org> <b76f0409-1104-23bc-827b-76525a32bdc3@selasky.org> <faa2032dde20ffbdc012bda307bce1f0@FreeBSD.org>
next in thread | previous in thread | raw e-mail | index | archive | help
Hi Neel, On 6/16/21 5:28 PM, Neel Chauhan wrote: > Hi, > > On 2021-06-16 00:35, Hans Petter Selasky wrote: >> Do you have the full backtrace? > > Yes. > > I have attached a stack trace in the previous email, but if you didn't > get it, I have uploaded it to GitHub: > https://gist.github.com/neelchauhan/437bd10239f84c563aafb37ab440029a > >> Doesn't this code work in the current DRM - kmod? What changed? Did >> you perhaps miss a patch? > > I think there is new code with Linux 5.6 which changes how this is done. > > I have been attempting to make a FreeBSD equivalent, but it panics. It > is **not** from missing Linux commits since I believe I added them all. > > The code in my GH repo: > https://github.com/neelchauhan/drm-kmod/blob/5.7-wip/drivers/gpu/drm/i915/gem/i915_gem_mman.c#L346 > I think the following changes are needed. CC'ing Jeff. > for_each_sg_page(pages->sgl, &sg_iter, pages->nents, 0) { > pmap_t pmap = vm_map_pmap(map); > struct vm_page *pa = sg_page_iter_page(&sg_iter); > VM_OBJECT_RLOCK(pa->object); Try adding this: vm_object_busy(pa->object); > if (pmap_enter(pmap, va, pa, 0, flags, 0)) { Try adding this: vm_object_unbusy(pa->object); VM_OBJECT_RUNLOCK(pa->object); > err = -ENOMEM; > break; > } Try adding this: vm_object_unbusy(pa->object); > VM_OBJECT_RUNLOCK(pa->object); > va += PAGE_SIZE; --HPS
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?e89496cd-6356-fbb4-5ef7-3ee470e9b85d>