Skip to content

Commit

Permalink
x86/intel_rdt/mbm: Fix MBM overflow handler during CPU hotplug
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Vikas Shivappa authored and Thomas Gleixner committed Aug 16, 2017
1 parent a9110b5 commit bbc4615
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions arch/x86/kernel/cpu/intel_rdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ static int domain_setup_mon_state(struct rdt_resource *r, struct rdt_domain *d)

if (is_mbm_enabled()) {
INIT_DELAYED_WORK(&d->mbm_over, mbm_handle_overflow);
mbm_setup_overflow_handler(d);
mbm_setup_overflow_handler(d, MBM_OVERFLOW_INTERVAL);
}

return 0;
Expand Down Expand Up @@ -540,7 +540,7 @@ static void domain_remove_cpu(int cpu, struct rdt_resource *r)
} else if (r == &rdt_resources_all[RDT_RESOURCE_L3] &&
cpu == d->mbm_work_cpu && is_mbm_enabled()) {
cancel_delayed_work(&d->mbm_over);
mbm_setup_overflow_handler(d);
mbm_setup_overflow_handler(d, 0);
}
}

Expand Down
2 changes: 1 addition & 1 deletion arch/x86/kernel/cpu/intel_rdt.h
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ void mkdir_mondata_subdir_allrdtgrp(struct rdt_resource *r,
struct rdt_domain *d);
void mon_event_read(struct rmid_read *rr, struct rdt_domain *d,
struct rdtgroup *rdtgrp, int evtid, int first);
void mbm_setup_overflow_handler(struct rdt_domain *dom);
void mbm_setup_overflow_handler(struct rdt_domain *dom, unsigned long delay_ms);
void mbm_handle_overflow(struct work_struct *work);

#endif /* _ASM_X86_INTEL_RDT_H */
4 changes: 2 additions & 2 deletions arch/x86/kernel/cpu/intel_rdt_monitor.c
Original file line number Diff line number Diff line change
Expand Up @@ -417,9 +417,9 @@ void mbm_handle_overflow(struct work_struct *work)
mutex_unlock(&rdtgroup_mutex);
}

void mbm_setup_overflow_handler(struct rdt_domain *dom)
void mbm_setup_overflow_handler(struct rdt_domain *dom, unsigned long delay_ms)
{
unsigned long delay = msecs_to_jiffies(MBM_OVERFLOW_INTERVAL);
unsigned long delay = msecs_to_jiffies(delay_ms);
int cpu;

if (!static_branch_likely(&rdt_enable_key))
Expand Down
2 changes: 1 addition & 1 deletion arch/x86/kernel/cpu/intel_rdt_rdtgroup.c
Original file line number Diff line number Diff line change
Expand Up @@ -1140,7 +1140,7 @@ static struct dentry *rdt_mount(struct file_system_type *fs_type,
if (is_mbm_enabled()) {
r = &rdt_resources_all[RDT_RESOURCE_L3];
list_for_each_entry(dom, &r->domains, list)
mbm_setup_overflow_handler(dom);
mbm_setup_overflow_handler(dom, MBM_OVERFLOW_INTERVAL);
}

goto out;
Expand Down

0 comments on commit bbc4615

Please sign in to comment.