Re: PROBLEM: kernel BUG at drivers/media/video/em28xx/em28xx-video.c:891

2011-02-07 Thread Rune Saetre

Hi

The STREAMOFF issue has not appeared after having tested with kernel 
version 2.6.38-rc2 for a while. I am happy :-)


Regards
Rune

--
We are proud to present our new web-pages at www.aptomar.com
Do not miss our video-window to the world; aptotube

Rune Sætre 
aptomar as

www.aptomar.com


On Wed, 19 Jan 2011, Rune Saetre wrote:


Hi

Yes. I will try it out and post a message as soon as I have some experience 
with it.


Regards
Rune

--
We are proud to present our new web-pages at www.aptomar.com
Do not miss our video-window to the world; aptotube

Rune Sætre 
aptomar as

www.aptomar.com


On Wed, 19 Jan 2011, Patrik Jakobsson wrote:


On 01/18/2011 05:30 PM, Hans Verkuil wrote:

On Tuesday, January 18, 2011 17:14:03 Patrik Jakobsson wrote:

Hello Rune

I'm trying to learn more about the linux kernel so I figured helping
with bugs is a good way to get started.

On 01/18/2011 02:20 AM, Rune Saetre wrote:

Hi

The crash is not as consistent as I first believed. I have managed to
stop and start capturing several (but not many) times without the
driver crashing now.


To me it seems that the resource locking (functions res_get, res_check,
res_locked and res_free) is subject to race condition.

I looked at older versions of the code and found that there used to be
locks around some of these pieces. It was removed in commit:

0499a5aa777f8e56e46df362f0bb9d9d116186f9 - V4L/DVB: em28xx: remove BKL

Other V4L drivers use pretty much the same code (res_get, res_free,
etc.) for resource locking but still have the mutex_lock/unlock around
it. Does anyone know why this was removed?

Because now the video4linux core does the locking.

Anyway, I'm pretty sure this is the bug that was fixed here:

http://www.mail-archive.com/linuxtv-commits@linuxtv.org/msg09413.html

This fix will be in 2.6.38.

The change in the locking mechanism had nothing to do this particular bug.
It was just incorrect administration of resources.

Regards,

Hans

Thanks for the explanation. I see now how the V4L core locks around the 
ioctls. The member unlocked_ioctl of struct v4l2_file_operations confused 
me a little. Maybe serialized_ioctl would be a better name? Not a big issue 
though.


Hopefully the patch fixes your problem Rune.

Thanks
Patrik Jakobsson


Thanks
Patrik Jakobsson

The trace logs also differ slightly. Here is the last one:

