Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2876277imm; Sun, 16 Sep 2018 05:07:47 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZt2sUKFJJR3GTNcM1o5LlM/SRXSqdlqVffXcGDikROQQG7KJSdjTZJGAMsfaFO7sHzzTOx X-Received: by 2002:a17:902:d213:: with SMTP id t19-v6mr20686122ply.63.1537099667571; Sun, 16 Sep 2018 05:07:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537099667; cv=none; d=google.com; s=arc-20160816; b=bx2YNyr/A1bF/EKUdhfPDAzmxfX2g16rcdw4vHPGgBJp7SjQwWXdVtvzm4lcqhpSv7 Kh00ut6sgcaL7V9MteIM6fyUSz61geCclYcDcf/8y9uoivYTsT13A8qG+PyMidHxCj3M xcmhmNodji1U1aa4lK2qYhTLcCBTXaa3ghyrdvkOZHxDDeu/gKvcpgXV4UCzHeKB5Z6r wapnVVdpiBZW1qPV2if//QbG6nx0/eg3/KGu3vdj+HDwnRdBWDl7TAuB4wIqRgbNXrQZ 73VRLtMBx4MRbTE5PPOu+pwWOgmvJCNi2MqJXzxtSP3v3rJNiQb+BiFC/jA/wD6eAaz8 cocQ== 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-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=ZjFv/KFt8U8I6gofR35jv1fBhGyRhMCqUXZV6A5bCFg=; b=aHlo/G+8H/2bS9kICBaJSEn7j+YvTtCb9ygpBjq749ARhrgDWbIQ0KsFOu6ythK4RS MOGRdfJR4Y7iSFBw+Xas1bemvm+KI80QSdvF2rX9xNwYvQA0Ypr/+AVpAGBEiEsM6cs3 ZQToTkxRaYDnNS3VAW9r3RZ4ChgQIlz62AonsIgqX3ceMxycWdVEkmmQQWVih7epKCFM W0kYvnfwJyzwdKZUYO61bdyDNGlXezq2QFj4+HSAgb3KS0sMyTaeSuY7Y3TmC6zSvdpk VfunYxMvjzwD780PLicHmXTJaBoys6vnRiZ5in3SVF2HikYo0S0VJ8EMo7wY4Q+PICJk k8qw== 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 z20-v6si13120743pgk.17.2018.09.16.05.07.30; Sun, 16 Sep 2018 05:07:47 -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 S1728225AbeIPRaK (ORCPT + 99 others); Sun, 16 Sep 2018 13:30:10 -0400 Received: from mga02.intel.com ([134.134.136.20]:53593 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728155AbeIPRaK (ORCPT ); Sun, 16 Sep 2018 13:30:10 -0400 X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 16 Sep 2018 05:07:24 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.53,381,1531810800"; d="scan'208";a="263937747" Received: from wintersr-mobl2.ger.corp.intel.com (HELO localhost) ([10.252.37.137]) by fmsmga006.fm.intel.com with ESMTP; 16 Sep 2018 05:03:50 -0700 Date: Sun, 16 Sep 2018 15:03:49 +0300 From: Jarkko Sakkinen To: Tadeusz Struk Cc: flihp@twobit.us, jgg@ziepe.ca, linux-integrity@vger.kernel.org, linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v6 0/2] tpm: add support for nonblocking operation Message-ID: <20180916120349.GB5040@linux.intel.com> References: <153659990230.2284.5511495299744743989.stgit@tstruk-mobl1.jf.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <153659990230.2284.5511495299744743989.stgit@tstruk-mobl1.jf.intel.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Sep 10, 2018 at 10:18:22AM -0700, Tadeusz Struk wrote: > The TCG SAPI specification [1] defines a set of functions, which allow > 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], and an example application > by Philip Tricca [4]. Here is a short description from Philip: > > "The example application `glib-tss2-event` uses a glib main event loop > to create an RSA 2048 primary key in the TPM2 NULL hierarchy while > using a glib timer event to time the operation. A GSource object is > used to generate an event when the FD underlying the tss2 function > call has data ready. While the application waits for an event indicating > that the CreatePrimary operation is complete, it counts timer events > that occur every 100ms. Once the CreatePrimary operation completes the > number of timer events that occurred is used to make a rough calculation > of the elapsed time. This value is then printed to the console. > This takes ~300 lines of C code and requires no management or > synchronization of threads. The glib GMainContext is "just a poll() > loop" according to the glib documentation here: > > https://developer.gnome.org/programming-guidelines/stable/main-contexts.html.en > > and so supporting 'poll' is the easiest way to integrate with glib / > gtk+. This is true of any other event system that relies on 'poll' > instead of worker threads." > > [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 > [4] https://github.com/flihp/glib-tss2-async-example I tried to test this but I get 404 from https://github.com/tstruk/tpm2-tss/tree/async /Jarkko