All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Rutland <mark.rutland@arm.com>
To: Thomas Renninger <trenn@suse.de>
Cc: linux-kernel@vger.kernel.org, gregkh@linuxfoundation.org,
	linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux@armlinux.org.uk, will.deacon@arm.com, x86@kernel.org,
	fschnitzlein@suse.de
Subject: Re: [PATCH v5 0/3] sysfs: add sysfs based cpuinfo
Date: Fri, 6 Dec 2019 18:16:56 +0000	[thread overview]
Message-ID: <20191206181655.GA35318@lakrids.cambridge.arm.com> (raw)
In-Reply-To: <2898795.Dnvf4huJ59@skinner.arch.suse.de>

On Fri, Dec 06, 2019 at 06:29:39PM +0100, Thomas Renninger wrote:
> On Friday, December 6, 2019 5:58:03 PM CET Mark Rutland wrote:
> > On Fri, Dec 06, 2019 at 05:24:18PM +0100, Thomas Renninger wrote:

> > For arm64 we already expose the MIDR and REVIDR register values under
> > /sys/devices/system/cpu/cpu*/regs/identification, and that's the bulk of
> > the useful information above
> 
> I'd like to come up with an extra CONFIG which parses:
> 
> arch/arm64/include/asm/cputype.h:
> 
> #define ARM_CPU_PART_AEM_V8             0xD0F
> #define ARM_CPU_PART_FOUNDATION         0xD00
> #define ARM_CPU_PART_CORTEX_A57         0xD07
> #define ARM_CPU_PART_CORTEX_A72         0xD08
> 
> and
> 
> #define ARM_CPU_IMP_ARM                 0x41
> #define ARM_CPU_IMP_APM                 0x50
> #define ARM_CPU_IMP_CAVIUM              0x43
> #define ARM_CPU_IMP_BRCM                0x42
> #define ARM_CPU_IMP_QCOM                0x51
> #define ARM_CPU_IMP_NVIDIA              0x4E
> 
> and converts the defines to strings, same as here:

A similar approach for /proc/cpuinfo has been NAK'd repeatedly in the
past. While some arguments against that don't apply here, I don't think
that we want to have to maintain an ever-growing list of strings that
end up being ABI which we cannot manage in a forwards-compatible manner.

When it is necessary to reliably and unambiguously identify a CPU, it'll
always end up being necessary to look at the MIDR (and possibly REVIDR),
so that's what applications should always do, and it's what users will
necessarily have to do when the kernel doesn't have a string for a CPU,
as is the case for all existing kernels.

I don't think that in-kernel stringification of the MIDR is a good idea,
and I would suggest not wasting your time on that.

Thanks,
Mark.

WARNING: multiple messages have this Message-ID (diff)
From: Mark Rutland <mark.rutland@arm.com>
To: Thomas Renninger <trenn@suse.de>
Cc: linux-arch@vger.kernel.org, gregkh@linuxfoundation.org,
	x86@kernel.org, will.deacon@arm.com,
	linux-kernel@vger.kernel.org, linux@armlinux.org.uk,
	fschnitzlein@suse.de, linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v5 0/3] sysfs: add sysfs based cpuinfo
Date: Fri, 6 Dec 2019 18:16:56 +0000	[thread overview]
Message-ID: <20191206181655.GA35318@lakrids.cambridge.arm.com> (raw)
In-Reply-To: <2898795.Dnvf4huJ59@skinner.arch.suse.de>

On Fri, Dec 06, 2019 at 06:29:39PM +0100, Thomas Renninger wrote:
> On Friday, December 6, 2019 5:58:03 PM CET Mark Rutland wrote:
> > On Fri, Dec 06, 2019 at 05:24:18PM +0100, Thomas Renninger wrote:

> > For arm64 we already expose the MIDR and REVIDR register values under
> > /sys/devices/system/cpu/cpu*/regs/identification, and that's the bulk of
> > the useful information above
> 
> I'd like to come up with an extra CONFIG which parses:
> 
> arch/arm64/include/asm/cputype.h:
> 
> #define ARM_CPU_PART_AEM_V8             0xD0F
> #define ARM_CPU_PART_FOUNDATION         0xD00
> #define ARM_CPU_PART_CORTEX_A57         0xD07
> #define ARM_CPU_PART_CORTEX_A72         0xD08
> 
> and
> 
> #define ARM_CPU_IMP_ARM                 0x41
> #define ARM_CPU_IMP_APM                 0x50
> #define ARM_CPU_IMP_CAVIUM              0x43
> #define ARM_CPU_IMP_BRCM                0x42
> #define ARM_CPU_IMP_QCOM                0x51
> #define ARM_CPU_IMP_NVIDIA              0x4E
> 
> and converts the defines to strings, same as here:

