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
  • bpf
  • stackmap.c
Find file BlameHistoryPermalink
  • Song Liu's avatar
    bpf: Introduce helper bpf_find_vma · 7c7e3d31
    Song Liu authored Nov 05, 2021
    
    
    In some profiler use cases, it is necessary to map an address to the
    backing file, e.g., a shared library. bpf_find_vma helper provides a
    flexible way to achieve this. bpf_find_vma maps an address of a task to
    the vma (vm_area_struct) for this address, and feed the vma to an callback
    BPF function. The callback function is necessary here, as we need to
    ensure mmap_sem is unlocked.
    
    It is necessary to lock mmap_sem for find_vma. To lock and unlock mmap_sem
    safely when irqs are disable, we use the same mechanism as stackmap with
    build_id. Specifically, when irqs are disabled, the unlocked is postponed
    in an irq_work. Refactor stackmap.c so that the irq_work is shared among
    bpf_find_vma and stackmap helpers.
    
    Signed-off-by: default avatarSong Liu <songliubraving@fb.com>
    Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
    Tested-by: default avatarHengqi Chen <hengqi.chen@gmail.com>
    Acked-by: default avatarYonghong Song <yhs@fb.com>
    Link: https://lore.kernel.org/bpf/20211105232330.1936330-2-songliubraving@fb.com
    7c7e3d31
GitLab Nexedi Edition | About GitLab | About Nexedi | 沪ICP备2021021310号-2 | 沪ICP备2021021310号-7