public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Petr Vorel <pvorel@suse.cz>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org,
	Eric Biederman <ebiederm@xmission.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	David Sterba <dsterba@suse.com>
Subject: Re: [PATCH v3 1/1] kernel/utsname_sysctl.c: Print kernel arch
Date: Thu, 1 Sep 2022 23:25:32 +0200	[thread overview]
Message-ID: <YxEjTK7zFfe4cxhS@pevik> (raw)
In-Reply-To: <20220901131539.1bfacab0f60b5116e492a46c@linux-foundation.org>

> On Thu,  1 Sep 2022 21:44:03 +0200 Petr Vorel <pvorel@suse.cz> 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.

> If they're this constrained, why not run sys_uname() directly?

Hi Andrew,

of course you're right that in C is the most straightforward way to use uname(2).
I was more concerned about userspace, but I have to admit uname is probably
everywhere, therefore this is probably useless.

The background of this was my colleague while writing software running LTP tests
with qemu (using whole systems on qcow image or minimal dracut initramfs) or over SSH
got all info about running kernel from proc / sysfs, just architecture was
missing.

/proc/cpuinfo and /sys/devices/system/cpu/ are full of details about CPU, but
surprisingly no info about the architecture. Understand, this info is in struct
utsname and there is uname binary, OTOH there are
/proc/sys/kernel/{osrelease,ostype,version}, which are also in struct utsname.

Kind regards,
Petr


  reply	other threads:[~2022-09-01 21:25 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-01 19:44 [PATCH v3 1/1] kernel/utsname_sysctl.c: Print kernel arch Petr Vorel
2022-09-01 20:15 ` Andrew Morton
2022-09-01 21:25   ` Petr Vorel [this message]
2022-09-02  5:55 ` 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=YxEjTK7zFfe4cxhS@pevik \
    --to=pvorel@suse.cz \
    --cc=akpm@linux-foundation.org \
    --cc=dsterba@suse.com \
    --cc=ebiederm@xmission.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