2.6.25-rc[12] Video4Linux Bttv Regression - Kernel

This is a discussion on 2.6.25-rc[12] Video4Linux Bttv Regression - Kernel ; The bttv driver seems to be experiencing problems in the 2.6.25-rcX kernels. I have the divided by error that Robert Fitzsimons has already reported (I'll test his patch and see if it fixes it for me) and I have the ...

+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 20 of 23

Thread: 2.6.25-rc[12] Video4Linux Bttv Regression

  1. 2.6.25-rc[12] Video4Linux Bttv Regression

    The bttv driver seems to be experiencing problems in the 2.6.25-rcX kernels. I
    have the divided by error that Robert Fitzsimons has already reported (I'll
    test his patch and see if it fixes it for me) and I have the following Oops
    when I try to use the radio:

    BUG: unable to handle kernel NULL pointer dereference at 0000000000000000
    IP: [] __mutex_lock_slowpath+0x3b/0xb2
    PGD 67671067 PUD 63f47067 PMD 0
    Oops: 0002 [1] PREEMPT SMP
    CPU 0
    Modules linked in: snd_seq_dummy snd_seq_oss snd_seq_midi_event snd_seq
    binfmt_misc loop nls_cp437 vfat fat nls_iso8859_1 ntfs dm_mod thermal
    processor fan container button pcspkr snd_pcm_oss snd_mixer_oss tuner tea5767
    tda8290 tuner_xc2028 tda9887 tuner_simple mt20xx tea5761 snd_emu10k1
    snd_rawmidi bttv snd_ac97_codec videodev ac97_bus v4l1_compat snd_pcm
    ir_common firewire_ohci firewire_core snd_seq_device compat_ioctl32 snd_timer
    uhci_hcd ehci_hcd v4l2_common ide_cd_mod crc_itu_t snd_page_alloc usbcore
    videobuf_dma_sg snd_util_mem videobuf_core ohci1394 btcx_risc i2c_viapro
    sr_mod snd_hwdep ieee1394 emu10k1_gp snd tg3 cdrom tveeprom gameport sg evdev
    soundcore
    Pid: 7197, comm: radio Tainted: G M 2.6.25-rc1 #20
    RIP: 0010:[] []
    __mutex_lock_slowpath+0x3b/0xb2
    RSP: 0018:ffff81007df515e8 EFLAGS: 00010246
    RAX: ffff81007f13ef10 RBX: ffff81007f13ef08 RCX: 0000000000000000
    RDX: ffff81007df515e8 RSI: ffffffff88184050 RDI: ffff81007f13ef0c
    RBP: ffff81007df51628 R08: 0000000000000004 R09: ffff81007df51aa8
    R10: ffff81007e680a40 R11: 0000000000000202 R12: ffff81007f13ef0c
    R13: ffff81007f13ef08 R14: ffff810063cfc040 R15: ffffffff88184050
    FS: 00007fa8d92ba6f0(0000) GS:ffffffff805b2000(0000) knlGS:00000000f61fb980
    CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    CR2: 0000000000000000 CR3: 00000000676dc000 CR4: 00000000000006e0
    DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
    DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
    Process radio (pid: 7197, threadinfo ffff81007df50000, task ffff810063cfc040)
    Stack: ffff81007f13ef10 0005049900000000 018060f7018060fa 0000000000000024
    ffff81007df51aa8 ffff81007f13e800 ffff81007f13ef08 ffff81007e0e5800
    ffff81007df51638 ffffffff80457083 ffff81007df51668 ffffffff88162f2f
    Call Trace:
    [] mutex_lock+0xe/0x10
    [] :bttv:radio_g_tuner+0x40/0xa6
    [] :videodev:__video_do_ioctl+0x2a6e/0x2e25
    [] :v4l1_compat:v4l_compat_translate_ioctl+0xea9/0x1af5
    [] ? :videodev:__video_do_ioctl+0x0/0x2e25
    [] ? blk_recount_segments+0x3e/0x62
    [] ? mempool_alloc_slab+0x11/0x13
    [] ? mempool_alloc+0x48/0xf9
    [] ? ext3_get_acl+0x87/0x332
    [] ? __d_lookup+0x125/0x137
    [] ? do_lookup+0x63/0x1b1
    [] ? dput+0x22/0x120
    [] ? __link_path_walk+0xbbd/0xd1b
    [] ? ext3_get_acl+0x87/0x332
    [] ? native_read_tsc+0x11/0x22
    [] ? __delay+0x27/0x59
    last message repeated 2 times
    [] ? __udelay+0x40/0x42
    [] ? i2c_stop+0x47/0x4b
    [] ? bit_xfer+0x412/0x423
    [] ? i2c_transfer+0x79/0x85
    [] ? :tuner_simple:simple_set_params+0x2bd/0xc1c
    [] ? get_unused_fd_flags+0x10d/0x11c
    [] ? touch_atime+0xe3/0xec
    [] ? mntput_no_expire+0x20/0x8f
    [] ? :tuner:fe_set_params+0x46/0x48
    [] ? :tuner:set_radio_freq+0x159/0x162
    [] ? klist_dec_and_del+0x14/0x16
    [] ? klist_next+0x6b/0x8a
    [] ? i2c_cmd+0x0/0x3e
    [] ? device_for_each_child+0x4c/0x5c
    [] :videodev:__video_do_ioctl+0x139/0x2e25
    [] ? :bttv:bttv_call_i2c_clients+0x16/0x18
    [] ? :bttv:audio_mux+0x105/0x1b5
    [] ? filemap_fault+0x1fe/0x371
    [] :videodev:video_ioctl2+0x1b8/0x259
    [] ? handle_mm_fault+0x341/0x697
    [] vfs_ioctl+0x5e/0x77
    [] do_vfs_ioctl+0x24d/0x262
    [] ? do_page_fault+0x434/0x7aa
    [] sys_ioctl+0x42/0x67
    [] system_call_after_swapgs+0x7b/0x80
    Feb 15 08:42:03 bongani64 kernel:
    Feb 15 08:42:03 bongani64 kernel:
    Code: 89 fb 4c 89 e7 48 83 ec 20 65 4c 8b 34 25 00 00 00 00 e8 19 12 00 00 48
    8d 43 08 48 8d 55 c0 48 8b 48 08 48 89 45 c0 48 89 50 08 <48> 89 11 48 83 ca
    ff 48 89 4d c8 4c 89 75 d0 48 89 d0 87 03 ff
    RIP [] __mutex_lock_slowpath+0x3b/0xb2
    RSP
    CR2: 0000000000000000
    ---[ end trace fdf145f4fc51dccd ]---
    note: radio[7197] exited with preempt_count 1
    --
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

  2. Re: 2.6.25-rc[12] Video4Linux Bttv Regression

    On Sun, 17 Feb 2008 10:36:19 +0200
    Bongani Hlope wrote:

    > The bttv driver seems to be experiencing problems in the 2.6.25-rcX kernels. I
    > have the divided by error that Robert Fitzsimons has already reported (I'll
    > test his patch and see if it fixes it for me) and I have the following Oops
    > when I try to use the radio:


    Have you tested Robert's patch?

    I can't see anything wrong on bttv_g_tuner lock. I suspect that the divide
    error caused some bad effects at some data on bttv.

    I've already applied his fix to my -git tree:

    http://git.kernel.org/?p=linux/kerne...ab/v4l-dvb.git

    Hopefully, Linus will pull soon the fixes there.


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

  3. Re: 2.6.25-rc[12] Video4Linux Bttv Regression

    On Monday 18 February 2008 18:11:25 Mauro Carvalho Chehab wrote:
    > On Sun, 17 Feb 2008 10:36:19 +0200
    >
    > Bongani Hlope wrote:
    > > The bttv driver seems to be experiencing problems in the 2.6.25-rcX
    > > kernels. I have the divided by error that Robert Fitzsimons has already
    > > reported (I'll test his patch and see if it fixes it for me) and I have
    > > the following Oops when I try to use the radio:

    >
    > Have you tested Robert's patch?
    >


    Sorry almost forgot, I have and it fixes the TV but not the radio.

    > I can't see anything wrong on bttv_g_tuner lock. I suspect that the divide
    > error caused some bad effects at some data on bttv.
    >


    The problems don't seem related because one is caused by opening the "radio"
    application, the divide error is caused by using a TV viewing application (I
    tried fbtv)

    > I've already applied his fix to my -git tree:


    Thanx, I'll try to bisect

    >
    > http://git.kernel.org/?p=linux/kerne...ab/v4l-dvb.git
    >
    > Hopefully, Linus will pull soon the fixes there.
    >

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

  4. Re: 2.6.25-rc[12] Video4Linux Bttv Regression

    On Monday 18 February 2008 23:20:40 Bongani Hlope wrote:
    > On Monday 18 February 2008 18:11:25 Mauro Carvalho Chehab wrote:
    > > Have you tested Robert's patch?

    >
    > Sorry almost forgot, I have and it fixes the TV but not the radio.
    >
    > > I can't see anything wrong on bttv_g_tuner lock. I suspect that the
    > > divide error caused some bad effects at some data on bttv.

    >
    > The problems don't seem related because one is caused by opening the
    > "radio" application, the divide error is caused by using a TV viewing
    > application (I tried fbtv)
    >
    > > I've already applied his fix to my -git tree:

    >
    > Thanx, I'll try to bisect


    I tried to bisect but the V4L/DVB changes are not bisect friendly, on two
    occursions I just selected "git bisect bad" because the bttv driver wouldn't
    compile, so I couldn't pin-point what causes the oops and hang.

    Here are some few observations I made though (I started bisecting between
    2.6.24 and 2.6.25-rc1, saved me ~1000 commits):
    1. On the third bisect, there's no oops my PC just hangs a I can't use any
    open terminals
    2. When I reached the V4L/DVB changes, my PC did not hag or oops, the radio
    just didn't work (something about invalid VID**AUD**). This made it harder to
    bisect, because it is not working and not breaking so is it good or bad...

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

  5. Re: 2.6.25-rc[12] Video4Linux Bttv Regression

    On Tue, 19 Feb 2008 01:21:36 +0200
    Bongani Hlope wrote:

    > On Monday 18 February 2008 23:20:40 Bongani Hlope wrote:
    > > On Monday 18 February 2008 18:11:25 Mauro Carvalho Chehab wrote:
    > > > Have you tested Robert's patch?

    > >
    > > Sorry almost forgot, I have and it fixes the TV but not the radio.
    > >
    > > > I can't see anything wrong on bttv_g_tuner lock. I suspect that the
    > > > divide error caused some bad effects at some data on bttv.

    > >
    > > The problems don't seem related because one is caused by opening the
    > > "radio" application, the divide error is caused by using a TV viewing
    > > application (I tried fbtv)
    > >
    > > > I've already applied his fix to my -git tree:

    > >
    > > Thanx, I'll try to bisect

    >
    > I tried to bisect but the V4L/DVB changes are not bisect friendly, on two
    > occursions I just selected "git bisect bad" because the bttv driver wouldn't
    > compile, so I couldn't pin-point what causes the oops and hang.
    >
    > Here are some few observations I made though (I started bisecting between
    > 2.6.24 and 2.6.25-rc1, saved me ~1000 commits):
    > 1. On the third bisect, there's no oops my PC just hangs a I can't use any
    > open terminals
    > 2. When I reached the V4L/DVB changes, my PC did not hag or oops, the radio
    > just didn't work (something about invalid VID**AUD**). This made it harder to
    > bisect, because it is not working and not breaking so is it good or bad...


    Bisecting this won't be that easy. The support for the depreciated V4L1 API
    were removed from bttv driver. Now, it uses v4l1-compat module, that translates
    a V4L1 call into a V4L2 one. I'll try to seek for troubles at the current code.


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

  6. Re: 2.6.25-rc[12] Video4Linux Bttv Regression

    More info add Ingo to CC, maybe he can explain what might cause such failure
    in the mutex code (sorry Ingo, I need to bother you once more)

    Ingo:

    I got the oops bellow whilst using the radio functionality of the
    bttv-drivers, nothing seems obvious except that I dies while calling
    __mutex_lock_slowpath. I've been trying to follow Linus' and Al's advise on
    oops tracing and I got as far as the _spin_lock code:


    BUG: unable to handle kernel NULL pointer dereference at 0000000000000000
    IP: [] __mutex_lock_slowpath+0x3b/0xb2
    PGD 67671067 PUD 63f47067 PMD 0
    Oops: 0002 [1] PREEMPT SMP
    CPU 0
    Modules linked in: snd_seq_dummy snd_seq_oss snd_seq_midi_event snd_seq
    binfmt_misc loop nls_cp437 vfat fat nls_iso8859_1 ntfs dm_mod thermal
    processor fan container button pcspkr snd_pcm_oss snd_mixer_oss tuner tea5767
    tda8290 tuner_xc2028 tda9887 tuner_simple mt20xx tea5761 snd_emu10k1
    snd_rawmidi bttv snd_ac97_codec videodev ac97_bus v4l1_compat snd_pcm
    ir_common firewire_ohci firewire_core snd_seq_device compat_ioctl32 snd_timer
    uhci_hcd ehci_hcd v4l2_common ide_cd_mod crc_itu_t snd_page_alloc usbcore
    videobuf_dma_sg snd_util_mem videobuf_core ohci1394 btcx_risc i2c_viapro
    sr_mod snd_hwdep ieee1394 emu10k1_gp snd tg3 cdrom tveeprom gameport sg evdev
    soundcore
    Pid: 7197, comm: radio Tainted: G M 2.6.25-rc1 #20
    RIP: 0010:[] []
    __mutex_lock_slowpath+0x3b/0xb2
    RSP: 0018:ffff81007df515e8 EFLAGS: 00010246
    RAX: ffff81007f13ef10 RBX: ffff81007f13ef08 RCX: 0000000000000000
    RDX: ffff81007df515e8 RSI: ffffffff88184050 RDI: ffff81007f13ef0c
    RBP: ffff81007df51628 R08: 0000000000000004 R09: ffff81007df51aa8
    R10: ffff81007e680a40 R11: 0000000000000202 R12: ffff81007f13ef0c
    R13: ffff81007f13ef08 R14: ffff810063cfc040 R15: ffffffff88184050
    FS: 00007fa8d92ba6f0(0000) GS:ffffffff805b2000(0000) knlGS:00000000f61fb980
    CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    CR2: 0000000000000000 CR3: 00000000676dc000 CR4: 00000000000006e0
    DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
    DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
    Process radio (pid: 7197, threadinfo ffff81007df50000, task ffff810063cfc040)
    Stack: ffff81007f13ef10 0005049900000000 018060f7018060fa 0000000000000024
    ffff81007df51aa8 ffff81007f13e800 ffff81007f13ef08 ffff81007e0e5800
    ffff81007df51638 ffffffff80457083 ffff81007df51668 ffffffff88162f2f
    Call Trace:
    []
    [] :bttv:radio_g_tuner+0x40/0xa6
    [] :videodev:__video_do_ioctl+0x2a6e/0x2e25
    [] :v4l1_compat:v4l_compat_translate_ioctl+0xea9/0x1af5
    [] ? :videodev:__video_do_ioctl+0x0/0x2e25
    [] ? blk_recount_segments+0x3e/0x62
    [] ? mempool_alloc_slab+0x11/0x13
    [] ? mempool_alloc+0x48/0xf9
    [] ? ext3_get_acl+0x87/0x332
    [] ? __d_lookup+0x125/0x137
    [] ? do_lookup+0x63/0x1b1
    [] ? dput+0x22/0x120
    [] ? __link_path_walk+0xbbd/0xd1b
    [] ? ext3_get_acl+0x87/0x332
    [] ? native_read_tsc+0x11/0x22
    [] ? __delay+0x27/0x59
    last message repeated 2 times
    [] ? __udelay+0x40/0x42
    [] ? i2c_stop+0x47/0x4b
    [] ? bit_xfer+0x412/0x423
    [] ? i2c_transfer+0x79/0x85
    [] ? :tuner_simple:simple_set_params+0x2bd/0xc1c
    [] ? get_unused_fd_flags+0x10d/0x11c
    [] ? touch_atime+0xe3/0xec
    [] ? mntput_no_expire+0x20/0x8f
    [] ? :tuner:fe_set_params+0x46/0x48
    [] ? :tuner:set_radio_freq+0x159/0x162
    [] ? klist_dec_and_del+0x14/0x16
    [] ? klist_next+0x6b/0x8a
    [] ? i2c_cmd+0x0/0x3e
    [] ? device_for_each_child+0x4c/0x5c
    [] :videodev:__video_do_ioctl+0x139/0x2e25
    [] ? :bttv:bttv_call_i2c_clients+0x16/0x18
    [] ? :bttv:audio_mux+0x105/0x1b5
    [] ? filemap_fault+0x1fe/0x371
    [] :videodev:video_ioctl2+0x1b8/0x259
    [] ? handle_mm_fault+0x341/0x697
    [] vfs_ioctl+0x5e/0x77
    [] do_vfs_ioctl+0x24d/0x262
    [] ? do_page_fault+0x434/0x7aa
    [] sys_ioctl+0x42/0x67
    [] system_call_after_swapgs+0x7b/0x80
    Feb 15 08:42:03 bongani64 kernel:
    Feb 15 08:42:03 bongani64 kernel:
    Code: 89 fb 4c 89 e7 48 83 ec 20 65 4c 8b 34 25 00 00 00 00 e8 19 12 00 00 48
    8d 43 08 48 8d 55 c0 48 8b 48 08 48 89 45 c0 48 89 50 08 <48> 89 11 48 83 ca
    ff 48 89 4d c8 4c 89 75 d0 48 89 d0 87 03 ff
    RIP [] __mutex_lock_slowpath+0x3b/0xb2
    RSP
    CR2: 0000000000000000
    ---[ end trace fdf145f4fc51dccd ]---
    note: radio[7197] exited with preempt_count 1

    Code dissamble:

    0x4005c0 : mov %edi,%ebx
    0x4005c2 : mov %r12,%rdi
    0x4005c5 : sub $0x20,%rsp
    0x4005c9 : mov %gs:0x0,%r14
    0x4005d2 : callq 0x4017f0
    0x4005d7 : lea 0x8(%rbx),%rax
    0x4005db : lea 0xffffffffffffffc0(%rbp),%rdx
    0x4005df : mov 0x8(%rax),%rcx
    0x4005e3 : mov %rax,0xffffffffffffffc0(%rbp)
    0x4005e7 : mov %rdx,0x8(%rax)
    0x4005eb : mov %rdx,(%rcx) <============= Here
    0x4005ee : or $0xffffffffffffffff,%rdx
    0x4005f2 : mov %rcx,0xffffffffffffffc8(%rbp)
    0x4005f6 : mov %r14,0xffffffffffffffd0(%rbp)
    0x4005fa : mov %rdx,%rax
    0x4005fd : xchg %eax,(%rbx)
    0x4005ff : incl (%rax)
    0x400601: and $0xa70,%eax
    0x400606: add %al,(%rax)
    0x400608: add %ebx,(%rbx)

    kernel/mutext.c dissamble:

    __mutex_lock_slowpath:
    pushq %rbp #
    movq %rsp, %rbp #,
    pushq %r14 #
    pushq %r13 #
    pushq %r12 #
    leaq 4(%rdi), %r12 #, D.13845
    pushq %rbx #
    movq %rdi, %rbx # lock_count, lock
    movq %r12, %rdi # D.13845, D.13845
    subq $32, %rsp #,
    #APP
    movq %gs:0,%r14 #, tsk
    #NO_APP
    call _spin_lock #
    leaq 8(%rbx), %rax #, next
    leaq -64(%rbp), %rdx #, tmp81
    movq 8(%rax), %rcx # .prev, prev
    movq %rax, -64(%rbp) # next, waiter.list.next
    movq %rdx, 8(%rax) # tmp81, .prev
    movq %rdx, (%rcx) # tmp81, .next <========= Here
    orq $-1, %rdx #, tmp83
    movq %rcx, -56(%rbp) # prev, waiter.list.prev
    movq %r14, -48(%rbp) # tsk, waiter.task
    movq %rdx, %rax # tmp83, x

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

  7. Re: 2.6.25-rc[12] Video4Linux Bttv Regression

    I've enabled MUTEX and SPINLOCK DEBUG, this is what I get

    ------------[ cut here ]------------
    WARNING: at /home/bongani/kernel/git/linux-2.6/kernel/mutex.c:134
    mutex_lock_nested+0xc0/0x2a3()
    Modules linked in: snd_seq_dummy snd_seq_oss snd_seq_midi_event snd_seq
    binfmt_misc loop nls_cp437 vfat fat nls_iso8859_1 ntfs dm_mod thermal
    processor fan container button pcspkr snd_pcm_oss snd_mixer_oss tuner
    snd_emu10k1 tea5767 tda8290 tuner_xc2028 tda9887 tuner_simple snd_rawmidi
    mt20xx snd_ac97_codec tea5761 ac97_bus snd_pcm bttv snd_seq_device snd_timer
    firewire_ohci videodev snd_page_alloc firewire_core v4l1_compat snd_util_mem
    uhci_hcd ehci_hcd ir_common snd_hwdep ide_cd_mod compat_ioctl32 crc_itu_t
    usbcore snd sr_mod v4l2_common ohci1394 videobuf_dma_sg cdrom ieee1394
    i2c_viapro videobuf_core emu10k1_gp tg3 btcx_risc gameport soundcore tveeprom
    sg evdev
    Pid: 4563, comm: radio Not tainted 2.6.25-rc2-00015-g1309d4e #36
    kernel:
    Call Trace:
    [] warn_on_slowpath+0x58/0x6b
    [] ? native_sched_clock+0x4d/0x6c
    [] ? get_lock_stats+0x16/0x49
    [] ? put_lock_stats+0xe/0x27
    [] ? lock_release_holdtime+0x56/0x5e
    [] ? ide_dma_intr+0x0/0x8f
    [] ? native_sched_clock+0x4d/0x6c
    [] mutex_lock_nested+0xc0/0x2a3
    [] ? :bttv:radio_g_tuner+0x42/0xa8
    [] ? virt_to_highmap+0x9/0x18
    [] ? __change_page_attr+0x179/0x697
    [] :bttv:radio_g_tuner+0x42/0xa8
    [] :videodev:__video_do_ioctl+0x2a6e/0x2e25
    [] ? __change_page_attr_set_clr+0x6c/0xc0
    [] ? kernel_map_pages+0x130/0x13b
    [] :v4l1_compat:v4l_compat_translate_ioctl+0xea9/0x1af5
    [] ? :videodev:__video_do_ioctl+0x0/0x2e25
    [] ? virt_to_highmap+0x9/0x18
    [] ? __change_page_attr+0x179/0x697
    [] ? __find_get_block+0x171/0x183
    [] ? virt_to_highmap+0x9/0x18
    [] ? __change_page_attr+0x179/0x697
    [] ? __change_page_attr_set_clr+0x6c/0xc0
    [] ? mempool_alloc_slab+0x11/0x13
    [] ? native_sched_clock+0x4d/0x6c
    [] ? mark_held_locks+0x59/0x75
    [] ? trace_hardirqs_on_thunk+0x35/0x3a
    [] ? trace_hardirqs_on+0xf9/0x124
    [] ? trace_hardirqs_on_thunk+0x35/0x3a
    [] ? native_sched_clock+0x4d/0x6c
    [] ? restore_args+0x0/0x3d
    [] ? __delay+0x33/0x4f
    last message repeated 2 times
    [] ? native_sched_clock+0x4d/0x6c
    [] ? get_lock_stats+0x16/0x49
    [] ? put_lock_stats+0xe/0x27
    [] ? mark_held_locks+0x59/0x75
    [] ? __mutex_unlock_slowpath+0xf9/0x11c
    [] ? trace_hardirqs_on+0xf9/0x124
    [] ? native_sched_clock+0x4d/0x6c
    [] ? __lock_acquire+0xc93/0xcb4
    [] ? native_sched_clock+0x4d/0x6c
    [] ? get_lock_stats+0x16/0x49
    [] ? put_lock_stats+0xe/0x27
    [] ? lock_release_holdtime+0x56/0x5e
    [] ? native_sched_clock+0x4d/0x6c
    [] ? __lock_acquire+0xc93/0xcb4
    [] ? native_sched_clock+0x4d/0x6c
    [] ? get_lock_stats+0x16/0x49
    [] ? put_lock_stats+0xe/0x27
    [] :videodev:__video_do_ioctl+0x139/0x2e25
    [] ? __lock_acquire+0xc93/0xcb4
    [] ? native_sched_clock+0x4d/0x6c
    [] ? put_lock_stats+0xe/0x27
    [] ? lock_release_holdtime+0x56/0x5e
    [] ? native_sched_clock+0x4d/0x6c
    [] :videodev:video_ioctl2+0x1b8/0x259
    [] ? _spin_unlock_irqrestore+0x3f/0x68
    [] ? trace_hardirqs_on+0xf9/0x124
    [] vfs_ioctl+0x5e/0x77
    [] do_vfs_ioctl+0x25b/0x270
    [] ? trace_hardirqs_on_thunk+0x35/0x3a
    [] sys_ioctl+0x42/0x65
    [] system_call_after_swapgs+0x7b/0x80
    kernel:
    ---[ end trace bb0fc13470ac3add ]---
    BUG: unable to handle kernel NULL pointer dereference at 0000000000000000
    IP: [] __list_add+0x2e/0x5b
    PGD 68e90067 PUD 6833a067 PMD 0
    Oops: 0000 [1] PREEMPT SMP DEBUG_PAGEALLOC
    CPU 1
    Modules linked in: snd_seq_dummy snd_seq_oss snd_seq_midi_event snd_seq
    binfmt_misc loop nls_cp437 vfat fat nls_iso8859_1 ntfs dm_mod thermal
    processor fan container button pcspkr snd_pcm_oss snd_mixer_oss tuner
    snd_emu10k1 tea5767 tda8290 tuner_xc2028 tda9887 tuner_simple snd_rawmidi
    mt20xx snd_ac97_codec tea5761 ac97_bus snd_pcm bttv snd_seq_device snd_timer
    firewire_ohci videodev snd_page_alloc firewire_core v4l1_compat snd_util_mem
    uhci_hcd ehci_hcd ir_common snd_hwdep ide_cd_mod compat_ioctl32 crc_itu_t
    usbcore snd sr_mod v4l2_common ohci1394 videobuf_dma_sg cdrom ieee1394
    i2c_viapro videobuf_core emu10k1_gp tg3 btcx_risc gameport soundcore tveeprom
    sg evdev
    Pid: 4563, comm: radio Not tainted 2.6.25-rc2-00015-g1309d4e #36
    RIP: 0010:[] [] __list_add+0x2e/0x5b
    RSP: 0018:ffff81005231d5b8 EFLAGS: 00010046
    RAX: 0000000000000000 RBX: ffffffffffffffff RCX: 0000000000000000
    RDX: ffff81007f2bc378 RSI: ffff81007f2bc378 RDI: ffff81005231d5d8
    RBP: ffff81005231d5b8 R08: 0000000000000000 R09: 0000000000000001
    R10: ffff81005231d2d8 R11: 0000000000007420 R12: ffff81007f2bc338
    R13: 0000000000000246 R14: ffff81007f2bc3a0 R15: ffff81005da847c0
    FS: 00007f3c348aa6f0(0000) GS:ffff81007f0554c8(0000) knlGS:0000000000000000
    CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    CR2: 0000000000000000 CR3: 0000000075c6e000 CR4: 00000000000006e0
    DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
    DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
    Process radio (pid: 4563, threadinfo ffff81005231c000, task ffff81005da847c0)
    Stack: ffff81005231d638 ffffffff8046487f ffffffff88133f3f 000000005da84808
    ffff81005231d5d8 ffff81005231d5d8 1111111111111111 ffff81007f2bc338
    ffff81005231d5d8 ffff81006002d000 ffff81005231d6e8 ffff81005231daa8
    Call Trace:
    [] mutex_lock_nested+0x111/0x2a3
    [] ? :bttv:radio_g_tuner+0x42/0xa8
    [] :bttv:radio_g_tuner+0x42/0xa8
    [] :videodev:__video_do_ioctl+0x2a6e/0x2e25
    [] ? __change_page_attr_set_clr+0x6c/0xc0
    [] ? kernel_map_pages+0x130/0x13b
    [] :v4l1_compat:v4l_compat_translate_ioctl+0xea9/0x1af5
    [] ? :videodev:__video_do_ioctl+0x0/0x2e25
    [] ? virt_to_highmap+0x9/0x18
    [] ? __change_page_attr+0x179/0x697
    [] ? __find_get_block+0x171/0x183
    [] ? virt_to_highmap+0x9/0x18
    [] ? __change_page_attr+0x179/0x697
    [] ? __change_page_attr_set_clr+0x6c/0xc0
    [] ? mempool_alloc_slab+0x11/0x13
    [] ? native_sched_clock+0x4d/0x6c
    [] ? mark_held_locks+0x59/0x75
    [] ? trace_hardirqs_on_thunk+0x35/0x3a
    [] ? trace_hardirqs_on+0xf9/0x124
    [] ? trace_hardirqs_on_thunk+0x35/0x3a
    [] ? native_sched_clock+0x4d/0x6c
    [] ? restore_args+0x0/0x3d
    [] ? __delay+0x33/0x4f
    last message repeated 2 times
    [] ? native_sched_clock+0x4d/0x6c
    [] ? get_lock_stats+0x16/0x49
    [] ? put_lock_stats+0xe/0x27
    [] ? mark_held_locks+0x59/0x75
    [] ? __mutex_unlock_slowpath+0xf9/0x11c
    [] ? trace_hardirqs_on+0xf9/0x124
    [] ? native_sched_clock+0x4d/0x6c
    [] ? __lock_acquire+0xc93/0xcb4
    [] ? native_sched_clock+0x4d/0x6c
    [] ? get_lock_stats+0x16/0x49
    [] ? put_lock_stats+0xe/0x27
    [] ? lock_release_holdtime+0x56/0x5e
    [] ? native_sched_clock+0x4d/0x6c
    [] ? __lock_acquire+0xc93/0xcb4
    [] ? native_sched_clock+0x4d/0x6c
    [] ? get_lock_stats+0x16/0x49
    [] ? put_lock_stats+0xe/0x27
    [] :videodev:__video_do_ioctl+0x139/0x2e25
    [] ? __lock_acquire+0xc93/0xcb4
    [] ? native_sched_clock+0x4d/0x6c
    [] ? put_lock_stats+0xe/0x27
    [] ? lock_release_holdtime+0x56/0x5e
    [] ? native_sched_clock+0x4d/0x6c
    [] :videodev:video_ioctl2+0x1b8/0x259
    [] ? _spin_unlock_irqrestore+0x3f/0x68
    [] ? trace_hardirqs_on+0xf9/0x124
    [] vfs_ioctl+0x5e/0x77
    [] do_vfs_ioctl+0x25b/0x270
    [] ? trace_hardirqs_on_thunk+0x35/0x3a
    [] sys_ioctl+0x42/0x65
    [] system_call_after_swapgs+0x7b/0x80
    kernel:
    kernel:
    Code: 42 08 49 89 f0 48 89 d6 48 89 e5 4c 39 c0 74 1b 48 89 d1 4c 89 c6 48 89
    c2 48 c7 c7 b4 ed 54 80 31 c0 e8 6d 3d f1 ff 0f 0b eb fe <48> 8b 10 48 39 f2
    74 15 48 89 c1 48 c7 c7 04 ee 54 80 31 c0 e8
    RIP [] __list_add+0x2e/0x5b
    RSP
    CR2: 0000000000000000
    ---[ end trace bb0fc13470ac3add ]---

    BUG: sleeping function called from invalid context
    at /home/bongani/kernel/git/linux-2.6/kernel/rwsem.c:21
    in_atomic():0, irqs_disabled():1
    INFO: lockdep is turned off.
    irq event stamp: 7544
    hardirqs last enabled at (7543): []
    trace_hardirqs_on_thunk+0x35/0x3a
    hardirqs last disabled at (7544): []
    mutex_lock_nested+0x7c/0x2a3
    softirqs last enabled at (7516): [] __do_softirq+0xbf/0xc8
    softirqs last disabled at (7511): [] call_softirq+0x1c/0x28
    Pid: 4563, comm: radio Tainted: G D 2.6.25-rc2-00015-g1309d4e #36
    kernel:
    Call Trace:
    [] ? print_irqtrace_events+0x110/0x114
    [] __might_sleep+0xda/0xdc
    [] down_read+0x20/0x68
    [] acct_collect+0x42/0x1a9
    [] do_exit+0x20a/0x6f3
    [] ? do_unblank_screen+0x29/0x125
    [] oops_begin+0x0/0x95
    [] do_page_fault+0x708/0x7bf
    [] error_exit+0x0/0xa9
    [] ? __list_add+0x2e/0x5b
    [] ? mutex_lock_nested+0x111/0x2a3
    [] ? :bttv:radio_g_tuner+0x42/0xa8
    [] ? :bttv:radio_g_tuner+0x42/0xa8
    [] ? :videodev:__video_do_ioctl+0x2a6e/0x2e25
    [] ? __change_page_attr_set_clr+0x6c/0xc0
    [] ? kernel_map_pages+0x130/0x13b
    [] ? :v4l1_compat:v4l_compat_translate_ioctl+0xea9/0x1af5
    [] ? :videodev:__video_do_ioctl+0x0/0x2e25
    [] ? virt_to_highmap+0x9/0x18
    [] ? __change_page_attr+0x179/0x697
    [] ? __find_get_block+0x171/0x183
    [] ? virt_to_highmap+0x9/0x18
    [] ? __change_page_attr+0x179/0x697
    [] ? __change_page_attr_set_clr+0x6c/0xc0
    [] ? mempool_alloc_slab+0x11/0x13
    [] ? native_sched_clock+0x4d/0x6c
    [] ? mark_held_locks+0x59/0x75
    [] ? trace_hardirqs_on_thunk+0x35/0x3a
    [] ? trace_hardirqs_on+0xf9/0x124
    [] ? trace_hardirqs_on_thunk+0x35/0x3a
    [] ? native_sched_clock+0x4d/0x6c
    [] ? restore_args+0x0/0x3d
    [] ? __delay+0x33/0x4f
    last message repeated 2 times
    [] ? native_sched_clock+0x4d/0x6c
    [] ? get_lock_stats+0x16/0x49
    [] ? put_lock_stats+0xe/0x27
    [] ? mark_held_locks+0x59/0x75
    [] ? __mutex_unlock_slowpath+0xf9/0x11c
    [] ? trace_hardirqs_on+0xf9/0x124
    [] ? native_sched_clock+0x4d/0x6c
    [] ? __lock_acquire+0xc93/0xcb4
    [] ? native_sched_clock+0x4d/0x6c
    [] ? get_lock_stats+0x16/0x49
    [] ? put_lock_stats+0xe/0x27
    [] ? lock_release_holdtime+0x56/0x5e
    [] ? native_sched_clock+0x4d/0x6c
    [] ? __lock_acquire+0xc93/0xcb4
    [] ? native_sched_clock+0x4d/0x6c
    [] ? get_lock_stats+0x16/0x49
    [] ? put_lock_stats+0xe/0x27
    [] ? :videodev:__video_do_ioctl+0x139/0x2e25
    [] ? __lock_acquire+0xc93/0xcb4
    [] ? native_sched_clock+0x4d/0x6c
    [] ? put_lock_stats+0xe/0x27
    [] ? lock_release_holdtime+0x56/0x5e
    [] ? native_sched_clock+0x4d/0x6c
    [] ? :videodev:video_ioctl2+0x1b8/0x259
    [] ? _spin_unlock_irqrestore+0x3f/0x68
    [] ? trace_hardirqs_on+0xf9/0x124
    [] ? vfs_ioctl+0x5e/0x77
    [] ? do_vfs_ioctl+0x25b/0x270
    [] ? trace_hardirqs_on_thunk+0x35/0x3a
    [] ? sys_ioctl+0x42/0x65
    [] ? system_call_after_swapgs+0x7b/0x80

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

  8. Re: 2.6.25-rc[12] Video4Linux Bttv Regression

    > Bisecting this won't be that easy. The support for the depreciated V4L1 API
    > were removed from bttv driver. Now, it uses v4l1-compat module, that translates
    > a V4L1 call into a V4L2 one. I'll try to seek for troubles at the current code.


    I think I might have seen this problem but it didn't cause a oops for
    me, just that the radio program would hang waiting for the ioctl syscall
    to return. I did tried looking for a new radio program that used the
    V4L2 API but couldn't find one. I'll have a more in-depth look at the
    bttv driver when I get home tonight.

    Robert

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

  9. [PATCH] bttv: Re-enable radio tuner support for VIDIOCGFREQ/VIDIOCSFREQ ioctls.

    Signed-off-by: Robert Fitzsimons
    ---
    drivers/media/video/bt8xx/bttv-driver.c | 5 +++--
    1 files changed, 3 insertions(+), 2 deletions(-)

    diff --git a/drivers/media/video/bt8xx/bttv-driver.c b/drivers/media/video/bt8xx/bttv-driver.c
    index 5404fcc..817a961 100644
    --- a/drivers/media/video/bt8xx/bttv-driver.c
    +++ b/drivers/media/video/bt8xx/bttv-driver.c
    @@ -1990,7 +1990,7 @@ static int bttv_g_frequency(struct file *file, void *priv,
    if (0 != err)
    return err;

    - f->type = V4L2_TUNER_ANALOG_TV;
    + f->type = btv->radio_user ? V4L2_TUNER_RADIO : V4L2_TUNER_ANALOG_TV;
    f->frequency = btv->freq;

    return 0;
    @@ -2009,7 +2009,8 @@ static int bttv_s_frequency(struct file *file, void *priv,

    if (unlikely(f->tuner != 0))
    return -EINVAL;
    - if (unlikely(f->type != V4L2_TUNER_ANALOG_TV))
    + if (unlikely(f->type != (btv->radio_user
    + ? V4L2_TUNER_RADIO : V4L2_TUNER_ANALOG_TV)))
    return -EINVAL;
    mutex_lock(&btv->lock);
    btv->freq = f->frequency;
    --
    1.5.4.34.g053d9

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

  10. [PATCH] bttv: Re-enabling radio support requires the use of struct bttv_fh.

    A number of the radio tuner ioctl functions are shared with the TV
    tuner, these functions require a struct bttv_fh data structure to be
    allocated and initialized.

    Signed-off-by: Robert Fitzsimons
    ---
    drivers/media/video/bt8xx/bttv-driver.c | 21 ++++++++++++++++-----
    1 files changed, 16 insertions(+), 5 deletions(-)


    Mauro, the radio_open function may want to do more initialisation then
    the amount I copied from bttv_open.


    diff --git a/drivers/media/video/bt8xx/bttv-driver.c b/drivers/media/video/bt8xx/bttv-driver.c
    index 817a961..04a8263 100644
    --- a/drivers/media/video/bt8xx/bttv-driver.c
    +++ b/drivers/media/video/bt8xx/bttv-driver.c
    @@ -3417,6 +3417,7 @@ static int radio_open(struct inode *inode, struct file *file)
    {
    int minor = iminor(inode);
    struct bttv *btv = NULL;
    + struct bttv_fh *fh;
    unsigned int i;

    dprintk("bttv: open minor=%d\n",minor);
    @@ -3431,12 +3432,19 @@ static int radio_open(struct inode *inode, struct file *file)
    return -ENODEV;

    dprintk("bttv%d: open called (radio)\n",btv->c.nr);
    +
    + /* allocate per filehandle data */
    + fh = kmalloc(sizeof(*fh),GFP_KERNEL);
    + if (NULL == fh)
    + return -ENOMEM;
    + file->private_data = fh;
    + *fh = btv->init;
    + v4l2_prio_open(&btv->prio,&fh->prio);
    +
    mutex_lock(&btv->lock);

    btv->radio_user++;

    - file->private_data = btv;
    -
    bttv_call_i2c_clients(btv,AUDC_SET_RADIO,NULL);
    audio_input(btv,TVAUDIO_INPUT_RADIO);

    @@ -3446,7 +3454,8 @@ static int radio_open(struct inode *inode, struct file *file)

    static int radio_release(struct inode *inode, struct file *file)
    {
    - struct bttv *btv = file->private_data;
    + struct bttv_fh *fh = file->private_data;
    + struct bttv *btv = fh->btv;
    struct rds_command cmd;

    btv->radio_user--;
    @@ -3571,7 +3580,8 @@ static int radio_g_input(struct file *filp, void *priv, unsigned int *i)
    static ssize_t radio_read(struct file *file, char __user *data,
    size_t count, loff_t *ppos)
    {
    - struct bttv *btv = file->private_data;
    + struct bttv_fh *fh = file->private_data;
    + struct bttv *btv = fh->btv;
    struct rds_command cmd;
    cmd.block_count = count/3;
    cmd.buffer = data;
    @@ -3585,7 +3595,8 @@ static ssize_t radio_read(struct file *file, char __user *data,

    static unsigned int radio_poll(struct file *file, poll_table *wait)
    {
    - struct bttv *btv = file->private_data;
    + struct bttv_fh *fh = file->private_data;
    + struct bttv *btv = fh->btv;
    struct rds_command cmd;
    cmd.instance = file;
    cmd.event_list = wait;
    --
    1.5.4.34.g053d9

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

  11. Re: 2.6.25-rc[12] Video4Linux Bttv Regression

    > I think I might have seen this problem but it didn't cause a oops for
    > me,


    Ok, I found the cause of the oops. Some of radio tuner code was
    expecting a struct bttv_fh to be allocated but this wasn't done in
    radio_open. So it would dereference an invalid data structure, causing
    a hang for me and an oops for Bongani. I also had to add support for
    the radio tuner to some shared functions. Patches to follow.

    Robert

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

  12. Re: [PATCH] bttv: Re-enabling radio support requires the use of struct bttv_fh.

    On Wed, 27 Feb 2008 01:47:29 +0000
    Robert Fitzsimons wrote:

    > A number of the radio tuner ioctl functions are shared with the TV
    > tuner, these functions require a struct bttv_fh data structure to be
    > allocated and initialized.
    >
    > Signed-off-by: Robert Fitzsimons
    > ---
    > drivers/media/video/bt8xx/bttv-driver.c | 21 ++++++++++++++++-----
    > 1 files changed, 16 insertions(+), 5 deletions(-)
    >
    >
    > Mauro, the radio_open function may want to do more initialisation then
    > the amount I copied from bttv_open.


    Maybe, but the proper way would be to use just one open for both radio and
    video, like cx88. This driver violates V4L2 API, since the spec says that
    opening /dev/radio will select radio, by default, but it is possible to listen
    video also on that interface (the opposite is valid also for /dev/video).

    I'll apply the fixes, for now. The better would be if you could try to use the
    same approach present on cx88.

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

  13. Re: [PATCH] bttv: Re-enabling radio support requires the use of struct bttv_fh.

    On Wednesday 27 February 2008 03:47:29 Robert Fitzsimons wrote:
    > A number of the radio tuner ioctl functions are shared with the TV
    > tuner, these functions require a struct bttv_fh data structure to be
    > allocated and initialized.
    >
    > Signed-off-by: Robert Fitzsimons
    > ---
    > drivers/media/video/bt8xx/bttv-driver.c | 21 ++++++++++++++++-----
    > 1 files changed, 16 insertions(+), 5 deletions(-)
    >
    >
    > Mauro, the radio_open function may want to do more initialisation then
    > the amount I copied from bttv_open.


    Thanx Robert

    I have applied both your patches and my radio works, but my TV doesn't work
    anymore (no picture or sound). But when I exit the radio program I get this
    oops:


    BUG: unable to handle kernel NULL pointer dereference at 0000000000000010
    IP: [] kref_get+0xc/0x29
    PGD 72230067 PUD 6dbd1067 PMD 0
    Oops: 0000 [1] PREEMPT SMP
    CPU 1
    Modules linked in: snd_seq_dummy snd_seq_oss snd_seq_midi_event snd_seq
    binfmt_misc loop nls_cp437 vfat fat nls_iso8859_1 ntfs thermal processor fan
    container button pcspkr snd_pcm_oss snd_mixer_oss snd_emu10k1 tuner tea5767
    tda8290 tuner_xc2028 tda9887 tuner_simple snd_rawmidi mt20xx snd_ac97_codec
    tea5761 bttv ac97_bus snd_pcm ir_common snd_seq_device firewire_ohci
    compat_ioctl32 snd_timer firewire_core videodev snd_page_alloc v4l1_compat
    uhci_hcd snd_util_mem ehci_hcd crc_itu_t v4l2_common snd_hwdep
    videobuf_dma_sg ohci1394 usbcore sr_mod ide_cd_mod snd videobuf_core ieee1394
    emu10k1_gp tg3 cdrom btcx_risc sg i2c_viapro gameport tveeprom evdev
    soundcore
    Pid: 4319, comm: radio Not tainted 2.6.25-rc3-dirty #42
    RIP: 0010:[] [] kref_get+0xc/0x29
    RSP: 0018:ffff810065211db8 EFLAGS: 00010296
    RAX: ffff81006d815880 RBX: 0000000000000010 RCX: 0000000000000000
    RDX: 0000000000000000 RSI: ffff810065211e28 RDI: 0000000000000010
    RBP: ffff810065211dc8 R08: 0000000000000000 R09: 0000001000000000
    R10: 0000000000000000 R11: 0000000000000246 R12: ffff810065211e28
    R13: 0000000000000000 R14: 0000000000000000 R15: fffffffffffffff8
    FS: 00007fe0f915f6f0(0000) GS:ffff81007fb89dc0(0000) knlGS:0000000000000000
    CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b
    CR2: 0000000000000010 CR3: 0000000063e8f000 CR4: 00000000000006e0
    DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
    DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
    Process radio (pid: 4319, threadinfo ffff810065210000, task ffff810068e534e0)
    Stack: ffff810065211ea8 0000000000000000 ffff810065211e08 ffffffff8044b362
    ffff810063dc0440 ffff810065211e28 0000000000000000 ffffffff803c0b75
    ffff810065211e78 ffff81007fb55580 ffff810065211e18 ffffffff8037be03
    Call Trace:
    [] klist_next+0x5d/0x8a
    [] ? i2c_cmd+0x0/0x3b
    [] next_device+0x9/0x19
    [] device_for_each_child+0x37/0x5c
    [] i2c_clients_command+0x23/0x25
    [] :bttv:bttv_call_i2c_clients+0x16/0x18
    [] :bttv:radio_release+0x23/0x27
    [] __fput+0xac/0x16c
    [] fput+0x14/0x16
    [] filp_close+0x66/0x71
    [] sys_close+0x8e/0xd1
    [] system_call_after_swapgs+0x7b/0x80


    Code: ff f0 ff 0b 0f 94 c0 31 d2 84 c0 74 0b 48 89 df 41 ff d4 ba 01 00 00 00
    5b 41 5c c9 89 d0 c3 55 48 89 e5 53 48 89 fb 48 83 ec 08 <83> 3f 00 75 11 be
    2b 00 00 00 48 c7 c7 46 b9 53 80 e8 d7 33 f2
    RIP [] kref_get+0xc/0x29
    RSP
    CR2: 0000000000000010
    ---[ end trace 7ada9aa1e484b38f ]---

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

  14. Re: [PATCH] bttv: Re-enabling radio support requires the use of struct bttv_fh.

    > I have applied both your patches and my radio works, but my TV doesn't work
    > anymore (no picture or sound). But when I exit the radio program I get this
    > oops:


    I've had a quick look and nothing stands out as the cause of the oops,
    but I did notice that I introduced a small memory leak. Over the next
    day or so I'll have a look at Mauro's suggestion of combining the opens
    like the cx88 driver.

    Robert

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

  15. Re: 2.6.25-rc[12] Video4Linux Bttv Regression

    On Wednesday 27 February 2008 03:42:38 Robert Fitzsimons wrote:
    > > I think I might have seen this problem but it didn't cause a oops for
    > > me,

    >
    > Ok, I found the cause of the oops. Some of radio tuner code was
    > expecting a struct bttv_fh to be allocated but this wasn't done in
    > radio_open. So it would dereference an invalid data structure, causing
    > a hang for me and an oops for Bongani. I also had to add support for
    > the radio tuner to some shared functions. Patches to follow.
    >
    > Robert


    More info...

    The Oops seems to be caused by a size mismatch that causes memset to write
    over other variables in the stack... The following debug hack moved oops to
    another point in the v4l1-compact code..

    So memset(&tun2,0,sizeof(tun2)) seems to be overwriting btv->lock->wait_list:

    --- drivers/media/video/v4l1-compat.c~ 2007-11-13 10:25:52.000000000 +0200
    +++ drivers/media/video/v4l1-compat.c 2008-03-17 23:17:38.000000000 +0200
    @@ -688,7 +688,7 @@
    {
    struct video_tuner *tun = arg;

    - memset(&tun2,0,sizeof(tun2));
    + memset(&tun2,-1,sizeof(tun2));
    err = drv(inode, file, VIDIOC_G_TUNER, &tun2);
    if (err < 0) {
    dprintk("VIDIOCGTUNER / VIDIOC_G_TUNER: %d\n",err);

    The new oops, where there's another memset(&tun2,0,sizeof(tun2)):

    BUG: unable to handle kernel NULL pointer dereference at 0000000000000000
    IP: [] __mutex_lock_slowpath+0x3b/0xb2
    PGD 699d9067 PUD 65837067 PMD 0
    Oops: 0002 [1] PREEMPT SMP
    CPU 1
    Modules linked in: snd_seq_dummy snd_seq_oss snd_seq_midi_event snd_seq
    binfmt_misc loop nls_cp437 vfat fat nls_iso8859_1 ntfs thermal processor fan
    container button pcspkr snd_pcm_oss snd_mixer_oss snd_emu10k1 tuner tea5767
    tda8290 tuner_xc2028 tda9887 tuner_simple snd_rawmidi mt20xx snd_ac97_codec
    tea5761 bttv ac97_bus snd_pcm ir_common firewire_ohci snd_seq_device
    compat_ioctl32 firewire_core snd_timer uhci_hcd videodev ehci_hcd
    snd_page_alloc v4l1_compat crc_itu_t snd_util_mem usbcore v4l2_common
    snd_hwdep videobuf_dma_sg ohci1394 ide_cd_mod snd videobuf_core emu10k1_gp
    ieee1394 sr_mod btcx_risc evdev gameport i2c_viapro tveeprom cdrom sg tg3
    soundcore
    Pid: 4230, comm: radio Not tainted 2.6.25-rc5-dirty #46
    RIP: 0010:[] []
    __mutex_lock_slowpath+0x3b/0xb2
    RSP: 0018:ffff8100658455e8 EFLAGS: 00010246
    RAX: ffff81007fbeff10 RBX: ffff81007fbeff08 RCX: 0000000000000000
    RDX: ffff8100658455e8 RSI: ffffffff8816711c RDI: ffff81007fbeff0c
    RBP: ffff810065845628 R08: ffffffff880e98df R09: 0000000000000002
    R10: ffff810065845f38 R11: 0000000000000246 R12: ffff81007fbeff0c
    R13: 0000000000000000 R14: ffff8100699d0d10 R15: ffffffff88167110
    FS: 00007f0c740e46f0(0000) GS:ffff81007fb6adc0(0000) knlGS:0000000000000000
    CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    CR2: 0000000000000000 CR3: 0000000065835000 CR4: 00000000000006e0
    DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
    DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
    Process radio (pid: 4230, threadinfo ffff810065844000, task ffff8100699d0d10)
    Stack: ffff81007fbeff10 ffff810065845774 0000000265845688 ffff810065845768
    ffff81007fbef800 ffff810065845c68 0000000000000000 ffff81007fbeff08
    ffff810065845638 ffffffff8045a16f ffff810065845668 ffffffff8814692f
    Call Trace:
    [] mutex_lock+0xe/0x10
    [] :bttv:bttv_s_frequency+0x46/0x9f
    [] :videodev:__video_do_ioctl+0x2ca4/0x2e16
    [] ? hrtick_set+0xdf/0xe8
    [] ? default_idle+0x0/0x5f
    [] ? thread_return+0x6c/0xbf
    [] :v4l1_compat:v4l_compat_translate_ioctl+0x1116/0x1b01
    [] ? generic_unplug_device+0x2c/0x30
    [] ? :videodev:__video_do_ioctl+0x0/0x2e16
    [] ? mark_page_accessed+0x20/0x36
    [] ? __find_get_block+0x153/0x165
    [] ? __getblk+0x20/0x22b
    [] ? blk_recount_segments+0x3e/0x68
    [] ? mempool_alloc+0x48/0xf9
    [] ? cache_alloc_refill+0x1cc/0x233
    [] ? blk_rq_map_sg+0x12b/0x24b
    [] ? lock_timer_base+0x26/0x4a
    [] ? dma_timer_expiry+0x0/0x6d
    [] ? __mod_timer+0xc4/0xd6
    [] ? __delay+0x27/0x59
    [] ? __delay+0x27/0x59
    [] ? __delay+0x27/0x59
    [] ? __delay+0x27/0x59
    [] ? __delay+0x27/0x59
    [] ? __udelay+0x40/0x42
    [] ? i2c_stop+0x47/0x4b
    [] ? bit_xfer+0x412/0x423
    [] ? i2c_transfer+0x79/0x85
    [] ? :tuner_simple:simple_set_params+0x2b9/0xc18
    [] ? enqueue_task_fair+0x179/0x186
    [] ? task_rq_lock+0x3d/0x73
    [] ? try_to_wake_up+0x1ae/0x1bf
    [] ? smp_send_reschedule+0x1d/0x1f
    [] ? default_wake_function+0xd/0xf
    [] ? __wake_up_common+0x46/0x75
    [] :videodev:__video_do_ioctl+0x139/0x2e16
    [] ? n_tty_receive_buf+0xf18/0xf77
    [] ? filemap_fault+0x1fe/0x371
    [] :videodev:video_ioctl2+0x1b8/0x259
    [] ? remove_wait_queue+0x3c/0x41
    [] ? __wake_up+0x43/0x4f
    [] vfs_ioctl+0x5e/0x77
    [] do_vfs_ioctl+0x24d/0x262
    [] sys_ioctl+0x42/0x67
    [] ? sys_write+0x47/0x70
    [] system_call_after_swapgs+0x7b/0x80


    Code: 89 fb 4c 89 e7 48 83 ec 20 65 4c 8b 34 25 00 00 00 00 e8 e5 0f 00 00 48
    8d 43 08 48 8d 55 c0 48 8b 48 08 48 89 45 c0 48 89 50 08 <48> 89 11 48 83 ca
    ff 48 89 4d c8 4c 89 75 d0 48 89 d0 87 03 ff
    RIP [] __mutex_lock_slowpath+0x3b/0xb2
    RSP
    CR2: 0000000000000000
    ---[ end trace 821f8e64b81db17b ]---




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

  16. Re: 2.6.25-rc[12] Video4Linux Bttv Regression

    On Mon, 17 Mar 2008 23:51:56 +0200
    Bongani Hlope wrote:

    > On Wednesday 27 February 2008 03:42:38 Robert Fitzsimons wrote:
    > > > I think I might have seen this problem but it didn't cause a oops for
    > > > me,

    > >
    > > Ok, I found the cause of the oops. Some of radio tuner code was
    > > expecting a struct bttv_fh to be allocated but this wasn't done in
    > > radio_open. So it would dereference an invalid data structure, causing
    > > a hang for me and an oops for Bongani. I also had to add support for
    > > the radio tuner to some shared functions. Patches to follow.
    > >
    > > Robert

    >
    > More info...
    >
    > The Oops seems to be caused by a size mismatch that causes memset to write
    > over other variables in the stack... The following debug hack moved oops to
    > another point in the v4l1-compact code..
    >
    > So memset(&tun2,0,sizeof(tun2)) seems to be overwriting btv->lock->wait_list:
    >
    > --- drivers/media/video/v4l1-compat.c~ 2007-11-13 10:25:52.000000000 +0200
    > +++ drivers/media/video/v4l1-compat.c 2008-03-17 23:17:38.000000000 +0200
    > @@ -688,7 +688,7 @@
    > {
    > struct video_tuner *tun = arg;
    >
    > - memset(&tun2,0,sizeof(tun2));
    > + memset(&tun2,-1,sizeof(tun2));
    > err = drv(inode, file, VIDIOC_G_TUNER, &tun2);
    > if (err < 0) {
    > dprintk("VIDIOCGTUNER / VIDIOC_G_TUNER: %d\n",err);
    >
    > The new oops, where there's another memset(&tun2,0,sizeof(tun2)):
    >
    > BUG: unable to handle kernel NULL pointer dereference at 0000000000000000
    > IP: [] __mutex_lock_slowpath+0x3b/0xb2
    > PGD 699d9067 PUD 65837067 PMD 0
    > Oops: 0002 [1] PREEMPT SMP
    > CPU 1
    > Modules linked in: snd_seq_dummy snd_seq_oss snd_seq_midi_event snd_seq
    > binfmt_misc loop nls_cp437 vfat fat nls_iso8859_1 ntfs thermal processor fan
    > container button pcspkr snd_pcm_oss snd_mixer_oss snd_emu10k1 tuner tea5767
    > tda8290 tuner_xc2028 tda9887 tuner_simple snd_rawmidi mt20xx snd_ac97_codec
    > tea5761 bttv ac97_bus snd_pcm ir_common firewire_ohci snd_seq_device
    > compat_ioctl32 firewire_core snd_timer uhci_hcd videodev ehci_hcd
    > snd_page_alloc v4l1_compat crc_itu_t snd_util_mem usbcore v4l2_common
    > snd_hwdep videobuf_dma_sg ohci1394 ide_cd_mod snd videobuf_core emu10k1_gp
    > ieee1394 sr_mod btcx_risc evdev gameport i2c_viapro tveeprom cdrom sg tg3
    > soundcore
    > Pid: 4230, comm: radio Not tainted 2.6.25-rc5-dirty #46
    > RIP: 0010:[] []
    > __mutex_lock_slowpath+0x3b/0xb2
    > RSP: 0018:ffff8100658455e8 EFLAGS: 00010246
    > RAX: ffff81007fbeff10 RBX: ffff81007fbeff08 RCX: 0000000000000000
    > RDX: ffff8100658455e8 RSI: ffffffff8816711c RDI: ffff81007fbeff0c
    > RBP: ffff810065845628 R08: ffffffff880e98df R09: 0000000000000002
    > R10: ffff810065845f38 R11: 0000000000000246 R12: ffff81007fbeff0c
    > R13: 0000000000000000 R14: ffff8100699d0d10 R15: ffffffff88167110
    > FS: 00007f0c740e46f0(0000) GS:ffff81007fb6adc0(0000) knlGS:0000000000000000
    > CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    > CR2: 0000000000000000 CR3: 0000000065835000 CR4: 00000000000006e0
    > DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
    > DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
    > Process radio (pid: 4230, threadinfo ffff810065844000, task ffff8100699d0d10)
    > Stack: ffff81007fbeff10 ffff810065845774 0000000265845688 ffff810065845768
    > ffff81007fbef800 ffff810065845c68 0000000000000000 ffff81007fbeff08
    > ffff810065845638 ffffffff8045a16f ffff810065845668 ffffffff8814692f
    > Call Trace:
    > [] mutex_lock+0xe/0x10
    > [] :bttv:bttv_s_frequency+0x46/0x9f
    > [] :videodev:__video_do_ioctl+0x2ca4/0x2e16
    > [] ? hrtick_set+0xdf/0xe8
    > [] ? default_idle+0x0/0x5f
    > [] ? thread_return+0x6c/0xbf
    > [] :v4l1_compat:v4l_compat_translate_ioctl+0x1116/0x1b01
    > [] ? generic_unplug_device+0x2c/0x30
    > [] ? :videodev:__video_do_ioctl+0x0/0x2e16
    > [] ? mark_page_accessed+0x20/0x36
    > [] ? __find_get_block+0x153/0x165
    > [] ? __getblk+0x20/0x22b
    > [] ? blk_recount_segments+0x3e/0x68
    > [] ? mempool_alloc+0x48/0xf9
    > [] ? cache_alloc_refill+0x1cc/0x233
    > [] ? blk_rq_map_sg+0x12b/0x24b
    > [] ? lock_timer_base+0x26/0x4a
    > [] ? dma_timer_expiry+0x0/0x6d
    > [] ? __mod_timer+0xc4/0xd6
    > [] ? __delay+0x27/0x59
    > [] ? __delay+0x27/0x59
    > [] ? __delay+0x27/0x59
    > [] ? __delay+0x27/0x59
    > [] ? __delay+0x27/0x59
    > [] ? __udelay+0x40/0x42
    > [] ? i2c_stop+0x47/0x4b
    > [] ? bit_xfer+0x412/0x423
    > [] ? i2c_transfer+0x79/0x85
    > [] ? :tuner_simple:simple_set_params+0x2b9/0xc18
    > [] ? enqueue_task_fair+0x179/0x186
    > [] ? task_rq_lock+0x3d/0x73
    > [] ? try_to_wake_up+0x1ae/0x1bf
    > [] ? smp_send_reschedule+0x1d/0x1f
    > [] ? default_wake_function+0xd/0xf
    > [] ? __wake_up_common+0x46/0x75
    > [] :videodev:__video_do_ioctl+0x139/0x2e16
    > [] ? n_tty_receive_buf+0xf18/0xf77
    > [] ? filemap_fault+0x1fe/0x371
    > [] :videodev:video_ioctl2+0x1b8/0x259
    > [] ? remove_wait_queue+0x3c/0x41
    > [] ? __wake_up+0x43/0x4f
    > [] vfs_ioctl+0x5e/0x77
    > [] do_vfs_ioctl+0x24d/0x262
    > [] sys_ioctl+0x42/0x67
    > [] ? sys_write+0x47/0x70
    > [] system_call_after_swapgs+0x7b/0x80
    >
    >
    > Code: 89 fb 4c 89 e7 48 83 ec 20 65 4c 8b 34 25 00 00 00 00 e8 e5 0f 00 00 48
    > 8d 43 08 48 8d 55 c0 48 8b 48 08 48 89 45 c0 48 89 50 08 <48> 89 11 48 83 ca
    > ff 48 89 4d c8 4c 89 75 d0 48 89 d0 87 03 ff
    > RIP [] __mutex_lock_slowpath+0x3b/0xb2
    > RSP
    > CR2: 0000000000000000
    > ---[ end trace 821f8e64b81db17b ]---


    Could you please test this small patch?

    diff -r 134d43b48b4a linux/drivers/media/video/bt8xx/bttv-driver.c
    --- a/linux/drivers/media/video/bt8xx/bttv-driver.c Tue Mar 18 23:46:37 2008 +0000
    +++ b/linux/drivers/media/video/bt8xx/bttv-driver.c Thu Mar 20 14:20:54 2008 -0300
    @@ -3288,6 +3288,7 @@ static int bttv_open(struct inode *inode
    return -ENOMEM;
    file->private_data = fh;
    *fh = btv->init;
    + fh->btv = btv;
    fh->type = type;
    fh->ov.setup_ok = 0;
    v4l2_prio_open(&btv->prio,&fh->prio);


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

  17. Re: 2.6.25-rc[12] Video4Linux Bttv Regression

    On Thursday 20 March 2008 19:22:12 Mauro Carvalho Chehab wrote:
    > On Mon, 17 Mar 2008 23:51:56 +0200
    >

    8<
    >
    > Could you please test this small patch?
    >
    > diff -r 134d43b48b4a linux/drivers/media/video/bt8xx/bttv-driver.c
    > --- a/linux/drivers/media/video/bt8xx/bttv-driver.c Tue Mar 18 23:46:37
    > 2008 +0000 +++ b/linux/drivers/media/video/bt8xx/bttv-driver.c Thu Mar 20
    > 14:20:54 2008 -0300 @@ -3288,6 +3288,7 @@ static int bttv_open(struct inode
    > *inode
    > return -ENOMEM;
    > file->private_data = fh;
    > *fh = btv->init;
    > + fh->btv = btv;
    > fh->type = type;
    > fh->ov.setup_ok = 0;
    > v4l2_prio_open(&btv->prio,&fh->prio);
    >
    >
    > Cheers,
    > Mauro


    Latest git with or without your patch still causes the oops..

    The call trace that seems to be causing this oops is

    radio
    |-> ioctl(
    |->videodev.c:__video_do_ioctl
    |->v4l1-compat.c:v4l_compat_translate_ioctl
    | case VIDIOCGTUNER: /* get tuner information */
    | {
    | struct video_tuner *tun = arg;
    |
    | memset(&tun2,0,sizeof(tun2));
    |__ err = drv(inode, file, VIDIOC_G_TUNER, &tun2);
    |->videodev.c:__video_do_ioctl
    | case VIDIOC_G_TUNER:
    | {
    | struct v4l2_tuner *p=arg;
    | __u32 index=p->index;
    |
    | if (!vfd->vidioc_g_tuner)
    | break;
    |
    | memset(p,0,sizeof(*p));
    | p->index=index;
    |
    | ret=vfd->vidioc_g_tuner(file, fh, p);
    |_
    |-> bttv_driver.c:radio_g_tuner
    | struct bttv_fh *fh = priv;
    | struct bttv *btv = fh->btv;
    |
    | if (UNSET == bttv_tvcards[btv->c.type].tuner)
    | return -EINVAL;
    | if (0 != t->index)
    | return -EINVAL;
    | mutex_lock(&btv->lock);
    |__
    |-> mutex.c:__mutex_lock_common
    | struct task_struct *task = current;
    | struct mutex_waiter waiter;
    | unsigned int old_val;
    | unsigned long flags;
    |
    | spin_lock_mutex(&lock->wait_lock, flags);
    |
    | debug_mutex_lock_common(lock, &waiter);
    | mutex_acquire(&lock->dep_map, subclass, 0, ip);
    | debug_mutex_add_waiter(lock, &waiter,
    task_thread_info(task));
    |
    | /* add waiting tasks to the end of the
    waitqueue (FIFO): */
    | list_add_tail(&waiter.list, &lock->wait_list);
    ^^^^
    This is where it oops because lock->wait_list->next is NULL.

    BUT, changing:
    memset(&tun2,0,sizeof(tun2));
    to
    memset(&tun2,-1,sizeof(tun2));
    in
    v4l1-compat.c:v4l_compat_translate_ioctl
    ....
    case VIDIOCGTUNER:

    changes
    lock->wait_list->next from being NULL to something else, and the oops move to
    the next case statement i.e. VIDIOCGFREQ





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

  18. [PATCH] bttv: Add a radio compat_ioctl file operation.

    Signed-off-by: Robert Fitzsimons
    ---
    drivers/media/video/bt8xx/bttv-driver.c | 1 +
    1 files changed, 1 insertions(+), 0 deletions(-)


    Hi Bongani

    I only noticed that you might be using a 32 bit userspace, so the radio
    compat_ioctl needs to be implmented.

    Robert



    diff --git a/drivers/media/video/bt8xx/bttv-driver.c b/drivers/media/video/bt8xx/bttv-driver.c
    index 5404fcc..1bdb726 100644
    --- a/drivers/media/video/bt8xx/bttv-driver.c
    +++ b/drivers/media/video/bt8xx/bttv-driver.c
    @@ -3601,6 +3601,7 @@ static const struct file_operations radio_fops =
    .read = radio_read,
    .release = radio_release,
    .ioctl = video_ioctl2,
    + .compat_ioctl = v4l_compat_ioctl32,
    .llseek = no_llseek,
    .poll = radio_poll,
    };
    --
    1.5.4.3.484.g60e3

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

  19. Re: [PATCH] bttv: Add a radio compat_ioctl file operation.

    On Saturday 22 March 2008 02:05:57 Robert Fitzsimons wrote:
    > Signed-off-by: Robert Fitzsimons
    > ---
    > drivers/media/video/bt8xx/bttv-driver.c | 1 +
    > 1 files changed, 1 insertions(+), 0 deletions(-)
    >
    >
    > Hi Bongani
    >
    > I only noticed that you might be using a 32 bit userspace, so the radio
    > compat_ioctl needs to be implmented.
    >
    > Robert
    >
    >
    >
    > diff --git a/drivers/media/video/bt8xx/bttv-driver.c
    > b/drivers/media/video/bt8xx/bttv-driver.c index 5404fcc..1bdb726 100644
    > --- a/drivers/media/video/bt8xx/bttv-driver.c
    > +++ b/drivers/media/video/bt8xx/bttv-driver.c
    > @@ -3601,6 +3601,7 @@ static const struct file_operations radio_fops =
    > .read = radio_read,
    > .release = radio_release,
    > .ioctl = video_ioctl2,
    > + .compat_ioctl = v4l_compat_ioctl32,
    > .llseek = no_llseek,
    > .poll = radio_poll,
    > };


    I run a 64-bit kernel and 64-bit user-space, only a chrooted version of
    mplayer and it's dependencies are 32 bit, and I don't use them that often.

    file /usr/bin/radio
    /usr/bin/radio: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), for
    GNU/Linux 2.6.9, dynamically linked (uses shared libs), stripped

    That patch doesn't help also...


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

  20. Re: [PATCH] bttv: Add a radio compat_ioctl file operation.

    On Sat, 22 Mar 2008, Bongani Hlope wrote:

    > On Saturday 22 March 2008 02:05:57 Robert Fitzsimons wrote:
    >> Signed-off-by: Robert Fitzsimons
    >> ---
    >> drivers/media/video/bt8xx/bttv-driver.c | 1 +
    >> 1 files changed, 1 insertions(+), 0 deletions(-)
    >>
    >>
    >> Hi Bongani
    >>
    >> I only noticed that you might be using a 32 bit userspace, so the radio
    >> compat_ioctl needs to be implmented.
    >>
    >> Robert
    >>
    >>
    >>
    >> diff --git a/drivers/media/video/bt8xx/bttv-driver.c
    >> b/drivers/media/video/bt8xx/bttv-driver.c index 5404fcc..1bdb726 100644
    >> --- a/drivers/media/video/bt8xx/bttv-driver.c
    >> +++ b/drivers/media/video/bt8xx/bttv-driver.c
    >> @@ -3601,6 +3601,7 @@ static const struct file_operations radio_fops =
    >> .read = radio_read,
    >> .release = radio_release,
    >> .ioctl = video_ioctl2,
    >> + .compat_ioctl = v4l_compat_ioctl32,
    >> .llseek = no_llseek,
    >> .poll = radio_poll,
    >> };

    >
    > I run a 64-bit kernel and 64-bit user-space, only a chrooted version of
    > mplayer and it's dependencies are 32 bit, and I don't use them that often.
    >
    > file /usr/bin/radio
    > /usr/bin/radio: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), for
    > GNU/Linux 2.6.9, dynamically linked (uses shared libs), stripped
    >
    > That patch doesn't help also...


    Unfortunately, I coudn't reproduce your bug here.

    I tested with a bttv board, plus two radio applications - radio and kradio
    (radio-3.95-7mdv2008.0 and kradio-1.0-0.r497.3mdv2008.0 packages). None of
    them used V4L1 API. I also tested reading frequency, using
    v4l-info /dev/radio0

    I also used ioctl-test, running all V4L1 API calls, with this result
    (I've enabled debug on v4l1-compat, and added a small patch to bttv to use
    video_ioctl2 debug):

    Linux video capture interface: v2.00
    bttv: driver version 0.9.17 loaded
    bttv: using 8 buffers with 2080k (520 pages) each for capture
    bttv: Bt8xx card found (0).
    bttv0: Bt848 (rev 17) at 0000:05:06.0, irq: 16, latency: 32, mmio: 0xce000000
    bttv0: using: STB, Gateway P/N 6000699 (bt848) [card=3,insmod option]
    bttv0: gpio: en=00000000, out=00000000 in=00fbffff [init]
    bttv0: tuner type=2
    bttv0: i2c: checking for TDA9875 @ 0xb0... not found
    bttv0: i2c: checking for TDA7432 @ 0x8a... not found
    bttv0: registered device video0
    bttv0: registered device vbi0
    bttv0: registered device radio0
    BT848 radio (STB, Gateway P/N 6: err:
    BT848 radio (STB, Gateway P/N 6: v4l2 ioctl VIDIOC_STREAMOFF, dir=-w (0x40045613)
    BT848 radio (STB, Gateway P/N 6: err:
    BT848 radio (STB, Gateway P/N 6: v4l2 ioctl VIDIOC_OVERLAY, dir=-w (0x4004560e)
    v4l1-compat: VIDIOCCAPTURE / VIDIOC_PREVIEW: -22
    BT848 radio (STB, Gateway P/N 6: v4l2 ioctl VIDIOC_G_AUDIO, dir=r- (0x80345621)
    BT848 radio (STB, Gateway P/N 6: Get for index=0
    BT848 radio (STB, Gateway P/N 6: index=0, name=Radio, capability=0, mode=0
    BT848 radio (STB, Gateway P/N 6: v4l2 ioctl VIDIOC_QUERYCTRL, dir=rw (0xc0445624)
    BT848 radio (STB, Gateway P/N 6: id=0, type=0, name=42, min/max=0/0, step=0, default=0, flags=0x00000001
    BT848 radio (STB, Gateway P/N 6: v4l2 ioctl VIDIOC_QUERYCTRL, dir=rw (0xc0445624)
    BT848 radio (STB, Gateway P/N 6: id=0, type=0, name=42, min/max=0/0, step=0, default=0, flags=0x00000001
    BT848 radio (STB, Gateway P/N 6: v4l2 ioctl VIDIOC_QUERYCTRL, dir=rw (0xc0445624)
    BT848 radio (STB, Gateway P/N 6: id=0, type=0, name=42, min/max=0/0, step=0, default=0, flags=0x00000001
    BT848 radio (STB, Gateway P/N 6: v4l2 ioctl VIDIOC_QUERYCTRL, dir=rw (0xc0445624)
    BT848 radio (STB, Gateway P/N 6: id=0, type=0, name=42, min/max=0/0, step=0, default=0, flags=0x00000001
    BT848 radio (STB, Gateway P/N 6: v4l2 ioctl VIDIOC_QUERYCTRL, dir=rw (0xc0445624)
    BT848 radio (STB, Gateway P/N 6: id=9963785, type=2, name=Mute, min/max=0/1, step=0, default=0, flags=0x00000000
    BT848 radio (STB, Gateway P/N 6: v4l2 ioctl VIDIOC_G_CTRL, dir=rw (0xc008561b)
    BT848 radio (STB, Gateway P/N 6: Enum for index=9963785
    BT848 radio (STB, Gateway P/N 6: id=9963785, value=-32512
    BT848 radio (STB, Gateway P/N 6: v4l2 ioctl VIDIOC_QUERYCTRL, dir=rw (0xc0445624)
    BT848 radio (STB, Gateway P/N 6: id=0, type=0, name=42, min/max=0/0, step=0, default=0, flags=0x00000001
    BT848 radio (STB, Gateway P/N 6: v4l2 ioctl VIDIOC_G_TUNER, dir=rw (0xc054561d)
    BT848 radio (STB, Gateway P/N 6: index=0, name=Radio, type=1, capability=0, rangelow=0, rangehigh=0, signal=0, afc=0, rxsubchans=0, audmode=0
    BT848 radio (STB, Gateway P/N 6: v4l2 ioctl VIDIOC_QUERYCAP, dir=r- (0x80685600)
    BT848 radio (STB, Gateway P/N 6: driver=bttv, card=BT848 radio (STB, Gateway P/N 6, bus=PCI:0000:05:06.0, version=0x00000911, capabilities=0x00010000
    BT848 radio (STB, Gateway P/N 6: v4l2 ioctl VIDIOC_ENUMINPUT, dir=rw (0xc050561a)
    BT848 radio (STB, Gateway P/N 6: index=0, name=Radio, type=1, audioset=0, tuner=0, std=00000000, status=0
    BT848 radio (STB, Gateway P/N 6: err:
    BT848 radio (STB, Gateway P/N 6: v4l2 ioctl VIDIOC_ENUMINPUT, dir=rw (0xc050561a)
    BT848 radio (STB, Gateway P/N 6: err:
    BT848 radio (STB, Gateway P/N 6: v4l2 ioctl VIDIOC_ENUM_FMT, dir=rw (0xc0405602)
    BT848 radio (STB, Gateway P/N 6: v4l2 ioctl VIDIOC_ENUMINPUT, dir=rw (0xc050561a)
    BT848 radio (STB, Gateway P/N 6: index=0, name=Radio, type=1, audioset=0, tuner=0, std=00000000, status=0
    BT848 radio (STB, Gateway P/N 6: v4l2 ioctl VIDIOC_G_STD, dir=r- (0x80085617)
    BT848 radio (STB, Gateway P/N 6: value=00000000
    BT848 radio (STB, Gateway P/N 6: err:
    BT848 radio (STB, Gateway P/N 6: v4l2 ioctl VIDIOC_G_FBUF, dir=r- (0x8030560a)
    v4l1-compat: VIDIOCGFBUF / VIDIOC_G_FBUF: -22
    BT848 radio (STB, Gateway P/N 6: v4l2 ioctl VIDIOC_G_FREQUENCY, dir=rw (0xc02c5638)
    BT848 radio (STB, Gateway P/N 6: tuner=0, type=1, frequency=0
    BT848 radio (STB, Gateway P/N 6: v4l2 ioctl VIDIOC_QUERYCTRL, dir=rw (0xc0445624)
    BT848 radio (STB, Gateway P/N 6: id=0, type=0, name=42, min/max=0/0, step=0, default=0, flags=0x00000001
    BT848 radio (STB, Gateway P/N 6: v4l2 ioctl VIDIOC_QUERYCTRL, dir=rw (0xc0445624)
    BT848 radio (STB, Gateway P/N 6: id=0, type=0, name=42, min/max=0/0, step=0, default=0, flags=0x00000001
    BT848 radio (STB, Gateway P/N 6: v4l2 ioctl VIDIOC_QUERYCTRL, dir=rw (0xc0445624)
    BT848 radio (STB, Gateway P/N 6: id=0, type=0, name=42, min/max=0/0, step=0, default=0, flags=0x00000001
    BT848 radio (STB, Gateway P/N 6: v4l2 ioctl VIDIOC_QUERYCTRL, dir=rw (0xc0445624)
    BT848 radio (STB, Gateway P/N 6: id=0, type=0, name=42, min/max=0/0, step=0, default=0, flags=0x00000001
    BT848 radio (STB, Gateway P/N 6: v4l2 ioctl VIDIOC_QUERYCTRL, dir=rw (0xc0445624)
    BT848 radio (STB, Gateway P/N 6: id=0, type=0, name=42, min/max=0/0, step=0, default=0, flags=0x00000001
    BT848 radio (STB, Gateway P/N 6: v4l2 ioctl VIDIOC_G_FMT, dir=rw (0xc0d05604)
    BT848 radio (STB, Gateway P/N 6: type=video-cap
    BT848 radio (STB, Gateway P/N 6: err:
    BT848 radio (STB, Gateway P/N 6: v4l2 ioctl VIDIOC_G_FMT, dir=rw (0xc0d05604)
    v4l1-compat: VIDIOCGPICT / VIDIOC_G_FMT: -22
    BT848 radio (STB, Gateway P/N 6: v4l2 ioctl VIDIOC_G_TUNER, dir=rw (0xc054561d)
    BT848 radio (STB, Gateway P/N 6: index=0, name=Radio, type=1, capability=0, rangelow=0, rangehigh=0, signal=0, afc=0, rxsubchans=0, audmode=0
    BT848 radio (STB, Gateway P/N 6: v4l2 ioctl VIDIOC_G_STD, dir=r- (0x80085617)
    BT848 radio (STB, Gateway P/N 6: value=00000000
    BT848 radio (STB, Gateway P/N 6: v4l2 ioctl VIDIOC_G_FMT, dir=rw (0xc0d05604)
    BT848 radio (STB, Gateway P/N 6: type=vbi-cap
    BT848 radio (STB, Gateway P/N 6: err:
    BT848 radio (STB, Gateway P/N 6: v4l2 ioctl VIDIOC_G_FMT, dir=rw (0xc0d05604)
    v4l1-compat: VIDIOCGVBIFMT / VIDIOC_G_FMT: -22
    BT848 radio (STB, Gateway P/N 6: v4l2 ioctl VIDIOC_G_FMT, dir=rw (0xc0d05604)
    BT848 radio (STB, Gateway P/N 6: type=video-over
    BT848 radio (STB, Gateway P/N 6: err:
    BT848 radio (STB, Gateway P/N 6: v4l2 ioctl VIDIOC_G_FMT, dir=rw (0xc0d05604)
    v4l1-compat: VIDIOCGWIN / VIDIOC_G_WIN: -22
    BT848 radio (STB, Gateway P/N 6: v4l2 ioctl VIDIOC_G_FMT, dir=rw (0xc0d05604)
    BT848 radio (STB, Gateway P/N 6: type=video-cap
    BT848 radio (STB, Gateway P/N 6: err:
    BT848 radio (STB, Gateway P/N 6: v4l2 ioctl VIDIOC_G_FMT, dir=rw (0xc0d05604)
    v4l1-compat: VIDIOCGWIN / VIDIOC_G_FMT: -22
    BT848 radio (STB, Gateway P/N 6: v4l2 ioctl VIDIOC_G_FMT, dir=rw (0xc0d05604)
    BT848 radio (STB, Gateway P/N 6: type=video-cap
    BT848 radio (STB, Gateway P/N 6: err:
    BT848 radio (STB, Gateway P/N 6: v4l2 ioctl VIDIOC_G_FMT, dir=rw (0xc0d05604)
    v4l1-compat: VIDIOCMCAPTURE / VIDIOC_G_FMT: -22
    BT848 radio (STB, Gateway P/N 6: v4l2 ioctl VIDIOC_S_AUDIO, dir=-w (0x40345622)
    BT848 radio (STB, Gateway P/N 6: index=0, name=, capability=0, mode=0
    BT848 radio (STB, Gateway P/N 6: v4l2 ioctl VIDIOC_QUERYCTRL, dir=rw (0xc0445624)
    BT848 radio (STB, Gateway P/N 6: id=0, type=0, name=42, min/max=0/0, step=0, default=0, flags=0x00000001
    BT848 radio (STB, Gateway P/N 6: v4l2 ioctl VIDIOC_QUERYCTRL, dir=rw (0xc0445624)
    BT848 radio (STB, Gateway P/N 6: id=0, type=0, name=42, min/max=0/0, step=0, default=0, flags=0x00000001
    BT848 radio (STB, Gateway P/N 6: v4l2 ioctl VIDIOC_QUERYCTRL, dir=rw (0xc0445624)
    BT848 radio (STB, Gateway P/N 6: id=0, type=0, name=42, min/max=0/0, step=0, default=0, flags=0x00000001
    BT848 radio (STB, Gateway P/N 6: v4l2 ioctl VIDIOC_QUERYCTRL, dir=rw (0xc0445624)
    BT848 radio (STB, Gateway P/N 6: id=0, type=0, name=42, min/max=0/0, step=0, default=0, flags=0x00000001
    BT848 radio (STB, Gateway P/N 6: v4l2 ioctl VIDIOC_QUERYCTRL, dir=rw (0xc0445624)
    BT848 radio (STB, Gateway P/N 6: id=9963785, type=2, name=Mute, min/max=0/1, step=0, default=0, flags=0x00000000
    BT848 radio (STB, Gateway P/N 6: v4l2 ioctl VIDIOC_S_CTRL, dir=rw (0xc008561c)
    BT848 radio (STB, Gateway P/N 6: id=9963785, value=0
    BT848 radio (STB, Gateway P/N 6: v4l2 ioctl VIDIOC_G_TUNER, dir=rw (0xc054561d)
    BT848 radio (STB, Gateway P/N 6: index=0, name=Radio, type=1, capability=0, rangelow=0, rangehigh=0, signal=0, afc=0, rxsubchans=0, audmode=0
    BT848 radio (STB, Gateway P/N 6: v4l2 ioctl VIDIOC_S_TUNER, dir=-w (0x4054561e)
    BT848 radio (STB, Gateway P/N 6: index=0, name=Radio, type=1, capability=0, rangelow=0, rangehigh=0, signal=0, afc=0, rxsubchans=0, audmode=0
    BT848 radio (STB, Gateway P/N 6: v4l2 ioctl VIDIOC_S_INPUT, dir=rw (0xc0045627)
    BT848 radio (STB, Gateway P/N 6: value=0
    BT848 radio (STB, Gateway P/N 6: v4l2 ioctl VIDIOC_S_STD, dir=-w (0x40085618)
    BT848 radio (STB, Gateway P/N 6: value=000000ff
    BT848 radio (STB, Gateway P/N 6: err:
    BT848 radio (STB, Gateway P/N 6: v4l2 ioctl VIDIOC_S_FBUF, dir=-w (0x4030560b)
    v4l1-compat: VIDIOCSFBUF / VIDIOC_S_FBUF: -22
    BT848 radio (STB, Gateway P/N 6: v4l2 ioctl VIDIOC_G_FREQUENCY, dir=rw (0xc02c5638)
    BT848 radio (STB, Gateway P/N 6: tuner=0, type=1, frequency=0
    BT848 radio (STB, Gateway P/N 6: v4l2 ioctl VIDIOC_S_FREQUENCY, dir=-w (0x402c5639)
    BT848 radio (STB, Gateway P/N 6: tuner=0, type=1, frequency=0
    BT848 radio (STB, Gateway P/N 6: v4l2 ioctl VIDIOC_QUERYCTRL, dir=rw (0xc0445624)
    BT848 radio (STB, Gateway P/N 6: id=0, type=0, name=42, min/max=0/0, step=0, default=0, flags=0x00000001
    BT848 radio (STB, Gateway P/N 6: v4l2 ioctl VIDIOC_QUERYCTRL, dir=rw (0xc0445624)
    BT848 radio (STB, Gateway P/N 6: id=0, type=0, name=42, min/max=0/0, step=0, default=0, flags=0x00000001
    BT848 radio (STB, Gateway P/N 6: v4l2 ioctl VIDIOC_QUERYCTRL, dir=rw (0xc0445624)
    BT848 radio (STB, Gateway P/N 6: id=0, type=0, name=42, min/max=0/0, step=0, default=0, flags=0x00000001
    BT848 radio (STB, Gateway P/N 6: v4l2 ioctl VIDIOC_QUERYCTRL, dir=rw (0xc0445624)
    BT848 radio (STB, Gateway P/N 6: id=0, type=0, name=42, min/max=0/0, step=0, default=0, flags=0x00000001
    BT848 radio (STB, Gateway P/N 6: v4l2 ioctl VIDIOC_QUERYCTRL, dir=rw (0xc0445624)
    BT848 radio (STB, Gateway P/N 6: id=0, type=0, name=42, min/max=0/0, step=0, default=0, flags=0x00000001
    BT848 radio (STB, Gateway P/N 6: v4l2 ioctl VIDIOC_G_FMT, dir=rw (0xc0d05604)
    BT848 radio (STB, Gateway P/N 6: type=video-cap
    BT848 radio (STB, Gateway P/N 6: err:
    BT848 radio (STB, Gateway P/N 6: v4l2 ioctl VIDIOC_G_FMT, dir=rw (0xc0d05604)
    v4l1-compat: VIDIOCSPICT / VIDIOC_G_FMT: -22
    BT848 radio (STB, Gateway P/N 6: err:
    BT848 radio (STB, Gateway P/N 6: v4l2 ioctl VIDIOC_G_FBUF, dir=r- (0x8030560a)
    v4l1-compat: VIDIOCSPICT / VIDIOC_G_FBUF: -22
    BT848 radio (STB, Gateway P/N 6: v4l2 ioctl VIDIOC_S_INPUT, dir=rw (0xc0045627)
    BT848 radio (STB, Gateway P/N 6: value=0
    BT848 radio (STB, Gateway P/N 6: err:
    BT848 radio (STB, Gateway P/N 6: v4l2 ioctl VIDIOC_STREAMOFF, dir=-w (0x40045613)
    BT848 radio (STB, Gateway P/N 6: v4l2 ioctl VIDIOC_G_FMT, dir=rw (0xc0d05604)
    BT848 radio (STB, Gateway P/N 6: type=video-cap
    BT848 radio (STB, Gateway P/N 6: err:
    BT848 radio (STB, Gateway P/N 6: v4l2 ioctl VIDIOC_G_FMT, dir=rw (0xc0d05604)
    v4l1-compat: VIDIOCSWIN / VIDIOC_G_FMT: -22
    BT848 radio (STB, Gateway P/N 6: v4l2 ioctl VIDIOC_S_FMT, dir=rw (0xc0d05605)
    BT848 radio (STB, Gateway P/N 6: type=video-over
    BT848 radio (STB, Gateway P/N 6: err:
    BT848 radio (STB, Gateway P/N 6: v4l2 ioctl VIDIOC_S_FMT, dir=rw (0xc0d05605)
    v4l1-compat: VIDIOCSWIN / VIDIOC_S_FMT #2: -22
    BT848 radio (STB, Gateway P/N 6: err:
    BT848 radio (STB, Gateway P/N 6: v4l2 ioctl VIDIOC_QUERYBUF, dir=rw (0xc0585609)
    v4l1-compat: VIDIOCSYNC / VIDIOC_QUERYBUF: -22

    I got no oops. The tests were done also on a 64bit kernel, on a dual-core
    machine.

    Cheers,
    Mauro

    ---

    I've patched the ioctl-test program (at v4l2-apps/test dir, on v4l/dvb
    development environment, available at http://linuxtv.org/hg/v4l-dvb) with
    this diff:

    diff -r f24051885fe9 v4l2-apps/test/ioctl-test.c
    --- a/v4l2-apps/test/ioctl-test.c Tue Mar 18 18:10:06 2008 -0300
    +++ b/v4l2-apps/test/ioctl-test.c Sat Mar 22 21:52:16 2008 -0300
    @@ -47,6 +47,8 @@ typedef __u32 u32;
    #else
    typedef u_int32_t u32;
    #endif
    +
    +#define CONFIG_VIDEO_V4L1_COMPAT

    /* All possible parameters used on v4l ioctls */
    union v4l_parms {
    @@ -142,7 +144,7 @@ int ioctls[] = {
    VIDIOCSYNC,/* int */
    #endif
    /* V4L2 ioctls */
    -
    +#if 0
    VIDIOC_CROPCAP,/* struct v4l2_cropcap */
    VIDIOC_DQBUF,/* struct v4l2_buffer */
    VIDIOC_ENUMAUDIO,/* struct v4l2_audio */
    @@ -173,7 +175,7 @@ int ioctls[] = {
    VIDIOC_S_OUTPUT,/* int */
    VIDIOC_S_PARM,/* struct v4l2_streamparm */
    VIDIOC_TRY_FMT,/* struct v4l2_format */
    -
    +#endif
    #if 0
    VIDIOC_G_AUDIO_OLD,/* struct v4l2_audio */
    VIDIOC_G_AUDOUT_OLD,/* struct v4l2_audioout */
    @@ -214,7 +216,7 @@ int main (void)
    {
    int fd=0, ret=0;
    unsigned i;
    - char *device="/dev/video0";
    + char *device="/dev/radio0";
    union v4l_parms p;

    if ((fd = open(device, O_RDONLY)) < 0) {
    --
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

+ Reply to Thread
Page 1 of 2 1 2 LastLast