Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp884025rdb; Fri, 2 Feb 2024 07:02:17 -0800 (PST) X-Google-Smtp-Source: AGHT+IFvwa21dbx3YHCc0luq6txaeWAjtdAgahiCyQsSrevj/a+0IRNerts5KntH8wjdqpJ2Mj0X X-Received: by 2002:a17:906:6dd6:b0:a36:bbcc:1ab with SMTP id j22-20020a1709066dd600b00a36bbcc01abmr1570327ejt.17.1706886137290; Fri, 02 Feb 2024 07:02:17 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706886137; cv=pass; d=google.com; s=arc-20160816; b=T1dbECKWm3Ov5Gfv4m48U3J9D4q0kjRHJ439TRXtqwleFl2Y7duhOVbBW984T13RPG 7q791hB1ikfeLEUY5WlJqHRtQtLLCyMQ1MwMTtGEaF3N0+qKib0dkFqWHMihigGsXAXe QSvzXoiw1xu8QwRA7DAr/OIeJis0QEy9Ceo5owa4vWcQVUHRFyOveyIgfK0x352fSMt6 pqTugPwrXzHZGRUTTiO9U8lUfcxCMGSBGFj4dpiHTHI/0cAfpBJWrmcilKcXzyEv5Xvj VLWx4NCA8XKA+SxJJLj3sHA06i3Slal1NMUNpGO/VGnnfXUKtWfBdSlauJ2QUke3Z6o8 8sWA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=kuqO5NfOV/UZy8IQZIu7XZkkv2oYSPVPd6uT5EIQ4R0=; fh=hQdyRWNnSlLQ3RAybKf6A2S0p8guWZFfbSPd4EzeFQk=; b=rWapv5TeUY54Nclzu18FLMRFWPmHXlahbrpfGszfvPwoF/A5PaytTVLidPpVRZ3bpI /m/GeUJ2t+naZFyJa+faoITSFJhT9LGt6A4sFrpyJXhbzOCDCd8HCTfOIuNwg9h1ugiu ZxTpyc/DyBYe4OsaMvq+J9OsRdAXGIzH6iuk/r5HmCo/J0uiofK19YPfZwE8d3+buW6U cAEs8OZvkZ4JjrWTufXJmpwmpHm9UQ2plFS5MgGc30XClRpcdbiheJD9kLNiz47Xzexa IXqd+FZ/cRrfus77KajHYEkrhR4MH1G0hPdqhaPcFvziGoDQY528IJ82MGDICjanmn4F uJqQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=g98pgsAP; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-49982-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-49982-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=1; AJvYcCU2jnvcrSn9FA42c/cpX2Q3Z5H2D4Rz01Cq2iGO0rVZH/QY5COVHDAIpyEU5XWdJgCanhN4nrvZWJr3jadbizYKxS7MZNaU7j7aGthXoA== Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id s18-20020a170906bc5200b00a36b79090cesi926754ejv.81.2024.02.02.07.02.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Feb 2024 07:02:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-49982-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=g98pgsAP; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-49982-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-49982-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 061E41F297F5 for ; Fri, 2 Feb 2024 15:02:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9DC28145353; Fri, 2 Feb 2024 15:02:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="g98pgsAP" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AAC7F7E5; Fri, 2 Feb 2024 15:02:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706886125; cv=none; b=QX8PMTnb1ZNcM6d7w6qQuByQHfaLIGKt9SMONvPgq8GmaxjxsXb+S8w42pbzyMmz1srZBcGF7M3mFmJGmKIEaGkdquY1ze4DfAv8hZemTxFd10+HV25XfJmHo1puHDKb7KXoI/KxyTUXBt/UqhTcfFOmwR7xbIohXKkxkiImxuU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706886125; c=relaxed/simple; bh=hDylnFMPrzeq70fQAWBU+9OkNShdD6KuDlCXCiW2zIU=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=WhAUvxHVxvRgyhJZRWAxT0zbiD9sCjVETL5UxG9EA+6zBwYW0XWIyWjSq7jBTTSilVCFNQlwY91Jrsatp8RJ3BEXxl791vXDLO5KTJ6ux0QZta90IjJ4To0Ig72BQQJm53fkZ9mS5szIZkmRc8RKQLQAObnHLjueAkJoqT+6zA0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=g98pgsAP; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1E7A3C433F1; Fri, 2 Feb 2024 15:02:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1706886125; bh=hDylnFMPrzeq70fQAWBU+9OkNShdD6KuDlCXCiW2zIU=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=g98pgsAPEayS+E5N0BVJ2sHKDfmZTd2ddIs0+VMuVgojD0HTCVv+UPggY9phr+7YZ 7i5cpnkUwh+aEasromv254prUWHZMLwW+sUpxpmiW/RSQUam8NRUJqlN56ldIJKfAM d+kC8pxmSeFjgZJlHtpIj1cv883BFG6WFECaWxdusMmBnRoQC9ahwKyJW1ldmKi4xg K+L00Yf0vg0LAIkp/CkrGq945ARV6xwZUUf6fy6/yFM8td3MIjUBVNQIH2gxkHUGsA doom7avwVCDRPK0MyH8kcBGV+kFUNDv3P/j3PWsuGhpt5/WVA2c1MZgkUjVpy4jFLo mujKl0KKF3YPw== Received: by mail-lf1-f46.google.com with SMTP id 2adb3069b0e04-5112ea89211so2485423e87.1; Fri, 02 Feb 2024 07:02:05 -0800 (PST) X-Gm-Message-State: AOJu0YwnzUEdBKt3ECFV7umDi5rVU++RuEl7Gm2D9qrY6F5q2Xz6DnRW 8uCeJ+03mhBcIKpgQxevAmpVMY7FuAmeUO7cWBBedUGY1fHN8u3Y0WWxOcCyQzLG6M7b3uhjppH M/Qpw4KmYKflmmgPFu0zxnmLn0Fs= X-Received: by 2002:ac2:44b2:0:b0:511:3d02:2641 with SMTP id c18-20020ac244b2000000b005113d022641mr156283lfm.53.1706886123633; Fri, 02 Feb 2024 07:02:03 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240131104851.2311358-1-john.g.garry@oracle.com> In-Reply-To: <20240131104851.2311358-1-john.g.garry@oracle.com> From: Masahiro Yamada Date: Sat, 3 Feb 2024 00:01:26 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH RFC 0/4] Introduce uts_release To: John Garry Cc: mcgrof@kernel.org, russ.weight@linux.dev, gregkh@linuxfoundation.org, rafael@kernel.org, rostedt@goodmis.org, mhiramat@kernel.org, mathieu.desnoyers@efficios.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, keescook@chromium.org, nathan@kernel.org, nicolas@fjasle.eu, linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-kbuild@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, Jan 31, 2024 at 7:49=E2=80=AFPM John Garry wrote: > > When hacking it is a waste of time and compute energy that we need to > rebuild much kernel code just for changing the head git commit, like this= : > > > touch include/generated/utsrelease.h > > time make -j3 > mkdir -p /home/john/mnt_sda4/john/kernel-dev2/tools/objtool && make O=3D/= home/john/mnt_sda4/john/kernel-dev2 subdir=3Dtools/objtool --no-print-direc= tory -C objtool > INSTALL libsubcmd_headers > CALL scripts/checksyscalls.sh > CC init/version.o > AR init/built-in.a > CC kernel/sys.o > CC kernel/module/main.o > AR kernel/module/built-in.a > CC drivers/base/firmware_loader/main.o > CC kernel/trace/trace.o > AR drivers/base/firmware_loader/built-in.a > AR drivers/base/built-in.a > CC net/ethtool/ioctl.o > AR kernel/trace/built-in.a > AR kernel/built-in.a > AR net/ethtool/built-in.a > AR net/built-in.a > AR drivers/built-in.a > AR built-in.a > ... > > Files like drivers/base/firmware_loader/main.c needs to be recompiled as > it includes generated/utsrelease.h for UTS_RELEASE macro, and utsrelease.= h > is regenerated when the head commit changes. > > Introduce global char uts_release[] in init/version.c, which this > mentioned code can use instead of UTS_RELEASE, meaning that we don't need > to rebuild for changing the head commit - only init/version.c needs to be > rebuilt. Whether all the references to UTS_RELEASE in the codebase are > proper is a different matter. > > For an x86_64 defconfig build for this series on my old laptop, here is > before and after rebuild time: > > before: > real 0m53.591s > user 1m1.842s > sys 0m9.161s > > after: > real 0m37.481s > user 0m46.461s > sys 0m7.199s > > Sending as an RFC as I need to test more of the conversions and I would > like to also convert more UTS_RELEASE users to prove this is proper > approach. > > John Garry (4): > init: Add uts_release > tracing: Use uts_release > net: ethtool: Use uts_release > firmware_loader: Use uts_release > > drivers/base/firmware_loader/main.c | 39 +++++++++++++++++++++++------ > include/linux/utsname.h | 1 + > init/version.c | 3 +++ > kernel/trace/trace.c | 4 +-- > net/ethtool/ioctl.c | 4 +-- > 5 files changed, 39 insertions(+), 12 deletions(-) > > -- > 2.35.3 > As you see, several drivers store UTS_RELEASE in their driver data, and even print it in debug print. I do not see why it is useful. As you discussed in 3/4, if UTS_RELEASE is unneeded, it is better to get rid of it. If such version information is useful for drivers, the intention is whether the version of the module, or the version of vmlinux. That is a question. They differ when CONFIG_MODVERSION. When module developers intend to printk the git version from which the module was compiled from, presumably they want to use UTS_RELEASE, which was expanded at the compile time of the module. If you replace it with uts_release, it is the git version of vmlinux. Of course, the replacement is safe for always-builtin code. Lastly, we can avoid using UTS_RELEASE without relying on your patch. For example, commit 3a3a11e6e5a2bc0595c7e36ae33c861c9e8c75b1 replaced UTS_RELEASE with init_uts_ns.name.release So, is your uts_release a shorthand of init_uts_ns.name.release? I think what you can contribute are: - Explore the UTS_RELEASE users, and check if you can get rid of it. - Where UTS_RELEASE is useful, consider if it is possible to replace it with init_uts_ns.name.release --=20 Best Regards Masahiro Yamada