aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVikas Shivappa <vikas.shivappa@linux.intel.com>2017-08-15 21:00:42 -0400
committerThomas Gleixner <tglx@linutronix.de>2017-08-16 06:05:41 -0400
commitbbc4615e0b7df5e21d0991adb4b2798508354924 (patch)
tree90ad683ed927c5845ff3ae2392b6a468be7d79fe
parenta9110b552d44fedbd1221eb0e5bde81da32d9350 (diff)
x86/intel_rdt/mbm: Fix MBM overflow handler during CPU hotplug
When a CPU is dying, the overflow worker is canceled and rescheduled on a different CPU in the same domain. But if the timer is already about to expire this essentially doubles the interval which might result in a non detected overflow. Cancel the overflow worker and reschedule it immediately on a different CPU in same domain. The work could be flushed as well, but that would reschedule it on the same CPU. [ tglx: Rewrote changelog once again ] Reported-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Vikas Shivappa <vikas.shivappa@linux.intel.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Cc: ravi.v.shankar@intel.com Cc: tony.luck@intel.com Cc: fenghua.yu@intel.com Cc: peterz@infradead.org Cc: eranian@google.com Cc: vikas.shivappa@intel.com Cc: ak@linux.intel.com Cc: davidcc@google.com Link: http://lkml.kernel.org/r/1502845243-20454-2-git-send-email-vikas.shivappa@linux.intel.com
-rw-r--r--arch/x86/kernel/cpu/intel_rdt.c4
-rw-r--r--arch/x86/kernel/cpu/intel_rdt.h2
-rw-r--r--arch/x86/kernel/cpu/intel_rdt_monitor.c4
-rw-r--r--arch/x86/kernel/cpu/intel_rdt_rdtgroup.c2
4 files changed, 6 insertions, 6 deletions
diff --git a/arch/x86/kernel/cpu/intel_rdt.c b/arch/x86/kernel/cpu/intel_rdt.c
index 97c8d8321e04..b8dc141896b6 100644
--- a/arch/x86/kernel/cpu/intel_rdt.c
+++ b/arch/x86/kernel/cpu/intel_rdt.c
@@ -447,7 +447,7 @@ static int domain_setup_mon_state(struct rdt_resource *r, struct rdt_domain *d)
447 447
448 if (is_mbm_enabled()) { 448 if (is_mbm_enabled()) {
449 INIT_DELAYED_WORK(&d->mbm_over, mbm_handle_overflow); 449 INIT_DELAYED_WORK(&d->mbm_over, mbm_handle_overflow);
450 mbm_setup_overflow_handler(d); 450 mbm_setup_overflow_handler(d, MBM_OVERFLOW_INTERVAL);
451 } 451 }
452 452
453 return 0; 453 return 0;
@@ -540,7 +540,7 @@ static void domain_remove_cpu(int cpu, struct rdt_resource *r)
540 } else if (r == &rdt_resources_all[RDT_RESOURCE_L3] && 540 } else if (r == &rdt_resources_all[RDT_RESOURCE_L3] &&
541 cpu == d->mbm_work_cpu && is_mbm_enabled()) { 541 cpu == d->mbm_work_cpu && is_mbm_enabled()) {
542 cancel_delayed_work(&d->mbm_over); 542 cancel_delayed_work(&d->mbm_over);
543 mbm_setup_overflow_handler(d); 543 mbm_setup_overflow_handler(d, 0);
544 } 544 }
545} 545}
546 546
diff --git a/arch/x86/kernel/cpu/intel_rdt.h b/arch/x86/kernel/cpu/intel_rdt.h
index 4040bf1a075c..3e4869390603 100644
--- a/arch/x86/kernel/cpu/intel_rdt.h
+++ b/arch/x86/kernel/cpu/intel_rdt.h
@@ -422,7 +422,7 @@ void mkdir_mondata_subdir_allrdtgrp(struct rdt_resource *r,
422 struct rdt_domain *d); 422 struct rdt_domain *d);
423void mon_event_read(struct rmid_read *rr, struct rdt_domain *d, 423void mon_event_read(struct rmid_read *rr, struct rdt_domain *d,
424 struct rdtgroup *rdtgrp, int evtid, int first); 424 struct rdtgroup *rdtgrp, int evtid, int first);
425void mbm_setup_overflow_handler(struct rdt_domain *dom); 425void mbm_setup_overflow_handler(struct rdt_domain *dom, unsigned long delay_ms);
426void mbm_handle_overflow(struct work_struct *work); 426void mbm_handle_overflow(struct work_struct *work);
427 427
428#endif /* _ASM_X86_INTEL_RDT_H */ 428#endif /* _ASM_X86_INTEL_RDT_H */
diff --git a/arch/x86/kernel/cpu/intel_rdt_monitor.c b/arch/x86/kernel/cpu/intel_rdt_monitor.c
index d6bfdfd22abe..8378785883dc 100644
--- a/arch/x86/kernel/cpu/intel_rdt_monitor.c
+++ b/arch/x86/kernel/cpu/intel_rdt_monitor.c
@@ -417,9 +417,9 @@ out_unlock:
417 mutex_unlock(&rdtgroup_mutex); 417 mutex_unlock(&rdtgroup_mutex);
418} 418}
419 419
420void mbm_setup_overflow_handler(struct rdt_domain *dom) 420void mbm_setup_overflow_handler(struct rdt_domain *dom, unsigned long delay_ms)
421{ 421{
422 unsigned long delay = msecs_to_jiffies(MBM_OVERFLOW_INTERVAL); 422 unsigned long delay = msecs_to_jiffies(delay_ms);
423 int cpu; 423 int cpu;
424 424
425 if (!static_branch_likely(&rdt_enable_key)) 425 if (!static_branch_likely(&rdt_enable_key))
diff --git a/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c b/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c
index 86a69794d7e4..b529f93e8ed0 100644
--- a/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c
+++ b/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c
@@ -1140,7 +1140,7 @@ static struct dentry *rdt_mount(struct file_system_type *fs_type,
1140 if (is_mbm_enabled()) { 1140 if (is_mbm_enabled()) {
1141 r = &rdt_resources_all[RDT_RESOURCE_L3]; 1141 r = &rdt_resources_all[RDT_RESOURCE_L3];
1142 list_for_each_entry(dom, &r->domains, list) 1142 list_for_each_entry(dom, &r->domains, list)
1143 mbm_setup_overflow_handler(dom); 1143 mbm_setup_overflow_handler(dom, MBM_OVERFLOW_INTERVAL);
1144 } 1144 }
1145 1145
1146 goto out; 1146 goto out;