From: Mark Rutland Date: Thu, 12 Apr 2018 11:11:07 +0000 (+0100) Subject: arm64: cpufeature: __this_cpu_has_cap() shouldn't stop early X-Git-Tag: khadas-vims-v0.9.6-release~2058 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=484099ffe906e4db78bae538c217c226ac3cdee7;p=platform%2Fkernel%2Flinux-amlogic.git arm64: cpufeature: __this_cpu_has_cap() shouldn't stop early PD#166068: arm64: cpufeature: __this_cpu_has_cap() shouldn't stop early From: James Morse Fix CPU-hotplug fail to bringup issue once stopped CPU. commit edf298cfce47ab7279d03b5203ae2ef3a58e49db upstream. this_cpu_has_cap() tests caps->desc not caps->matches, so it stops walking the list when it finds a 'silent' feature, instead of walking to the end of the list. Prior to v4.6's 644c2ae198412 ("arm64: cpufeature: Test 'matches' pointer to find the end of the list") we always tested desc to find the end of a capability list. This was changed for dubious things like PAN_NOT_UAO. v4.7's e3661b128e53e ("arm64: Allow a capability to be checked on single CPU") added this_cpu_has_cap() using the old desc style test. Change-Id: I29788b05eb636de777de5d4f423097804d465a7b CC: Suzuki K Poulose Reviewed-by: Suzuki K Poulose Acked-by: Marc Zyngier Signed-off-by: James Morse Signed-off-by: Catalin Marinas Signed-off-by: Mark Rutland [v4.9 backport] Tested-by: Greg Hackmann Signed-off-by: Greg Kroah-Hartman Signed-off-by: Yixun Lan --- diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c index 08344c9..0274745 100644 --- a/arch/arm64/kernel/cpufeature.c +++ b/arch/arm64/kernel/cpufeature.c @@ -1026,9 +1026,8 @@ static bool __this_cpu_has_cap(const struct arm64_cpu_capabilities *cap_array, if (WARN_ON(preemptible())) return false; - for (caps = cap_array; caps->desc; caps++) + for (caps = cap_array; caps->matches; caps++) if (caps->capability == cap && - caps->matches && caps->matches(caps, SCOPE_LOCAL_CPU)) return true; return false;