Bug 7888
Summary: | Killing an application under gdb that open pwc drivers did not send the .release() function | ||
---|---|---|---|
Product: | Drivers | Reporter: | Nicolas Boulay (nicolas.boulay) |
Component: | USB | Assignee: | Greg Kroah-Hartman (greg) |
Status: | REJECTED INSUFFICIENT_DATA | ||
Severity: | normal | CC: | bunk, protasnb |
Priority: | P2 | ||
Hardware: | i386 | ||
OS: | Linux | ||
Kernel Version: | 2.6.17-5mdv | Subsystem: | |
Regression: | --- | Bisected commit-id: |
Description
Nicolas Boulay
2007-01-26 01:24:48 UTC
Can you duplicate this on a 2.6.19 kernel.org kernel without any add-on pwc drivers? I don't think that pwc is the problem. When i use the debug trace in pwc, i can't see the call to the .release function of the driver. So it did not look like a pwc bug. I see it with pwc because pwc enable only one process to use it. I can't reproduice the bug with a tiny programme like : #include<stdio.h> #include<stdlib.h> #include<fcntl.h> #include <errno.h> main(int argc, char ** argv){ int f; f=open(argv[1],O_RDWR| O_NONBLOCK, 0); if (-1 == f) { perror("! "); exit(EXIT_FAILURE); } while(1){}; close(f); } The programme i wrote is there : http://astromech.googlecode.com/svn/trunk/ImageLab/nico/ $ svn checkout http://astromech.googlecode.com/svn/trunk/ImageLab/nico astromech $ cd astromech $ make $ ./fps open device :/dev/video Video Capture Device Name : Philips 740 webcam 120x160 ^c [cyrano@localhost nico]$ gdb ./fps GNU gdb 6.3-8mdv2007.0 (Mandriva Linux release 2007.0) Copyright 2004 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "i586-mandriva-linux-gnu"...Using host libthread_db library "/lib/i686/libthread_db.so.1". (gdb) run Starting program: /home/cyrano/Documents/eurobot/astromech/2007/dev/astromech/ImageLab/nico/fps Reading symbols from shared object read from target memory...done. Loaded system supplied DSO at 0xbfffe000 [Thread debugging using libthread_db enabled] [New Thread -1212687696 (LWP 19494)] [New Thread -1212691552 (LWP 19497)] open device :/dev/video Video Capture Device Name : Philips 740 webcam 120x160 ^z Program received signal SIGTSTP, Stopped (user). [Switching to Thread -1212687696 (LWP 19494)] 0xbfffe410 in __kernel_vsyscall () Current language: auto; currently c (gdb) quit The program is running. Exit anyway? (y or n) y [cyrano@localhost nico]$ ./fps open device :/dev/video Cannot open '/dev/video': 16, Device or resource busy I have a new test case. the mmap function seems to be the origin of the comportement. After the following test, i can't reopen the /dev/video0 device. It's completely locked. ------------------------------------ [cyrano@localhost nico]$ g++ -o t test_pwc.cpp [cyrano@localhost nico]$ ./t [cyrano@localhost nico]$ ./t [cyrano@localhost nico]$ gdb ./t GNU gdb 6.3-8mdv2007.0 (Mandriva Linux release 2007.0) Copyright 2004 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "i586-mandriva-linux-gnu"...Using host libthread_db library "/lib/i686/libthread_db.so.1". (gdb) run Starting program: /home/cyrano/Documents/eurobot/astromech/2007/dev/astromech/ImageLab/nico/t Reading symbols from shared object read from target memory...done. Loaded system supplied DSO at 0xbfffe000 Program received signal SIGINT, Interrupt. <--- here i press ^C 0x080488b3 in main () (gdb) quit The program is running. Exit anyway? (y or n) y [cyrano@localhost nico]$ ./t Cannot open : 16, Device or resource busy [cyrano@localhost nico]$ ./t Cannot open : 16, Device or resource busy the test_pwc.cpp file------------------------- #include<stdio.h> //perror() #include<fcntl.h> //O_RDONLY #include <sys/ioctl.h> // system d'appel ioctl #include<iostream> #include <errno.h> #include <sys/mman.h> //mmap #include <linux/videodev.h> int main(int argc, char ** argv) { int f= open("/dev/video0", O_RDWR | O_NONBLOCK, 0); if (-1 == f) { fprintf (stderr, "Cannot open : %d, %s\n", errno, strerror (errno)); exit (EXIT_FAILURE); } unsigned char *framebuf = (unsigned char*) mmap(0, 120 * 160 * 3, PROT_READ | PROT_WRITE, MAP_SHARED, f, 0); struct video_mmap mm; mm.frame=0; mm.height = 120; mm.width = 160; mm.format = 15; if (ioctl(f, VIDIOCMCAPTURE, &(mm.frame)) < 0) { perror ("VIDIOCMCAPTURE"); exit (EXIT_FAILURE); } if (ioctl(f, VIDIOCSYNC, &(mm.frame)) < 0) { perror ("VIDIOCSYNC"); exit (EXIT_FAILURE); } while(1); munmap(framebuf,120 * 160 * 3); close(f); return 0; } Can you please try the latest kernel (2.6.22-rc4). There were multiple fixes to videodev and also to USB subsystem, including device release and shutdown. Thanks. Please reopen this bug if it's still present with kernel 2.6.22. |