public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Petr Vorel <pvorel@suse.cz>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	David Sterba <dsterba@suse.com>
Subject: Re: [PATCH v2 1/1] drivers/base/cpu: Print kernel arch
Date: Fri, 29 Jul 2022 14:53:44 +0200	[thread overview]
Message-ID: <YuPYWLD7xxcNmuCx@pevik> (raw)
In-Reply-To: <20220729125141.12786-1-pvorel@suse.cz>

Hi all,

> Print the machine hardware name (UTS_MACHINE) in /proc/sys/kernel/arch.

> This helps people who debug kernel with initramfs with minimal
> environment (i.e. without coreutils or even busybox) or allow to open
> sysfs file instead of run 'uname -m' in high level languages.

> Signed-off-by: Petr Vorel <pvorel@suse.cz>
> ---

Changes v1->v2:
* Add file into /proc/sys/kernel/ (previously it was in
  /sys/devices/system/cpu/). There are 
* Update Documentation/ABI/ (Greg)

Kind regards,
Petr

>  Documentation/admin-guide/sysctl/kernel.rst | 5 +++++ kernel/utsname_sysctl.c
>  | 7 +++++++ 2 files changed, 12 insertions(+)

> diff --git a/Documentation/admin-guide/sysctl/kernel.rst b/Documentation/admin-guide/sysctl/kernel.rst
> index ddccd1077462..70a0acf07101 100644
> --- a/Documentation/admin-guide/sysctl/kernel.rst
> +++ b/Documentation/admin-guide/sysctl/kernel.rst
> @@ -65,6 +65,11 @@ combining the following values:
>  4 s3_beep
>  = =======

> +arch
> +====
> +
> +The machine hardware name, the same output as ``uname -m``
> +(e.g. ``x86_64`` or ``aarch64``).

>  auto_msgmni
>  ===========
> diff --git a/kernel/utsname_sysctl.c b/kernel/utsname_sysctl.c
> index 4ca61d49885b..7ffdd2cd5ff9 100644
> --- a/kernel/utsname_sysctl.c
> +++ b/kernel/utsname_sysctl.c
> @@ -73,6 +73,13 @@ static DEFINE_CTL_TABLE_POLL(hostname_poll);
>  static DEFINE_CTL_TABLE_POLL(domainname_poll);

>  static struct ctl_table uts_kern_table[] = {
> +	{
> +		.procname	= "arch",
> +		.data		= init_uts_ns.name.machine,
> +		.maxlen		= sizeof(init_uts_ns.name.machine),
> +		.mode		= 0444,
> +		.proc_handler	= proc_do_uts_string,
> +	},
>  	{
>  		.procname	= "ostype",
>  		.data		= init_uts_ns.name.sysname,

  reply	other threads:[~2022-07-29 12:53 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-29 12:51 [PATCH v2 1/1] drivers/base/cpu: Print kernel arch Petr Vorel
2022-07-29 12:53 ` Petr Vorel [this message]
2022-07-29 13:49   ` Greg Kroah-Hartman
2022-07-29 13:55     ` Petr Vorel
2022-08-17  9:56     ` Petr Vorel
2022-08-17 11:16       ` Greg Kroah-Hartman
2022-08-17 19:37         ` Petr Vorel
2022-09-01 14:29 ` Greg Kroah-Hartman
2022-09-01 15:47   ` Petr Vorel
2022-09-01 16:02     ` Greg Kroah-Hartman

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=YuPYWLD7xxcNmuCx@pevik \
    --to=pvorel@suse.cz \
    --cc=dsterba@suse.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rafael@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