Subject: Re: UVM - Kernel & User access question
To: Stephan Uphoff <ups@stups.com>
From: Eric Circlaeys <eric.c@mac.com>
List: tech-kern
Date: 10/26/2003 12:14:11
Tried both,

BUT for example at any time I got after execution that ran well:
uvm_fault(..., 0, 1) -> e
kernel: page fault trao, code=0
Stopped in pid 10 (ioflush) at ffs_sync+0x7b: testb $ox1f, 0x38(%eax)

Eric.

On 25 oct. 03, at 23:19, Stephan Uphoff wrote:

>
> Eric Circlaeys wrote:
>>
>> void		*nm_core_uvm_allocate(struct proc *p, int size,
>> 				      struct uvm_object **object)
>> {
> ....
>>    handler = round_page((vaddr_t)p->p_vmspace->vm_taddr + MAXTSIZ +
>> MAXDSIZ);
>
> Wrong space ... just set it to vm_map_min(kernel_map);
> ( Should be harmless since it is just a preference )
>
>> .....
>> Using this API in my kernel module I can now allocate and deallocate
>> pageable kernel memory.
>> I use right now kcopy for all my needs.
>>
>> BUT BUT BUT after deallocating such memory,
>>
>> sometimes, my NetBSD 1.6.1, or other applications running raised an
>> uvm_page_fault, or other uvm_* errors and cause a kernel panic.
>>
>> Did I forget something to do when deallocating memory or usage of
>> virtual / physical pages???
>
> Looks ok - maybe you have a bug somewhere else ?
>
> 	Stephan
>
> PS:  You might want to try
>   addr = uvm_km_valloc(kernel_map,size);
>   uvm_km_free(kernel_map,addr,size);
> to allocate/deallocate your memory since you are not
> doing anything tricky with it.
>