Subject: Re: port-amd64/32816: amd64 can not load lkms
To: None <port-amd64-maintainer@netbsd.org, gnats-admin@netbsd.org,>
From: Frank van der Linden <fvdl@netbsd.org>
List: netbsd-bugs
Date: 02/13/2006 10:55:02
The following reply was made to PR port-amd64/32816; it has been noted by GNATS.

From: Frank van der Linden <fvdl@netbsd.org>
To: gnats-bugs@netbsd.org
Cc: netbsd-bugs@netbsd.org
Subject: Re: port-amd64/32816: amd64 can not load lkms
Date: Mon, 13 Feb 2006 11:58:41 +0100

 On Mon, Feb 13, 2006 at 09:35:00AM +0000, Martin Husemann wrote:
 > I'm trying to get the nvidia nforce ethernet lkm working on amd64. It does
 > not load, crashes the kernel instead.
 > 
 > On investigation I found that I can not load *any* lkm.
 > 
 > I get a failed assertion: end < VM_MAX_KERNEL_ADDRESS
 > in uvm/uvm_km.c:479
 > 
 > with the backtrace:
 > uvm_km_check_empty()
 > uvm_map()
 > uvm_km_alloc()
 > lkmioctl()
 > 
 > 
 > (this is a DEBUG, DIAGNOSTIC, LOCKDEBUG kernel, and yes, I do know that the
 > pf.o would not have worked anyway in this kernel)
 
 The vm_map that LKM space is allocated from is lkm_map. This is usually
 the same as kernel_map, but on a few architectures it is different.
 On amd64 it is different, since the LKM code needs to be in proximity
 to the kernel code, to make the branches/jumps fit.
 
 end < VM_MAX_KERNEL_ADDRESS is *not* true for lkm_map space.
 
 The problem is that VM_MAP_IS_KERNEL, which the check is conditional
 on, is coded as: (vm_map_pmap(map) == pmap_kernel(). This is true
 for lkm_map as well, so things go wrong.
 
 I can't think of an easy fix right away, but it should not be
 too hard.
 
 - Frank