Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp1111143ybp; Fri, 4 Oct 2019 09:39:19 -0700 (PDT) X-Google-Smtp-Source: APXvYqz0EPj3nZOj6Y9f9V4R+69GaFTTgzxeqdr36GBoSlk3I84gpmtBuZNf3zdpi0VRYq+KGteo X-Received: by 2002:a17:906:7245:: with SMTP id n5mr13147479ejk.173.1570207159767; Fri, 04 Oct 2019 09:39:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570207159; cv=none; d=google.com; s=arc-20160816; b=ULCUeR5arQNRIwwSRRkMeyJB3ePOt/xUEqvDbeRgU/Jauk6Sc4jit70sMnuyS9ytrz 51ZkKdyX6Ii2rkJwH55v/NabxEnBD+d7poMqCekXsztI2pORUhZdabQNfUIJbxgPtIrr uvcIaqjT9rfLrLYGGj692XH/cO+QxFVhcIsr0qScPAOFkDUWC5XwVlvChKPpk7kYSZxg 3O3VHRXpNLp5HFoQXePV9Y+lgU6sB9LBPdJr09gWSjZLWQ7Xxo/DM6cV7f/YmHeitLpK ATXVQNd/vM9byl/mbWtkjoA5y44bYVDpVxTwpOGt87i3OseBy1uSvYajaG/gTHgtVfkU p6pA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id :dkim-signature:dkim-signature; bh=jSbndNwmBCmiusjyX75NyG651TNTvE4RpG6KTF/Gl+8=; b=JBNRGozl8Aas+Ejx22hd0J1yZEkVdr7hlGPBuU3Rls/Ble7XqxEd2lSHULC1Bhg+Ry /U2h+jPAfbIgjnVQhmfUK6MzaUk/umsB+GORf7yrR8V42gQ49R7I4n5orvzv5KfdeHcC zk9GgQFfvVHo18TY4QeO+B40yWcdiSLCLcAnuNvpkRJ6LapvelJiL7cCosgv48LtQIDO 9oJO7xYG9BBSaVHIJGmAL1aG+ZOSv3S36YEqdGqzffP56e2X1z8ofqRrrfGsrKFWYXfU zJ9nGuZsejiK9Zc3WCftc9J3P8sCGniL+bbenDV9EMxxZ2iukZH/dsGcqfkVHfin6mld 96Pg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@hansenpartnership.com header.s=20151216 header.b=xx+Yvr2i; dkim=fail header.i=@hansenpartnership.com header.s=20151216 header.b=xx+Yvr2i; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=hansenpartnership.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c48si3848118eda.100.2019.10.04.09.38.54; Fri, 04 Oct 2019 09:39:19 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@hansenpartnership.com header.s=20151216 header.b=xx+Yvr2i; dkim=fail header.i=@hansenpartnership.com header.s=20151216 header.b=xx+Yvr2i; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=hansenpartnership.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729147AbfJDQhp (ORCPT + 99 others); Fri, 4 Oct 2019 12:37:45 -0400 Received: from bedivere.hansenpartnership.com ([66.63.167.143]:58154 "EHLO bedivere.hansenpartnership.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727326AbfJDQhp (ORCPT ); Fri, 4 Oct 2019 12:37:45 -0400 Received: from localhost (localhost [127.0.0.1]) by bedivere.hansenpartnership.com (Postfix) with ESMTP id D65978EE21D; Fri, 4 Oct 2019 09:37:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=hansenpartnership.com; s=20151216; t=1570207064; bh=9/gg/H5bLdJpnhTAPNXhRv5fbH+hAXHLjl54w4KDegA=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=xx+Yvr2iM0hWVGfwX6Yxv+cFT/nml/QHdp3Q13C7ZVjlBfDGG+Zo+F8iCRW8kZ2ac 9hYNEGirPm5X1TDVcSh11p0bJBwWRz/18fCuS6T5hjHw2BMdFhxhhUeIb/1wdnwVH3 zgy9oekEIV4CozsTDuEm3VzBpefUII+duC2HXYzE= Received: from bedivere.hansenpartnership.com ([127.0.0.1]) by localhost (bedivere.hansenpartnership.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id XXIx5vitGsIk; Fri, 4 Oct 2019 09:37:44 -0700 (PDT) Received: from jarvis.lan (unknown [50.35.76.230]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bedivere.hansenpartnership.com (Postfix) with ESMTPSA id 199BC8EE0EE; Fri, 4 Oct 2019 09:37:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=hansenpartnership.com; s=20151216; t=1570207064; bh=9/gg/H5bLdJpnhTAPNXhRv5fbH+hAXHLjl54w4KDegA=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=xx+Yvr2iM0hWVGfwX6Yxv+cFT/nml/QHdp3Q13C7ZVjlBfDGG+Zo+F8iCRW8kZ2ac 9hYNEGirPm5X1TDVcSh11p0bJBwWRz/18fCuS6T5hjHw2BMdFhxhhUeIb/1wdnwVH3 zgy9oekEIV4CozsTDuEm3VzBpefUII+duC2HXYzE= Message-ID: <1570207062.3563.17.camel@HansenPartnership.com> Subject: Re: [PATCH v3 2/2] tpm: Detach page allocation from tpm_buf From: James Bottomley To: Jarkko Sakkinen , linux-integrity@vger.kernel.org Cc: Mimi Zohar , Jerry Snitselaar , Sumit Garg , Stefan Berger , Peter Huewe , Jason Gunthorpe , Arnd Bergmann , Greg Kroah-Hartman , open list Date: Fri, 04 Oct 2019 09:37:42 -0700 In-Reply-To: <20191003185103.26347-3-jarkko.sakkinen@linux.intel.com> References: <20191003185103.26347-1-jarkko.sakkinen@linux.intel.com> <20191003185103.26347-3-jarkko.sakkinen@linux.intel.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.26.6 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 2019-10-03 at 21:51 +0300, Jarkko Sakkinen wrote: > As has been seen recently, binding the buffer allocation and tpm_buf > together is sometimes far from optimal. Can you elaborate on this a bit more? I must have missed the discussion. > The buffer might come from the caller namely when tpm_send() is used > by another subsystem. In addition we can stability in call sites w/o > rollback (e.g. power events)> > > Take allocation out of the tpm_buf framework and make it purely a > wrapper for the data buffer. What you're doing here is taking a single object with a single lifetime and creating two separate objects with separate lifetimes and a dependency. The problem with doing that is that it always creates subtle and hard to debug corner cases where the dependency gets violated, so it's usually better to simplify the object lifetimes by reducing the dependencies and combining as many dependent objects as possible into a single object with one lifetime. Bucking this trend for a good reason is OK, but I think a better reason than "is sometimes far from optimal" is needed. James