Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:arch\x86\kernel\cpu\resctrl\pseudo_lock.c Create Date:2022-07-28 08:14:06
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:measure_residency_fn

Proto:static int measure_residency_fn(struct perf_event_attr *miss_attr, struct perf_event_attr *hit_attr, struct pseudo_lock_region *plr, struct residency_counts *counts)

Type:int

Parameter:

TypeParameterName
struct perf_event_attr *miss_attr
struct perf_event_attr *hit_attr
struct pseudo_lock_region *plr
struct residency_counts *counts
936  hits_before = 0 , hits_after = 0 , miss_before = 0 , miss_after = 0
945  miss_event = perf_event_create_kernel_counter*@attr: attributes of the counter to create*@cpu: cpu in which the counter is bound*@task: task to profile (NULL for percpu)
947  If IS_ERR(miss_event) Then Go to out
950  hit_event = perf_event_create_kernel_counter*@attr: attributes of the counter to create*@cpu: cpu in which the counter is bound*@task: task to profile (NULL for percpu)
952  If IS_ERR(hit_event) Then Go to out_miss
955  local_irq_disable()
960  If perf_event_read_local(miss_event, & tmp, NULL, NULL) Then
961  The local_irq_*() APIs are equal to the raw_local_irq*()* if !TRACE_IRQFLAGS.()
962  Go to out_hit
964  If perf_event_read_local(hit_event, & tmp, NULL, NULL) Then
965  The local_irq_*() APIs are equal to the raw_local_irq*()* if !TRACE_IRQFLAGS.()
966  Go to out_hit
972  wrmsr(MSR_MISC_FEATURE_CONTROL, The bits needed to disable hardware prefetching varies based on the* platform. During initialization we will discover which bits to use., 0x0)
979  miss_pmcnum = x86_perf_rdpmc_index(miss_event)
980  hit_pmcnum = x86_perf_rdpmc_index(hit_event)
981  line_size = READ_ONCE(line_size)
982  mem_r = READ_ONCE(kmem)
983  size = READ_ONCE(size)
990  rdpmcl(hit_pmcnum, hits_before)
991  rdpmcl(miss_pmcnum, miss_before)
998  rmb()
999  rdpmcl(hit_pmcnum, hits_before)
1000  rdpmcl(miss_pmcnum, miss_before)
1005  rmb()
1006  When i < size cycle
1011  rmb()
1012  asm volatile
1021  rmb()
1022  rdpmcl(hit_pmcnum, hits_after)
1023  rdpmcl(miss_pmcnum, miss_after)
1028  rmb()
1030  wrmsr(MSR_MISC_FEATURE_CONTROL, 0x0, 0x0)
1031  The local_irq_*() APIs are equal to the raw_local_irq*()* if !TRACE_IRQFLAGS.()
1032  out_hit :
1033  perf_event_release_kernel(hit_event)
1034  out_miss :
1035  perf_event_release_kernel(miss_event)
1036  out :
1040  miss_before = miss_before
1041  hits_before = hits_before
1042  miss_after = miss_after
1043  hits_after = hits_after
1044  Return 0
Caller
NameDescribe
measure_l2_residency
measure_l3_residency