Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kernel Oops when trying to record from USB Audio Mic (Akiro Kinobo) #588

Closed
CrazyCoder opened this issue May 9, 2014 · 34 comments
Closed

Comments

@CrazyCoder
Copy link

This started to occur after updating to firmware with 3.12.18 kernel, older firmware doesn't have this problem.

dsc00099

Bus 001 Device 007: ID 0c76:160a JMTek, LLC.

[    4.744374] usb 1-1.3.1.3: new full-speed USB device number 7 using dwc_otg
[    4.869397] usb 1-1.3.1.3: New USB device found, idVendor=0c76, idProduct=160a
[    4.903967] usb 1-1.3.1.3: New USB device strings: Mfr=0, Product=1, SerialNumber=0
[    4.934018] usb 1-1.3.1.3: Product: USB Audio Device
[    5.031202] hid-generic 0003:0C76:160A.0002: input,hidraw1: USB HID v1.00 Device [USB Audio Device] on usb-bcm2708_usb-1.3.1.3/input2
pi@jasper1 ~ $ arecord -l
**** List of CAPTURE Hardware Devices ****
card 0: Device [USB PnP Sound Device], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: Device_1 [USB Audio Device], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

Issue occurs after arecord -f cd -c 1 -D hw:1,0 test.wav

@P33M
Copy link
Contributor

P33M commented May 9, 2014

Can you post a full lsusb -v -d 0c76: for the device?

Is this reproducible if you e.g. change the arecord parameters (channels, bitrate)?

@CrazyCoder
Copy link
Author

Bus 001 Device 007: ID 0c76:160a JMTek, LLC.
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               1.10
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0
  bDeviceProtocol         0
  bMaxPacketSize0        64
  idVendor           0x0c76 JMTek, LLC.
  idProduct          0x160a
  bcdDevice            1.00
  iManufacturer           0
  iProduct                1 USB Audio Device
  iSerial                 0
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength          156
    bNumInterfaces          3
    bConfigurationValue     1
    iConfiguration          0
    bmAttributes         0x80
      (Bus Powered)
    MaxPower              100mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           0
      bInterfaceClass         1 Audio
      bInterfaceSubClass      1 Control Device
      bInterfaceProtocol      0
      iInterface              0
      AudioControl Interface Descriptor:
        bLength                 9
        bDescriptorType        36
        bDescriptorSubtype      1 (HEADER)
        bcdADC               1.00
        wTotalLength           46
        bInCollection           1
        baInterfaceNr( 0)       1
      AudioControl Interface Descriptor:
        bLength                12
        bDescriptorType        36
        bDescriptorSubtype      2 (INPUT_TERMINAL)
        bTerminalID             2
        wTerminalType      0x0201 Microphone
        bAssocTerminal          0
        bNrChannels             1
        wChannelConfig     0x0001
          Left Front (L)
        iChannelNames           0
        iTerminal               0
      AudioControl Interface Descriptor:
        bLength                 9
        bDescriptorType        36
        bDescriptorSubtype      3 (OUTPUT_TERMINAL)
        bTerminalID            18
        wTerminalType      0x0101 USB Streaming
        bAssocTerminal          2
        bSourceID              33
        iTerminal               0
      AudioControl Interface Descriptor:
        bLength                 7
        bDescriptorType        36
        bDescriptorSubtype      5 (SELECTOR_UNIT)
        bUnitID                33
        bNrInPins               1
        baSource( 0)           50
        iSelector               0
      AudioControl Interface Descriptor:
        bLength                 9
        bDescriptorType        36
        bDescriptorSubtype      6 (FEATURE_UNIT)
        bUnitID                50
        bSourceID               2
        bControlSize            1
        bmaControls( 0)      0x43
          Mute Control
          Volume Control
          Automatic Gain Control
        bmaControls( 1)      0x00
        iFeature                0
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       0
      bNumEndpoints           0
      bInterfaceClass         1 Audio
      bInterfaceSubClass      2 Streaming
      bInterfaceProtocol      0
      iInterface              0
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       1
      bNumEndpoints           1
      bInterfaceClass         1 Audio
      bInterfaceSubClass      2 Streaming
      bInterfaceProtocol      0
      iInterface              0
      AudioStreaming Interface Descriptor:
        bLength                 7
        bDescriptorType        36
        bDescriptorSubtype      1 (AS_GENERAL)
        bTerminalLink          18
        bDelay                  1 frames
        wFormatTag              1 PCM
      AudioStreaming Interface Descriptor:
        bLength                26
        bDescriptorType        36
        bDescriptorSubtype      2 (FORMAT_TYPE)
        bFormatType             1 (FORMAT_TYPE_I)
        bNrChannels             1
        bSubframeSize           2
        bBitResolution         16
        bSamFreqType            6 Discrete
        tSamFreq[ 0]        48000
        tSamFreq[ 1]        44100
        tSamFreq[ 2]        32000
        tSamFreq[ 3]        22050
        tSamFreq[ 4]        11025
        tSamFreq[ 5]         8000
      Endpoint Descriptor:
        bLength                 9
        bDescriptorType         5
        bEndpointAddress     0x82  EP 2 IN
        bmAttributes            5
          Transfer Type            Isochronous
          Synch Type               Asynchronous
          Usage Type               Data
        wMaxPacketSize     0x0064  1x 100 bytes
        bInterval               1
        bRefresh                0
        bSynchAddress           0
        AudioControl Endpoint Descriptor:
          bLength                 7
          bDescriptorType        37
          bDescriptorSubtype      1 (EP_GENERAL)
          bmAttributes         0x01
            Sampling Frequency
          bLockDelayUnits         0 Undefined
          wLockDelay              0 Undefined
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        2
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass         3 Human Interface Device
      bInterfaceSubClass      0 No Subclass
      bInterfaceProtocol      0 None
      iInterface              0
        HID Device Descriptor:
          bLength                 9
          bDescriptorType        33
          bcdHID               1.00
          bCountryCode            0 Not supported
          bNumDescriptors         1
          bDescriptorType        34 Report
          wDescriptorLength      50
         Report Descriptors:
           ** UNAVAILABLE **
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0004  1x 4 bytes
        bInterval               8
