diff options
| -rw-r--r-- | arch/x86/include/asm/intel_rdt_sched.h | 30 | ||||
| -rw-r--r-- | arch/x86/kernel/cpu/intel_rdt.c | 10 | ||||
| -rw-r--r-- | arch/x86/kernel/cpu/intel_rdt_rdtgroup.c | 10 |
3 files changed, 26 insertions, 24 deletions
diff --git a/arch/x86/include/asm/intel_rdt_sched.h b/arch/x86/include/asm/intel_rdt_sched.h index 3badc0a87ef5..b4bbf8b21512 100644 --- a/arch/x86/include/asm/intel_rdt_sched.h +++ b/arch/x86/include/asm/intel_rdt_sched.h | |||
| @@ -10,8 +10,10 @@ | |||
| 10 | 10 | ||
| 11 | /** | 11 | /** |
| 12 | * struct intel_pqr_state - State cache for the PQR MSR | 12 | * struct intel_pqr_state - State cache for the PQR MSR |
| 13 | * @rmid: The cached Resource Monitoring ID | 13 | * @cur_rmid: The cached Resource Monitoring ID |
| 14 | * @closid: The cached Class Of Service ID | 14 | * @cur_closid: The cached Class Of Service ID |
| 15 | * @default_rmid: The user assigned Resource Monitoring ID | ||
| 16 | * @default_closid: The user assigned cached Class Of Service ID | ||
| 15 | * | 17 | * |
| 16 | * The upper 32 bits of IA32_PQR_ASSOC contain closid and the | 18 | * The upper 32 bits of IA32_PQR_ASSOC contain closid and the |
| 17 | * lower 10 bits rmid. The update to IA32_PQR_ASSOC always | 19 | * lower 10 bits rmid. The update to IA32_PQR_ASSOC always |
| @@ -22,12 +24,13 @@ | |||
| 22 | * not change. | 24 | * not change. |
| 23 | */ | 25 | */ |
| 24 | struct intel_pqr_state { | 26 | struct intel_pqr_state { |
| 25 | u32 rmid; | 27 | u32 cur_rmid; |
| 26 | u32 closid; | 28 | u32 cur_closid; |
| 29 | u32 default_rmid; | ||
| 30 | u32 default_closid; | ||
| 27 | }; | 31 | }; |
| 28 | 32 | ||
| 29 | DECLARE_PER_CPU(struct intel_pqr_state, pqr_state); | 33 | DECLARE_PER_CPU(struct intel_pqr_state, pqr_state); |
| 30 | DECLARE_PER_CPU_READ_MOSTLY(struct intel_pqr_state, rdt_cpu_default); | ||
| 31 | 34 | ||
| 32 | DECLARE_STATIC_KEY_FALSE(rdt_enable_key); | 35 | DECLARE_STATIC_KEY_FALSE(rdt_enable_key); |
| 33 | DECLARE_STATIC_KEY_FALSE(rdt_alloc_enable_key); | 36 | DECLARE_STATIC_KEY_FALSE(rdt_alloc_enable_key); |
| @@ -49,8 +52,9 @@ DECLARE_STATIC_KEY_FALSE(rdt_mon_enable_key); | |||
| 49 | */ | 52 | */ |
| 50 | static void __intel_rdt_sched_in(void) | 53 | static void __intel_rdt_sched_in(void) |
| 51 | { | 54 | { |
| 52 | struct intel_pqr_state newstate = this_cpu_read(rdt_cpu_default); | 55 | struct intel_pqr_state *state = this_cpu_ptr(&pqr_state); |
| 53 | struct intel_pqr_state *curstate = this_cpu_ptr(&pqr_state); | 56 | u32 closid = state->default_closid; |
| 57 | u32 rmid = state->default_rmid; | ||
| 54 | 58 | ||
| 55 | /* | 59 | /* |
| 56 | * If this task has a closid/rmid assigned, use it. | 60 | * If this task has a closid/rmid assigned, use it. |
| @@ -58,18 +62,18 @@ static void __intel_rdt_sched_in(void) | |||
| 58 | */ | 62 | */ |
| 59 | if (static_branch_likely(&rdt_alloc_enable_key)) { | 63 | if (static_branch_likely(&rdt_alloc_enable_key)) { |
| 60 | if (current->closid) | 64 | if (current->closid) |
| 61 | newstate.closid = current->closid; | 65 | closid = current->closid; |
| 62 | } | 66 | } |
| 63 | 67 | ||
| 64 | if (static_branch_likely(&rdt_mon_enable_key)) { | 68 | if (static_branch_likely(&rdt_mon_enable_key)) { |
| 65 | if (current->rmid) | 69 | if (current->rmid) |
| 66 | newstate.rmid = current->rmid; | 70 | rmid = current->rmid; |
| 67 | } | 71 | } |
| 68 | 72 | ||
| 69 | if (newstate.closid != curstate->closid || | 73 | if (closid != state->cur_closid || rmid != state->cur_rmid) { |
| 70 | newstate.rmid != curstate->rmid) { | 74 | state->cur_closid = closid; |
| 71 | *curstate = newstate; | 75 | state->cur_rmid = rmid; |
| 72 | wrmsr(IA32_PQR_ASSOC, newstate.rmid, newstate.closid); | 76 | wrmsr(IA32_PQR_ASSOC, rmid, closid); |
| 73 | } | 77 | } |
| 74 | } | 78 | } |
| 75 | 79 | ||
diff --git a/arch/x86/kernel/cpu/intel_rdt.c b/arch/x86/kernel/cpu/intel_rdt.c index 4b9edb2617a5..97c8d8321e04 100644 --- a/arch/x86/kernel/cpu/intel_rdt.c +++ b/arch/x86/kernel/cpu/intel_rdt.c | |||
| @@ -47,8 +47,6 @@ DEFINE_MUTEX(rdtgroup_mutex); | |||
| 47 | */ | 47 | */ |
| 48 | DEFINE_PER_CPU(struct intel_pqr_state, pqr_state); | 48 | DEFINE_PER_CPU(struct intel_pqr_state, pqr_state); |
| 49 | 49 | ||
| 50 | DEFINE_PER_CPU_READ_MOSTLY(struct intel_pqr_state, rdt_cpu_default); | ||
| 51 | |||
| 52 | /* | 50 | /* |
| 53 | * Used to store the max resource name width and max resource data width | 51 | * Used to store the max resource name width and max resource data width |
| 54 | * to display the schemata in a tabular format | 52 | * to display the schemata in a tabular format |
| @@ -550,10 +548,10 @@ static void clear_closid_rmid(int cpu) | |||
| 550 | { | 548 | { |
| 551 | struct intel_pqr_state *state = this_cpu_ptr(&pqr_state); | 549 | struct intel_pqr_state *state = this_cpu_ptr(&pqr_state); |
| 552 | 550 | ||
| 553 | per_cpu(rdt_cpu_default.closid, cpu) = 0; | 551 | state->default_closid = 0; |
| 554 | per_cpu(rdt_cpu_default.rmid, cpu) = 0; | 552 | state->default_rmid = 0; |
| 555 | state->closid = 0; | 553 | state->cur_closid = 0; |
| 556 | state->rmid = 0; | 554 | state->cur_rmid = 0; |
| 557 | wrmsr(IA32_PQR_ASSOC, 0, 0); | 555 | wrmsr(IA32_PQR_ASSOC, 0, 0); |
| 558 | } | 556 | } |
| 559 | 557 | ||
diff --git a/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c b/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c index 2621ae3f07fc..86a69794d7e4 100644 --- a/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c +++ b/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c | |||
| @@ -202,8 +202,8 @@ static void update_cpu_closid_rmid(void *info) | |||
| 202 | struct rdtgroup *r = info; | 202 | struct rdtgroup *r = info; |
| 203 | 203 | ||
| 204 | if (r) { | 204 | if (r) { |
| 205 | this_cpu_write(rdt_cpu_default.closid, r->closid); | 205 | this_cpu_write(pqr_state.default_closid, r->closid); |
| 206 | this_cpu_write(rdt_cpu_default.rmid, r->mon.rmid); | 206 | this_cpu_write(pqr_state.default_rmid, r->mon.rmid); |
| 207 | } | 207 | } |
| 208 | 208 | ||
| 209 | /* | 209 | /* |
| @@ -1733,7 +1733,7 @@ static int rdtgroup_rmdir_mon(struct kernfs_node *kn, struct rdtgroup *rdtgrp, | |||
| 1733 | 1733 | ||
| 1734 | /* Update per cpu rmid of the moved CPUs first */ | 1734 | /* Update per cpu rmid of the moved CPUs first */ |
| 1735 | for_each_cpu(cpu, &rdtgrp->cpu_mask) | 1735 | for_each_cpu(cpu, &rdtgrp->cpu_mask) |
| 1736 | per_cpu(rdt_cpu_default.rmid, cpu) = prdtgrp->mon.rmid; | 1736 | per_cpu(pqr_state.default_rmid, cpu) = prdtgrp->mon.rmid; |
| 1737 | /* | 1737 | /* |
| 1738 | * Update the MSR on moved CPUs and CPUs which have moved | 1738 | * Update the MSR on moved CPUs and CPUs which have moved |
| 1739 | * task running on them. | 1739 | * task running on them. |
| @@ -1774,8 +1774,8 @@ static int rdtgroup_rmdir_ctrl(struct kernfs_node *kn, struct rdtgroup *rdtgrp, | |||
| 1774 | 1774 | ||
| 1775 | /* Update per cpu closid and rmid of the moved CPUs first */ | 1775 | /* Update per cpu closid and rmid of the moved CPUs first */ |
| 1776 | for_each_cpu(cpu, &rdtgrp->cpu_mask) { | 1776 | for_each_cpu(cpu, &rdtgrp->cpu_mask) { |
| 1777 | per_cpu(rdt_cpu_default.closid, cpu) = rdtgroup_default.closid; | 1777 | per_cpu(pqr_state.default_closid, cpu) = rdtgroup_default.closid; |
| 1778 | per_cpu(rdt_cpu_default.rmid, cpu) = rdtgroup_default.mon.rmid; | 1778 | per_cpu(pqr_state.default_rmid, cpu) = rdtgroup_default.mon.rmid; |
| 1779 | } | 1779 | } |
| 1780 | 1780 | ||
| 1781 | /* | 1781 | /* |
