lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Tue, 14 Mar 2023 10:55:13 -0700
From:   Namhyung Kim <namhyung@...nel.org>
To:     Arnaldo Carvalho de Melo <acme@...nel.org>
Cc:     Jiri Olsa <jolsa@...nel.org>,
        Peter Zijlstra <peterz@...radead.org>,
        Ingo Molnar <mingo@...nel.org>, Song Liu <song@...nel.org>,
        Hao Luo <haoluo@...gle.com>,
        Juri Lelli <juri.lelli@...hat.com>,
        Will Deacon <will@...nel.org>,
        Waiman Long <longman@...hat.com>,
        Boqun Feng <boqun.feng@...il.com>,
        Stephane Eranian <eranian@...gle.com>,
        LKML <linux-kernel@...r.kernel.org>,
        linux-perf-users@...r.kernel.org, bpf@...r.kernel.org
Subject: Re: [PATCH 0/4] perf lock contention: Improve lock symbol display (v1)

Hi Arnaldo,

On Tue, Mar 14, 2023 at 5:23 AM Arnaldo Carvalho de Melo
<acme@...nel.org> wrote:
>
> Em Mon, Mar 13, 2023 at 06:45:53PM -0300, Arnaldo Carvalho de Melo escreveu:
> > Em Mon, Mar 13, 2023 at 01:48:21PM -0700, Namhyung Kim escreveu:
> > > Hello,
> > >
> > > This patchset improves the symbolization of locks for -l/--lock-addr mode.
> > > As of now it only shows global lock symbols present in the kallsyms.  But
> > > we can add some more lock symbols by traversing pointers in the BPF program.
> > >
> > > For example, mmap_lock can be reached from the mm_struct of the current task
> > > (task_struct->mm->mmap_lock) and we can compare the address of the give lock
> > > with it.  Similarly I've added 'siglock' for current->sighand->siglock.
>
> Hey, we can go a bit further by using something like pahole's
> --expand_types and --expand_pointers and play iterating a type members
> and looking for locks, like:
>
> ⬢[acme@...lbox pahole]$ pahole task_struct | grep spinlock_t
>         spinlock_t                 alloc_lock;           /*  3280     4 */
>         raw_spinlock_t             pi_lock;              /*  3284     4 */
>         seqcount_spinlock_t        mems_allowed_seq;     /*  3616     4 */
> ⬢[acme@...lbox pahole]$
>
> Expand points will find mmap_lock:
>
> ⬢[acme@...lbox pahole]$ pahole --expand_pointers -C task_struct | grep -B10 mmap_lock
>                                                                 } *pgd;
>                                                                 atomic_t                       membarrier_state;
>                                                                 atomic_t                       mm_users;
>                                                                 atomic_t                       mm_count;
>
>                                                                 /* XXX 4 bytes hole, try to pack */
>
>                                                                 atomic_long_t                  pgtables_bytes;
>                                                                 int                            map_count;
>                                                                 spinlock_t                     page_table_lock;
>                                                                 struct rw_semaphore                          mmap_lock;
> ^C
> ⬢[acme@...lbox pahole]$
>
>
> ITs just too much expansion to see task_struct->mm, but it is there, of
> course:
>
> ⬢[acme@...lbox pahole]$ pahole mm_struct | grep mmap_lock
>                 struct rw_semaphore mmap_lock;           /*   120    40 */
> ⬢[acme@...lbox pahole]$
>
> Also:
>
> ⬢[acme@...lbox pahole]$ pahole --contains rw_semaphore
> address_space
> signal_struct
> key
> inode
> super_block
> quota_info
> user_namespace
> blocking_notifier_head
> backing_dev_info
> anon_vma
> tty_struct
> cpufreq_policy
> tcf_block
> ipc_ids
> autogroup
> kvm_arch
> posix_clock
> listener_list
> uprobe
> kernfs_root
> configfs_fragment
> ext4_inode_info
> ext4_group_info
> btrfs_fs_info
> extent_buffer
> btrfs_dev_replace
> btrfs_space_info
> btrfs_inode
> btrfs_block_group
> tpm_chip
> ib_device
> ib_xrcd
> blk_crypto_profile
> controller
> led_classdev
> cppc_pcc_data
> dm_snapshot
> ⬢[acme@...lbox pahole]$
>
> And:
>
> ⬢[acme@...lbox pahole]$ pahole --find_pointers_to mm_struct
> task_struct: mm
> task_struct: active_mm
> vm_area_struct: vm_mm
> flush_tlb_info: mm
> signal_struct: oom_mm
> tlb_state: loaded_mm
> linux_binprm: mm
> mmu_gather: mm
> trace_event_raw_xen_mmu_ptep_modify_prot: mm
> trace_event_raw_xen_mmu_alloc_ptpage: mm
> trace_event_raw_xen_mmu_pgd: mm
> trace_event_raw_xen_mmu_flush_tlb_multi: mm
> trace_event_raw_hyperv_mmu_flush_tlb_multi: mm
> mmu_notifier: mm
> mmu_notifier_range: mm
> sgx_encl_mm: mm
> rq: prev_mm
> kvm: mm
> cpuset_migrate_mm_work: mm
> mmap_unlock_irq_work: mm
> delayed_uprobe: mm
> map_info: mm
> trace_event_raw_mmap_lock: mm
> trace_event_raw_mmap_lock_acquire_returned: mm
> mm_walk: mm
> make_exclusive_args: mm
> mmu_interval_notifier: mm
> mm_slot: mm
> rmap_item: mm
> trace_event_raw_mm_khugepaged_scan_pmd: mm
> trace_event_raw_mm_collapse_huge_page: mm
> trace_event_raw_mm_collapse_huge_page_swapin: mm
> mm_slot: mm
> move_charge_struct: mm
> userfaultfd_ctx: mm
> proc_maps_private: mm
> remap_pfn: mm
> intel_svm: mm
> binder_alloc: vma_vm_mm
> ⬢[acme@...lbox pahole]$

This looks really cool! especially.

I'm especially interested in adding super_block and kernfs_root.
Let me see how I can add them.

Thanks,
Namhyung

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