Problems with mmap under 2.1.117 SMP

Problems with mmap under 2.1.117 SMP

Post by Mathias Waa » Thu, 27 Aug 1998 04:00:00



Hi all,

I've rewritten a driver for the 2.1.xxx kernels and (of course:( )
I've got some trouble.
The driver got a mmap-operation which maps some pages (produced
by calling __get_free_pages() ) to the user space. It seems to
work for one process, but it fails if I call the mmap for the
same device multiple times (from different processes). The first
time succeeds but the second call hangs and the mmap-operation was
not called.

Here comes a part of the code:
(PDEBUG ist a debug macro which expands to something like printk(...) )

static int ma_mmap(struct file *filp, struct vm_area_struct *vma)
{
  Ma_Dev *dev = (Ma_Dev *)filp->private_data;

  PDEBUG("mmap for %d\n",dev->id);  // <-- the second process never
            // reaches this statement:(
  if (dev->id < 0 || dev->id > 3) {
    PDEBUG("ma_mmap called for false device\n");
    return 0;
  }
  if (vma->vm_end - vma->vm_start != (1<<MA_QUOTA)*PAGE_SIZE)
    return -EINVAL;
  if (remap_page_range(vma->vm_start,
                       virt_to_phys((char *)dev->dma_offset_send),
                       (vma->vm_end-vma->vm_start), vma->vm_page_prot))
    return -EAGAIN;
  vma->vm_ops = &simple_vm_ops; // a struct vm_operations_struct
  MOD_INC_USE_COUNT;
  vma->vm_file = filp;
  filp->f_count++;

  return 0;

Quote:}

I've looked at the code for the sound-driver which comes with the
kernel sources, and they did the same. So what's going wrong?

Regards
    Mathias

--

Tel.:  +49 621 292 1620  Fax.:  +49 621 292 5597

 
 
 

1. QIC-117 kernel compilation problems

        I've checked the hardware and ftape FAQs and didn't find
anything relevant.
        I'm trying to compile my kernel (1.2.1) to include QIC-117
support. I do a make configure and reply Y to enabling support
and leave the nyumber of buffers at three.
        make dep and make clean are OK. The actual compilation
(done with make zlilo) errors out as folllows:

Script started on Sun Sep 17 16:19:34 1995
make# make zlilo
gcc -D__KERNEL__ -I/usr/src/linux/include -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer -pipe -m486 -DUTS_MACHINE='"i386"' -c -o init/version.o init/version.c
set -e; for i in kernel drivers mm fs net ipc lib arch/i386/kernel arch/i386/mm; do make -C $i; done
make[1]: Entering directory `/usr/src/linux-1.2.1/kernel'
gcc -D__KERNEL__ -I/usr/src/linux/include -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer -pipe -m486 -DEXPORT_SYMTAB -c ksyms.c
ksyms.c:281: warning: missing braces around initializer for `symbol_table[140]'
ksyms.c:281: initializer element for `symbol_table[140].addr' is not constant
ksyms.c:283: warning: braces around scalar initializer for `symbol_table.name'
ksyms.c:283: warning: excess elements in scalar initializer after `symbol_table.name'
ksyms.c:312: warning: initialization from incompatible pointer type
ksyms.c:314: warning: initialization from incompatible pointer type
ksyms.c:316: warning: initialization from incompatible pointer type
ksyms.c:320: warning: braces around scalar initializer for `symbol_table.name'
ksyms.c:320: warning: excess elements in scalar initializer after `symbol_table.name'
make[1]: *** [ksyms.o] Error 1
make[1]: Leaving directory `/usr/src/linux-1.2.1/kernel'
make: *** [linuxsubdirs] Error 127
# exit
Script done on Sun Sep 17 16:19:53 1995

        Cany anyone offer any pointers as to what I'm missing?

        Thanks.
--

2. help: compiling zlib-0.5

3. keycode > 117 problem.

4. 2.1.59: problem with SLIP etc.

5. 2.1.117 + ATM-patch compile problem

6. HP5100C PARALLELPORT SCANNER -REDHAT 7

7. problem with kernel 2.1.117

8. kill ps -ef | grep " 6 "

9. Problems rebuilding kernel with QIC-117 tape support

10. Build problems in 2.1.117: no crt1.o file?

11. 2.1.117 + ATM-patch compile problem

12. QIC-117 standard: where?

13. umask 117, 116