From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751394AbdK0HI4 (ORCPT ); Mon, 27 Nov 2017 02:08:56 -0500 Received: from mail-bl2nam02on0082.outbound.protection.outlook.com ([104.47.38.82]:32292 "EHLO NAM02-BL2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751138AbdK0HIx (ORCPT ); Mon, 27 Nov 2017 02:08:53 -0500 From: Leendert van Doorn To: Mimi Zohar , Jarkko Sakkinen , Nayna Jain CC: "Alexander.Steffen@infineon.com" , "linux-integrity@vger.kernel.org" , "linux-security-module@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "peterhuewe@gmx.de" , "tpmdd@selhorst.net" , "patrickc@us.ibm.com" , "Safford, David (GE Global Research, US)" Subject: Re: [PATCH v4 2/4] tpm: ignore burstcount to improve tpm_tis send() performance Thread-Topic: [PATCH v4 2/4] tpm: ignore burstcount to improve tpm_tis send() performance Thread-Index: AQHTZtTobU5Uh+YUvkmdN0QLDwdtVqMnSWAA Date: Mon, 27 Nov 2017 07:08:51 +0000 Message-ID: <694703AB-68E1-4026-937C-61DBBE08DB4B@paramecium.org> References: <20171017203232.2262-1-nayna@linux.vnet.ibm.com> <20171017203232.2262-3-nayna@linux.vnet.ibm.com> <5ef60315f2254b3b8bcc217a572280e5@infineon.com> <3ff12c6536de4379aa61cb09ebc9d105@infineon.com> <20171123144742.GC8862@swastik> <20171126152218.c5fsr7uhs3ipwwha@linux.intel.com> <1511714261.4361.13.camel@linux.vnet.ibm.com> In-Reply-To: <1511714261.4361.13.camel@linux.vnet.ibm.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=leendert@paramecium.org; x-originating-ip: [2601:600:8280:5494:ec4:7aff:fe69:d918] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;BN3PR19MB0610;6:UJPLnoedRhpcgMIypaPok55jaW10WRbK+fzypv4ecxbmm8hZ1tQPGFhRQbN9XUfM+xoDwKzwrdytUb54KDBIkxfuoRoeSjg1yTbT317t2b2Jn+g3XFiRKe57h3R9Csa3dn+LaI8jVFlqIA/XQZ30eaQmokMwqL7NAlbaTe9rE1QHEJtVR8rHeDlVFV778A9OKnwQ9VDtNvshPcHJCPRmhrt1zdTcVQjL8ATJejKkBrkZDLZ8hqWrkstjHbj6DnRXm1Nxv45qFAQZXGLFHhuUJOkayKqKT7+ESGTslCCR3cu/wR8h9/JHhB9NQfIhRM7pExNQIR4fWA12alszOqEC1jRrdxxdK3P/gaT83IG7LwM=;5:cqhkjUjTwnAK6pv3S3E+psvTLqb5cqf8CHxvOYOazb484UPMl6c2X4WbJHzHAqKHNM9dXUGiedJgUjqVWQRBjVEaV7SEKVPSCVNeAbp1LZnmtbmnO0d0027DMGJXxLw47t+s5X5suTWxvCdX8l+22F/tuINO7VL6OermXEcSxV0=;24:A9vl9j3BKSaIg2RBChO3smdU9WVLL/iijXrPG6bynqEthrPSlXsVyYLWvu9dvOcGQFF1BSI4okvwCJJ3fDKv8XE4xXYh/b30nVCxsdqTqb8=;7:yIg+qUnQY4DDVEVW/ho+IWTG+Yrym6noVBbZUXjwY9bOSZlaix+HRRIjKw0iwQOfIvNnG/0nnDeSsZ9g3c4edyzZBm6NctfX5TjwYeQQniWNgeGJd0h/eD96JApyHJVvIeom18dsxKSA0Yp9lA8UfV4iprCUiErK1SYhl5Gd4jrrk6/1WyPfV9N0IMpqoJP5yMICBkaV7pi9GMDxjYJv+NI/ct71h45dg6F0srMjtZar8IY8itKYt9BCfko3YXmj x-ms-exchange-antispam-srfa-diagnostics: SSOS; x-ms-office365-filtering-correlation-id: 55f8c978-e7ef-4f3e-f6de-08d53565b6b8 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(4534020)(4602075)(4603075)(4627115)(201702281549075)(5600026)(4604075)(2017052603199);SRVR:BN3PR19MB0610; x-ms-traffictypediagnostic: BN3PR19MB0610: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(104084551191319); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(6040450)(2401047)(8121501046)(5005006)(3231022)(93006095)(93001095)(10201501046)(3002001)(6041248)(20161123555025)(20161123564025)(20161123562025)(20161123560025)(20161123558100)(201703131423075)(201703061421075)(2016111802025)(6043046)(6072148)(201708071742011);SRVR:BN3PR19MB0610;BCL:0;PCL:0;RULEID:(100000803101)(100110400095);SRVR:BN3PR19MB0610; x-forefront-prvs: 0504F29D72 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(6009001)(366004)(376002)(346002)(24454002)(199003)(189002)(2900100001)(25786009)(99286004)(6116002)(8656006)(106356001)(2950100002)(6436002)(33656002)(101416001)(7416002)(5660300001)(2906002)(68736007)(3660700001)(6486002)(97736004)(6246003)(8666007)(4326008)(77096006)(82746002)(3280700002)(105586002)(81166006)(8676002)(7736002)(81156014)(83716003)(305945005)(102836003)(86362001)(8936002)(189998001)(575784001)(508600001)(54356999)(50986999)(36756003)(229853002)(76176999)(54906003)(14454004)(93886005)(53936002)(110136005)(6512007)(6506006);DIR:OUT;SFP:1101;SCL:1;SRVR:BN3PR19MB0610;H:BN3PR19MB0612.namprd19.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;A:0;MX:1;LANG:en; spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="utf-8" Content-ID: <32E938F490438049BA12C9589C384C82@namprd19.prod.outlook.com> MIME-Version: 1.0 X-OriginatorOrg: paramecium.org X-MS-Exchange-CrossTenant-Network-Message-Id: 55f8c978-e7ef-4f3e-f6de-08d53565b6b8 X-MS-Exchange-CrossTenant-originalarrivaltime: 27 Nov 2017 07:08:51.4774 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 02ee7039-4a74-4bc8-a31e-6b045857e55f X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN3PR19MB0610 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by nfs id vAR790Au002726 Hmm, this is almost 20 years old code ( I think the original code did a burst write and didn't check for error conditions until the very last byte write. I seem to remember that there was some text in the original standard to that effect (this may have gone back as far as IBM's ESS spec). The current code does check for error conditions after each write byte(s) so I don't think there is any reason for this anymore. Changing the while condition to count < len and setting burstcnt = min_t(int, burstcnt, len - count) and remove the tpm_tis_write8/wait_for_tpm_stat/tpm_tis_status clauses after the while loop should be sufficient. Leendert On 11/26/17, 8:37 AM, "Mimi Zohar" wrote: [Cc'ing Dave and Leendeert] Hi Jarkko, > > It seems that the last byte was sent from the beginning (27084ef > > [PATCH] tpm: driver for next generation TPM chips,), does anyone > > remember the reason ? > > Sent from the beginning? I went through the commit logs to see if any of the patch descriptions have an explanation for sending the last byte separately. Based on commit 27084efee0c3 "[PATCH] tpm: driver for next generation TPM chips", it seems it's been there since the beginning. Dave, Leendert, Do either of you remember the reason for tpm_tis_send_data() sending the last byte separately? thanks, Mimi From mboxrd@z Thu Jan 1 00:00:00 1970 From: leendert@paramecium.org (Leendert van Doorn) Date: Mon, 27 Nov 2017 07:08:51 +0000 Subject: [PATCH v4 2/4] tpm: ignore burstcount to improve tpm_tis send() performance In-Reply-To: <1511714261.4361.13.camel@linux.vnet.ibm.com> References: <20171017203232.2262-1-nayna@linux.vnet.ibm.com> <20171017203232.2262-3-nayna@linux.vnet.ibm.com> <5ef60315f2254b3b8bcc217a572280e5@infineon.com> <3ff12c6536de4379aa61cb09ebc9d105@infineon.com> <20171123144742.GC8862@swastik> <20171126152218.c5fsr7uhs3ipwwha@linux.intel.com> <1511714261.4361.13.camel@linux.vnet.ibm.com> Message-ID: <694703AB-68E1-4026-937C-61DBBE08DB4B@paramecium.org> To: linux-security-module@vger.kernel.org List-Id: linux-security-module.vger.kernel.org Hmm, this is almost 20 years old code ( I think the original code did a burst write and didn't check for error conditions until the very last byte write. I seem to remember that there was some text in the original standard to that effect (this may have gone back as far as IBM's ESS spec). The current code does check for error conditions after each write byte(s) so I don't think there is any reason for this anymore. Changing the while condition to count < len and setting burstcnt = min_t(int, burstcnt, len - count) and remove the tpm_tis_write8/wait_for_tpm_stat/tpm_tis_status clauses after the while loop should be sufficient. Leendert ???On 11/26/17, 8:37 AM, "Mimi Zohar" wrote: [Cc'ing Dave and Leendeert] Hi Jarkko, > > It seems that the last byte was sent from the beginning (27084ef > > [PATCH] tpm: driver for next generation TPM chips,), does anyone > > remember the reason ? > > Sent from the beginning? I went through the commit logs to see if any of the patch descriptions have an explanation for sending the last byte separately. Based on commit 27084efee0c3 "[PATCH] tpm: driver for next generation TPM chips", it seems it's been there since the beginning. Dave, Leendert, Do either of you remember the reason for tpm_tis_send_data() sending the last byte separately? thanks, Mimi ????{.n?+???????+%?????????w??{.n?+????{??????????v?^?)????w*jg??????????j????G?????? ???j:+v???w?j?m????????w?????f???h????????? From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-bl2nam02on0082.outbound.protection.outlook.com ([104.47.38.82]:32292 "EHLO NAM02-BL2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751138AbdK0HIx (ORCPT ); Mon, 27 Nov 2017 02:08:53 -0500 From: Leendert van Doorn To: Mimi Zohar , Jarkko Sakkinen , Nayna Jain CC: "Alexander.Steffen@infineon.com" , "linux-integrity@vger.kernel.org" , "linux-security-module@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "peterhuewe@gmx.de" , "tpmdd@selhorst.net" , "patrickc@us.ibm.com" , "Safford, David (GE Global Research, US)" Subject: Re: [PATCH v4 2/4] tpm: ignore burstcount to improve tpm_tis send() performance Date: Mon, 27 Nov 2017 07:08:51 +0000 Message-ID: <694703AB-68E1-4026-937C-61DBBE08DB4B@paramecium.org> References: <20171017203232.2262-1-nayna@linux.vnet.ibm.com> <20171017203232.2262-3-nayna@linux.vnet.ibm.com> <5ef60315f2254b3b8bcc217a572280e5@infineon.com> <3ff12c6536de4379aa61cb09ebc9d105@infineon.com> <20171123144742.GC8862@swastik> <20171126152218.c5fsr7uhs3ipwwha@linux.intel.com> <1511714261.4361.13.camel@linux.vnet.ibm.com> In-Reply-To: <1511714261.4361.13.camel@linux.vnet.ibm.com> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Sender: linux-integrity-owner@vger.kernel.org List-ID: Hmm, this is almost 20 years old code ( I think the original code did a burst write and didn't check for error conditions until the very last byte write. I seem to remember that there was some text in the original standard to that effect (this may have gone back as far as IBM's ESS spec). The current code does check for error conditions after each write byte(s) so I don't think there is any reason for this anymore. Changing the while condition to count < len and setting burstcnt = min_t(int, burstcnt, len - count) and remove the tpm_tis_write8/wait_for_tpm_stat/tpm_tis_status clauses after the while loop should be sufficient. Leendert On 11/26/17, 8:37 AM, "Mimi Zohar" wrote: [Cc'ing Dave and Leendeert] Hi Jarkko, > > It seems that the last byte was sent from the beginning (27084ef > > [PATCH] tpm: driver for next generation TPM chips,), does anyone > > remember the reason ? > > Sent from the beginning? I went through the commit logs to see if any of the patch descriptions have an explanation for sending the last byte separately. Based on commit 27084efee0c3 "[PATCH] tpm: driver for next generation TPM chips", it seems it's been there since the beginning. Dave, Leendert, Do either of you remember the reason for tpm_tis_send_data() sending the last byte separately? thanks, Mimi