mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-28 11:18:45 +07:00
11ea68f553
The affinity of managed interrupts is completely handled in the kernel and cannot be changed via the /proc/irq/* interfaces from user space. As the kernel tries to spread out interrupts evenly accross CPUs on x86 to prevent vector exhaustion, it can happen that a managed interrupt whose affinity mask contains both isolated and housekeeping CPUs is routed to an isolated CPU. As a consequence IO submitted on a housekeeping CPU causes interrupts on the isolated CPU. Add a new sub-parameter 'managed_irq' for 'isolcpus' and the corresponding logic in the interrupt affinity selection code. The subparameter indicates to the interrupt affinity selection logic that it should try to avoid the above scenario. This isolation is best effort and only effective if the automatically assigned interrupt mask of a device queue contains isolated and housekeeping CPUs. If housekeeping CPUs are online then such interrupts are directed to the housekeeping CPU so that IO submitted on the housekeeping CPU cannot disturb the isolated CPU. If a queue's affinity mask contains only isolated CPUs then this parameter has no effect on the interrupt routing decision, though interrupts are only happening when tasks running on those isolated CPUs submit IO. IO submitted on housekeeping CPUs has no influence on those queues. If the affinity mask contains both housekeeping and isolated CPUs, but none of the contained housekeeping CPUs is online, then the interrupt is also routed to an isolated CPU. Interrupts are only delivered when one of the isolated CPUs in the affinity mask submits IO. If one of the contained housekeeping CPUs comes online, the CPU hotplug logic migrates the interrupt automatically back to the upcoming housekeeping CPU. Depending on the type of interrupt controller, this can require that at least one interrupt is delivered to the isolated CPU in order to complete the migration. [ tglx: Removed unused parameter, added and edited comments/documentation and rephrased the changelog so it contains more details. ] Signed-off-by: Ming Lei <ming.lei@redhat.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Link: https://lore.kernel.org/r/20200120091625.17912-1-ming.lei@redhat.com
60 lines
1.5 KiB
C
60 lines
1.5 KiB
C
#ifndef _LINUX_SCHED_ISOLATION_H
|
|
#define _LINUX_SCHED_ISOLATION_H
|
|
|
|
#include <linux/cpumask.h>
|
|
#include <linux/init.h>
|
|
#include <linux/tick.h>
|
|
|
|
enum hk_flags {
|
|
HK_FLAG_TIMER = 1,
|
|
HK_FLAG_RCU = (1 << 1),
|
|
HK_FLAG_MISC = (1 << 2),
|
|
HK_FLAG_SCHED = (1 << 3),
|
|
HK_FLAG_TICK = (1 << 4),
|
|
HK_FLAG_DOMAIN = (1 << 5),
|
|
HK_FLAG_WQ = (1 << 6),
|
|
HK_FLAG_MANAGED_IRQ = (1 << 7),
|
|
};
|
|
|
|
#ifdef CONFIG_CPU_ISOLATION
|
|
DECLARE_STATIC_KEY_FALSE(housekeeping_overridden);
|
|
extern int housekeeping_any_cpu(enum hk_flags flags);
|
|
extern const struct cpumask *housekeeping_cpumask(enum hk_flags flags);
|
|
extern bool housekeeping_enabled(enum hk_flags flags);
|
|
extern void housekeeping_affine(struct task_struct *t, enum hk_flags flags);
|
|
extern bool housekeeping_test_cpu(int cpu, enum hk_flags flags);
|
|
extern void __init housekeeping_init(void);
|
|
|
|
#else
|
|
|
|
static inline int housekeeping_any_cpu(enum hk_flags flags)
|
|
{
|
|
return smp_processor_id();
|
|
}
|
|
|
|
static inline const struct cpumask *housekeeping_cpumask(enum hk_flags flags)
|
|
{
|
|
return cpu_possible_mask;
|
|
}
|
|
|
|
static inline bool housekeeping_enabled(enum hk_flags flags)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
static inline void housekeeping_affine(struct task_struct *t,
|
|
enum hk_flags flags) { }
|
|
static inline void housekeeping_init(void) { }
|
|
#endif /* CONFIG_CPU_ISOLATION */
|
|
|
|
static inline bool housekeeping_cpu(int cpu, enum hk_flags flags)
|
|
{
|
|
#ifdef CONFIG_CPU_ISOLATION
|
|
if (static_branch_unlikely(&housekeeping_overridden))
|
|
return housekeeping_test_cpu(cpu, flags);
|
|
#endif
|
|
return true;
|
|
}
|
|
|
|
#endif /* _LINUX_SCHED_ISOLATION_H */
|