Re: Kernel/driver hacking: panic: Assertion vm_object_busied((m->object)) failed at /usr/src/sys/vm/vm_page.c:5455
Date: Mon, 21 Jun 2021 04:32:37 UTC
Hi Hans,
Sorry if I have to bother you again.
On 2021-06-20 01:36, Hans Petter Selasky wrote:
> sg_dma_address() is zero, because the memory hasn't been loaded.
Makes sense!
> 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.
I have addressed it in my code.
Hans, while your approach is correct (that's also done in Linux), for
some reason it still crashes on vm_page_insert(). I must be doing "pa =
" wrong.
Stacktrace: https://misc.neelc.org/drm-kmod/stacktrace2.txt
I have a separate function for getting the physical address:
https://github.com/neelchauhan/drm-kmod/blob/5.7-wip/drivers/gpu/drm/i915/intel_freebsd.c#L219
This crash happens when "iobase == -1", so we execute Lines 228-231:
-
} else {
struct sgt_iter sgt = __sgt_iter(sgl, 0);
pa = (sgt.pfn + (sgt.curr >> PAGE_SHIFT)) << PAGE_SHIFT;
}
sgt.curr is zero, since (I believe) it's the first iteration.
I have copied the Linux approach and ported what I felt was necessary, I
am worried I am doing this wrong.
> Also, there is a superfluous "pa = " in the beginning of the function.
(Hopefully) I have cleaned it up.
> --HPS
-Neel (nc@)