From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D31DEC433DF for ; Thu, 25 Jun 2020 21:25:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AC7ED204EC for ; Thu, 25 Jun 2020 21:25:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2406059AbgFYVZJ (ORCPT ); Thu, 25 Jun 2020 17:25:09 -0400 Received: from mga12.intel.com ([192.55.52.136]:48700 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2403817AbgFYVZJ (ORCPT ); Thu, 25 Jun 2020 17:25:09 -0400 IronPort-SDR: 9aj0JHzH+46SYZmpY3zgR4ipms0dJKrn3mtpToH3uuSZJkV6ebLblFTTOgW3XqZyXJr0ZhwFHl UWT36zlniaCw== X-IronPort-AV: E=McAfee;i="6000,8403,9663"; a="124731569" X-IronPort-AV: E=Sophos;i="5.75,280,1589266800"; d="scan'208";a="124731569" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Jun 2020 14:25:07 -0700 IronPort-SDR: JjzDwpV7/tC8ln67VUO2qXVTBl+4LIVaxChS5eHlCy/zuRAKXDUCyNlknQHRYEzQyWbVV0gSlN hSy5cQDguCRw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,280,1589266800"; d="scan'208";a="298925489" Received: from gumm-mobl2.ger.corp.intel.com (HELO localhost) ([10.252.49.123]) by orsmga007.jf.intel.com with ESMTP; 25 Jun 2020 14:25:01 -0700 Date: Fri, 26 Jun 2020 00:24:53 +0300 From: Jarkko Sakkinen To: Stefan Berger Cc: linux-integrity@vger.kernel.org, James Bottomley , Peter Huewe , Jason Gunthorpe , Arnd Bergmann , Greg Kroah-Hartman , Jerry Snitselaar , Sumit Garg , Alexey Klimov , open list Subject: Re: [PATCH] tpm: tpm2-space: Resize session and context buffers dynamically Message-ID: <20200625212453.GB20341@linux.intel.com> References: <20200625042424.370072-1-jarkko.sakkinen@linux.intel.com> <2f8a0127-d2ba-21aa-75b3-2dfccfb52eab@linux.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2f8a0127-d2ba-21aa-75b3-2dfccfb52eab@linux.ibm.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Sender: linux-integrity-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-integrity@vger.kernel.org On Thu, Jun 25, 2020 at 08:13:09AM -0400, Stefan Berger wrote: > On 6/25/20 12:24 AM, Jarkko Sakkinen wrote: > > Re-allocate context and session buffers when needed. Scale them in page > > increments so that the reallocation is only seldomly required, and thus > > causes minimal stress to the system. Add a static maximum limit of four > > pages for buffer sizes. > > > > Cc: James Bottomley > > Suggested-by: Stefan Berger > > Signed-off-by: Jarkko Sakkinen > > --- > > Tested only for compilation. > > drivers/char/tpm/tpm2-space.c | 80 ++++++++++++++++++++++++----------- > > include/linux/tpm.h | 6 ++- > > 2 files changed, 59 insertions(+), 27 deletions(-) > > > > diff --git a/drivers/char/tpm/tpm2-space.c b/drivers/char/tpm/tpm2-space.c > > index 982d341d8837..acb9e82bf9e8 100644 > > --- a/drivers/char/tpm/tpm2-space.c > > +++ b/drivers/char/tpm/tpm2-space.c > > @@ -15,6 +15,8 @@ > > #include > > #include "tpm.h" > > +#define TPM2_SPACE_MAX_BUFFER_SIZE (4 * PAGE_SIZE) > > PAGE_SIZE is 64k on ppc64. Rather use 4 * 4096? Better to then just put it as 16384. /Jarkko