Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit 01fd0fc3 authored by Chandana Kishori Chiluveru's avatar Chandana Kishori Chiluveru
Browse files

serial: msm_geni_serial: drop port->lock before tty_flip_buffer_push() call



In one core msm_geni_serail driver acquiring port->lock in isr function
and calling tty_flip_buffer_push() which in turn will wait for another
lock in __queue_work function. At the same time TX happening on
other core, __queue_work first took the lock and calling
msm_geni_serial_console_write() api and waiting for port->lock.
This is resulting in deadlock issue.

Below are the core call stacks of deadlock.
Core#0 call stack:
-000|__cmpwait(inline)
-000|queued_spin_lock_slowpath()
-001|do_raw_spin_lock()
-002|__raw_spin_lock(inline)
-002|raw_spin_lock()
-003|__queue_work()
-004|atomic_long_fetch_or(inline)
-004|test_and_set_bit(inline)
-004|queue_work_on()
-005|tty_flip_buffer_push()
-006|handle_rx_console()
-007|msm_geni_serial_handle_rx(inline)
-007|msm_geni_serial_isr()
-008|__read_once_size(inline)
-008|static_key_count(inline)
-008|static_key_false(inline)
-008|trace_irq_handler_exit(inline)
-008|__handle_irq_event_percpu()
-009|handle_irq_event_percpu(inline)
-009|handle_irq_event()
-010|cond_unmask_eoi_irq(inline)
-010|handle_fasteoi_irq()
-011|__handle_domain_irq()
-012|gic_handle_irq()
-013|el1_irq(asm)
 -->|exception
-014|lpm_cpuidle_enter()
-015|cpuidle_enter_state()
-016|cpuidle_enter()
-017|test_ti_thread_flag(inline)
-017|current_clr_polling_and_test(inline)
-017|call_cpuidle(inline)
-017|cpuidle_idle_call(inline)
-017|do_idle()
-018|cpu_startup_entry()
-019|rest_init()
-020|efi_enabled(inline)
-020|start_kernel()
 ---|end of frame

Core#7 call stack:
-000|__cmpwait(inline)
-000|queued_spin_lock_slowpath()
-001|do_raw_spin_lock()
-002|__raw_spin_lock_irqsave(inline)
-002|raw_spin_lock_irqsave()
-003|msm_geni_serial_console_write()
-004|cpumask_test_cpu(inline)
-004|call_console_drivers(inline)
-004|console_unlock()
-005|vprintk_emit()
-006|vprintk_default()
-007|vprintk_func()
-008|printk()
-009|print_lockdep_off(inline)
-009|__lock_acquire()
-010|lock_acquire()
-011|__raw_spin_lock_irqsave(inline)
-011|raw_spin_lock_irqsave()
-012|rq_pin_lock(inline)
-012|rq_lock_irqsave(inline)
-012|walt_try_to_wake_up(inline)
-012|try_to_wake_up()
-013|wake_up_process()
-014|__queue_work()
-015|atomic_long_fetch_or(inline)
-015|test_and_set_bit(inline)
-015|queue_work_on()
-016|tick_sched_timer()
-017|__read_once_size(inline)
-017|static_key_count(inline)
-017|static_key_false(inline)
-017|trace_hrtimer_expire_exit(inline)
-017|__run_hrtimer(inline)
-017|__hrtimer_run_queues()
-018|__hrtimer_get_next_event(inline)
-018|hrtimer_interrupt()
-019|arch_timer_reg_write(inline)
-019|timer_handler(inline)
-019|arch_timer_handler_virt()
-020|__read_once_size(inline)
-020|static_key_count(inline)
-020|static_key_false(inline)
-020|trace_irq_handler_exit(inline)
-020|handle_percpu_devid_irq()
-021|__handle_domain_irq()
-022|gic_handle_irq()
-023|el1_irq(asm)
 -->|exception
-024|arch_local_irq_restore(inline)
-024|__slab_alloc(inline)
-024|slab_alloc_node(inline)
-024|slab_alloc(inline)
-024|kmem_cache_alloc()
-025|vm_area_dup(inline)
-025|dup_mmap(inline)
-025|dup_mm(inline)
-025|copy_mm(inline)
-025|copy_process()
-026|do_fork()
-027|__se_sys_clone(inline)
-027|__arm64_sys_clone()
-028|el0_svc_common()
-029|el0_svc_handler()
-030|el0_svc(asm)
 -->|exception
-031|NUX:0x7FA9209340(asm)
 ---|end of frame

To fix this issue release the port lock before calling
tty_flip_buffer_push() and reacquire it after the call.

Change-Id: I59fe9ba2949c4f4edcf4f4c7e7f6c75391e8c84e
Signed-off-by: default avatarChandana Kishori Chiluveru <cchiluve@codeaurora.org>
parent 766f56fd
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment