Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp248814ybn; Thu, 3 Oct 2019 04:37:59 -0700 (PDT) X-Google-Smtp-Source: APXvYqzK4MTJxm3Tf/ZzKwOoHQZiVjvDZZ9d8zBO3twLW/fv18ZwVsIXfzp+THQN8qq1/EOU3liI X-Received: by 2002:a50:ee10:: with SMTP id g16mr8916066eds.267.1570102678924; Thu, 03 Oct 2019 04:37:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570102678; cv=none; d=google.com; s=arc-20160816; b=Fj5kEDngJOg4RinAmANayHnAilFgHb+CDHHAW88/x7TT//WT7OH561UG4uelD96khZ euNU/fNbLfFd3c/FBj6R79bIHal75I9V+nSOrCG1x0iwT8Udu4d/nxpZJk4q9EoSJqbM LsrieT12hCOU5W9Qlb30r311xnMApR+Vtbmw/4D9n8AY1HPGbZwxGES6xkFxTAaGnfHC YFjjnSJ0knbvoMNpkxV9uFt7VdFNj+UGQQdqFap74A7MV3SXLK40zP8eSm4c2cgeRwPb dZ3l0dbbd9I7hMn77v0WxLM9XUZnubw7BhdusCF2e4v9LuJuAng1+fhQXRCou+dzT4tk jIEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:organization:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=QBSsoOjgC9xCMAD5qW/y9yoQXC55KNr5VwU5dk1daT4=; b=x8HxtFIch42Ld2PX85lflY+fWifNoM1hh3lv2Rv8pRkdfqZ2W0N2IGRTOvgCq4Vqml c/q2RKALSdVGvMCHd9SEChlzmDAw71rGZCthCiyoUwn07p5uZULDvO6UNPDDJCS+2nDG MsQ6wTL59THRh/+jC3HwYyw3aUXIe3+o1BLyJ5SsKa6YC6BR44EATp5XlQ6OuAfyxKiP Oj1fYY2Ot7fm4Wr9Ege2RvKI9d+/cfVM0zw3uNkP0Ov/Cyb07LQALr1XWe12NZW2YveJ yYIkvqkgtWTg3TkDY8K0fD2miSJOPsCGZnlRJjBiR/RQIrOhuiuWhbsI8mClXs7PwcJe bhKA== ARC-Authentication-Results: i=1; mx.google.com; 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=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q8si1076271ejx.315.2019.10.03.04.37.34; Thu, 03 Oct 2019 04:37:58 -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; 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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730064AbfJCLfK (ORCPT + 99 others); Thu, 3 Oct 2019 07:35:10 -0400 Received: from mga12.intel.com ([192.55.52.136]:44399 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729820AbfJCLfJ (ORCPT ); Thu, 3 Oct 2019 07:35:09 -0400 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Oct 2019 04:35:09 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.67,251,1566889200"; d="scan'208";a="198505323" Received: from jsakkine-mobl1.tm.intel.com (HELO localhost) ([10.237.50.161]) by FMSMGA003.fm.intel.com with ESMTP; 03 Oct 2019 04:35:06 -0700 Date: Thu, 3 Oct 2019 14:35:06 +0300 From: Jarkko Sakkinen To: Mimi Zohar Cc: James Bottomley , linux-integrity@vger.kernel.org, Jerry Snitselaar , Sumit Garg , Stefan Berger , Peter Huewe , Jason Gunthorpe , Arnd Bergmann , Greg Kroah-Hartman , open list Subject: Re: [PATCH] tpm: Detach page allocation from tpm_buf Message-ID: <20191003113506.GE8933@linux.intel.com> References: <20190925134842.19305-1-jarkko.sakkinen@linux.intel.com> <1569420226.3642.24.camel@HansenPartnership.com> <20190927130657.GA5556@linux.intel.com> <1570020105.4999.106.camel@linux.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1570020105.4999.106.camel@linux.ibm.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Oct 02, 2019 at 08:41:45AM -0400, Mimi Zohar wrote: > On Fri, 2019-09-27 at 16:06 +0300, Jarkko Sakkinen wrote: > > On Wed, Sep 25, 2019 at 10:03:46AM -0400, James Bottomley wrote: > > > On Wed, 2019-09-25 at 16:48 +0300, Jarkko Sakkinen wrote: > > > [...] > > > > + data_page = alloc_page(GFP_HIGHUSER); > > > > + if (!data_page) > > > > + return -ENOMEM; > > > > + > > > > + data_ptr = kmap(data_page); > > > > > > I don't think this is such a good idea. On 64 bit it's no different > > > from GFP_KERNEL and on 32 bit where we do have highmem, kmap space is > > > at a premium, so doing a highmem allocation + kmap is more wasteful of > > > resources than simply doing GFP_KERNEL. In general, you should only do > > > GFP_HIGHMEM if the page is going to be mostly used by userspace, which > > > really isn't the case here. > > > > Changing that in this commit would be wrong even if you are right. > > After this commit has been applied it is somewhat easier to make > > best choices for allocation in each call site (probably most will > > end up using stack). > > Agreed, but it could be a separate patch, prior to this one. ?Why > duplicate the problem all over only to change it later? What problem exactly it is duplicating? The existing allocation scheme here works correctly. /Jarkko