This source file includes following definitions.
- __resctrl_sched_in
- resctrl_sched_in
- resctrl_sched_in
1
2 #ifndef _ASM_X86_RESCTRL_SCHED_H
3 #define _ASM_X86_RESCTRL_SCHED_H
4
5 #ifdef CONFIG_X86_CPU_RESCTRL
6
7 #include <linux/sched.h>
8 #include <linux/jump_label.h>
9
10 #define IA32_PQR_ASSOC 0x0c8f
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27 struct resctrl_pqr_state {
28 u32 cur_rmid;
29 u32 cur_closid;
30 u32 default_rmid;
31 u32 default_closid;
32 };
33
34 DECLARE_PER_CPU(struct resctrl_pqr_state, pqr_state);
35
36 DECLARE_STATIC_KEY_FALSE(rdt_enable_key);
37 DECLARE_STATIC_KEY_FALSE(rdt_alloc_enable_key);
38 DECLARE_STATIC_KEY_FALSE(rdt_mon_enable_key);
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54 static void __resctrl_sched_in(void)
55 {
56 struct resctrl_pqr_state *state = this_cpu_ptr(&pqr_state);
57 u32 closid = state->default_closid;
58 u32 rmid = state->default_rmid;
59
60
61
62
63
64 if (static_branch_likely(&rdt_alloc_enable_key)) {
65 if (current->closid)
66 closid = current->closid;
67 }
68
69 if (static_branch_likely(&rdt_mon_enable_key)) {
70 if (current->rmid)
71 rmid = current->rmid;
72 }
73
74 if (closid != state->cur_closid || rmid != state->cur_rmid) {
75 state->cur_closid = closid;
76 state->cur_rmid = rmid;
77 wrmsr(IA32_PQR_ASSOC, rmid, closid);
78 }
79 }
80
81 static inline void resctrl_sched_in(void)
82 {
83 if (static_branch_likely(&rdt_enable_key))
84 __resctrl_sched_in();
85 }
86
87 #else
88
89 static inline void resctrl_sched_in(void) {}
90
91 #endif
92
93 #endif