Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp138059imm; Tue, 19 Jun 2018 17:46:28 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJR2w+Kt4Qex+X2AxowLGmHhFwh6CHwA53BYSRgBrjvCRsegiE2NSWVtIonBxY/CA5OGak1 X-Received: by 2002:a17:902:7604:: with SMTP id k4-v6mr20752941pll.13.1529455588531; Tue, 19 Jun 2018 17:46:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529455588; cv=none; d=google.com; s=arc-20160816; b=TC4m4fjGSHaaEYkA3ZUGE9uR439KE482rOtdOXA20vj0gp5KoCxLBq2RkYSFju6qzl kNskjZNkdhlKUAm7UNr3k9cR0+HiQeo+RoV8JR1ORvv4EUEqWNdKTYbjUPf0Dtc2BEcX eHsktP5wJ6CM6woLkdnnLCSdEDrLu4re9Trt8Oe54bJJnvjUzReQ4cJ+NEeLcIk6gFMs KwodyntyCU0j7lbckPrPvbwQpOqDRy/k3ixIO0V8huVEV0W0yrWCgRKyxBTrii/pjVkG iw0a0HzmBrxdei0oADdaEpOs/VIaHIAD6Xok9T9Eqa5tk2g+GVC9oqc/ndbP3RorZLLY B81g== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:autocrypt:openpgp:from:references:cc:to:subject :arc-authentication-results; bh=FAokDGzCV5h+S7MYISjnwziazqq0JBoUjeaTmT5GDgA=; b=UHrdSlwQnTqWFXG63MmiTG2AZovBl8MVK9l8+HwzZsLdIOlsIv0G5h7CrYphPZQusX KX8pR/5dfBhj8KGO1XDPf4E648HPkgMz35TUkJMXTRAb/DqGZOwxFySUIZMqtmq9qY5G zB6FBj0nwoXontDHjSSf7QvSCrQblwteoLXmkcg8gezbsUPb+l71J3VmIBy6WOIbNfU7 1wbRBlBH/45aJNMdNjTF7s825RiNRD2/rJ/VKBdTmTMIstakR01xRaA53qhaRKp964W9 /g0tn/lj5FJPAETuoaGRCLuxnbdW7D3nh7+xvfF6kUubOxL3cKlorEgehNkJhoTRMSHU 3CHA== 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 m189-v6si809395pga.107.2018.06.19.17.46.14; Tue, 19 Jun 2018 17:46:28 -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 S1752915AbeFTApi (ORCPT + 99 others); Tue, 19 Jun 2018 20:45:38 -0400 Received: from mga06.intel.com ([134.134.136.31]:10813 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751337AbeFTApf (ORCPT ); Tue, 19 Jun 2018 20:45:35 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Jun 2018 17:45:35 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,245,1526367600"; d="scan'208";a="60623899" Received: from tstruk-mobl1.jf.intel.com ([10.7.196.162]) by orsmga003.jf.intel.com with ESMTP; 19 Jun 2018 17:45:35 -0700 Subject: Re: [PATCH v3 0/2] tpm: add support for nonblocking operation To: Jarkko Sakkinen Cc: jgg@ziepe.ca, linux-integrity@vger.kernel.org, linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org, philip.b.tricca@intel.com, James.Bottomley@HansenPartnership.com, "Dock, Deneen T" References: <152882630662.30206.8805136953394285180.stgit@tstruk-mobl1.jf.intel.com> <20180619131046.GC5609@linux.intel.com> From: Tadeusz Struk Openpgp: preference=signencrypt Autocrypt: addr=tadeusz.struk@intel.com; prefer-encrypt=mutual; keydata= xsDiBEiLICMRBADteQacQxypsuFvAw6IwYzbD8pgQi+kLYBcqfGgVAUN/cO+sLl6u1lVdaDB fhAArdbV9lpoqcWnmhQFTb4A+W569EpydBr6nuatWkEB+fmmx8YoUtuZfXt7v+1l1rc09kaW LY+TkwQkvFCeuvdasgmBLnmRWymEGWi1E12hUgTw/wCgtK24geC7XkiuANMv0gpr+raOgQMD /2yJZ0SeXQApWyTRaeIYN8GgYHZTWuBp/ofN+viEkhrDxahcaGPP5B/Nv6VS1+M0e5m8OzHj qPUbgfyOeJcslC5aoZdqqqzVWVLaA/+Jy+O+6T3k3R/IryVVATldBlwnGFDhET0mKQsd15zt cIdQBBbfSFR5VlugZuWV5q442IpPA/4g7nen9FFPxh45Te8D54hAsOCywjm6xUE0UJGYHeJ/ MXCPtuXfVCbYcOxZVH7kUS2Vtk5d3bF40IE2WnVq1ZScNANF4ZjikxYhYGfNWX3HXak1gSoj UrY87rMSjPIAry4L0BoIx2qgL/k4iV/3QcXL4t5wosU0iw++suf1zGGcKM0gVGFkZXVzeiBT dHJ1ayA8dHN0cnVrQGdtYWlsLmNvbT7CYwQTEQIAIwIbAwYLCQgHAwIEFQIIAwQWAgMBAh4B AheABQJQTjJTAhkBAAoJEDFswfskq9xyqvcAoI2nsaUCX8ZGbu+Jhq+++qlBFJ2rAJ983RoO R2ofHhn3g3Qi4K34tw0l087BTQRauzUlARAAqkWRL/InEPnoGMg/gw/CRaDBaIBgMsvIcghI 7xevIzpleXt6jKHghSBooH+zaT7qi4u2gkgPn4odsER3Rm94XgrZJgoqls6EpKMWpJNGP4HT eYgykhfsZOLX8ijUbjTM/Sm/dZVo6aYoBL2+ciJwyl+Zt3Mp6un3/GWu6cA9005V50pRqO7j PTlVCHi2bedcEEf5DDsYJv/3Oz8/4LpSf6BL6BltjeZVa2y03dTMmD031JTH+OuyJm1yh72Z HWxhlYNXOv6uFJJVr+paQjrAsBVIYKhK24bD+uGJxLm8AN9i7/Si+2YeSsXvKUhk9mIoFBnU VFo63cziRTcpRu/kXgDAbujwN88qytEcvhEZHS6B9vdws+lhTpolEjkLCkz0Y59z4Fs9srKy QkRN+wtdiLgrwyDW3ryAKxcDmOumGWebDxpaOI/pBhrlS93HmDlvj7JmgTUU4a/NhwI3dXh5 pn8FZzZyVXe3Kc3bu5T3UAC7uztinsAvCJQS6jGZWrXmXkqYkaLXQOw61eInWjr01zE/zDbE mdJPM0+va/gtZx9TtGxr4PpjbqswqCiubLDZXZHh5uqArPv/i+E8aXIsNSTN6Rrqs1j9YgDN ALksibv6+tXH3sOlCUgjuZgJH3+s/mnaAtiV2rZ/WlH15d6nd0uiDSZrKhlR+g4NHMh1ztEA EQEAAcJPBBgRAgAPBQJauzUlAhsMBQkJZgGAAAoJEDFswfskq9xyfv8AoI8aPrJCoM0h5WOP kKxMmPEPHzUNAJ9jBBYXhX1CWg+IhI7i/fLlI0vwCA== Message-ID: Date: Tue, 19 Jun 2018 17:45:35 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <20180619131046.GC5609@linux.intel.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 06/19/2018 06:10 AM, Jarkko Sakkinen wrote: > On Tue, Jun 12, 2018 at 10:58:26AM -0700, Tadeusz Struk wrote: >> The TCG SAPI specification [1] defines a set of functions, which allows >> applications to use the TPM device in either blocking or non-blocking fashion. >> Each command defined by the specification has a corresponding >> Tss2_Sys__Prepare() and Tss2_Sys__Complete() call, which >> together with Tss2_Sys_ExecuteAsync() is designed to allow asynchronous >> mode of operation. Currently the TPM driver supports only blocking calls, >> which doesn't allow asynchronous IO operations. >> This patch changes it and adds support for nonblocking write and a new poll >> function to enable applications, which want to take advantage of this feature. >> The new functionality can be tested using standard TPM tools implemented >> in [2], together with modified TCTI from [3]. >> >> [1] https://trustedcomputinggroup.org/wp-content/uploads/TSS_SAPI_Version-1.1_Revision-22_review_030918.pdf >> [2] https://github.com/tpm2-software/tpm2-tools >> [3] https://github.com/tstruk/tpm2-tss/tree/async > > For me the value is still a bit questionable. The benchmark looks a bit > flakky to give much figures how this would work with real world workloads. > > I read James response and I also have to question why not just a worker > thread in user space? TPM does only one command at a time anyways. > > Cannot take this in before I know that user space will (1) adapt to > this and (2) gain value compared to a worker thread. > Hi Jarkko, Thanks for reviewing the patch. There are applications/frameworks where a worker thread is not an option. Take for example the IoT use-cases and frameworks like IoT.js, or "Node.js for IoT". They are all single threaded, event-driven frameworks, using non-blocking I/O as the base of their processing model. Similarly embedded applications, which are basically just a single threaded event loop, quite often don't use threads because of resources constrains. If your concern is that user space will not adopt to this, I can say that TSS library [1] is currently blocked on this feature, and we can not enable some of the use-cases mentioned above because of this. Thanks, Tadeusz [1] https://github.com/tpm2-software/tpm2-tss