• Stanimir Varbanov's avatar
    media: venus: cache vb payload to be used by clock scaling · fd1ee315
    Stanimir Varbanov authored
    Instead of iterate over previously queued buffers in clock
    scaling code do cache the payload in instance context structure
    for later use when calculating new clock rate.
    
    This will avoid to use spin locks during buffer list iteration
    in clock_scaling.
    
    This fixes following kernel Oops:
    
     Unable to handle kernel paging request at virtual address deacfffffffffd6c
     Mem abort info:
       ESR = 0x96000004
       EC = 0x25: DABT (current EL), IL = 32 bits
       SET = 0, FnV = 0
       EA = 0, S1PTW = 0
     Data abort info:
       ISV = 0, ISS = 0x00000004
       CM = 0, WnR = 0
     [deacfffffffffd6c] address between user and kernel address ranges
     Internal error: Oops: 96000004 [#1] PREEMPT SMP
     CPU: 7 PID: 5763 Comm: V4L2DecoderThre Tainted: G S      W         5.4.11 #8
     pstate: 20400009 (nzCv daif +PAN -UAO)
     pc : load_scale_v4+0x4c/0x2bc [venus_core]
     lr : session_process_buf+0x18c/0x1c0 [venus_core]
     sp : ffffffc01376b8d0
     x29: ffffffc01376b8d0 x28: ffffff80cf1b0220
     x27: ffffffc01376bba0 x26: ffffffd8f562b2d8
     x25: ffffff80cf1b0220 x24: 0000000000000005
     x23: ffffffd8f5620d98 x22: ffffff80ca01c800
     x21: ffffff80cf1b0000 x20: ffffff8149490080
     x19: ffffff8174b2c010 x18: 0000000000000000
     x17: 0000000000000000 x16: ffffffd96ee3a0dc
     x15: 0000000000000026 x14: 0000000000000026
     x13: 00000000000055ac x12: 0000000000000001
     x11: deacfffffffffd6c x10: dead000000000100
     x9 : ffffff80ca01cf28 x8 : 0000000000000026
     x7 : 0000000000000000 x6 : ffffff80cdd899c0
     x5 : ffffff80cdd899c0 x4 : 0000000000000008
     x3 : ffffff80ca01cf28 x2 : ffffff80ca01cf28
     x1 : ffffff80d47ffc00 x0 : ffffff80cf1b0000
     Call trace:
      load_scale_v4+0x4c/0x2bc [venus_core]
      session_process_buf+0x18c/0x1c0 [venus_core]
      venus_helper_vb2_buf_queue+0x7c/0xf0 [venus_core]
      __enqueue_in_driver+0xe4/0xfc [videobuf2_common]
      vb2_core_qbuf+0x15c/0x338 [videobuf2_common]
      vb2_qbuf+0x78/0xb8 [videobuf2_v4l2]
      v4l2_m2m_qbuf+0x80/0xf8 [v4l2_mem2mem]
      v4l2_m2m_ioctl_qbuf+0x2c/0x38 [v4l2_mem2mem]
      v4l_qbuf+0x48/0x58
      __video_do_ioctl+0x2b0/0x39c
      video_usercopy+0x394/0x710
      video_ioctl2+0x38/0x48
      v4l2_ioctl+0x6c/0x80
      do_video_ioctl+0xb00/0x2874
      v4l2_compat_ioctl32+0x5c/0xcc
      __se_compat_sys_ioctl+0x100/0x2074
      __arm64_compat_sys_ioctl+0x20/0x2c
      el0_svc_common+0xa4/0x154
      el0_svc_compat_handler+0x2c/0x38
      el0_svc_compat+0x8/0x10
     Code: eb0a013f 54000200 aa1f03e8 d10e514b (b940016c)
     ---[ end trace e11304b46552e0b9 ]---
    
    Fixes: c0e284cc ("media: venus: Update clock scaling")
    
    Cc: stable@vger.kernel.org # v5.5+
    Signed-off-by: default avatarStanimir Varbanov <stanimir.varbanov@linaro.org>
    Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
    fd1ee315
helpers.c 36.4 KB