From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.6 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4ED72C55179 for ; Thu, 29 Oct 2020 00:57:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 07C7A20747 for ; Thu, 29 Oct 2020 00:57:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603933053; bh=3GDju+YyeSHmZOlUL8Quu28K0NFYnWoAlVT8urBXKzo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:List-ID:From; b=eRBXHWb7JlSZPEeMfuDUOVkbeAsNsQV/mlsg8vZoLDJiSPVHAz4PmoCbCFySH2dnh 7O5Yh/Wj8GDPnFhBxYfK+YtacB3+zKymYfDfENMUbL5DBlk7dkszkJCG3/F0YZ20rc 4aAKfcV32CYIxfwN4r1XotVuqo1S1XMJvPb/LUu8= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727983AbgJ2A5c (ORCPT ); Wed, 28 Oct 2020 20:57:32 -0400 Received: from mail.kernel.org ([198.145.29.99]:60522 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731603AbgJ1WRf (ORCPT ); Wed, 28 Oct 2020 18:17:35 -0400 Received: from willie-the-truck (236.31.169.217.in-addr.arpa [217.169.31.236]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7A1B82469F; Wed, 28 Oct 2020 09:51:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603878702; bh=3GDju+YyeSHmZOlUL8Quu28K0NFYnWoAlVT8urBXKzo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Ptcjspj/0/gtfIy/P6pjg0Gm0+c/EMz0VKZtzjNxGaFanOdum6jhky0cuaSA40IA/ mKMZDfH4pwP1JQONI5Ma0m2rni6wkUrnOMnGO2a5+A/1LTNn4tiwBQYj9JwxJ+6dOL 0JXKnZzjsWAHCxD+kz7Mlswf2f0beNDhBTYwJZx0= Date: Wed, 28 Oct 2020 09:51:36 +0000 From: Will Deacon To: Greg Kroah-Hartman Cc: linux-arm-kernel@lists.infradead.org, linux-arch@vger.kernel.org, Catalin Marinas , Marc Zyngier , Peter Zijlstra , Morten Rasmussen , Qais Yousef , Suren Baghdasaryan , kernel-team@android.com Subject: Re: [PATCH 5/6] arm64: Advertise CPUs capable of running 32-bit applcations in sysfs Message-ID: <20201028095136.GA27796@willie-the-truck> References: <20201027215118.27003-1-will@kernel.org> <20201027215118.27003-6-will@kernel.org> <20201028083746.GA1854746@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201028083746.GA1854746@kroah.com> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-arch@vger.kernel.org On Wed, Oct 28, 2020 at 09:37:46AM +0100, Greg Kroah-Hartman wrote: > On Tue, Oct 27, 2020 at 09:51:17PM +0000, Will Deacon wrote: > > Since 32-bit applications will be killed if they are caught trying to > > execute on a 64-bit-only CPU in a mismatched system, advertise the set > > of 32-bit capable CPUs to userspace in sysfs. > > > > Signed-off-by: Will Deacon > > --- > > .../ABI/testing/sysfs-devices-system-cpu | 8 ++++++++ > > arch/arm64/kernel/cpufeature.c | 19 +++++++++++++++++++ > > 2 files changed, 27 insertions(+) > > > > diff --git a/Documentation/ABI/testing/sysfs-devices-system-cpu b/Documentation/ABI/testing/sysfs-devices-system-cpu > > index b555df825447..19893fb8e870 100644 > > --- a/Documentation/ABI/testing/sysfs-devices-system-cpu > > +++ b/Documentation/ABI/testing/sysfs-devices-system-cpu > > @@ -472,6 +472,14 @@ Description: AArch64 CPU registers > > 'identification' directory exposes the CPU ID registers for > > identifying model and revision of the CPU. > > > > +What: /sys/devices/system/cpu/aarch32_el0 > > +Date: October 2020 > > +Contact: Linux ARM Kernel Mailing list > > +Description: Identifies the subset of CPUs in the system that can execute > > + AArch32 (32-bit ARM) applications. If absent, then all or none > > + of the CPUs can execute AArch32 applications and execve() will > > + behave accordingly. > > How is this value represented? A hint here would be nice. It's in the same format as /sys/devices/system/cpu/{online,offline,possible,present}, so I'll just say that (although the text for those doesn't seem to specify it either...). > > What: /sys/devices/system/cpu/cpu#/cpu_capacity > > Date: December 2016 > > Contact: Linux kernel mailing list > > diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c > > index 2e2219cbd54c..9f29d4d1ef7e 100644 > > --- a/arch/arm64/kernel/cpufeature.c > > +++ b/arch/arm64/kernel/cpufeature.c > > @@ -67,6 +67,7 @@ > > #include > > #include > > #include > > +#include > > #include > > #include > > #include > > @@ -1236,6 +1237,24 @@ bool system_has_mismatched_32bit_el0(void) > > return fld == ID_AA64PFR0_EL0_64BIT_ONLY; > > } > > > > +static ssize_t aarch32_el0_show(struct kobject *kobj, > > + struct kobj_attribute *attr, char *buf) > > +{ > > + const struct cpumask *mask = system_32bit_el0_cpumask(); > > + return sprintf(buf, "%*pbl\n", cpumask_pr_args(mask)); > > sysfs_emit()? > > And a blank line to make checkpatch.pl happy :) Hehe, yeah ok. > > +} > > +static const struct kobj_attribute aarch32_el0_attr = __ATTR_RO(aarch32_el0); > > DEVICE_ATTR_RO()? > > > + > > +static int __init aarch32_el0_sysfs_init(void) > > +{ > > + if (!__allow_mismatched_32bit_el0) > > + return 0; > > + > > + return sysfs_create_file(&cpu_subsys.dev_root->kobj, > > + &aarch32_el0_attr.attr); > > device_create_file() please, dev_root is a struct device, no need to > "thunk" down to a "raw" sysfs call. Totally missed I had a struct device in my hand, so hopefully that will tidy things up a little bit. Cheers, Will From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A1EEAC388F7 for ; Wed, 28 Oct 2020 09:52:14 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 14070246A2 for ; Wed, 28 Oct 2020 09:52:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="kHHpNcOQ"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="Ptcjspj/" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 14070246A2 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=AMdiXusnHS7pW6Arrx9+sRL7eFHYqigmwspmfuEXpps=; b=kHHpNcOQ9bOl9Ws6LTw34zlsQ bUNFg4I4IOpVNZfUB0vFvhPMEYck+1zLsYuyrQWOu4OJppm4YxPc8dUzWUA/5GM8iMYpMd0QSwf1N zIma4rnMBGq7OFRBxs1co00RkvPmQMLLB4a9UgWnO6sIvY1em8pdDFPuf8Ug8xztrxHfkrM/8RmzT EsajGTvqRbemVBh6CuZaMJSQWEmTF3uazgagvgti+OcJ+639oJg0+vUNrtkLXUWvpBASwp7TwTcZG PWdx0d1ccqq9P/9D0nx3lw+0dzux0SaOkwlExSPgr0UgB2JfK3p/0Io+Bjbwpx3VNc/BOPzerr9X9 QjZx3vgWw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kXi7O-0006qu-6J; Wed, 28 Oct 2020 09:51:46 +0000 Received: from mail.kernel.org ([198.145.29.99]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kXi7L-0006po-CQ for linux-arm-kernel@lists.infradead.org; Wed, 28 Oct 2020 09:51:44 +0000 Received: from willie-the-truck (236.31.169.217.in-addr.arpa [217.169.31.236]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7A1B82469F; Wed, 28 Oct 2020 09:51:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603878702; bh=3GDju+YyeSHmZOlUL8Quu28K0NFYnWoAlVT8urBXKzo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Ptcjspj/0/gtfIy/P6pjg0Gm0+c/EMz0VKZtzjNxGaFanOdum6jhky0cuaSA40IA/ mKMZDfH4pwP1JQONI5Ma0m2rni6wkUrnOMnGO2a5+A/1LTNn4tiwBQYj9JwxJ+6dOL 0JXKnZzjsWAHCxD+kz7Mlswf2f0beNDhBTYwJZx0= Date: Wed, 28 Oct 2020 09:51:36 +0000 From: Will Deacon To: Greg Kroah-Hartman Subject: Re: [PATCH 5/6] arm64: Advertise CPUs capable of running 32-bit applcations in sysfs Message-ID: <20201028095136.GA27796@willie-the-truck> References: <20201027215118.27003-1-will@kernel.org> <20201027215118.27003-6-will@kernel.org> <20201028083746.GA1854746@kroah.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20201028083746.GA1854746@kroah.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201028_055143_732662_9A55A9EF X-CRM114-Status: GOOD ( 25.95 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arch@vger.kernel.org, kernel-team@android.com, Peter Zijlstra , Catalin Marinas , Qais Yousef , Marc Zyngier , Suren Baghdasaryan , Morten Rasmussen , linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, Oct 28, 2020 at 09:37:46AM +0100, Greg Kroah-Hartman wrote: > On Tue, Oct 27, 2020 at 09:51:17PM +0000, Will Deacon wrote: > > Since 32-bit applications will be killed if they are caught trying to > > execute on a 64-bit-only CPU in a mismatched system, advertise the set > > of 32-bit capable CPUs to userspace in sysfs. > > > > Signed-off-by: Will Deacon > > --- > > .../ABI/testing/sysfs-devices-system-cpu | 8 ++++++++ > > arch/arm64/kernel/cpufeature.c | 19 +++++++++++++++++++ > > 2 files changed, 27 insertions(+) > > > > diff --git a/Documentation/ABI/testing/sysfs-devices-system-cpu b/Documentation/ABI/testing/sysfs-devices-system-cpu > > index b555df825447..19893fb8e870 100644 > > --- a/Documentation/ABI/testing/sysfs-devices-system-cpu > > +++ b/Documentation/ABI/testing/sysfs-devices-system-cpu > > @@ -472,6 +472,14 @@ Description: AArch64 CPU registers > > 'identification' directory exposes the CPU ID registers for > > identifying model and revision of the CPU. > > > > +What: /sys/devices/system/cpu/aarch32_el0 > > +Date: October 2020 > > +Contact: Linux ARM Kernel Mailing list > > +Description: Identifies the subset of CPUs in the system that can execute > > + AArch32 (32-bit ARM) applications. If absent, then all or none > > + of the CPUs can execute AArch32 applications and execve() will > > + behave accordingly. > > How is this value represented? A hint here would be nice. It's in the same format as /sys/devices/system/cpu/{online,offline,possible,present}, so I'll just say that (although the text for those doesn't seem to specify it either...). > > What: /sys/devices/system/cpu/cpu#/cpu_capacity > > Date: December 2016 > > Contact: Linux kernel mailing list > > diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c > > index 2e2219cbd54c..9f29d4d1ef7e 100644 > > --- a/arch/arm64/kernel/cpufeature.c > > +++ b/arch/arm64/kernel/cpufeature.c > > @@ -67,6 +67,7 @@ > > #include > > #include > > #include > > +#include > > #include > > #include > > #include > > @@ -1236,6 +1237,24 @@ bool system_has_mismatched_32bit_el0(void) > > return fld == ID_AA64PFR0_EL0_64BIT_ONLY; > > } > > > > +static ssize_t aarch32_el0_show(struct kobject *kobj, > > + struct kobj_attribute *attr, char *buf) > > +{ > > + const struct cpumask *mask = system_32bit_el0_cpumask(); > > + return sprintf(buf, "%*pbl\n", cpumask_pr_args(mask)); > > sysfs_emit()? > > And a blank line to make checkpatch.pl happy :) Hehe, yeah ok. > > +} > > +static const struct kobj_attribute aarch32_el0_attr = __ATTR_RO(aarch32_el0); > > DEVICE_ATTR_RO()? > > > + > > +static int __init aarch32_el0_sysfs_init(void) > > +{ > > + if (!__allow_mismatched_32bit_el0) > > + return 0; > > + > > + return sysfs_create_file(&cpu_subsys.dev_root->kobj, > > + &aarch32_el0_attr.attr); > > device_create_file() please, dev_root is a struct device, no need to > "thunk" down to a "raw" sysfs call. Totally missed I had a struct device in my hand, so hopefully that will tidy things up a little bit. Cheers, Will _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel