linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 1/1] drivers/base/cpu: Print kernel arch
@ 2022-07-29 12:51 Petr Vorel
  2022-07-29 12:53 ` Petr Vorel
  2022-09-01 14:29 ` Greg Kroah-Hartman
  0 siblings, 2 replies; 10+ messages in thread
From: Petr Vorel @ 2022-07-29 12:51 UTC (permalink / raw)
  To: linux-kernel
  Cc: Petr Vorel, Greg Kroah-Hartman, Rafael J. Wysocki, David Sterba

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>
---
 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,
-- 
2.37.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH v2 1/1] drivers/base/cpu: Print kernel arch
  2022-07-29 12:51 [PATCH v2 1/1] drivers/base/cpu: Print kernel arch Petr Vorel
@ 2022-07-29 12:53 ` Petr Vorel
  2022-07-29 13:49   ` Greg Kroah-Hartman
  2022-09-01 14:29 ` Greg Kroah-Hartman
  1 sibling, 1 reply; 10+ messages in thread
From: Petr Vorel @ 2022-07-29 12:53 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, Rafael J. Wysocki, David Sterba

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,

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v2 1/1] drivers/base/cpu: Print kernel arch
  2022-07-29 12:53 ` Petr Vorel
@ 2022-07-29 13:49   ` Greg Kroah-Hartman
  2022-07-29 13:55     ` Petr Vorel
  2022-08-17  9:56     ` Petr Vorel
  0 siblings, 2 replies; 10+ messages in thread
From: Greg Kroah-Hartman @ 2022-07-29 13:49 UTC (permalink / raw)
  To: Petr Vorel; +Cc: linux-kernel, Rafael J. Wysocki, David Sterba

On Fri, Jul 29, 2022 at 02:53:44PM +0200, Petr Vorel wrote:
> 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 

Looks like this line ended too soon?

> * Update Documentation/ABI/ (Greg)

This looks good to me, I'll queue it up after the next -rc1 is out
unless someone objects.

greg k-h

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v2 1/1] drivers/base/cpu: Print kernel arch
  2022-07-29 13:49   ` Greg Kroah-Hartman
@ 2022-07-29 13:55     ` Petr Vorel
  2022-08-17  9:56     ` Petr Vorel
  1 sibling, 0 replies; 10+ messages in thread
From: Petr Vorel @ 2022-07-29 13:55 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, Rafael J. Wysocki, David Sterba

Hi Greg,

> On Fri, Jul 29, 2022 at 02:53:44PM +0200, Petr Vorel wrote:
> > 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 

> Looks like this line ended too soon?
OK, Friday. I'm sorry to be too abstracted today.
I was about to explain the reason - that there are other related files
osrelease, ostype.

> > * Update Documentation/ABI/ (Greg)

> This looks good to me, I'll queue it up after the next -rc1 is out
> unless someone objects.
Thanks!

Kind regards,
Petr

> greg k-h

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v2 1/1] drivers/base/cpu: Print kernel arch
  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
  1 sibling, 1 reply; 10+ messages in thread
From: Petr Vorel @ 2022-08-17  9:56 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, Rafael J. Wysocki, David Sterba

> On Fri, Jul 29, 2022 at 02:53:44PM +0200, Petr Vorel wrote:
> > 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 

> Looks like this line ended too soon?

> > * Update Documentation/ABI/ (Greg)

> This looks good to me, I'll queue it up after the next -rc1 is out
> unless someone objects.

Hi Greg,

gently ping just to make sure you didn't forget on it. I'm sorry if I overlooked
it (search in next tree and your git trees) or if you remember and are too busy
(fully understand).

Kind regards,
Petr

> greg k-h

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v2 1/1] drivers/base/cpu: Print kernel arch
  2022-08-17  9:56     ` Petr Vorel
@ 2022-08-17 11:16       ` Greg Kroah-Hartman
  2022-08-17 19:37         ` Petr Vorel
  0 siblings, 1 reply; 10+ messages in thread
From: Greg Kroah-Hartman @ 2022-08-17 11:16 UTC (permalink / raw)
  To: Petr Vorel; +Cc: linux-kernel, Rafael J. Wysocki, David Sterba

On Wed, Aug 17, 2022 at 11:56:18AM +0200, Petr Vorel wrote:
> > On Fri, Jul 29, 2022 at 02:53:44PM +0200, Petr Vorel wrote:
> > > 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 
> 
> > Looks like this line ended too soon?
> 
> > > * Update Documentation/ABI/ (Greg)
> 
> > This looks good to me, I'll queue it up after the next -rc1 is out
> > unless someone objects.
> 
> Hi Greg,
> 
> gently ping just to make sure you didn't forget on it. I'm sorry if I overlooked
> it (search in next tree and your git trees) or if you remember and are too busy
> (fully understand).

It's only been 2 days since -rc1 is out, and here's my todo queue right
now:
	❯ mdfrm -c ~/mail/todo/
	1733 messages in /home/gregkh/mail/todo/

It's in good company :)

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v2 1/1] drivers/base/cpu: Print kernel arch
  2022-08-17 11:16       ` Greg Kroah-Hartman