Jan 18 02:12:08 mate kernel: [  117.219326] [ cut here
]
Jan 18 02:12:08 mate kernel: [  117.219412] kernel BUG at
drivers/media/video/em28xx/em28xx-video.c:891!
Jan 18 02:12:08 mate kernel: [  117.219507] invalid opcode:  [#1]
PREEMPT SMP Jan 18 02:12:08 mate kernel: [  117.219597] last sysfs
file: /sys/devices/virtual/block/dm-8/stat
Jan 18 02:12:08 mate kernel: [  117.219681] CPU 1 Jan 18 02:12:08 mate
kernel: [  117.219714] Modules linked in: acpi_cpufreq mperf
cpufreq_powersave cpufreq_stats cpufreq_userspace cpufreq_conservative
ppdev lp nfsd lockd nfs_acl auth_rpcgss sunrpc exportfs binfmt_misc
fuse dummy bridge stp ext2 mbcache coretemp kvm_intel kvm loop
firewire_sbp2 tuner snd_hda_codec_realtek arc4 snd_hda_intel
snd_usb_audio snd_hda_codec ecb snd_seq_dummy snd_pcm_oss
snd_mixer_oss saa7115 snd_pcm ir_lirc_codec lirc_dev ir_sony_decoder
snd_hwdep snd_usbmidi_lib em28xx ir_jvc_decoder ir_rc6_decoder
snd_seq_oss snd_seq_midi snd_rawmidi r8169 ir_rc5_decoder mii
ir_nec_decoder snd_seq_midi_event i915 v4l2_common iwlagn iwlcore
snd_seq ir_core drm_kms_helper drm videobuf_vmalloc snd_timer
snd_seq_device videobuf_core pcmcia joydev mac80211 uvcvideo videodev
v4l1_compat v4l2_compat_ioctl32 tveeprom cfg80211 rfkill i2c_i801
i2c_algo_bit tpm_tis tpm yenta_socket snd intel_agp shpchp pci_hotplug
video output pcmcia_rsrc wmi pcmcia_core soundcore snd_page_alloc
parport_pc parport i2c_cor
Jan 18 02:12:08 mate kernel:  irda tpm_bios intel_gtt pcspkr crc_ccitt
psmouse evdev serio_raw container processor battery ac button reiserfs
dm_mod raid10 raid456 async_raid6_recov async_pq raid6_pq async_xor
xor async_memcpy async_tx raid1 raid0 multipath linear md_mod
ide_cd_mod cdrom sd_mod ata_generic pata_acpi ata_piix crc_t10dif
ide_pci_generic ahci libahci sdhci_pci firewire_ohci sdhci libata
scsi_mod piix ide_core firewire_core mmc_core uhci_hcd tg3 thermal
crc_itu_t thermal_sys ehci_hcd [last unloaded: scsi_wait_scan]
Jan 18 02:12:08 mate kernel: [  117.220091] Jan 18 02:12:08 mate
kernel: [  117.220091] Pid: 3154, comm: camera_factory_ Not tainted
2.6.37-rst #1 Victoria/TravelMate 6292 Jan 18 02:12:08 mate
kernel: [  117.220091] RIP: 0010:[]
[] res_free+0x14/0x49 [em28xx]
Jan 18 02:12:08 mate kernel: [  117.220091] RSP:
0018:8800794a1c48  EFLAGS: 00010297
Jan 18 02:12:08 mate kernel: [  117.220091] RAX: 0001 RBX:
88007b94dc00 RCX: 
Jan 18 02:12:08 mate kernel: [  117.220091] RDX:  RSI:
8800378e7000 RDI: 88007b94dc00
Jan 18 02:12:09 mate kernel: [  117.220091] RBP: 8800378e7000 R08:
000

Re: PROBLEM: kernel BUG at drivers/media/video/em28xx/em28xx-video.c:891

2011-01-19 Thread Rune Saetre

Hi

Yes. I will try it out and post a message as soon as I have some 
experience with it.


Regards
Rune

--
We are proud to present our new web-pages at www.aptomar.com
Do not miss our video-window to the world; aptotube

Rune Sætre 
aptomar as

Tel.   (+47) 40 00 34 03
Mob.   (+47) 93 43 42 85
Fax    (+47) 73 51 00 84

www.aptomar.com


On Wed, 19 Jan 2011, Patrik Jakobsson wrote:


On 01/18/2011 05:30 PM, Hans Verkuil wrote:

On Tuesday, January 18, 2011 17:14:03 Patrik Jakobsson wrote:

Hello Rune

I'm trying to learn more about the linux kernel so I figured helping
with bugs is a good way to get started.

On 01/18/2011 02:20 AM, Rune Saetre wrote:

Hi

The crash is not as consistent as I first believed. I have managed to
stop and start capturing several (but not many) times without the
driver crashing now.


To me it seems that the resource locking (functions res_get, res_check,
res_locked and res_free) is subject to race condition.

I looked at older versions of the code and found that there used to be
locks around some of these pieces. It was removed in commit:

0499a5aa777f8e56e46df362f0bb9d9d116186f9 - V4L/DVB: em28xx: remove BKL

Other V4L drivers use pretty much the same code (res_get, res_free,
etc.) for resource locking but still have the mutex_lock/unlock around
it. Does anyone know why this was removed?

Because now the video4linux core does the locking.

Anyway, I'm pretty sure this is the bug that was fixed here:

http://www.mail-archive.com/linuxtv-commits@linuxtv.org/msg09413.html

This fix will be in 2.6.38.

The change in the locking mechanism had nothing to do this particular bug.
It was just incorrect administration of resources.

Regards,

Hans

Thanks for the explanation. I see now how the V4L core locks around the 
ioctls. The member unlocked_ioctl of struct v4l2_file_operations confused me 
a little. Maybe serialized_ioctl would be a better name? Not a big issue 
though.


Hopefully the patch fixes your problem Rune.

Thanks
Patrik Jakobsson


Thanks
Patrik Jakobsson

The trace logs also differ slightly. Here is the last one:

Jan 18 02:12:08 mate kernel: [  117.219326] [ cut here
]
Jan 18 02:12:08 mate kernel: [  117.219412] kernel BUG at
drivers/media/video/em28xx/em28xx-video.c:891!
Jan 18 02:12:08 mate kernel: [  117.219507] invalid opcode:  [#1]
PREEMPT SMP Jan 18 02:12:08 mate kernel: [  117.219597] last sysfs
file: /sys/devices/virtual/block/dm-8/stat
Jan 18 02:12:08 mate kernel: [  117.219681] CPU 1 Jan 18 02:12:08 mate
kernel: [  117.219714] Modules linked in: acpi_cpufreq mperf
cpufreq_powersave cpufreq_stats cpufreq_userspace cpufreq_conservative
ppdev lp nfsd lockd nfs_acl auth_rpcgss sunrpc exportfs binfmt_misc
fuse dummy bridge stp ext2 mbcache coretemp kvm_intel kvm loop
firewire_sbp2 tuner snd_hda_codec_realtek arc4 snd_hda_intel
snd_usb_audio snd_hda_codec ecb snd_seq_dummy snd_pcm_oss
snd_mixer_oss saa7115 snd_pcm ir_lirc_codec lirc_dev ir_sony_decoder
snd_hwdep snd_usbmidi_lib em28xx ir_jvc_decoder ir_rc6_decoder
snd_seq_oss snd_seq_midi snd_rawmidi r8169 ir_rc5_decoder mii
ir_nec_decoder snd_seq_midi_event i915 v4l2_common iwlagn iwlcore
snd_seq ir_core drm_kms_helper drm videobuf_vmalloc snd_timer
snd_seq_device videobuf_core pcmcia joydev mac80211 uvcvideo videodev
v4l1_compat v4l2_compat_ioctl32 tveeprom cfg80211 rfkill i2c_i801
i2c_algo_bit tpm_tis tpm yenta_socket snd intel_agp shpchp pci_hotplug
video output pcmcia_rsrc wmi pcmcia_core soundcore snd_page_alloc
parport_pc parport i2c_cor
Jan 18 02:12:08 mate kernel:  irda tpm_bios intel_gtt pcspkr crc_ccitt
psmouse evdev serio_raw container processor battery ac button reiserfs
dm_mod raid10 raid456 async_raid6_recov async_pq raid6_pq async_xor
xor async_memcpy async_tx raid1 raid0 multipath linear md_mod
ide_cd_mod cdrom sd_mod ata_generic pata_acpi ata_piix crc_t10dif
ide_pci_generic ahci libahci sdhci_pci firewire_ohci sdhci libata
scsi_mod piix ide_core firewire_core mmc_core uhci_hcd tg3 thermal
crc_itu_t thermal_sys ehci_hcd [last unloaded: scsi_wait_scan]
Jan 18 02:12:08 mate kernel: [  117.220091] Jan 18 02:12:08 mate
kernel: [  117.220091] Pid: 3154, comm: camera_factory_ Not tainted
2.6.37-rst #1 Victoria/TravelMate 6292 Jan 18 02:12:08 mate
kernel: [  117.220091] RIP: 0010:[]
[] res_free+0x14/0x49 [em28xx]
Jan 18 02:12:08 mate kernel: [  117.220091] RSP:
0018:8800794a1c48  EFLAGS: 00010297
Jan 18 02:12:08 mate kernel: [  117.220091] RAX: 0001 RBX:
88007b94dc00 RCX: 
Jan 18 02:12:08 mate kernel: [  117.220091] RDX:  RSI:
8800378e7000 RDI: 88007b94dc00
Jan 18 02:12:09 mate kernel: [  117.220091] RBP: 8800378e7000 R08:
0001 R09: 0c52
Jan 18 02:12:09 mate kernel: [  117.220091] R10:  R11:
0246 R12: 
Jan 18 02:12:09 mate kernel: [  117.220091] R13: a05ab920 R14:
88006dd123c0 R15: 88007b94dc00
Jan 18 02:12:09 ma

Re: PROBLEM: kernel BUG at drivers/media/video/em28xx/em28xx-video.c:891

2011-01-19 Thread Patrik Jakobsson

On 01/18/2011 05:30 PM, Hans Verkuil wrote:

On Tuesday, January 18, 2011 17:14:03 Patrik Jakobsson wrote:

Hello Rune

I'm trying to learn more about the linux kernel so I figured helping
with bugs is a good way to get started.

On 01/18/2011 02:20 AM, Rune Saetre wrote:

Hi

The crash is not as consistent as I first believed. I have managed to
stop and start capturing several (but not many) times without the
driver crashing now.


To me it seems that the resource locking (functions res_get, res_check,
res_locked and res_free) is subject to race condition.

I looked at older versions of the code and found that there used to be
locks around some of these pieces. It was removed in commit:

0499a5aa777f8e56e46df362f0bb9d9d116186f9 - V4L/DVB: em28xx: remove BKL

Other V4L drivers use pretty much the same code (res_get, res_free,
etc.) for resource locking but still have the mutex_lock/unlock around
it. Does anyone know why this was removed?

Because now the video4linux core does the locking.

Anyway, I'm pretty sure this is the bug that was fixed here:

http://www.mail-archive.com/linuxtv-commits@linuxtv.org/msg09413.html

This fix will be in 2.6.38.

The change in the locking mechanism had nothing to do this particular bug.
It was just incorrect administration of resources.

Regards,

Hans

Thanks for the explanation. I see now how the V4L core locks around the 
ioctls. The member unlocked_ioctl of struct v4l2_file_operations 
confused me a little. Maybe serialized_ioctl would be a better name? Not 
a big issue though.


Hopefully the patch fixes your problem Rune.

Thanks
Patrik Jakobsson


Thanks
Patrik Jakobsson

The trace logs also differ slightly. Here is the last one:

Jan 18 02:12:08 mate kernel: [  117.219326] [ cut here
]
Jan 18 02:12:08 mate kernel: [  117.219412] kernel BUG at
drivers/media/video/em28xx/em28xx-video.c:891!
Jan 18 02:12:08 mate kernel: [  117.219507] invalid opcode:  [#1]
PREEMPT SMP Jan 18 02:12:08 mate kernel: [  117.219597] last sysfs
file: /sys/devices/virtual/block/dm-8/stat
Jan 18 02:12:08 mate kernel: [  117.219681] CPU 1 Jan 18 02:12:08 mate
kernel: [  117.219714] Modules linked in: acpi_cpufreq mperf
cpufreq_powersave cpufreq_stats cpufreq_userspace cpufreq_conservative
ppdev lp nfsd lockd nfs_acl auth_rpcgss sunrpc exportfs binfmt_misc
fuse dummy bridge stp ext2 mbcache coretemp kvm_intel kvm loop
firewire_sbp2 tuner snd_hda_codec_realtek arc4 snd_hda_intel
snd_usb_audio snd_hda_codec ecb snd_seq_dummy snd_pcm_oss
snd_mixer_oss saa7115 snd_pcm ir_lirc_codec lirc_dev ir_sony_decoder
snd_hwdep snd_usbmidi_lib em28xx ir_jvc_decoder ir_rc6_decoder
snd_seq_oss snd_seq_midi snd_rawmidi r8169 ir_rc5_decoder mii
ir_nec_decoder snd_seq_midi_event i915 v4l2_common iwlagn iwlcore
snd_seq ir_core drm_kms_helper drm videobuf_vmalloc snd_timer
snd_seq_device videobuf_core pcmcia joydev mac80211 uvcvideo videodev
v4l1_compat v4l2_compat_ioctl32 tveeprom cfg80211 rfkill i2c_i801
i2c_algo_bit tpm_tis tpm yenta_socket snd intel_agp shpchp pci_hotplug
video output pcmcia_rsrc wmi pcmcia_core soundcore snd_page_alloc
parport_pc parport i2c_cor
Jan 18 02:12:08 mate kernel:  irda tpm_bios intel_gtt pcspkr crc_ccitt
psmouse evdev serio_raw container processor battery ac button reiserfs
dm_mod raid10 raid456 async_raid6_recov async_pq raid6_pq async_xor
xor async_memcpy async_tx raid1 raid0 multipath linear md_mod
ide_cd_mod cdrom sd_mod ata_generic pata_acpi ata_piix crc_t10dif
ide_pci_generic ahci libahci sdhci_pci firewire_ohci sdhci libata
scsi_mod piix ide_core firewire_core mmc_core uhci_hcd tg3 thermal
crc_itu_t thermal_sys ehci_hcd [last unloaded: scsi_wait_scan]
Jan 18 02:12:08 mate kernel: [  117.220091] Jan 18 02:12:08 mate
kernel: [  117.220091] Pid: 3154, comm: camera_factory_ Not tainted
2.6.37-rst #1 Victoria/TravelMate 6292 Jan 18 02:12:08 mate
kernel: [  117.220091] RIP: 0010:[]
[] res_free+0x14/0x49 [em28xx]
Jan 18 02:12:08 mate kernel: [  117.220091] RSP:
0018:8800794a1c48  EFLAGS: 00010297
Jan 18 02:12:08 mate kernel: [  117.220091] RAX: 0001 RBX:
88007b94dc00 RCX: 
Jan 18 02:12:08 mate kernel: [  117.220091] RDX:  RSI:
8800378e7000 RDI: 88007b94dc00
Jan 18 02:12:09 mate kernel: [  117.220091] RBP: 8800378e7000 R08:
0001 R09: 0c52
Jan 18 02:12:09 mate kernel: [  117.220091] R10:  R11:
0246 R12: 
Jan 18 02:12:09 mate kernel: [  117.220091] R13: a05ab920 R14:
88006dd123c0 R15: 88007b94dc00
Jan 18 02:12:09 mate kernel: [  117.220091] FS:
7f37105bb820() GS:88007f50() knlGS:
Jan 18 02:12:09 mate kernel: [  117.220091] CS:  0010 DS:  ES:
 CR0: 80050033
Jan 18 02:12:09 mate kernel: [  117.220091] CR2: 0378b248 CR3:
7a079000 CR4: 06e0
Jan 18 02:12:09 mate kernel: [  117.220091] DR0:  DR1:
000

Re: PROBLEM: kernel BUG at drivers/media/video/em28xx/em28xx-video.c:891

2011-01-18 Thread Hans Verkuil
On Tuesday, January 18, 2011 17:14:03 Patrik Jakobsson wrote:
> Hello Rune
> 
> I'm trying to learn more about the linux kernel so I figured helping 
> with bugs is a good way to get started.
> 
> On 01/18/2011 02:20 AM, Rune Saetre wrote:
> > Hi
> >
> > The crash is not as consistent as I first believed. I have managed to 
> > stop and start capturing several (but not many) times without the 
> > driver crashing now.
> >
> To me it seems that the resource locking (functions res_get, res_check, 
> res_locked and res_free) is subject to race condition.
> 
> I looked at older versions of the code and found that there used to be 
> locks around some of these pieces. It was removed in commit:
> 
> 0499a5aa777f8e56e46df362f0bb9d9d116186f9 - V4L/DVB: em28xx: remove BKL
> 
> Other V4L drivers use pretty much the same code (res_get, res_free, 
> etc.) for resource locking but still have the mutex_lock/unlock around 
> it. Does anyone know why this was removed?

Because now the video4linux core does the locking.

Anyway, I'm pretty sure this is the bug that was fixed here:

http://www.mail-archive.com/linuxtv-commits@linuxtv.org/msg09413.html

This fix will be in 2.6.38.

The change in the locking mechanism had nothing to do this particular bug.
It was just incorrect administration of resources.

Regards,

Hans

> 
> Thanks
> Patrik Jakobsson
> > The trace logs also differ slightly. Here is the last one:
> >
> > Jan 18 02:12:08 mate kernel: [  117.219326] [ cut here 
> > ]
> > Jan 18 02:12:08 mate kernel: [  117.219412] kernel BUG at 
> > drivers/media/video/em28xx/em28xx-video.c:891!
> > Jan 18 02:12:08 mate kernel: [  117.219507] invalid opcode:  [#1] 
> > PREEMPT SMP Jan 18 02:12:08 mate kernel: [  117.219597] last sysfs 
> > file: /sys/devices/virtual/block/dm-8/stat
> > Jan 18 02:12:08 mate kernel: [  117.219681] CPU 1 Jan 18 02:12:08 mate 
> > kernel: [  117.219714] Modules linked in: acpi_cpufreq mperf 
> > cpufreq_powersave cpufreq_stats cpufreq_userspace cpufreq_conservative 
> > ppdev lp nfsd lockd nfs_acl auth_rpcgss sunrpc exportfs binfmt_misc 
> > fuse dummy bridge stp ext2 mbcache coretemp kvm_intel kvm loop 
> > firewire_sbp2 tuner snd_hda_codec_realtek arc4 snd_hda_intel 
> > snd_usb_audio snd_hda_codec ecb snd_seq_dummy snd_pcm_oss 
> > snd_mixer_oss saa7115 snd_pcm ir_lirc_codec lirc_dev ir_sony_decoder 
> > snd_hwdep snd_usbmidi_lib em28xx ir_jvc_decoder ir_rc6_decoder 
> > snd_seq_oss snd_seq_midi snd_rawmidi r8169 ir_rc5_decoder mii 
> > ir_nec_decoder snd_seq_midi_event i915 v4l2_common iwlagn iwlcore 
> > snd_seq ir_core drm_kms_helper drm videobuf_vmalloc snd_timer 
> > snd_seq_device videobuf_core pcmcia joydev mac80211 uvcvideo videodev 
> > v4l1_compat v4l2_compat_ioctl32 tveeprom cfg80211 rfkill i2c_i801 
> > i2c_algo_bit tpm_tis tpm yenta_socket snd intel_agp shpchp pci_hotplug 
> > video output pcmcia_rsrc wmi pcmcia_core soundcore snd_page_alloc 
> > parport_pc parport i2c_cor
> > Jan 18 02:12:08 mate kernel:  irda tpm_bios intel_gtt pcspkr crc_ccitt 
> > psmouse evdev serio_raw container processor battery ac button reiserfs 
> > dm_mod raid10 raid456 async_raid6_recov async_pq raid6_pq async_xor 
> > xor async_memcpy async_tx raid1 raid0 multipath linear md_mod 
> > ide_cd_mod cdrom sd_mod ata_generic pata_acpi ata_piix crc_t10dif 
> > ide_pci_generic ahci libahci sdhci_pci firewire_ohci sdhci libata 
> > scsi_mod piix ide_core firewire_core mmc_core uhci_hcd tg3 thermal 
> > crc_itu_t thermal_sys ehci_hcd [last unloaded: scsi_wait_scan]
> > Jan 18 02:12:08 mate kernel: [  117.220091] Jan 18 02:12:08 mate 
> > kernel: [  117.220091] Pid: 3154, comm: camera_factory_ Not tainted 
> > 2.6.37-rst #1 Victoria/TravelMate 6292 Jan 18 02:12:08 mate 
> > kernel: [  117.220091] RIP: 0010:[]  
> > [] res_free+0x14/0x49 [em28xx]
> > Jan 18 02:12:08 mate kernel: [  117.220091] RSP: 
> > 0018:8800794a1c48  EFLAGS: 00010297
> > Jan 18 02:12:08 mate kernel: [  117.220091] RAX: 0001 RBX: 
> > 88007b94dc00 RCX: 
> > Jan 18 02:12:08 mate kernel: [  117.220091] RDX:  RSI: 
> > 8800378e7000 RDI: 88007b94dc00
> > Jan 18 02:12:09 mate kernel: [  117.220091] RBP: 8800378e7000 R08: 
> > 0001 R09: 0c52
> > Jan 18 02:12:09 mate kernel: [  117.220091] R10:  R11: 
> > 0246 R12: 
> > Jan 18 02:12:09 mate kernel: [  117.220091] R13: a05ab920 R14: 
> > 88006dd123c0 R15: 88007b94dc00
> > Jan 18 02:12:09 mate kernel: [  117.220091] FS:  
> > 7f37105bb820() GS:88007f50() knlGS:
> > Jan 18 02:12:09 mate kernel: [  117.220091] CS:  0010 DS:  ES: 
> >  CR0: 80050033
> > Jan 18 02:12:09 mate kernel: [  117.220091] CR2: 0378b248 CR3: 
> > 7a079000 CR4: 06e0
> > Jan 18 02:12:09 mate kernel: [  117.220091] DR0:  DR1: 
> >  DR2

Re: PROBLEM: kernel BUG at drivers/media/video/em28xx/em28xx-video.c:891

2011-01-18 Thread Patrik Jakobsson

Hello Rune

I'm trying to learn more about the linux kernel so I figured helping 
with bugs is a good way to get started.


On 01/18/2011 02:20 AM, Rune Saetre wrote:

Hi

The crash is not as consistent as I first believed. I have managed to 
stop and start capturing several (but not many) times without the 
driver crashing now.


To me it seems that the resource locking (functions res_get, res_check, 
res_locked and res_free) is subject to race condition.


I looked at older versions of the code and found that there used to be 
locks around some of these pieces. It was removed in commit:


0499a5aa777f8e56e46df362f0bb9d9d116186f9 - V4L/DVB: em28xx: remove BKL

Other V4L drivers use pretty much the same code (res_get, res_free, 
etc.) for resource locking but still have the mutex_lock/unlock around 
it. Does anyone know why this was removed?


Thanks
Patrik Jakobsson

The trace logs also differ slightly. Here is the last one:

Jan 18 02:12:08 mate kernel: [  117.219326] [ cut here 
]
Jan 18 02:12:08 mate kernel: [  117.219412] kernel BUG at 
drivers/media/video/em28xx/em28xx-video.c:891!
Jan 18 02:12:08 mate kernel: [  117.219507] invalid opcode:  [#1] 
PREEMPT SMP Jan 18 02:12:08 mate kernel: [  117.219597] last sysfs 
file: /sys/devices/virtual/block/dm-8/stat
Jan 18 02:12:08 mate kernel: [  117.219681] CPU 1 Jan 18 02:12:08 mate 
kernel: [  117.219714] Modules linked in: acpi_cpufreq mperf 
cpufreq_powersave cpufreq_stats cpufreq_userspace cpufreq_conservative 
ppdev lp nfsd lockd nfs_acl auth_rpcgss sunrpc exportfs binfmt_misc 
fuse dummy bridge stp ext2 mbcache coretemp kvm_intel kvm loop 
firewire_sbp2 tuner snd_hda_codec_realtek arc4 snd_hda_intel 
snd_usb_audio snd_hda_codec ecb snd_seq_dummy snd_pcm_oss 
snd_mixer_oss saa7115 snd_pcm ir_lirc_codec lirc_dev ir_sony_decoder 
snd_hwdep snd_usbmidi_lib em28xx ir_jvc_decoder ir_rc6_decoder 
snd_seq_oss snd_seq_midi snd_rawmidi r8169 ir_rc5_decoder mii 
ir_nec_decoder snd_seq_midi_event i915 v4l2_common iwlagn iwlcore 
snd_seq ir_core drm_kms_helper drm videobuf_vmalloc snd_timer 
snd_seq_device videobuf_core pcmcia joydev mac80211 uvcvideo videodev 
v4l1_compat v4l2_compat_ioctl32 tveeprom cfg80211 rfkill i2c_i801 
i2c_algo_bit tpm_tis tpm yenta_socket snd intel_agp shpchp pci_hotplug 
video output pcmcia_rsrc wmi pcmcia_core soundcore snd_page_alloc 
parport_pc parport i2c_cor
Jan 18 02:12:08 mate kernel:  irda tpm_bios intel_gtt pcspkr crc_ccitt 
psmouse evdev serio_raw container processor battery ac button reiserfs 
dm_mod raid10 raid456 async_raid6_recov async_pq raid6_pq async_xor 
xor async_memcpy async_tx raid1 raid0 multipath linear md_mod 
ide_cd_mod cdrom sd_mod ata_generic pata_acpi ata_piix crc_t10dif 
ide_pci_generic ahci libahci sdhci_pci firewire_ohci sdhci libata 
scsi_mod piix ide_core firewire_core mmc_core uhci_hcd tg3 thermal 
crc_itu_t thermal_sys ehci_hcd [last unloaded: scsi_wait_scan]
Jan 18 02:12:08 mate kernel: [  117.220091] Jan 18 02:12:08 mate 
kernel: [  117.220091] Pid: 3154, comm: camera_factory_ Not tainted 
2.6.37-rst #1 Victoria/TravelMate 6292 Jan 18 02:12:08 mate 
kernel: [  117.220091] RIP: 0010:[]  
[] res_free+0x14/0x49 [em28xx]
Jan 18 02:12:08 mate kernel: [  117.220091] RSP: 
0018:8800794a1c48  EFLAGS: 00010297
Jan 18 02:12:08 mate kernel: [  117.220091] RAX: 0001 RBX: 
88007b94dc00 RCX: 
Jan 18 02:12:08 mate kernel: [  117.220091] RDX:  RSI: 
8800378e7000 RDI: 88007b94dc00
Jan 18 02:12:09 mate kernel: [  117.220091] RBP: 8800378e7000 R08: 
0001 R09: 0c52
Jan 18 02:12:09 mate kernel: [  117.220091] R10:  R11: 
0246 R12: 
Jan 18 02:12:09 mate kernel: [  117.220091] R13: a05ab920 R14: 
88006dd123c0 R15: 88007b94dc00
Jan 18 02:12:09 mate kernel: [  117.220091] FS:  
7f37105bb820() GS:88007f50() knlGS:
Jan 18 02:12:09 mate kernel: [  117.220091] CS:  0010 DS:  ES: 
 CR0: 80050033
Jan 18 02:12:09 mate kernel: [  117.220091] CR2: 0378b248 CR3: 
7a079000 CR4: 06e0
Jan 18 02:12:09 mate kernel: [  117.220091] DR0:  DR1: 
 DR2: 
Jan 18 02:12:09 mate kernel: [  117.220091] DR3:  DR6: 
0ff0 DR7: 0400
Jan 18 02:12:09 mate kernel: [  117.220091] Process camera_factory_ 
(pid: 3154, threadinfo 8800794a, task 880071f6d820)

Jan 18 02:12:09 mate kernel: [  117.220091] Stack:
Jan 18 02:12:09 mate kernel: [  117.220091]  8800378e7000 
a05a46b9 88007a2fd040 81042cf3
Jan 18 02:12:09 mate kernel: [  117.220091]  0001 
0001 8103dadb 0001
Jan 18 02:12:09 mate kernel: [  117.220091]  88007ba3e400 
a03302ff 000135c0 000135c0

Jan 18 02:12:09 mate kernel: [  117.220091] Call Trace:
Jan