A similar approach for /proc/cpuinfo has been NAK'd repeatedly in the
past. While some arguments against that don't apply here, I don't think
that we want to have to maintain an ever-growing list of strings that
end up being ABI which we cannot manage in a forwards-compatible manner.

When it is necessary to reliably and unambiguously identify a CPU, it'll
always end up being necessary to look at the MIDR (and possibly REVIDR),
so that's what applications should always do, and it's what users will
necessarily have to do when the kernel doesn't have a string for a CPU,
as is the case for all existing kernels.

I don't think that in-kernel stringification of the MIDR is a good idea,
and I would suggest not wasting your time on that.

Thanks,
Mark.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2019-12-06 18:17 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-06 16:24 [PATCH v5 0/3] sysfs: add sysfs based cpuinfo Thomas Renninger
2019-12-06 16:24 ` Thomas Renninger
2019-12-06 16:24 ` [PATCH 1/3] cpuinfo: add sysfs based arch independent cpuinfo framework Thomas Renninger
2019-12-06 16:24   ` Thomas Renninger
2019-12-06 16:33   ` Greg KH
2019-12-06 16:33     ` Greg KH
2019-12-06 16:33     ` Greg KH
2019-12-06 16:56   ` Randy Dunlap
2019-12-06 16:56     ` Randy Dunlap
2019-12-06 16:56     ` Randy Dunlap
2019-12-06 16:24 ` [PATCH 2/3] x86 cpuinfo: implement sysfs nodes for x86 Thomas Renninger
2019-12-06 16:24   ` Thomas Renninger
2019-12-06 16:36   ` Greg KH
2019-12-06 16:36     ` Greg KH
2019-12-10 20:48     ` Thomas Gleixner
2019-12-10 20:48       ` Thomas Gleixner
2019-12-10 20:53       ` Greg KH
2019-12-10 20:53         ` Greg KH
2019-12-11 10:42       ` Thomas Renninger
2019-12-11 10:42         ` Thomas Renninger
2019-12-11 13:56         ` Greg KH
2019-12-11 13:56           ` Greg KH
2019-12-11 14:12           ` Thomas Renninger
2019-12-11 14:12             ` Thomas Renninger
2019-12-11 14:26             ` Greg KH
2019-12-11 14:26               ` Greg KH
2019-12-11 14:52               ` Thomas Renninger
2019-12-11 14:52                 ` Thomas Renninger
2019-12-11 14:57                 ` Greg KH
2019-12-11 14:57                   ` Greg KH
2019-12-06 16:24 ` [PATCH 3/3] arm64 cpuinfo: implement sysfs nodes for arm64 Thomas Renninger
2019-12-06 16:24   ` Thomas Renninger
2019-12-06 16:37   ` Greg KH
2019-12-06 16:37     ` Greg KH
2019-12-09 10:31   ` Will Deacon
2019-12-09 10:31     ` Will Deacon
2019-12-09 11:28     ` Thomas Renninger
2019-12-09 11:28       ` Thomas Renninger
2019-12-09 17:38       ` Will Deacon
2019-12-09 17:38         ` Will Deacon
2019-12-10 13:33         ` Thomas Renninger
2019-12-10 13:33           ` Thomas Renninger
2019-12-10 14:47           ` Greg KH
2019-12-10 14:47             ` Greg KH
2019-12-10 16:24             ` Thomas Renninger
2019-12-10 16:24               ` Thomas Renninger
2019-12-06 16:58 ` [PATCH v5 0/3] sysfs: add sysfs based cpuinfo Mark Rutland
2019-12-06 16:58   ` Mark Rutland
2019-12-06 17:29   ` Thomas Renninger
2019-12-06 17:29     ` Thomas Renninger
2019-12-06 18:16     ` Mark Rutland [this message]
2019-12-06 18:16       ` Mark Rutland

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=20191206181655.GA35318@lakrids.cambridge.arm.com \
    --to=mark.rutland@arm.com \
    --cc=fschnitzlein@suse.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=trenn@suse.de \
    --cc=will.deacon@arm.com \
    --cc=x86@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.