Re: Kernel crash during video transcoding

From: Alexandre Levy <a13xlevy_at_gmail.com>
Date: Mon, 10 Aug 2020 11:59:59 +0100
I could reproduce with GENERIC kernel and i915 kms compiled with DEBUG and
I got this additional info (still no crash dump though) :

Kernel page fault with the following non-sleepable locks held:
kernel: exclusive rw vm object (vm object) r = 0 (0xfffff8037533bc60)
locked _at_
/usr/ports/graphics/drm-devel-kmod/work/drm-kmod-drm_v5.3_4/drivers/gpu/drm/i915/intel_freebsd.c:186

Looking at the code, the error happens during the call to VM_OBJECT_WLOCK
(memory page locking for write ?) in the intel_freebsd.c (see [1] below).
I'm out for a few days but I'll try to dig more into it when I'm back next
weekend although I have no experience in the drm-devel-kmod codebase. In
the meantime if you have any suggestions on debugging this further I'm
happy to follow them.

Thanks again.


[1] i915/intel_freebsd.c
int
remap_io_mapping(struct vm_area_struct *vma, unsigned long addr,
    unsigned long pfn, unsigned long size, struct io_mapping *iomap)
{
    vm_page_t m;
    vm_object_t vm_obj;
    vm_memattr_t attr;
    vm_paddr_t pa;
    vm_pindex_t pidx, pidx_start;
    int count, rc;

    attr = iomap->attr;
    count = size >> PAGE_SHIFT;
    pa = pfn << PAGE_SHIFT;
    pidx_start = OFF_TO_IDX(addr);
    rc = 0;
    vm_obj = vma->vm_obj;

    vma->vm_pfn_first = pidx_start;

    >>> VM_OBJECT_WLOCK(vm_obj); <<<
    for (pidx = pidx_start; pidx < pidx_start + count;
        pidx++, pa += PAGE_SIZE) {
retry:
        m = vm_page_grab(vm_obj, pidx, VM_ALLOC_NOCREAT);
        if (m == NULL) {
            m = PHYS_TO_VM_PAGE(pa);
            if (!vm_page_busy_acquire(m, VM_ALLOC_WAITFAIL))
                goto retry;
            if (vm_page_insert(m, vm_obj, pidx)) {
                vm_page_xunbusy(m);
                VM_OBJECT_WUNLOCK(vm_obj);
                vm_wait(NULL);
                VM_OBJECT_WLOCK(vm_obj);
                goto retry;
            }
            vm_page_valid(m);
        }
        pmap_page_set_memattr(m, attr);
        vma->vm_pfn_count++;
    }
    VM_OBJECT_WUNLOCK(vm_obj);
    return (rc);
}

Le lun. 10 août 2020 à 09:44, Alexandre Levy <a13xlevy_at_gmail.com> a écrit :

> Ah thanks, I was doing a make config-recursive and that didn't show the
> DEBUG option. It's recompiling the module with DEBUG now.
>
> Le lun. 10 août 2020 à 09:43, Hans Petter Selasky <hps_at_selasky.org> a
> écrit :
>
>> On 2020-08-10 10:41, Alexandre Levy wrote:
>> > I'm recompiling the kernel using GENERIC at the moment but I'm not sure
>> how
>> > to enable debugging in i915 kms, there is no compile option for that,
>> am I
>> > missing something ?
>>
>> Type:
>>
>> make config
>>
>> Before building the i915kms port, then there should be a DEBUG option
>> you can select.
>>
>> --HPS
>>
>
Received on Mon Aug 10 2020 - 09:00:17 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:41:24 UTC