Re: Kernel/driver hacking: panic: Assertion vm_object_busied((m->object)) failed at /usr/src/sys/vm/vm_page.c:5455

From: Hans Petter Selasky <hps_at_selasky.org>
Date: Sun, 20 Jun 2021 08:36:40 UTC
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