Re: PROBLEM: usage of page_address and CONFIG_HIGHMEM on ix86

From: wollny (wollny@cns.mpg.de)
Date: Mon Jun 12 2000 - 18:00:08 EST


On Mon, 12 Jun 2000, Alan Cox wrote:

> > hitting on a BUG() statement in bttv.c i found out that it seems to be no
> > good idea, to use the 'page_address' macro from <asm/pgtable.h> on the
> > ix86 with CONFIG_HIGHMEM enabled.
>
> The mmap pages for bttv in the current code are drawn from vmalloc32 so
> should always be low pages
Is vmalloc32 == vmalloc? (Found no vmalloc32 in the sources of
2.4.0test1[-ac13])
 
> > Replacing 'page_address' with 'kmap' (from <linux/highmem.h>) in
> > bttv.c solved the problem for me .
> > Without CONFIG_HIGHMEM this simply is defined as 'page_address' and else as 'kmap_high'.
>
> That wont I suspect work. If the pages are high then kmapping them doesnt
> make them visible to PCI DMA
Well, all I can say is the patch works as much as disableling
CONFIG_HIGHMEM. In both ways the BUG is not hit, and the TV-card puts
things to screen.

OTOH the BUG() statement was hit randomly. Adding a printk in the
bttv-source could change the behavior and also changing the verbose and
debug options in conf.modules. I understood the "lock is needed since else
not reliable" thingy, and such random behavior told me, this could be the
error.
But what the bttv code does I have only a very general idea.

Other thought:
bttv does not change the dma_mask, so it is 0xFFFFFFFF, and if i
understand this right, the dma can access 4GB of RAM.
With HIGHMEM4G enabled the kernel reports 1028xxx/1048xxx available [...]
131xxxk highmem. Thus i have highmem and in my understanding it is in the
pci-dma accessable address range.
Also the DMA-transfer to screen goes to 0xE2000000 at my setup. The
offending address was around 0x37AAXXXX. The page_address is needed for
creation of some RISC-code (make_vbitab)

Without HIGHMEM enabled I get a warning I should enable it since only 896
MB will be used, and the mem report reads:
899xxxk/917xxxk available ... and 0k highmem.

Some additional info:

Linux version 2.4.0-test1 (the BUG was also hit with ac13)
(gcc version pgcc-2.95.2 19991024 (release))
#16 SMP Mon Jun 12 13:03:18 CEST 2000

modules:
lirc_haup tuner msp3400 bttv i2c-algo-bit videodev i2c-core
lirc_dev nfsd lockd sunrpc 8139too awe_wave sb sb_lib uart401
sound soundcore parport_pc imm advansys scsi_mod

Tools are in the right versions.

Board ASUS PB2D with 2xPII450+1GB RAM

The BUG after ksymoops:
ksymoops 2.3.4 on i686 2.4.0-test1. Options used
     -V (default)
     -k /proc/ksyms (default)
     -l /proc/modules (default)
     -o /lib/modules/2.4.0-test1/ (default)
     -m /usr/src/linux/System.map (default)

... BUG() in bttv.c 231
Jun 9 18:11:16 bolide kernel: invalid operand: 0000
Jun 9 18:11:16 bolide kernel: CPU: 0
Jun 9 18:11:16 bolide kernel: EIP: 0010:[<f88ff5cd>]
Using defaults from ksymoops -t elf32-i386 -a i386
Jun 9 18:11:16 bolide kernel: EFLAGS: 00010296
Jun 9 18:11:16 bolide kernel: eax: 0000001a ebx: f890f000 ecx: 00000011 edx: c023d70c
Jun 9 18:11:16 bolide kernel: esi: f7ec0440 edi: f7ec004c ebp: 011b1f40 esp: f7e9ded4
Jun 9 18:11:16 bolide kernel: ds: 0018 es: 0018 ss: 0018
Jun 9 18:11:16 bolide kernel: Process insmod (pid: 581, stackpage=f7e9d000)
Jun 9 18:11:16 bolide kernel: Stack: 00000002 f8909c20 f891f000 c222f800 00000000 f8905b53 f8909c20 00000000
Jun 9 18:11:16 bolide kernel: f8909c20 f890647a f890684a f8909c20 c222f800 f8909be0 00000000 f88fe048
Jun 9 18:11:16 bolide kernel: f890647a c222f800 c01a004c c222f800 f8909b70 c222f800 f8909be0 c01a00a4
Jun 9 18:11:16 bolide kernel: Call Trace: [<f8909c20>] [<f891f000>] [<f8905b53>] [<f8909c20>] [<f8909c20>] [<f890647a>] [<f890684a>]
Jun 9 18:11:16 bolide kernel: [<f8909c20>] [<f8909be0>] [<f88fe048>] [<f890647a>] [pci_announce_device+44/64] [<f8909b70>] [<f8909be0>] [pci_register_driver+68/96]
Jun 9 18:11:16 bolide kernel: [<f8909be0>] [<f88fe000>] [<f88fe04d>] [<f8906939>] [<f8909be0>] [sys_init_module+1357/1632] [<f88fe000>] [<f88fb000>]
Jun 9 18:11:16 bolide kernel: [<f88fe048>] [system_call+52/56] [<f88fe000>] [<f88fe000>]
Jun 9 18:11:16 bolide kernel: Code: 0f 0b 90 a1 20 e4 23 c0 89 d9 81 e1 ff 0f 00 00 0b 4c 28 40

