Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp1217769rwe; Thu, 1 Sep 2022 14:41:22 -0700 (PDT) X-Google-Smtp-Source: AA6agR7hv4HWDYm3dNcVOGmEsq6j152WuhJTKz2aEDyDb6IKdgO3vcDxkYhCa893duzrwRZydsTI X-Received: by 2002:a17:907:2954:b0:742:299b:4f38 with SMTP id et20-20020a170907295400b00742299b4f38mr10935155ejc.508.1662068482501; Thu, 01 Sep 2022 14:41:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662068482; cv=none; d=google.com; s=arc-20160816; b=tHuY7f2E119YlL/xg21k7mjG3BAkYrW07qD8p6iYwj3lEbeibVkzrvXzUq/6Km3BpD WJXa7P2zbtCoAVNgY3gX4T1gb6i5iTYkCFrh91RcI9xfld11/cel7gjNUOOwPRARCouV WwxxIu4TwrhI693iScsqKLYPFJyJj/F3H7dKVpgKkWP88igvhDRNKnc3JOS4zmga9KJu A8Pb9XGK9OE55v4312VFyeY2KHL1slK2HhhhNI6HQJxtRl0/VdzeQ1UxwZZln1ONhU73 N+DiVk1vTJ/Vi50tHIQpxHRBWuA0+7/uKJD9jfIOsvR3I2JRwVjZwAomO1T5LM6GqhGY PBTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:reply-to:message-id:subject:cc:to:from:date :dkim-signature:dkim-signature; bh=BZhfAFK+s57FlhVBfKpeOWjhLLLthHzN52MYfn6xqLk=; b=UZO7938fkstq2mDQIZkvRFtFLENEzJ87Ei1LP/lRL6OQlLQxivGANyFXrots5YibDm njycxsZXMZIx4wTkS22wMyUt/x9Khl9BPIGeETF3PvswM58J8dnhSnycBnGtlv5iouuT smOsMvdEJEkly0c+NkpMqFZlS2PQogcYPWVxSi+sIUKe3UWNhe+/Ld0lwBqDRvgdE/Ij a/+vt4SdNFkrbqF5aO6xmSEJ1iWmMLaXN/zXkjJ0zA4DyrY+vxIcdAmiHR+2uySDiEru KQSiXpF/rxOzrFQDp846Q6tqKb1mQm17pKxAWyf0XO3AKtmTmAz8E0XBmVGH+i6GgR50 Sy9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=hyHEuDtx; dkim=neutral (no key) header.i=@suse.cz header.b=s+vRjkaB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id kw10-20020a170907770a00b00734b451c8c1si207900ejc.931.2022.09.01.14.40.57; Thu, 01 Sep 2022 14:41:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=hyHEuDtx; dkim=neutral (no key) header.i=@suse.cz header.b=s+vRjkaB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233787AbiIAVZn (ORCPT + 99 others); Thu, 1 Sep 2022 17:25:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44106 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232594AbiIAVZk (ORCPT ); Thu, 1 Sep 2022 17:25:40 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0EA5F54CAB for ; Thu, 1 Sep 2022 14:25:36 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 4849520637; Thu, 1 Sep 2022 21:25:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1662067535; h=from:from:reply-to:reply-to:date:date:message-id:message-id:to:to: cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=BZhfAFK+s57FlhVBfKpeOWjhLLLthHzN52MYfn6xqLk=; b=hyHEuDtxqCUmvLWH9bHlEQtMZr3aEIni/K4gw3pEvssN3Z5v7a8JTBOXDZDdknJ7yCPOvu PwszOH0+lEPJAbGO7l4CDTx9nrr2zZV7uUhynNvndjZbsh8iNt6gp4B84i1+gXob4auSre 4XqSosvVsyAlEOIhT008VYfr22Volww= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1662067535; h=from:from:reply-to:reply-to:date:date:message-id:message-id:to:to: cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=BZhfAFK+s57FlhVBfKpeOWjhLLLthHzN52MYfn6xqLk=; b=s+vRjkaB15YkOffb3Z+SAkL9WPfMsPUGpFuIka6FCVApd41JrMqy5xPpVB5ImpOESv0u50 L6LVF7ilEtqjT/DA== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id E882A13A79; Thu, 1 Sep 2022 21:25:34 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id jKu7NU4jEWPwBwAAMHmgww (envelope-from ); Thu, 01 Sep 2022 21:25:34 +0000 Date: Thu, 1 Sep 2022 23:25:32 +0200 From: Petr Vorel To: Andrew Morton Cc: linux-kernel@vger.kernel.org, Eric Biederman , Greg Kroah-Hartman , "Rafael J. Wysocki" , David Sterba Subject: Re: [PATCH v3 1/1] kernel/utsname_sysctl.c: Print kernel arch Message-ID: Reply-To: Petr Vorel References: <20220901194403.3819-1-pvorel@suse.cz> <20220901131539.1bfacab0f60b5116e492a46c@linux-foundation.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220901131539.1bfacab0f60b5116e492a46c@linux-foundation.org> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > On Thu, 1 Sep 2022 21:44:03 +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. > 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