Device Status:     0x0000
  (Bus Powered)

Seems to happen with any parameters.

@P33M
Copy link
Contributor

P33M commented May 9, 2014

Do you have the ability to connect to the GPIO serial port? I.e. PC -> USB/3.3v serial dongle -> GPIO?

@CrazyCoder
Copy link
Author

Yes, I have USB TTL cable.

@P33M
Copy link
Contributor

P33M commented May 9, 2014

Good.

For some background, there are very few situations that can hit that BUG(). One possibility is that your device is babbling and continuously transmitting data, but I need to get a debug kernel to you to verify this.

@CrazyCoder
Copy link
Author

OK, here is the text output from the serial console:

jasper1 login: [  358.142134] Bad mode in undefined instruction handler detected
[  358.150596] Internal error: Oops - bad mode: 0 [#1] PREEMPT ARM

Entering kdb (current=0xda220000, pid 2412) Oops: (null)
due to oops @ 0xc03074cc

dCPU: 0 PID: 2412 Comm: arecord Not tainted 3.12.18+ #680
dtask: da220000 ti: db1b6000 task.ti: db1b6000
PC is at fiq_fsm_do_sof+0x0/0x294
LR is at snd_ctl_ioctl+0x2e0/0xbe4 [snd]
pc : [<c03074cc>]    lr : [<bf00cf20>]    psr: 400001d1
sp : db1b7e58  ip : bf010b1c  fp : db2c5600
r10: be85a9bc  r9 : be85a9bc  r8 : c05ca008
r7 : 00000102  r6 : db0f7614  r5 : db0f7400  r4 : 00000007
r3 : 01b49064  r2 : 00000002  r1 : 1b7d277a  r0 : 000005e0
Flags: nZcv  IRQs off  FIQs off  Mode FIQ_32  ISA ARM  Segment user
Control: 00c5387d  Table: 1b270008  DAC: 00000015
dCPU: 0 PID: 2412 Comm: arecord Not tainted 3.12.18+ #680
[<c00140b4>] (unwind_backtrace+0x0/0xf0) from [<c00112cc>] (show_stack+0x10/0x14)
[<c00112cc>] (show_stack+0x10/0x14) from [<c007e8a0>] (kdb_dumpregs+0x28/0x50)
[<c007e8a0>] (kdb_dumpregs+0x28/0x50) from [<c0080b10>] (kdb_main_loop+0x3c0/0x6c0)
[<c0080b10>] (kdb_main_loop+0x3c0/0x6c0) from [<c0083210>] (kdb_stub+0x154/0x380)
[<c0083210>] (kdb_stub+0x154/0x380) from [<c007a3cc>] (kgdb_handle_exception+0x340/0x6f0)
[<c007a3cc>] (kgdb_handle_exception+0x340/0x6f0) from [<c0013814>] (kgdb_notify+0x24/0x50)
[<c0013814>] (kgdb_notify+0x24/0x50) from [<c0424ea4>] (notifier_call_chain+0x44/0x84)
[<c0424ea4>] (notifier_call_chain+0x44/0x84) from [<c0424f1c>] (__atomic_notifier_call_chain+0x38/0x4c)
[<c0424f1c>] (__atomic_notifier_call_chain+0x38/0x4c) from [<c0424f48>] (atomic_notifier_call_chain+0x18/0x20)
[<c0424f48>] (atomic_notifier_call_chain+0x18/0x20) from [<c0424f88>] (notify_die+0x38/0x44)
[<c0424f88>] (notify_die+0x38/0x44) from [<c0011394>] (die+0xc4/0x3b8)
[<c0011394>] (die+0xc4/0x3b8) from [<c00119c4>] (bad_mode+0x3c/0x5c)
[<c00119c4>] (bad_mode+0x3c/0x5c) from [<bf00cf20>] (snd_ctl_ioctl+0x2e0/0xbe4 [snd])
[<bf00cf20>] (snd_ctl_ioctl+0x2e0/0xbe4 [snd]) from [<c000e328>] (sys_call_table+0x0/0x5f0)

@pierrep
Copy link

pierrep commented May 13, 2014

After doing an rpi-update I'm getting the exact same problem. I'm on the same kernel (3.12.18) after being on stock 3.10
Are there any workarounds to this? I'm using a USB audio card for the recording. Playback works fine.

@CrazyCoder
Copy link
Author

Current workaround is to downgrade the firmware using

sudo rpi-update f6eef32dd6388c3b04dbf462bd324d93281bf397

@pierrep
Copy link

pierrep commented May 13, 2014

That worked. But now I'm back to my buzzing USB audio recording, which works if I set dwc_otg.speed=1 but that kills my USB bar-code scanner....sigh...

@CrazyCoder
Copy link
Author

Well, the new firmware is not guaranteed to fix the buzzing.

@pierrep
Copy link

pierrep commented May 13, 2014

I realise this, I was just being optimistic. Thanks for lodging this bug and pointing me to that commit.

@P33M
Copy link
Contributor

P33M commented May 13, 2014

@pierrep please post a full lsusb -v for the device.

As a workaround, can you try adding the following in /boot/cmdline.txt: dwc_otg.fiq_fsm_enable=0 This will prevent the crash but audio recording will be subject to random glitches.

@pierrep
Copy link

pierrep commented May 14, 2014

@P33M I tried the dwc_otg.fiq_fsm_enable=0 workaround and it worked! Audio is much improved. Thanks!

here is the usb audio lsusb output:

Bus 001 Device 004: ID 0c76:1607 JMTek, LLC. audio controller
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               1.10
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0        64
  idVendor           0x0c76 JMTek, LLC.
  idProduct          0x1607 audio controller
  bcdDevice            1.00
  iManufacturer           0 
  iProduct                1 USB Headphone Set
  iSerial                 0 
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength          247
    bNumInterfaces          4
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0x80
      (Bus Powered)
    MaxPower              100mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           0
      bInterfaceClass         1 Audio
      bInterfaceSubClass      1 Control Device
      bInterfaceProtocol      0 
      iInterface              0 
      AudioControl Interface Descriptor:
        bLength                10
        bDescriptorType        36
        bDescriptorSubtype      1 (HEADER)
        bcdADC               1.00
        wTotalLength          100
        bInCollection           2
        baInterfaceNr( 0)       1
        baInterfaceNr( 1)       2
      AudioControl Interface Descriptor:
        bLength                12
        bDescriptorType        36
        bDescriptorSubtype      2 (INPUT_TERMINAL)
        bTerminalID             1
        wTerminalType      0x0101 USB Streaming
        bAssocTerminal          0
        bNrChannels             2
        wChannelConfig     0x0003
          Left Front (L)
          Right Front (R)
        iChannelNames           0 
        iTerminal               0 
      AudioControl Interface Descriptor:
        bLength                12
        bDescriptorType        36
        bDescriptorSubtype      2 (INPUT_TERMINAL)
        bTerminalID             2
        wTerminalType      0x0201 Microphone
        bAssocTerminal          0
        bNrChannels             1
        wChannelConfig     0x0001
          Left Front (L)
        iChannelNames           0 
        iTerminal               0 
      AudioControl Interface Descriptor:
        bLength                 9
        bDescriptorType        36
        bDescriptorSubtype      3 (OUTPUT_TERMINAL)
        bTerminalID            17
        wTerminalType      0x0301 Speaker
        bAssocTerminal          0
        bSourceID              49
        iTerminal               0 
      AudioControl Interface Descriptor:
        bLength                 9
        bDescriptorType        36
        bDescriptorSubtype      3 (OUTPUT_TERMINAL)
        bTerminalID            18
        wTerminalType      0x0101 USB Streaming
        bAssocTerminal          2
        bSourceID              33
        iTerminal               0 
      AudioControl Interface Descriptor:
        bLength                 7
        bDescriptorType        36
        bDescriptorSubtype      5 (SELECTOR_UNIT)
        bUnitID                33
        bNrInPins               1
        baSource( 0)           50
        iSelector               0 
      AudioControl Interface Descriptor:
        bLength                10
        bDescriptorType        36
        bDescriptorSubtype      6 (FEATURE_UNIT)
        bUnitID                49
        bSourceID              65
        bControlSize            1
        bmaControls( 0)      0x01
          Mute Control
        bmaControls( 1)      0x02
          Volume Control
        bmaControls( 2)      0x02
          Volume Control
        iFeature                0 
      AudioControl Interface Descriptor:
        bLength                 9
        bDescriptorType        36
        bDescriptorSubtype      6 (FEATURE_UNIT)
        bUnitID                50
        bSourceID               2
        bControlSize            1
        bmaControls( 0)      0x43
          Mute Control
          Volume Control
          Automatic Gain Control
        bmaControls( 1)      0x00
        iFeature                0 
      AudioControl Interface Descriptor:
        bLength                 9
        bDescriptorType        36
        bDescriptorSubtype      6 (FEATURE_UNIT)
        bUnitID                51
        bSourceID               2
        bControlSize            1
        bmaControls( 0)      0x03
          Mute Control
          Volume Control
        bmaControls( 1)      0x00
        iFeature                0 
      AudioControl Interface Descriptor:
        bLength                13
        bDescriptorType        36
        bDescriptorSubtype      4 (MIXER_UNIT)
        bUnitID                65
        bNrInPins               2
        baSourceID( 0)          1
        baSourceID( 1)         51
        bNrChannels             2
        wChannelConfig     0x0003
          Left Front (L)
          Right Front (R)
        iChannelNames           0 
        bmControls         0x00
        iMixer                  0 
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       0
      bNumEndpoints           0
      bInterfaceClass         1 Audio
      bInterfaceSubClass      2 Streaming
      bInterfaceProtocol      0 
      iInterface              0 
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       1
      bNumEndpoints           1
      bInterfaceClass         1 Audio
      bInterfaceSubClass      2 Streaming
      bInterfaceProtocol      0 
      iInterface              0 
      AudioStreaming Interface Descriptor:
        bLength                 7
        bDescriptorType        36
        bDescriptorSubtype      1 (AS_GENERAL)
        bTerminalLink           1
        bDelay                  1 frames
        wFormatTag              1 PCM
      AudioStreaming Interface Descriptor:
        bLength                11
        bDescriptorType        36
        bDescriptorSubtype      2 (FORMAT_TYPE)
        bFormatType             1 (FORMAT_TYPE_I)
        bNrChannels             2
        bSubframeSize           2
        bBitResolution         16
        bSamFreqType            1 Discrete
        tSamFreq[ 0]        48000
      Endpoint Descriptor:
        bLength                 9
        bDescriptorType         5
        bEndpointAddress     0x01  EP 1 OUT
        bmAttributes            9
          Transfer Type            Isochronous
          Synch Type               Adaptive
          Usage Type               Data
        wMaxPacketSize     0x00c8  1x 200 bytes
        bInterval               1
        bRefresh                0
        bSynchAddress           0
        AudioControl Endpoint Descriptor:
          bLength                 7
          bDescriptorType        37
          bDescriptorSubtype      1 (EP_GENERAL)
          bmAttributes         0x00
          bLockDelayUnits         1 Milliseconds
          wLockDelay              1 Milliseconds
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        2
      bAlternateSetting       0
      bNumEndpoints           0
      bInterfaceClass         1 Audio
      bInterfaceSubClass      2 Streaming
      bInterfaceProtocol      0 
      iInterface              0 
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        2
      bAlternateSetting       1
      bNumEndpoints           1
      bInterfaceClass         1 Audio
      bInterfaceSubClass      2 Streaming
      bInterfaceProtocol      0 
      iInterface              0 
      AudioStreaming Interface Descriptor:
        bLength                 7
        bDescriptorType        36
        bDescriptorSubtype      1 (AS_GENERAL)
        bTerminalLink          18
        bDelay                  1 frames
        wFormatTag              1 PCM
      AudioStreaming Interface Descriptor:
        bLength                11
        bDescriptorType        36
        bDescriptorSubtype      2 (FORMAT_TYPE)
        bFormatType             1 (FORMAT_TYPE_I)
        bNrChannels             1
        bSubframeSize           2
        bBitResolution         16
        bSamFreqType            1 Discrete
        tSamFreq[ 0]        48000
      Endpoint Descriptor:
        bLength                 9
        bDescriptorType         5
        bEndpointAddress     0x82  EP 2 IN
        bmAttributes            5
          Transfer Type            Isochronous
          Synch Type               Asynchronous
          Usage Type               Data
        wMaxPacketSize     0x0064  1x 100 bytes
        bInterval               1
        bRefresh                0
        bSynchAddress           0
        AudioControl Endpoint Descriptor:
          bLength                 7
          bDescriptorType        37
          bDescriptorSubtype      1 (EP_GENERAL)
          bmAttributes         0x00
          bLockDelayUnits         0 Undefined
          wLockDelay              0 Undefined
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        3
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass         3 Human Interface Device
      bInterfaceSubClass      0 No Subclass
      bInterfaceProtocol      0 None
      iInterface              0 
        HID Device Descriptor:
          bLength                 9
          bDescriptorType        33
          bcdHID               1.00
          bCountryCode            0 Not supported
          bNumDescriptors         1
          bDescriptorType        34 Report
          wDescriptorLength      50
         Report Descriptors: 
           ** UNAVAILABLE **
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0004  1x 4 bytes
        bInterval               8
Device Status:     0x0000
  (Bus Powered)

@CrazyCoder
Copy link
Author

dwc_otg.fiq_fsm_enable=0 has fixed the crash, but the audio quality is still very poor with this device. I have another USB Audio card which works much better, see my post for more details: jasperproject/jasper-client#49 (comment).

@pierrep
Copy link

pierrep commented May 14, 2014

Also, just pointing out that audio recording was better with dwc_otg.speed=1, currently the audio recording is a little scratchy and has a little bit of weird modulation in it, but it's massively improved from the prior output.

I have a C-Media USB audio card as well as a Tenx one on hand. Haven't tried these out yet but will give them a go.

@P33M
Copy link
Contributor

P33M commented May 14, 2014

It's overwhelmingly likely that this JMTek chipset is an audio chipset that does something "bad". It's not one I've seen in the wild before.

Can you post a photo of the device with this chipset? Manufacturer/model number label if possible.

@CrazyCoder
Copy link
Author

"Akiro" by Kinobo: http://www.amazon.com/USB-2-0-Microphone-Recognition-Software/dp/B008CNZOJY .

Works perfectly with Windows and Intel NUC running Ubuntu 14.04, but not on RPi.

@P33M
Copy link
Contributor

P33M commented May 14, 2014

I've ordered one. Should be here tomorrow.

@pierrep
Copy link

pierrep commented May 14, 2014

Pretty nondescript:
img1
img2

@P33M
Copy link
Contributor

P33M commented May 14, 2014

Generic DAC is generic - which means that it used the chipset du jour. The Akiro device is much more likely to have a fixed design.

@P33M
Copy link
Contributor

P33M commented May 15, 2014

I can reproduce the crash.

I was right. The device returns 138 bytes on an endpoint with wMaxPacketSize = 100 bytes.

@CrazyCoder
Copy link
Author

Great news. Hope you'll be able to workaround this issue as the device works fine on other systems.

@P33M
Copy link
Contributor

P33M commented May 15, 2014

No other systems use buggy OTG hardware in host mode with the expectation that it be used as a desktop PC.

@CrazyCoder
Copy link
Author

Oh, I see that there is a hardware limitation of the OTG mode. Does it mean that this device will never work properly with RPi?

@P33M
Copy link
Contributor

P33M commented May 15, 2014

No, because I've fixed the bug.

The otg core was (somewhat correctly) raising a device babble interrupt which wasn't being handled - despite the complete-split packet being smaller that the maximum isochronous packet size that can be returned from the hub. It appears that the host channel internal transfer length counter is also used to determine babble.

@CrazyCoder
Copy link
Author

Cool! How's the audio quality after fixing the bug?

@P33M
Copy link
Contributor

P33M commented May 15, 2014

No idea, my singing voice is terrible.

Ambient audio is being recorded fine, though.

@CrazyCoder
Copy link
Author

I see your bugfix commit in the fiq_fsm branch (3.10.30 kernel?). Should I try to build it and test or will it appear in the official firmware via rpi-update eventually?

UPDATE: compiled and installed your kernel branch with the patch. It works, no more distortion like with older firmwares and no crash like with the latest official firmware. Thanks a lot.

Precompiled kernel/modules for those who want to try it.

@P33M
Copy link
Contributor

P33M commented May 16, 2014

@popcornmix

Can you cherry pick P33M@06ee59b in the next firmware build.

popcornmix pushed a commit to raspberrypi/firmware that referenced this issue May 16, 2014
See: raspberrypi/linux#588

kernel: Perform I2C combined transactions when possible
See: raspberrypi/linux#318

kernel: V4L2: Increase the MMAL timeout to 3sec
See: raspberrypi/linux#592

kernel: i2c-bcm2708: fixed baudrate
See: raspberrypi/linux#592

firmware: Avoid calling hdcp_shutdown() when hotplug deasserted
See: http://forum.stmlabs.com/showthread.php?tid=11003&pid=101848#pid101848

firmware: hello_fft: Update readme to mention use with GL
See: http://www.raspberrypi.org/forums/viewtopic.php?f=68&t=76189

firmware: Clear unused pixels in the subsample image in H264 codec
See: http://www.raspberrypi.org/forums/viewtopic.php?f=43&t=76845&p=551515#p551515
popcornmix pushed a commit to Hexxeh/rpi-firmware that referenced this issue May 16, 2014
See: raspberrypi/linux#588

kernel: Perform I2C combined transactions when possible
See: raspberrypi/linux#318

kernel: V4L2: Increase the MMAL timeout to 3sec
See: raspberrypi/linux#592

kernel: i2c-bcm2708: fixed baudrate
See: raspberrypi/linux#592

firmware: Avoid calling hdcp_shutdown() when hotplug deasserted
See: http://forum.stmlabs.com/showthread.php?tid=11003&pid=101848#pid101848

firmware: hello_fft: Update readme to mention use with GL
See: http://www.raspberrypi.org/forums/viewtopic.php?f=68&t=76189

firmware: Clear unused pixels in the subsample image in H264 codec
See: http://www.raspberrypi.org/forums/viewtopic.php?f=43&t=76845&p=551515#p551515
@popcornmix
Copy link
Collaborator

The fix is in latest firmware. @CrazyCoder please rpi-update and test.

@CrazyCoder
Copy link
Author

@popcornmix updated to Linux jasper1 3.12.19+ #684 PREEMPT Fri May 16 19:27:32 BST 2014 armv6l, it was stuck after trying to record (no oops), now it hangs on boot after starting sshd (even with all USB devices disconnected). Can't do anything via SSH or USB TTL cable. Will need to figure out why it happens (possibly corrupted SD?).

@CrazyCoder
Copy link
Author

@popcornmix seems to work after checking SD from another system and reinstalling the firmware, not sure what it was.

@popcornmix
Copy link
Collaborator

Okay to close?

@CrazyCoder
Copy link
Author

@popcornmix Yes, closing.Thank you and @P33M for the quick fix.

anholt pushed a commit to anholt/linux that referenced this issue Jul 18, 2015
[ 1572.417121] BUG: unable to handle kernel NULL pointer dereference at           (null)
[ 1572.421010] IP: [<ffffffffa00b2514>] ftrace_raw_event_i915_context+0x5d/0x70 [i915]
[ 1572.424970] PGD 1766a3067 PUD 1767a2067 PMD 0
[ 1572.428892] Oops: 0000 [#1] SMP
[ 1572.432787] Modules linked in: ipv6 dm_mod iTCO_wdt iTCO_vendor_support snd_hda_codec_realtek snd_hda_codec_generic snd_hda_intel snd_hda_controller snd_hda_codec snd_hda_core snd_hwdep snd_pcm snd_timer snd soundcore serio_raw pcspkr lpc_ich i2c_i801 mfd_core battery ac acpi_cpufreq i915 button video drm_kms_helper drm
[ 1572.441720] CPU: 2 PID: 18853 Comm: kworker/u8:0 Not tainted 4.0.0_kcloud_3f0360_20150429+ raspberrypi#588
[ 1572.446298] Workqueue: i915 i915_gem_retire_work_handler [i915]
[ 1572.450876] task: ffff880002f428f0 ti: ffff880035724000 task.ti: ffff880035724000
[ 1572.455557] RIP: 0010:[<ffffffffa00b2514>]  [<ffffffffa00b2514>] ftrace_raw_event_i915_context+0x5d/0x70 [i915]
[ 1572.460423] RSP: 0018:ffff880035727ce8  EFLAGS: 00010286
[ 1572.465262] RAX: ffff880073f1643c RBX: ffff880002da9058 RCX: ffff880073e5db40
[ 1572.470179] RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffff880035727ce8
[ 1572.475107] RBP: ffff88007bb11a00 R08: 0000000000000000 R09: 0000000000000000
[ 1572.480034] R10: 0000000000362200 R11: 0000000000000008 R12: 0000000000000000
[ 1572.484952] R13: ffff880035727d78 R14: ffff880002dc1c98 R15: ffff880002dc1dc8
[ 1572.489886] FS:  0000000000000000(0000) GS:ffff88017fd00000(0000) knlGS:0000000000000000
[ 1572.494883] CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
[ 1572.499859] CR2: 0000000000000000 CR3: 000000017572a000 CR4: 00000000001006e0
[ 1572.504842] Stack:
[ 1572.509834]  ffff88017b0090c0 ffff880073f16438 ffff880002da9058 ffff880073f1643c
[ 1572.514904]  0000000000000246 ffff880100000000 ffff88007bb11a00 ffff880002ddeb10
[ 1572.519985]  ffff8801759f79c0 ffffffffa0092ff0 0000000000000000 ffff88007bb11a00
[ 1572.525049] Call Trace:
[ 1572.530093]  [<ffffffffa0092ff0>] ? i915_gem_context_free+0xa8/0xc1 [i915]
[ 1572.535227]  [<ffffffffa009b969>] ? i915_gem_request_free+0x4e/0x50 [i915]
[ 1572.540347]  [<ffffffffa00b5533>] ? intel_execlists_retire_requests+0x14c/0x159 [i915]
[ 1572.545500]  [<ffffffffa009d9ea>] ? i915_gem_retire_requests+0x9d/0xeb [i915]
[ 1572.550664]  [<ffffffffa009dd8c>] ? i915_gem_retire_work_handler+0x4c/0x61 [i915]
[ 1572.555825]  [<ffffffff8104ca7f>] ? process_one_work+0x1b2/0x31d
[ 1572.560951]  [<ffffffff8104d278>] ? worker_thread+0x24d/0x339
[ 1572.566033]  [<ffffffff8104d02b>] ? cancel_delayed_work_sync+0xa/0xa
[ 1572.571140]  [<ffffffff81050b25>] ? kthread+0xce/0xd6
[ 1572.576191]  [<ffffffff81050a57>] ? kthread_create_on_node+0x162/0x162
[ 1572.581228]  [<ffffffff8179b3c8>] ? ret_from_fork+0x58/0x90
[ 1572.586259]  [<ffffffff81050a57>] ? kthread_create_on_node+0x162/0x162
[ 1572.591318] Code: de 48 89 e7 e8 09 4d 00 e1 48 85 c0 74 27 48 89 68 10 48 8b 55 38 48 89 e7 48 89 50 18 48 8b 55 10 48 8b 12 48 8b 12 48 8b 52 38 <8b> 12 89 50 08 e8 95 4d 00 e1 48 83 c4 30 5b 5d 41 5c c3 41 55
[ 1572.596981] RIP  [<ffffffffa00b2514>] ftrace_raw_event_i915_context+0x5d/0x70 [i915]
[ 1572.602464]  RSP <ffff880035727ce8>
[ 1572.607911] CR2: 0000000000000000

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=90112#c23
Signed-off-by: Chris Wilson <[email protected]>
Signed-off-by: Daniel Vetter <[email protected]>
neuschaefer pushed a commit to neuschaefer/raspi-binary-firmware that referenced this issue Feb 27, 2017
See: raspberrypi/linux#588

kernel: Perform I2C combined transactions when possible
See: raspberrypi/linux#318

kernel: V4L2: Increase the MMAL timeout to 3sec
See: raspberrypi/linux#592

kernel: i2c-bcm2708: fixed baudrate
See: raspberrypi/linux#592

firmware: Avoid calling hdcp_shutdown() when hotplug deasserted
See: http://forum.stmlabs.com/showthread.php?tid=11003&pid=101848#pid101848

firmware: hello_fft: Update readme to mention use with GL
See: http://www.raspberrypi.org/forums/viewtopic.php?f=68&t=76189

firmware: Clear unused pixels in the subsample image in H264 codec
See: http://www.raspberrypi.org/forums/viewtopic.php?f=43&t=76845&p=551515#p551515
popcornmix pushed a commit that referenced this issue Jan 22, 2018
When a tail call fails, it is documented that the tail call should
continue execution at the following instruction.  An example tail call
sequence is:

  12: (85) call bpf_tail_call#12
  13: (b7) r0 = 0
  14: (95) exit

The ARM assembler for the tail call in this case ends up branching to
instruction 14 instead of instruction 13, resulting in the BPF filter
returning a non-zero value:

  178:	ldr	r8, [sp, #588]	; insn 12
  17c:	ldr	r6, [r8, r6]
  180:	ldr	r8, [sp, #580]
  184:	cmp	r8, r6
  188:	bcs	0x1e8
  18c:	ldr	r6, [sp, #524]
  190:	ldr	r7, [sp, #528]
  194:	cmp	r7, #0
  198:	cmpeq	r6, #32
  19c:	bhi	0x1e8
  1a0:	adds	r6, r6, #1
  1a4:	adc	r7, r7, #0
  1a8:	str	r6, [sp, #524]
  1ac:	str	r7, [sp, #528]
  1b0:	mov	r6, #104
  1b4:	ldr	r8, [sp, #588]
  1b8:	add	r6, r8, r6
  1bc:	ldr	r8, [sp, #580]
  1c0:	lsl	r7, r8, #2
  1c4:	ldr	r6, [r6, r7]
  1c8:	cmp	r6, #0
  1cc:	beq	0x1e8
  1d0:	mov	r8, #32
  1d4:	ldr	r6, [r6, r8]
  1d8:	add	r6, r6, #44
  1dc:	bx	r6
  1e0:	mov	r0, #0		; insn 13
  1e4:	mov	r1, #0
  1e8:	add	sp, sp, #596	; insn 14
  1ec:	pop	{r4, r5, r6, r7, r8, sl, pc}

For other sequences, the tail call could end up branching midway through
the following BPF instructions, or maybe off the end of the function,
leading to unknown behaviours.

Fixes: 39c13c2 ("arm: eBPF JIT compiler")
Signed-off-by: Russell King <[email protected]>
popcornmix pushed a commit that referenced this issue Jan 31, 2018
commit f4483f2 upstream.

When a tail call fails, it is documented that the tail call should
continue execution at the following instruction.  An example tail call
sequence is:

  12: (85) call bpf_tail_call#12
  13: (b7) r0 = 0
  14: (95) exit

The ARM assembler for the tail call in this case ends up branching to
instruction 14 instead of instruction 13, resulting in the BPF filter
returning a non-zero value:

  178:	ldr	r8, [sp, #588]	; insn 12
  17c:	ldr	r6, [r8, r6]
  180:	ldr	r8, [sp, #580]
  184:	cmp	r8, r6
  188:	bcs	0x1e8
  18c:	ldr	r6, [sp, #524]
  190:	ldr	r7, [sp, #528]
  194:	cmp	r7, #0
  198:	cmpeq	r6, #32
  19c:	bhi	0x1e8
  1a0:	adds	r6, r6, #1
  1a4:	adc	r7, r7, #0
  1a8:	str	r6, [sp, #524]
  1ac:	str	r7, [sp, #528]
  1b0:	mov	r6, #104
  1b4:	ldr	r8, [sp, #588]
  1b8:	add	r6, r8, r6
  1bc:	ldr	r8, [sp, #580]
  1c0:	lsl	r7, r8, #2
  1c4:	ldr	r6, [r6, r7]
  1c8:	cmp	r6, #0
  1cc:	beq	0x1e8
  1d0:	mov	r8, #32
  1d4:	ldr	r6, [r6, r8]
  1d8:	add	r6, r6, #44
  1dc:	bx	r6
  1e0:	mov	r0, #0		; insn 13
  1e4:	mov	r1, #0
  1e8:	add	sp, sp, #596	; insn 14
  1ec:	pop	{r4, r5, r6, r7, r8, sl, pc}

For other sequences, the tail call could end up branching midway through
the following BPF instructions, or maybe off the end of the function,
leading to unknown behaviours.

Fixes: 39c13c2 ("arm: eBPF JIT compiler")
Signed-off-by: Russell King <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants