From: Suzuki K Poulose <suzuki.poulose@arm.com>
To: amit.kachhap@arm.com, linux-arm-kernel@lists.infradead.org
Cc: mark.rutland@arm.com, keescook@chromium.org,
catalin.marinas@arm.com, kristina.martsenko@arm.com,
dave.martin@arm.com, broonie@kernel.org, james.morse@arm.com,
ramana.radhakrishnan@arm.com, Vincenzo.Frascino@arm.com,
will@kernel.org, ardb@kernel.org
Subject: Re: [PATCH v4 01/17] arm64: cpufeature: Fix meta-capability cpufeature check
Date: Thu, 23 Jan 2020 23:07:16 +0000 [thread overview]
Message-ID: <13e3aa5c-a7e8-69be-3bbe-006d0c43fb8b@arm.com> (raw)
In-Reply-To: <1579774839-19562-2-git-send-email-amit.kachhap@arm.com>
Hi Amit
On 01/23/2020 10:20 AM, Amit Daniel Kachhap wrote:
> Some existing meta cpucaps match needs the presence of individual
> cpucaps. Currently the individual cpucaps checks it via an array
> based flag and this introduces dependency on the array entry order.
> This limitation exists only for system scope cpufeature.
>
> This patch introduces a helper function (system_has_cap) to invoke
> the matching handler for system scope. This is similar to the
> existing helper function (this_cpu_has_cap) for local cpu scope.
It is similar (in name, see more on that below) but this must be limited
to very narrow "window" where :
- We have the system wide safe registers set with all the SMP CPUs
*and*
- The SYSTEM_FEATURE cpu_hwcaps may not have been set.
The normal users must continue to use the existing
cpus_have_{const_}cap() helper(s).
>
> Use this new helper function for an existing meta cpucaps.
>
> Suggested-by: Catalin Marinas <catalin.marinas@arm.com>
> Signed-off-by: Amit Daniel Kachhap <amit.kachhap@arm.com>
> ---
> Changes since v3:
> * New patch.
> * This is added as suggested by Catalin [1] to avoid the array entry order
> dependency.
> * A new helper system_has_cap is added.
>
> [1]: http://lists.infradead.org/pipermail/linux-arm-kernel/2020-January/705845.html
>
> arch/arm64/include/asm/cpufeature.h | 1 +
> arch/arm64/kernel/cpufeature.c | 13 ++++++++++++-
> 2 files changed, 13 insertions(+), 1 deletion(-)
>
> diff --git a/arch/arm64/include/asm/cpufeature.h b/arch/arm64/include/asm/cpufeature.h
> index 4261d55..695e538 100644
> --- a/arch/arm64/include/asm/cpufeature.h
> +++ b/arch/arm64/include/asm/cpufeature.h
> @@ -382,6 +382,7 @@ extern DECLARE_BITMAP(boot_capabilities, ARM64_NPATCHABLE);
> for_each_set_bit(cap, cpu_hwcaps, ARM64_NCAPS)
>
> bool this_cpu_has_cap(unsigned int cap);
> +bool system_has_cap(unsigned int cap);
You don't need this.
> void cpu_set_feature(unsigned int num);
> bool cpu_have_feature(unsigned int num);
> unsigned long cpu_get_elf_hwcap(void);
> diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c
> index 04cf64e..74d6c13 100644
> --- a/arch/arm64/kernel/cpufeature.c
> +++ b/arch/arm64/kernel/cpufeature.c
> @@ -2008,6 +2008,17 @@ bool this_cpu_has_cap(unsigned int n)
> return false;
> }
>
> +bool system_has_cap(unsigned int n)
> +{
nit: This could be made static for now.
More importantly, the name is very much similar to "cap" specific
wrappers, e.g, system_has_fpsimd() etc, which could create a confusion
and make people use this instead of the "cpus_have_cap() or
cpus_have_const_cap()". It would be a good idea to make this explicitly
look like an internal helper.
e.g:
__system_matches_cap() to avoid abusing this helper.
Otherwise looks good to me.
Suzuki
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2020-01-23 23:03 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-23 10:20 [PATCH v4 00/17] arm64: return address signing Amit Daniel Kachhap
2020-01-23 10:20 ` [PATCH v4 01/17] arm64: cpufeature: Fix meta-capability cpufeature check Amit Daniel Kachhap
2020-01-23 23:07 ` Suzuki K Poulose [this message]
2020-01-24 11:58 ` Amit Kachhap
2020-01-23 10:20 ` [PATCH v4 02/17] arm64: cpufeature: add pointer auth meta-capabilities Amit Daniel Kachhap
2020-01-23 10:20 ` [PATCH v4 03/17] arm64: rename ptrauth key structures to be user-specific Amit Daniel Kachhap
2020-01-23 10:20 ` [PATCH v4 04/17] arm64: install user ptrauth keys at kernel exit time Amit Daniel Kachhap
2020-01-23 10:20 ` [PATCH v4 05/17] arm64: create macro to park cpu in an infinite loop Amit Daniel Kachhap
2020-01-23 10:20 ` [PATCH v4 06/17] arm64: ptrauth: Add bootup/runtime flags for __cpu_setup Amit Daniel Kachhap
2020-01-23 10:20 ` [PATCH v4 07/17] arm64: cpufeature: handle conflicts based on capability Amit Daniel Kachhap
2020-01-23 10:20 ` [PATCH v4 08/17] arm64: enable ptrauth earlier Amit Daniel Kachhap
2020-01-23 10:20 ` [PATCH v4 09/17] arm64: initialize and switch ptrauth kernel keys Amit Daniel Kachhap
2020-01-23 10:20 ` [PATCH v4 10/17] arm64: initialize ptrauth keys for kernel booting task Amit Daniel Kachhap
2020-01-23 10:20 ` [PATCH v4 11/17] arm64: mask PAC bits of __builtin_return_address Amit Daniel Kachhap
2020-01-23 10:20 ` [PATCH v4 12/17] arm64: unwind: strip PAC from kernel addresses Amit Daniel Kachhap
2020-01-23 10:20 ` [PATCH v4 13/17] arm64: __show_regs: strip PAC from lr in printk Amit Daniel Kachhap
2020-01-23 10:20 ` [PATCH v4 14/17] arm64: suspend: restore the kernel ptrauth keys Amit Daniel Kachhap
2020-01-23 10:20 ` [PATCH v4 15/17] kconfig: Add support for 'as-option' Amit Daniel Kachhap
2020-01-23 10:30 ` Ard Biesheuvel
2020-01-23 10:52 ` Vincenzo Frascino
2020-01-26 14:45 ` Masahiro Yamada
2020-01-27 9:33 ` Vincenzo Frascino
2020-01-23 10:20 ` [PATCH v4 16/17] arm64: compile the kernel with ptrauth return address signing Amit Daniel Kachhap
2020-01-23 10:20 ` [PATCH v4 17/17] lkdtm: arm64: test kernel pointer authentication Amit Daniel Kachhap
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=13e3aa5c-a7e8-69be-3bbe-006d0c43fb8b@arm.com \
--to=suzuki.poulose@arm.com \
--cc=Vincenzo.Frascino@arm.com \
--cc=amit.kachhap@arm.com \
--cc=ardb@kernel.org \
--cc=broonie@kernel.org \
--cc=catalin.marinas@arm.com \
--cc=dave.martin@arm.com \
--cc=james.morse@arm.com \
--cc=keescook@chromium.org \
--cc=kristina.martsenko@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=mark.rutland@arm.com \
--cc=ramana.radhakrishnan@arm.com \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).