lkml.org 
[lkml]   [1999]   [Jun]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRedhat 6.0 kernel paging fails
Date
I am writing an Fibre Channel HBA device driver on Redhat 6.0 x86 platform
and need help on three questions so far:

1, I use vmalloc to get 170f0 byte virtual memory and
allocation OK, got memory starting at c2885000;

kmalloc to get 0x5808 byte DMA virtual memory and
allocation OK, got memory starting at c0760000;
DMA virt_addr is converted to phys_addr with "virt_to_bus"
and get 760000.

When access those memories, system gives meesage:
"Unable to handle kernel paging request at virtual address 0001c000"

Since I amnot familiar wit hLinux environment yet and don't know
what to to with those register value and trace, thought someone
might be able t help on the case.

Following is the messages:
HPFC: DetectHBA!
HPFC: fcInitializeDriver OK!
HPFC: ProbeHBA!
HPFC: ProbeCard!
ProbeCard!
HPFC: hpfc_adapter_count = 1!
HPFC: InitCardInfo!
HPFC: IOL = 6500, IOH = 6600
HPFC: Call vmalloc to get 170f0 byte mem
HPFC: vmalloc got memory at c2885000
HPFC: DMA alignment = 800
HPFC: kmalloc to get DMA memory 5808
HPFC: kmalloc got DMA memory at c0760000
HPFC: phys_dma_addr = 760000
HPFC: Memory allocated! virtaddr = c0760000, physaddr=760000
HPFC: Call check_region
HPFC: Call request_region
HPFC: Call request_irq
HPFC: Call InitCard
Unable to handle kernel paging request at virtual address 0001c000
current->tss.cr3 = 00222000, %cr3 = 00222000
*pde = 00000000
Oops: 0000
CPU: 0
EIP: 0010:[<c284ce2e>]
EFLAGS: 00010206
eax: 00000000 ebx: 00004000 ecx: c078007c edx: 0001c000
esi: c2892e78 edi: 0001c000 ebp: c1f21a38 esp: c1f21a40
ds: 0018 es: 0018 ss: 0018
Process insmod (pid: 500, process nr: 6, stackpage=c1f21000)
Stack: c078007c 0001c000 c1f21a64 c285a7ca c078007c 0001c000
c2892e78 c078007c
00000000 c1f21a84 c285a26f c078007c 0001c000 c2892e78
00004000 c289b468
c2892e78 c1f21aa0 c2859f10 c078007c c2892e78 c289b468
c078007c c289bb08
Call Trace: [<c285a7ca>] [<c2892e78>] [<c285a26f>] [<c2892e78>]
[<c289b468>] [<c2892e78>] [<c2859f10>] [<c2892e78>]
[<c289b468>]
[<c289bb08>] [<c2859d1b>] [<c289b468>] [<c2858d43>]
[<c2885000>]
[<c2892e78>] [<c289bb08>] [<c289b468>] [<c2899878>]
[scrup+107/264]
[<c2885000>] [vgacon_cursor+433/440] [<c2896e78>]
[<c289a9e8>]
[<c284ba99>] [<c2885000>] [<c286a955>] [<c284b52d>]
[<c28742a0>]
[<c284b04d>] [<c28606a4>] [do_bottom_half+69/100]
[do_IRQ+59/64]
[<c284b048>] [ret_from_intr+0/32] [<c28742a0>]
[scsi_register_host+67/580] [<c28742a0>] [<c28742a0>]
[<c284b04d>]
[__generic_copy_from_user+48/64]
[scsi_register_module+42/92]
[<c28742a0>] [<c284b000>] [<c284ccbd>] [<c28742a0>]
[sys_init_module+1107/1212] [<c284b000>] [<c2882420>]
[<c2825000>]
[<c284b048>] [system_call+52/56] [<c284b000>]
localhost kernel: Code: 0f b6 04 02 c9 c3 55 89 e5 8b 45 08 8b 55 0c 8b 40
04 8b 40

Following is the piece of code:

>>>>>>>>>>>
if (!(pAdapterInfo->fcMemVirtPtr =
(caddr_t)vmalloc(pDriverInfo->fcMemSize)))
{
printk(KERN_WARNING "HPFC: memory allocation error!");
return HPFC_FAIL;
}

memset((void *)pAdapterInfo->fcMemVirtPtr, 0,
pDriverInfo->fcMemSize);

/*
FC requires DMA memory alignment. It needs to be
implemented here since OS doesn't take care of it.
*/
align_offset = pDriverInfo->fcDmaPhysAlign - 1;

/* TBD, here kmalloc has limitation of 128k - 24 byte (131048).
Need to find a way of doing it later */
if (!(pAdapterInfo->fcDmaVirtAlloc =
(caddr_t)kmalloc(pDriverInfo->fcDmaSize + align_offset,
GFP_ATOMIC | GFP_DMA)))
{
printk(KERN_WARNING "HPFC: DMA memory allocation error!");
return HPFC_FAIL;
}

memset((void *)pAdapterInfo->fcDmaVirtAlloc, 0,
pDriverInfo->fcDmaSize);

/* convert to physical memory address with alignment */
physmemaddr = virt_to_bus(pAdapterInfo->fcDmaVirtAlloc);
pAdapterInfo->fcDmaPhysLow32 =
(physmemaddr + align_offset) & ~align_offset;
pAdapterInfo->fcDmaPhysUp32 = 0;

/* calculate aligned virtual memory address */
pAdapterInfo->fcDmaVirtPtr = (caddr_t)((U32)(pAdapterInfo->
fcDmaVirtAlloc) + (pAdapterInfo->fcDmaPhysLow32 -
physmemaddr));
<<<<<<<<<

During the insmod, it fails and system oops.

What is the problem here?

2, What driver should do if needs to allocate large memory (say 256K, DMA
and NON-DMA)?

3, Each time insmod fails, module is registered anyway. After changing
code and recompile, the module cannot be re-insmod since the module
name exists already. Tried to use rmmod but wont work. What is the
best way to get rid of old module name instead of reboot system?

Many Thx!

-eddie

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:52    [W:0.022 / U:0.712 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site