From patchwork Mon Feb 26 08:19:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Shi X-Patchwork-Id: 129572 Delivered-To: patch@linaro.org Received: by 10.46.66.2 with SMTP id p2csp3356834lja; Mon, 26 Feb 2018 00:23:28 -0800 (PST) X-Google-Smtp-Source: AH8x225+QLfbSB/oSrmP2z68w6JNaHp3C6fgssa5vBew5ThpcibkGdNiG/PlwueOGRn4KkH0BTWg X-Received: by 2002:a17:902:968b:: with SMTP id n11-v6mr9837930plp.168.1519633408090; Mon, 26 Feb 2018 00:23:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519633408; cv=none; d=google.com; s=arc-20160816; b=tJbcBJlKVLkEnHIwWetmhxrVgn6HEbeouKMlVfR0zf9+Z7hyb434v2C38zMFarY5qO kMbCkdH7T9WfW/yBK1YbnePel0VPAysCGnEJP3rtnTHTSPM9xT1gn6a+F5RXcMLqckhY VD/9TL+iIJx+TeBDHyix7neaHaIJjx3kb3q17C3NztArWyO6ltDQvPTVwjJZK3b51eoi BwLlhJQ06L2UQZW04cQQykpjXFTEJuPakyxlN9nP4xmePdf58Ms9bTO3WOBxU6n691wb f0b92kiN1VLch56UJhI6nLUWL/OA8w4TuoDvZ83Yf2gErw476fdw0l5AHi2W/6XFAVTB yPqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=XfV6Yv3SjvB5RVvJ7haGkLOWLK58ZxDQcMshzGS5NdQ=; b=hmsFSGPn+fffwL0wioAz4/gXVCxiTOHI6LWrmbfagQ7pCBIACutE0ohWXWDBKIyJON 6zMvMF9VFvQoICn6sF6tEdLY3Xcq3SALKoXZLabHggKg+sJ1o29pHI1LeW6Rg+qUD9SC gLCUMH/O+betApqemTyFTqv2K+ZWpAzbNK4PsVB9hUy3+a68dI++fbpTIFdXe+c8LsLD uAWXNvKt/keks2TziFj5nSoLwFYJ28jFEEMXWG+jdLImBnOO1xz8H9fcAaYA8Ah60xIr 5Lx8lOyuNUsN6zq+KUxOvoFet/xsUKtoNjuPyQcWk0oG5+a9y/di29MHcmvfhp1yk3+6 zbVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GUnDuslp; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m12-v6si3738150pll.351.2018.02.26.00.23.27; Mon, 26 Feb 2018 00:23:28 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GUnDuslp; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752531AbeBZIXZ (ORCPT + 28 others); Mon, 26 Feb 2018 03:23:25 -0500 Received: from mail-pg0-f67.google.com ([74.125.83.67]:38561 "EHLO mail-pg0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751793AbeBZIXT (ORCPT ); Mon, 26 Feb 2018 03:23:19 -0500 Received: by mail-pg0-f67.google.com with SMTP id l24so5915022pgc.5 for ; Mon, 26 Feb 2018 00:23:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=XfV6Yv3SjvB5RVvJ7haGkLOWLK58ZxDQcMshzGS5NdQ=; b=GUnDuslpSiChZ+QIgEJzPMtjXw0pn/sfSRH6ZkzKshR10JThMZJJjWh/Zb7/BWrS+U /I68OuzXRLS5btS73LM3MYhwx0Mxltux2/+dOlXJQborMenSXZwjwBfN2CrttmqMVs78 p8WRyf6jWZok/ewRYnJESmK4NpvAdfpUpDgSw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=XfV6Yv3SjvB5RVvJ7haGkLOWLK58ZxDQcMshzGS5NdQ=; b=gNgHVCIp6WtUazM45SHsvtIttT7kGqk+zcf+jprshJFdTvu5IFzDnz5Vw3XtsbKNRb l+oaJAnc6GZLqGlRRZtXtyvmX70iLa4JcCbgEgLof8EHeNgQeSA4vPGzKjPR4Fv8ClOX 63pt3P8shhhjpSTbeKFoXlyFrSWcS1Bz28zJkGUumrm6TTOSyxoB/s7GTLtOPjkuLT4D UAaclTArmeTNZKHhc2tcTagTBDv8Az6q0n0L4zydub5a02YM4NvOyr1qtpaTc4A8r/Cl hN66MAaMAPWFh+7B5wbWSdVztjKTNQapqfcjevzXzoEKrwYsywpcqHEA/XDXK2Z86cle agzQ== X-Gm-Message-State: APf1xPCOqLBlng9E5+mX2EGisL+vlN16HMiF4opxvMmfIgMb6/iYwgay 83QTK0FtGPfTciNTeO7hDhgplA== X-Received: by 10.98.91.5 with SMTP id p5mr9794882pfb.163.1519633399033; Mon, 26 Feb 2018 00:23:19 -0800 (PST) Received: from localhost.localdomain (176.122.172.82.16clouds.com. [176.122.172.82]) by smtp.gmail.com with ESMTPSA id o86sm1422706pfi.87.2018.02.26.00.23.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 26 Feb 2018 00:23:18 -0800 (PST) From: Alex Shi To: Marc Zyngier , Will Deacon , Ard Biesheuvel , Catalin Marinas , stable@vger.kernel.org, linux-arm-kernel@lists.infradead.org (moderated list:ARM64 PORT (AARCH64 ARCHITECTURE)), linux-kernel@vger.kernel.org (open list) Cc: James Morse Subject: [PATCH 18/52] arm64: cpufeature: __this_cpu_has_cap() shouldn't stop early Date: Mon, 26 Feb 2018 16:19:52 +0800 Message-Id: <1519633227-29832-19-git-send-email-alex.shi@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519633227-29832-1-git-send-email-alex.shi@linaro.org> References: <1519633227-29832-1-git-send-email-alex.shi@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: James Morse commit edf298cfce47 upstream. Alex Shi rewrite this commit on func this_cpu_has_cap(). The following commit log is still meaningful. 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. 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: Will Deacon Signed-off-by: Alex Shi --- arch/arm64/include/asm/futex.h | 1 + arch/arm64/kernel/cpufeature.c | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) -- 2.7.4 diff --git a/arch/arm64/include/asm/futex.h b/arch/arm64/include/asm/futex.h index 1943cf6..718140a 100644 --- a/arch/arm64/include/asm/futex.h +++ b/arch/arm64/include/asm/futex.h @@ -20,6 +20,7 @@ #include #include +#include #include diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c index 3a129d4..fcb67e0 100644 --- a/arch/arm64/kernel/cpufeature.c +++ b/arch/arm64/kernel/cpufeature.c @@ -1063,8 +1063,8 @@ bool this_cpu_has_cap(unsigned int cap) if (WARN_ON(preemptible())) return false; - for (caps = arm64_features; caps->desc; caps++) - if (caps->capability == cap && caps->matches) + for (caps = arm64_features; caps->matches; caps++) + if (caps->capability == cap) return caps->matches(caps, SCOPE_LOCAL_CPU); return false;