ARM架构:
1.sudo apt install bpfcc-tools
2.sudo apt install auditd
sudo apt install libncurses5
不安装会报错
./memtest
@-PC:~/bpftest$ sudo trace-bpfcc -tUK __alloc_pages_nodemask -p 30771
TIME PID TID COMM FUNC
12.13609 30771 30771 memtest __alloc_pages_nodemask
__alloc_pages_nodemask+0x0 [kernel]
__handle_mm_fault+0xa78 [kernel]
handle_mm_fault+0x13c [kernel]
do_page_fault+0x1b4 [kernel]
do_translation_fault+0x58 [kernel]
do_mem_abort+0x54 [kernel]
el0_da+0x20 [kernel]
[unknown] [libc-2.28.so]
[unknown] [libc-2.28.so]
malloc+0x9c [libc-2.28.so]
main+0x30 [memtest]
__libc_start_main+0xe4 [libc-2.28.so]
[unknown] [memtest]
12.13616 30771 30771 memtest __alloc_pages_nodemask
__alloc_pages_nodemask+0x0 [kernel]
handle_mm_fault+0x13c [kernel]
do_page_fault+0x1b4 [kernel]
do_translation_fault+0x58 [kernel]
do_mem_abort+0x54 [kernel]
el0_da+0x20 [kernel]
[unknown] [libc-2.28.so]
[unknown] [libc-2.28.so]
malloc+0x9c [libc-2.28.so]
main+0x30 [memtest]
__libc_start_main+0xe4 [libc-2.28.so]
[unknown] [memtest]
================================================
sudo trace-bpfcc -t ‘submit_bio(struct bio *bio) “func=0x%lx”,bio->bi_disk->queue->make_request_fn’
uos@uos-PC:~/bpftest$ sudo trace-bpfcc -t ‘submit_bio(struct bio *bio) “func=0x%lx”,bio->bi_disk->queue->make_request_fn’
struct bio {
struct bio bi_next; / request queue link */
struct gendisk bi_disk;
unsigned int bi_opf; / bottom bits req flags,
* top bits REQ_OP. Use
* accessors.
/
unsigned short bi_flags; / status, etc and bvec pool number */
unsigned short bi_ioprio;
unsigned short bi_write_hint;
blk_status_t bi_status;
u8 bi_partno;
/* Number of segments in this BIO after
* physical address coalescing is performed.
*/
unsigned int bi_phys_segments;
/*
* To keep track of the max segment size, we account for the
* sizes of the first and last mergeable segments in this bio.
*/
unsigned int bi_seg_front_size;
unsigned int bi_seg_back_size;
struct bvec_iter bi_iter;
atomic_t __bi_remaining;
bio_end_io_t *bi_end_io;
void *bi_private;
#ifdef CONFIG_BLK_CGROUP
/*
* Optional ioc and css associated with this bio. Put on bio
* release. Read comment on top of bio_associate_current().
*/
struct io_context *bi_ioc;
struct cgroup_subsys_state *bi_css;
struct blkcg_gq *bi_blkg;
struct bio_issue bi_issue;
#endif
union {
#if defined(CONFIG_BLK_DEV_INTEGRITY)
struct bio_integrity_payload bi_integrity; / data integrity */
#endif
};
unsigned short bi_vcnt; /* how many bio_vec's */
/*
* Everything starting with bi_max_vecs will be preserved by bio_reset()
*/
unsigned short bi_max_vecs; /* max bvl_vecs we can hold */
atomic_t __bi_cnt; /* pin count */
struct bio_vec *bi_io_vec; /* the actual vec list */
struct bio_set *bi_pool;
/*
* We can inline a number of vecs at the end of the bio, to avoid
* double allocations for a small number of bio_vecs. This member
* MUST obviously be kept at the very end of the bio.
*/
struct bio_vec bi_inline_vecs[0];
};
struct gendisk {
/* major, first_minor and minors are input parameters only,
* don’t use directly. Use disk_devt() and disk_max_parts().
/
int major; / major number of driver /
int first_minor;
int minors; / maximum number of minors, =1 for
* disks that can’t be partitioned. */
char disk_name[DISK_NAME_LEN]; /* name of major driver */
char *(*devnode)(struct gendisk *gd, umode_t *mode);
unsigned int events; /* supported events */
unsigned int async_events; /* async events, subset of all */
/* Array of pointers to partitions indexed by partno.
* Protected with matching bdev lock but stat and other
* non-critical accesses use RCU. Always access through
* helpers.
*/
struct disk_part_tbl __rcu *part_tbl;
struct hd_struct part0;
const struct block_device_operations *fops;
**struct request_queue *queue;**
void *private_data;
int flags;
struct rw_semaphore lookup_sem;
struct kobject *slave_dir;
struct timer_rand_state *random;
atomic_t sync_io; /* RAID */
struct disk_events *ev;
#ifdef CONFIG_BLK_DEV_INTEGRITY
struct kobject integrity_kobj;
#endif /* CONFIG_BLK_DEV_INTEGRITY */
int node_id;
struct badblocks *bb;
struct lockdep_map lockdep_map;
};
struct request_queue {
/*
* Together with queue_head for cacheline sharing
*/
struct list_head queue_head;
struct request *last_merge;
struct elevator_queue elevator;
int nr_rqs[2]; / # allocated [a]sync rqs /
int nr_rqs_elvpriv; / # allocated rqs w/ elvpriv */
struct blk_queue_stats *stats;
struct rq_qos *rq_qos;
/*
* If blkcg is not used, @q->root_rl serves all requests. If blkcg
* is used, root blkg allocates from @q->root_rl and all other
* blkgs from their own blkg->rl. Which one to use should be
* determined using bio_request_list().
*/
struct request_list root_rl;
request_fn_proc *request_fn;
**make_request_fn *make_request_fn;**
poll_q_fn *poll_fn;
prep_rq_fn *prep_rq_fn;
unprep_rq_fn *unprep_rq_fn;
softirq_done_fn *softirq_done_fn;
rq_timed_out_fn *rq_timed_out_fn;
dma_drain_needed_fn *dma_drain_needed;
lld_busy_fn *lld_busy_fn;
....
TIME PID TID COMM FUNC -
2.691405 562 562 jbd2/nvme0n1p7- submit_bio func=0xffffff800860ec18
2.691507 562 562 jbd2/nvme0n1p7- submit_bio func=0xffffff800860ec18
2.691534 562 562 jbd2/nvme0n1p7- submit_bio func=0xffffff800860ec18
2.691553 562 562 jbd2/nvme0n1p7- submit_bio func=0xffffff800860ec18
2.691570 562 562 jbd2/nvme0n1p7- submit_bio func=0xffffff800860ec18
2.691586 562 562 jbd2/nvme0n1p7- submit_bio func=0xffffff800860ec18
2.691601 562 562 jbd2/nvme0n1p7- submit_bio func=0xffffff800860ec18
2.695064 562 562 jbd2/nvme0n1p7- submit_bio func=0xffffff800860ec18
3.946072 4663 4663 kworker/u16:1 submit_bio func=0xffffff800860ec18
3.946150 4663 4663 kworker/u16:1 submit_bio func=0xffffff800860ec18
5.738055 224 224 jbd2/nvme0n1p4- submit_bio func=0xffffff800860ec18
5.738152 224 224 jbd2/nvme0n1p4- submit_bio func=0xffffff800860ec18
5.738181 224 224 jbd2/nvme0n1p4- submit_bio func=0xffffff800860ec18
5.738199 224 224 jbd2/nvme0n1p4- submit_bio func=0xffffff800860ec18
5.738216 224 224 jbd2/nvme0n1p4- submit_bio func=0xffffff800860ec18
5.741650 224 224 jbd2/nvme0n1p4- submit_bio func=0xffffff800860ec18
5.899551 26166 26167 auditd submit_bio func=0xffffff800860ec18
5.899692 26166 26167 auditd submit_bio func=0xffffff800860ec18
5.899872 562 562 jbd2/nvme0n1p7- submit_bio func=0xffffff800860ec18
5.899894 562 562 jbd2/nvme0n1p7- submit_bio func=0xffffff800860ec18
5.899901 562 562 jbd2/nvme0n1p7- submit_bio func=0xffffff800860ec18
5.899906 562 562 jbd2/nvme0n1p7- submit_bio func=0xffffff800860ec18
sudo cat /proc/kallsyms |grep ffffff800860ec18
ffffff800860ec18 t blk_mq_make_request