Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Register
  • Sign in
  • L linux
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Issues 0
    • Issues 0
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • Deployments
    • Deployments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • Kirill Smelkov
  • linux
  • Repository
You need to sign in or sign up before continuing.
  • linux
  • kernel
  • time
  • hrtimer.c
Find file BlameHistoryPermalink
  • Eric Dumazet's avatar
    hrtimer: Annotate lockless access to timer->base · ff229eee
    Eric Dumazet authored Oct 08, 2019
    Followup to commit dd2261ed
    
     ("hrtimer: Protect lockless access
    to timer->base")
    
    lock_hrtimer_base() fetches timer->base without lock exclusion.
    
    Compiler is allowed to read timer->base twice (even if considered dumb)
    which could end up trying to lock migration_base and return
    &migration_base.
    
      base = timer->base;
      if (likely(base != &migration_base)) {
    
           /* compiler reads timer->base again, and now (base == &migration_base)
    
           raw_spin_lock_irqsave(&base->cpu_base->lock, *flags);
           if (likely(base == timer->base))
                return base; /* == &migration_base ! */
    
    Similarly the write sides must use WRITE_ONCE() to avoid store tearing.
    
    Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
    Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
    Link: https://lkml.kernel.org/r/20191008173204.180879-1-edumazet@google.com
    ff229eee
GitLab Nexedi Edition | About GitLab | About Nexedi | 沪ICP备2021021310号-2 | 沪ICP备2021021310号-7