Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753686AbdHIUnh (ORCPT ); Wed, 9 Aug 2017 16:43:37 -0400 Received: from mout.gmx.net ([212.227.17.22]:61792 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753626AbdHIUnT (ORCPT ); Wed, 9 Aug 2017 16:43:19 -0400 MIME-Version: 1.0 Message-ID: From: "Peter Huewe" To: "Ken Goldman" Cc: linux-ima-devel@lists.sourceforge.net, linux-security-module@vger.kernel.org, tpmdd-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org Subject: Aw: Re: [tpmdd-devel] [PATCH] tpm: improve tpm_tis send() performance by ignoring burstcount Content-Type: text/plain; charset=UTF-8 Date: Wed, 9 Aug 2017 22:43:07 +0200 Importance: normal Sensitivity: Normal In-Reply-To: <819e3d38-3f16-a32b-1928-c425b763d5f8@linux.vnet.ibm.com> References: <20170807114632.1339-1-nayna@linux.vnet.ibm.com> <20170808191145.kggmoczd5laiccrn@linux.intel.com> <819e3d38-3f16-a32b-1928-c425b763d5f8@linux.vnet.ibm.com> X-UI-Message-Type: mail X-Priority: 3 X-Provags-ID: V03:K1:huG3szdh+kqBdeiOjzhlK5FUVr2Lf+QlgxR82HyuTai eLaWYG4Z+XRdvm5P7tGnCoYnalipbvyPl+m7JqSzEOdSbEyvP8 HeCWxzijGiIgeMRoUFAsvgVWNmecgCnNMWanYr19tYqy0lHm9j sqx4QtyJPf7cL7vuhSZl5cDhcrTDOMK1txu2mV3L9P/503Z03d oxgh7OZsW+hEA3IPqemdYcUazb3dgMHhHMQYDaJGZzNLNwVXzN PwE2SOqA5/BTBGP90LMbkIvSq4tBsnI6t09I1fi1OQVRkSyxQ7 nv4hu8= X-UI-Out-Filterresults: notjunk:1;V01:K0:16cNCiji89c=:v8sWGgj8uAqyze1fs4Yxvs IOmIq3mFgY1pn15H/SEichdTC9SB58pb5mcAWChgUorUsXrHRNY11VjCSHoSHsCrO2N/6zB8E 3Sa7BaSpmqjO9lFZxDvouaQnXzqsuWgEQXfawzaAEeM1xRRio+yvDhQQBDtdaUVM73QNXH/Q1 +5QicwopPPA+zMQtt1cCdP9xlqPTF3M6BwndFR2VHBh6UIQjbHk4MqXeQpfQvEZg6v51sXL/G 3DL+01WBvbVareC/h+nu09jQGtB50np0mLObX2Fz1SskmpXyHHsf/5UwDSnDyBy/0qFfu27lb s/JFPG0x6dWcDdyncuIKJWlNOYyt4pG4sRTZ/AK/z4iUj90SrIysx8g4APzVDw7IOEg01EcB6 4Y9r/GqxhiLH1C6Ov4gsT/3fIPmC1DZRSJEUiZX8X91tVAb+lpAlxw8OJUdueNiNMCsKtI3na EvBRj3JJiHRj7Putjt42Ts9cKV/6RfUz2X4AUgvASWnXY/ZIqdxX Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2263 Lines: 61 Hi Ken, (speaking on behalf of myself here, not my employer :) ) > On Mon, Aug 07, 2017 at 01:52:34PM +0200, Peter Huewe wrote: >> Imho: NACK from my side. > After these viewpoints definitive NACK from my side too... > I responded to the thread comments separately. However, assuming NACK > is the final response, I have a question. Nothing is ever final :) > The problem is the 5 msec sleep between polls of burst count. In the > case of one TPM with an 8 byte FIFO, a 32 byte transfer incurs 4 of > these sleeps. Yes that's bad, especially with current msleep(5) is actually msleep(20). However, please also keep in mind SPI tpms show a much higher burst count value, (255) our I2C TPM SLB9645 even shows something in the range of 1k. :) > Would another solution be to reduce the burst count poll and sleep to, > e.g., 100 usec or even 10 usec? This would probably help greatly, but > till not incur the wait states that triggered the NACK. Imho the 5ms were an arbitrary chosen value for old old tpms. Back then also only msleep was available which was msleep(20) anyway. > My worry is that the scheduler would not be able to context switch that > fast, and so we wouldn't actually see usec speed polling. > Can a kernel expert offer an opinion? If you use sleep it's not guaranteed that you wakeup after exactly xx specified amount of time. Just that you sleep at least xx amount of time. Otherwise you would have to do delay/busywaiting. https://www.kernel.org/doc/Documentation/timers/timers-howto.txt Imho the best option is to figure out whether any vendor can determine the "FIFO flush time" i.e. how much time does it take to empty the fifo and fillup the burstcount and use this on the lower bound of an usleep range. I don't think tpms are in the range of < 10 us... @Ken: Maybe can you check in DDWG? What we often see/saw during some performance optimization tests is something like burstcount 7, burstcount 1, burstcount 7, burstcount 1... which is the oposite of what you want to achieve. You'd like to have something like burstcount 8, burstcount 8, burstcount 8.... Unfortunately TPMS don't report their max burstcount (afaik), otherwise it would be easy to write a calibration routine for the poll times. Thanks, Peter