Skip to content

Commit c12a29e

Browse files
committed
Merge tag 'sched-urgent-2021-05-15' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull scheduler fixes from Ingo Molnar: "Fix an idle CPU selection bug, and an AMD Ryzen maximum frequency enumeration bug" * tag 'sched-urgent-2021-05-15' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: x86, sched: Fix the AMD CPPC maximum performance value on certain AMD Ryzen generations sched/fair: Fix clearing of has_idle_cores flag in select_idle_cpu()
2 parents e7c425b + 3743d55 commit c12a29e

File tree

5 files changed

+25
-3
lines changed

5 files changed

+25
-3
lines changed

arch/x86/include/asm/processor.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -787,8 +787,10 @@ DECLARE_PER_CPU(u64, msr_misc_features_shadow);
787787

788788
#ifdef CONFIG_CPU_SUP_AMD
789789
extern u32 amd_get_nodes_per_socket(void);
790+
extern u32 amd_get_highest_perf(void);
790791
#else
791792
static inline u32 amd_get_nodes_per_socket(void) { return 0; }
793+
static inline u32 amd_get_highest_perf(void) { return 0; }
792794
#endif
793795

794796
static inline uint32_t hypervisor_cpuid_base(const char *sig, uint32_t leaves)

arch/x86/kernel/cpu/amd.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1165,3 +1165,19 @@ void set_dr_addr_mask(unsigned long mask, int dr)
11651165
break;
11661166
}
11671167
}
1168+
1169+
u32 amd_get_highest_perf(void)
1170+
{
1171+
struct cpuinfo_x86 *c = &boot_cpu_data;
1172+
1173+
if (c->x86 == 0x17 && ((c->x86_model >= 0x30 && c->x86_model < 0x40) ||
1174+
(c->x86_model >= 0x70 && c->x86_model < 0x80)))
1175+
return 166;
1176+
1177+
if (c->x86 == 0x19 && ((c->x86_model >= 0x20 && c->x86_model < 0x30) ||
1178+
(c->x86_model >= 0x40 && c->x86_model < 0x70)))
1179+
return 166;
1180+
1181+
return 255;
1182+
}
1183+
EXPORT_SYMBOL_GPL(amd_get_highest_perf);

arch/x86/kernel/smpboot.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2043,7 +2043,7 @@ static bool amd_set_max_freq_ratio(void)
20432043
return false;
20442044
}
20452045

2046-
highest_perf = perf_caps.highest_perf;
2046+
highest_perf = amd_get_highest_perf();
20472047
nominal_perf = perf_caps.nominal_perf;
20482048

20492049
if (!highest_perf || !nominal_perf) {

drivers/cpufreq/acpi-cpufreq.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -646,7 +646,11 @@ static u64 get_max_boost_ratio(unsigned int cpu)
646646
return 0;
647647
}
648648

649-
highest_perf = perf_caps.highest_perf;
649+
if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD)
650+
highest_perf = amd_get_highest_perf();
651+
else
652+
highest_perf = perf_caps.highest_perf;
653+
650654
nominal_perf = perf_caps.nominal_perf;
651655

652656
if (!highest_perf || !nominal_perf) {

kernel/sched/fair.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6217,7 +6217,7 @@ static int select_idle_cpu(struct task_struct *p, struct sched_domain *sd, bool
62176217
}
62186218

62196219
if (has_idle_core)
6220-
set_idle_cores(this, false);
6220+
set_idle_cores(target, false);
62216221

62226222
if (sched_feat(SIS_PROP) && !has_idle_core) {
62236223
time = cpu_clock(this) - time;

0 commit comments

Comments
 (0)