RT Spinlock Kernel Meetup 2024 in Bangalore: Tracing and Challenges

rt linux tracing of rt spinlock n.w
1 / 9
Embed
Share

Explore the world of RT Linux and tracing of rt_spinlock at the upcoming Kernel Meetup in Bangalore 2024. Learn about the behavior of spinlocks in Linux and RT Linux, the challenges associated with rt_spinlock, and dive into actual issues faced by developers. Join experts as they discuss proposed frameworks and resources for managing rt_spinlock efficiently.

  • RT Spinlock
  • Kernel Meetup
  • Bangalore 2024
  • Tracing
  • Challenges

Uploaded on | 0 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.

E N D

Presentation Transcript


  1. RT Linux & Tracing of rt_spinlock Kernel Meetup at Bangalore 2024

  2. Introduction Mintu Patel Kernel Developer and Lead at Harman Int. Bangalore. Chinmoy Ghosh System & kernel Architect at Stellantis Bangalore Vimal Kumar Kernel Developer at Harman Int. Bangalore Kernel Meetup at Bangalore 2024

  3. Agenda What is RT Linux Spinlock Behavior at Linux & RT-Linux Challenges associated with Spinlock in RT-Linux Diving into an actual issue Proposed framework for rt_spinlock Resources Kernel Meetup at Bangalore 2024

  4. Linux RT RT Linux is deterministic derivative of Vanilla Linux. Preemption every where Spin_locks turn into mutexes Interrupt handlers turn into kernel threads Priority inheritance inside the kernel Kernel Meetup at Bangalore 2024

  5. Behaviorof Spinlock at Linux and RT Linux Linux RT As we know, spinlocks will disable preemption and used to protect the critical section Let's travel the spin_lock (&xxx_lock) Linux Similarly for other spin_lock variants Ahhh!! Driver owner need to redesign the critical section With PREEMPT_RT, spinlock_t and rwlock_t will become sleeping locks Only raw_spinlock_t remains a real spinning lock Kernel Meetup at Bangalore 2024

  6. Challenges associated with rt_spinlock kthreadB kthreadA _try_to_take_rt_mutex+0x95c+0x74 rt_spin_lock_slowlock_locked+0xac+ 2 rt_spin_lock_slowlock+0x5c/0x90 rt_spin_lock+0x58/0x5c driverA_acquire_lock+0x28/0x56 rt_mutex locking subsystem enqueue_task_dl+0x8cc/0x8dc rt_mutex_setprio+0x28c/0x574 task_blocks_rt_mutex+0x240/0x310 rt_spin_lock_slowlock_locked+0xac/0x2 rt_spin_lock_slowlock+0x5c/0x90 rt_spin_lock+0x58/0x5c driverB_acquire_lock+0x48/0x6c Critical section ThreadA got preempted Note: Here both kthreadA/B will be assigned as owner of the rt_mutex lock, even though only one has acquired it. Kernel Meetup at Bangalore 2024

  7. Diving into an actual issue Here Sugov thread was blocked on rt_mutex and finally got queued on deadline queue. Kernel Meetup at Bangalore 2024

  8. Proposed framework for rt_spinlock releasedthe lock acquiring rt_spin_lock acquired the lock < -------- > HeldPeriod < -------- > ContentionPeriod ex: cat /sys/kernel/debug/tracing/trace kworker/u13:0-150 [003] .....11 202.761025: rt_spinlock_acquire: Process: kworker/u13:0 is acquiring lock: &kbdev->hwaccess_lock kworker/u13:0-150 [003] .....11 202.761039: rt_spinlock_acquired: Process: kworker/u13:0 has acquired lock: &kbdev->hwaccess_lock kworker/u13:0-150 [003] .....11 202.761042: rt_spinlock_released: Process: kworker/u13:0 has released lock: &kbdev->hwaccess_lock Source code : https://lkml.org/lkml/2022/7/8/1023 Correct owner of lock Contention time for lock Held time for lock Which driver need to be redesigned for RT Linux Kernel Meetup at Bangalore 2024

  9. Resources Framework source code and RT Linux maintainer review Link Link : : https://lkml.org/lkml/2022/7/8/1023 Thank You Kernel Meetup at Bangalore 2024

More Related Content