Received: by 2002:ac0:e34a:0:0:0:0:0 with SMTP id g10csp309618imn; Thu, 28 Jul 2022 01:00:27 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sHCIPrKc1KFXF4O6NQK/rfec3PlLUJhi6lldHcwCAfNl507NqDRCD60hXqFZZ31Z9ALLQk X-Received: by 2002:a17:903:244f:b0:16d:83df:f746 with SMTP id l15-20020a170903244f00b0016d83dff746mr15399862pls.67.1658995227491; Thu, 28 Jul 2022 01:00:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658995227; cv=none; d=google.com; s=arc-20160816; b=XadPrmD5WMgvTOl4rxH54oA6x2uJjj3JQopbm08HmLAlp1tCgRvU6dB2RKwmGFtFsL kBdF/+uTeTdIPn7F4fHtgn/2avQUhjWq8puQnof4qyfgnDAxP8a/7CY02Z8lekYVsP5E y8LSo9ua2xIh3pxBLMXbi4H9fXhalaa2ASXlNsqCq3g3MkDInCj+aDxswRKZO7GHL8B4 JU45ENBcen99yl5s4uru8gzuRkAJ+SneBHxJDoo6Cz6z+glBGBonl9oK9TABg/tSTwcm ZDy0/71YrRTcXY3U/qIUYQP8XhSdf9oL7IK1o+xREL0ekAjvw4pOdQEV6z6v5PEC6kyo NC1A== 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=HA2OxoEIzsjynWmHnpVgHh77MhV4G6QUODaqUF4b0kc=; b=tGGGebfwvAV+eq4syi34mqjRPs3se18K3UMAuC4cJ85+pmta+4lkuI03EqJQZqpvAN NhOwt4S8DMpLSbI4JB8g6towq7VORaOMSa51bUQaUaaE5uNQmmLYG8v0vrwyv3u+lHeI IM8VUE0Wx6c7Z1u4cxxH4cUCc4xN7dkPnSqfF0lap3KRvM3L153UQSKzBhWfVowcwQmN U7jiaMoAeJLg8IeyU8InxkAC1/RyL0I+fTHdgZ6FQKG6e2DIIH6WaGMieNfircj1iipU QFgMvBzyrdg/CmIyZA4/cg3Cl+/MLcqjQInA5vB2UI22h2kGurwAYhNCo+v+HM5fFMdl APpw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=096bkuSc; dkim=neutral (no key) header.i=@suse.cz; 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 u8-20020a17090341c800b0016bf01a662asi372475ple.499.2022.07.28.01.00.12; Thu, 28 Jul 2022 01:00:27 -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=096bkuSc; dkim=neutral (no key) header.i=@suse.cz; 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 S233986AbiG1HfS (ORCPT + 99 others); Thu, 28 Jul 2022 03:35:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56582 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232635AbiG1HfQ (ORCPT ); Thu, 28 Jul 2022 03:35:16 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EA70722289 for ; Thu, 28 Jul 2022 00:35:14 -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-out1.suse.de (Postfix) with ESMTPS id A6B0634D99; Thu, 28 Jul 2022 07:35:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1658993713; 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=HA2OxoEIzsjynWmHnpVgHh77MhV4G6QUODaqUF4b0kc=; b=096bkuScD6x3RE2dBy8EWuWqvEghwRHXdbG4njGuAKdGd3J4eub6vZHbhEEvU9JrbrXdOE a7d9Q6oYU7ZGaao2kaGXv6qiMZ1x7LXsLovunBWLyTJU1hBxOn1mlYuUhSKSMUNGvPzWqW /fwQ04NEzZEvP15s+Vm4nK10HoK1QPA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1658993713; 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=HA2OxoEIzsjynWmHnpVgHh77MhV4G6QUODaqUF4b0kc=; b=e5dmcgR/VtgslV2/uMTD66tDSvICLMAX7pKmE6Ut7pgKNero22wHVCRCJinnKzyvYXvMc/ TSPB9H1H+sP9J/Ag== 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 6A7B713A7E; Thu, 28 Jul 2022 07:35:13 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id sjYAGDE84mILFwAAMHmgww (envelope-from ); Thu, 28 Jul 2022 07:35:13 +0000 Date: Thu, 28 Jul 2022 09:35:11 +0200 From: Petr Vorel To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, "Rafael J. Wysocki" , David Sterba Subject: Re: [PATCH 1/1] drivers/base/cpu: Print kernel arch Message-ID: Reply-To: Petr Vorel References: <20220727161135.24531-1-pvorel@suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 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, Jul 28, 2022 at 12:22:05AM +0200, Petr Vorel wrote: > > Hi Greg, > > thanks for your review! > > > On Wed, Jul 27, 2022 at 06:11:35PM +0200, Petr Vorel wrote: > > > > Print kernel architecture in /sys/devices/system/cpu/arch > > > > using UTS_MACHINE, i.e. member of struct uts_namespace.machine. > > > > 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 > > > > --- > > > > drivers/base/cpu.c | 9 +++++++++ > > > > 1 file changed, 9 insertions(+) > > > You can't add a new sysfs file without a Documentation/ABI/ update as > > > well. Please fix that up. > > I'm sorry. Yes, I realized it later on (once I got offline). > > Sure, I'll fix this in v2. But the main question is whether this feature is > > acceptable and what is the best place for the file. > > > > diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c > > > > index 4c98849577d4..7c8032e3ff10 100644 > > > > --- a/drivers/base/cpu.c > > > > +++ b/drivers/base/cpu.c > > > > @@ -3,6 +3,7 @@ > > > > * CPU subsystem support > > > > */ > > > > +#include > > > > #include > > > > #include > > > > #include > > > > @@ -232,6 +233,13 @@ static ssize_t print_cpus_kernel_max(struct device *dev, > > > > } > > > > static DEVICE_ATTR(kernel_max, 0444, print_cpus_kernel_max, NULL); > > > > +static ssize_t print_cpus_arch(struct device *dev, > > > > + struct device_attribute *attr, char *buf) > > > > +{ > > > > + return sysfs_emit(buf, "%s\n", UTS_MACHINE); > > > > +} > > > > +static DEVICE_ATTR(arch, 0444, print_cpus_arch, NULL); > > > why just UTS_MACHINE? Doesn't 'uname' show this already? And I thought > > > this was in /proc/cpuinfo but odd, it isn't... > > Sure, this info is in uname(). But for certain cases is really easier to read > > file from /proc or /sys than run create custom C bindings or a binary which > > calls uname(2) libc wrapper or run uname binary via execve(2). > > Yes, I also expected /proc/cpuinfo would have it but it does not have it. I > > don't think it's a good idea to add 'arch : foo' line to it, but I can do if > > there is consensus that it's the best place. > > > Also what about the other things in compile.h? > > UTS_VERSION is in /proc/version. > > LINUX_COMPILE_BY (e.g. "user"), LINUX_COMPILE_HOST (e.g. "host") and > > LINUX_COMPILER (e.g. "aarch64-alpine-linux-musl-gcc (Alpine 11.2.1_git20220219) > > ...") are IMHO useless, but I can add it if you wish. > > Well, there is hostname in /proc/sys/kernel/hostname, there are also ostype and > > osrelease.. Thinking about it twice /proc/sys/kernel/ looks to me a better place > > for arch file than current /sys/devices/system/cpu/. WDYT? > Yeah, I think /proc/sys/kernel/ makes sense, good idea. Thanks for info, I'll send v2 shortly. Kind regards, Petr > greg k-h