>>EIP; f88ff5cd <[bttv]make_vbitab+dd/250> <=====
Trace; f8909c20 <bttv_cleanup_module+32c0/????>
Trace; f891f000 <END_OF_CODE+186a0/????>
Trace; f8905b53 <[bttv]init_bt848+5f3/620>
Trace; f8909c20 <bttv_cleanup_module+32c0/????>
Trace; f8909c20 <bttv_cleanup_module+32c0/????>
Trace; f890647a <[bttv]bttv_probe+ca/500>
Trace; f890684a <[bttv]bttv_probe+49a/500>
Trace; f8909c20 <bttv_cleanup_module+32c0/????>
Trace; f8909be0 <bttv_cleanup_module+3280/????>
Trace; f88fe048 <[i2c-algo-bit]cleanup_module+1df8/1e00>
Trace; f890647a <[bttv]bttv_probe+ca/500>
Trace; f8909be0 <bttv_cleanup_module+3280/????>
Trace; f88fe000 <[i2c-algo-bit]cleanup_module+1db0/1e00>
Trace; f88fe04d <[i2c-algo-bit]cleanup_module+1dfd/1e00>
Trace; f8906939 <[bttv]bttv_init_module+89/b0>
Trace; f8909be0 <bttv_cleanup_module+3280/????>
Trace; f88fe048 <[i2c-algo-bit]cleanup_module+1df8/1e00>
Code; f88ff5cd <[bttv]make_vbitab+dd/250>
00000000 <_EIP>:
Code; f88ff5cd <[bttv]make_vbitab+dd/250> <=====
   0: 0f 0b ud2a <=====
Code; f88ff5cf <[bttv]make_vbitab+df/250>
   2: 90 nop
Code; f88ff5d0 <[bttv]make_vbitab+e0/250>
   3: a1 20 e4 23 c0 movl 0xc023e420,%eax
Code; f88ff5d5 <[bttv]make_vbitab+e5/250>
   8: 89 d9 movl %ebx,%ecx
Code; f88ff5d7 <[bttv]make_vbitab+e7/250>
   a: 81 e1 ff 0f 00 00 andl $0xfff,%ecx
Code; f88ff5dd <[bttv]make_vbitab+ed/250>
  10: 0b 4c 28 40 orl 0x40(%eax,%ebp,1),%ecx

And here the patch I tried to send to Gerd - there was some mailserver
problem, won't accept mail directly from dialups :(

--- bttv.c.test1-ac13 Sun Jun 11 13:29:56 2000
+++ bttv.c Mon Jun 12 15:11:15 2000
@@ -45,6 +45,12 @@
 #include <linux/vmalloc.h>
 #include <linux/init.h>
+/* page_address -> kmap 06/12/00 Gert Wollny <wollny@cns.mpg.de> */
+#include <linux/highmem.h>
+
 #include "bttv.h"
 #include "tuner.h"
 
@@ -238,7 +244,7 @@
                         ptep = pte_offset(pmd, adr);
                         pte = *ptep;
                         if(pte_present(pte))
- ret = (page_address(pte_page(pte))|(adr&(PAGE_SIZE-1)));
+ ret = (kmap(pte_page(pte))|(adr&(PAGE_SIZE-1)));
                 }
         }
         MDEBUG(printk("uv2kva(%lx-->%lx)", adr, ret));

---
Best wishes

Gert

- 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/



This archive was generated by hypermail 2b29 : Thu Jun 15 2000 - 21:00:26 EST