@ 2022-08-17 19:37         ` Petr Vorel
  0 siblings, 0 replies; 10+ messages in thread
From: Petr Vorel @ 2022-08-17 19:37 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, Rafael J. Wysocki, David Sterba

> On Wed, Aug 17, 2022 at 11:56:18AM +0200, Petr Vorel wrote:
> > > On Fri, Jul 29, 2022 at 02:53:44PM +0200, Petr Vorel wrote:
> > > > 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 

> > > Looks like this line ended too soon?

> > > > * Update Documentation/ABI/ (Greg)

> > > This looks good to me, I'll queue it up after the next -rc1 is out
> > > unless someone objects.

> > Hi Greg,

> > gently ping just to make sure you didn't forget on it. I'm sorry if I overlooked
> > it (search in next tree and your git trees) or if you remember and are too busy
> > (fully understand).

> It's only been 2 days since -rc1 is out, and here's my todo queue right
> now:
> 	❯ mdfrm -c ~/mail/todo/
> 	1733 messages in /home/gregkh/mail/todo/

> It's in good company :)

Lol, thanks for info, I'm very sorry I was impatient.

Petr

> thanks,

> greg k-h

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v2 1/1] drivers/base/cpu: Print kernel arch
  2022-07-29 12:51 [PATCH v2 1/1] drivers/base/cpu: Print kernel arch Petr Vorel
  2022-07-29 12:53 ` Petr Vorel
@ 2022-09-01 14:29 ` Greg Kroah-Hartman
  2022-09-01 15:47   ` Petr Vorel
  1 sibling, 1 reply; 10+ messages in thread
From: Greg Kroah-Hartman @ 2022-09-01 14:29 UTC (permalink / raw)
  To: Petr Vorel; +Cc: linux-kernel, Rafael J. Wysocki, David Sterba

On Fri, Jul 29, 2022 at 02:51:41PM +0200, Petr Vorel wrote:
> 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>
> ---
>  Documentation/admin-guide/sysctl/kernel.rst | 5 +++++
>  kernel/utsname_sysctl.c                     | 7 +++++++
>  2 files changed, 12 insertions(+)

Wait, why does the subject line say "drivers/base/cpu"?  That's not a
file being touched in this commit at all, so this isn't for me to take
:(

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v2 1/1] drivers/base/cpu: Print kernel arch
  2022-09-01 14:29 ` Greg Kroah-Hartman
@ 2022-09-01 15:47   ` Petr Vorel
  2022-09-01 16:02     ` Greg Kroah-Hartman
  0 siblings, 1 reply; 10+ messages in thread
From: Petr Vorel @ 2022-09-01 15:47 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-kernel, Rafael J. Wysocki, David Sterba, Eric Biederman

Hi Greg,

[ Cc Eric Biederman as the author of kernel/utsname_sysctl.c ]

> On Fri, Jul 29, 2022 at 02:51:41PM +0200, Petr Vorel wrote:
> > 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>
> > ---
> >  Documentation/admin-guide/sysctl/kernel.rst | 5 +++++
> >  kernel/utsname_sysctl.c                     | 7 +++++++
> >  2 files changed, 12 insertions(+)

> Wait, why does the subject line say "drivers/base/cpu"?  That's not a
> file being touched in this commit at all, so this isn't for me to take
> :(

Thanks for info. My bad, I forget to update the subject.
I can send v3 with corrected subject, but who is going to take this?

$ ./scripts/get_maintainer.pl kernel/utsname_sysctl.c
linux-kernel@vger.kernel.org (open list)

There is listed Author: Eric Biederman, so is it him to Cc ?

Kind regards,
Petr

> thanks,

> greg k-h

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v2 1/1] drivers/base/cpu: Print kernel arch
  2022-09-01 15:47   ` Petr Vorel
@ 2022-09-01 16:02     ` Greg Kroah-Hartman
  0 siblings, 0 replies; 10+ messages in thread
From: Greg Kroah-Hartman @ 2022-09-01 16:02 UTC (permalink / raw)
  To: Petr Vorel; +Cc: linux-kernel, Rafael J. Wysocki, David Sterba, Eric Biederman

On Thu, Sep 01, 2022 at 05:47:03PM +0200, Petr Vorel wrote:
> Hi Greg,
> 
> [ Cc Eric Biederman as the author of kernel/utsname_sysctl.c ]
> 
> > On Fri, Jul 29, 2022 at 02:51:41PM +0200, Petr Vorel wrote:
> > > 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>
> > > ---
> > >  Documentation/admin-guide/sysctl/kernel.rst | 5 +++++
> > >  kernel/utsname_sysctl.c                     | 7 +++++++
> > >  2 files changed, 12 insertions(+)
> 
> > Wait, why does the subject line say "drivers/base/cpu"?  That's not a
> > file being touched in this commit at all, so this isn't for me to take
> > :(
> 
> Thanks for info. My bad, I forget to update the subject.
> I can send v3 with corrected subject, but who is going to take this?
> 
> $ ./scripts/get_maintainer.pl kernel/utsname_sysctl.c
> linux-kernel@vger.kernel.org (open list)
> 
> There is listed Author: Eric Biederman, so is it him to Cc ?

Yeah, that would be best, or maybe Andrew?


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2022-09-01 16:02 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-29 12:51 [PATCH v2 1/1] drivers/base/cpu: Print kernel arch Petr Vorel
2022-07-29 12:53 ` Petr Vorel
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

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).