From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796143376; b=UjeSBvywXgZrmGh5gcwMAdaDs1NpfSUeKTquGxmPQjtNYEHfrfInlR8Zvw+gQ/d8hDqD LBCoCpdItZ0OqjydHEQjM6SX2mVpZ9M7nEWwiz4aVERZHfffL4872ySM3wx/FgHQCWJc6 HUGp43LmBLEFqD/xKDCXvViLveqJ6HSNOwXoAyi4FIwvpG97NnHPbUyr0W990hBAmNuDp gBJwuz1oXhLFTz2Re7Xiipwprh/Sf+5xDnJ2kjt638nqnZrKVHVT0tZHbUxC4wZS/u3hr FD9NoYtegHNzZz41qgVOSGklbs/8eKNMcxGGfjHW7d0GCbYsHpv2s0Mb0lndIp64zxg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796143376; h=Received:DKIM-Signature:Date:From:To:Cc:Subject:Message-ID: References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=iWAw8w8qFqWxZbcBT9vNpStfJ1YjWnHxENfZ56AicgE=; b=BT0y0mtoe45OZiQXI9tMtpfynK65GREOilzdost43EjHZ94vXYBrlPd/H54v5KdWgfcg hJfBLKwO9Tam1mMXalW1R+eOYzq4sY6pVVNGlbqma4lZvI3kpJawRvnrSW/7nY+X0frs1 vjuOH94Wl4WfA3IyqLHcnA6BUVzj/T+tnVTXIt9KHkNQGlsUTdS//36Qco+xcTyvuStDn hS1FRh1iHT+dBEK8I/XHba5vpprCa+BvGdnNBu4y9FaKse0xj5Xi1767qjCo1FBM2P+MY nch+xcWmWmyWtq4zcBUZfCFuqK6YJNoIpK3p2V9VZvAfKTz7CI3tch/WjWwNb7zFMkQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=dwydMlP8; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with UTF8SMTPS id 22315606A31A; Tue, 1 Dec 2026 16:42:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=dwydMlP8 Received: by smtp.kernel.org (Postfix) with UTF8SMTPSA id DBE291F000C1; Tue, 1 Dec 2026 16:42:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796143375; bh=iWAw8w8qFqWxZbcBT9vNpStfJ1YjWnHxENfZ56AicgE=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=dwydMlP8+87iR/ag/HdrpfYEMa7THSRd3o3gKRAJ3xmjYFrUb1/Ku5PPnjOuDN/xv B361XMSUvGzzyQD5hpU+ki1++yvTR5fUSUAu1fOzJdffwt9V57EV78iUJyNu97OH8D O/TkF2IDggERKK+29ZnUUnGYGm/lkDn9WxNAsIjs2TTjU2eP/vfeFqU99TGD+LmZkA uQrT1mTFPkTOMdN+rls51BPenoek3w4vZGx/H7YB0IHJfDaJNkA86J+7xpLYCiIh9D JARrtndthvLvMae12Cd9kc4CpLy9BJXTh7jMZf/7+pdNo6PTkNetIVKMq/rr5f0Dvs G18MmPPrCSuhg== Date: Tue, 1 Dec 2026 18:42:51 +0200 From: Jarkko Sakkinen To: Surendran Kanagaraj Cc: corbet@lwn.net, graf@amazon.de, gunnarku@amazon.com, jgg@ziepe.ca, joshlev@amazon.com, leitao@debian.org, linux-doc@vger.kernel.org, linux-integrity@vger.kernel.org, linux-kernel@vger.kernel.org, nh-open-source@amazon.com, noodles@earth.li, peterhuewe@gmx.de, rdunlap@infradead.org, skhan@linuxfoundation.org Subject: Re: [RFC PATCH v4 1/8] tpm: Add a single table for all TPM wait limits Message-ID: References: <20261201081408.58562-1-surenkj@amazon.com> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Tue, Dec 01, 2026 at 02:41:15PM +0200, Jarkko Sakkinen wrote: > On Tue, Dec 01, 2026 at 08:14:08AM +0000, Surendran Kanagaraj wrote: > > On Sat, Nov 28, 2026 at 01:30:15AM +0200, Jarkko Sakkinen wrote: > > > On Fri, Nov 27, 2026 at 10:23:47PM +0000, Surendran Kanagaraj wrote: > > > > Yes, that should work. Something like this: > > > > > > > > struct tpm_cmd_duration { > > > > /* TPM 2.0: command code or TPM 1.x: duration class */ > > > > u32 cmd; > > > > u32 duration; /* msecs */ > > > > }; > > > > > > > > /* in struct tpm_chip, in place of chip->duration[] */ > > > > struct tpm_cmd_duration durations[TPM_MAX_DURATIONS]; > > > > > > > > eg: > > > > /* TPM 1.x */ > > > > chip->durations[0] = { TPM_SHORT, 750 } > > > > > > > > /* TPM 2.0 */ > > > > chip->durations[2] = { TPM2_CC_GET_RANDOM, 2000 } > > > > > > Hmm... in theory TPM 1.x commands could be "normalized" to have same > > > format. Is that because of sysfs files? > > > > Yes partly. It's doable. I agree it would unify the format nicely. My > > hesitation is that the per chip copy grows from 3 values to 123 > > entries just to match the format. Also the code paths which work with > > duration class - sysfs (stable ABI), vendor overrides etc would need > > additional logic. Would you prefer the normalized version? > > Memory consumption is not a concern here. And as a general rule it is better to optimize a clean data flow over performance at first almost for any feature. Too slow but clean version is superior over fast but wrong. Why in some cases we end up to using unions or data packing is often due to evolution, legacy and architectural constraints; or parametrical growth in memory consumption. I.e. when space needs to be carved out in already constrained space and/or memory consumption is more than O(1) unions *might* start to make sense. Usually this should happen only when conditions enforce to make that choice rather than as "creative innovation". Linux is a high-grade software project but that position is retained by not being too clever; rather than being clever (I wrote this despite Claude phrasing :-) ). "Not being too clever" code is what makes e.g., data centers work. Br, Jarkko