Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp1585116imm; Wed, 20 Jun 2018 22:27:43 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJsfP3phQkrSMEPy+pbWRwv+D03KX3xIc/FISKpmKrxZT+2cvGXDNsmuYQxiTp8khYB7S+C X-Received: by 2002:a17:902:bd95:: with SMTP id q21-v6mr26642623pls.237.1529558863135; Wed, 20 Jun 2018 22:27:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529558863; cv=none; d=google.com; s=arc-20160816; b=YbyMIhhDDUlkarymDy8oocqQuEkYLhHZ6rfNZvafV5w0PHFYRqWy2oqQT7wgmX7PXR J2tGNCjaCOD3P+5k9o4zPL0wi//YauXeYTCbIil9lWzs/W9EE5GY6hQkNie5vGmE04/H tQ2CXo0OA0EX5+W+7rorcwOpOcLi7AKbLTuSoLdRsYCFIif0ctoxnoDJLapQrAy4QU5E OfJnzRC9boBsfkzsBTcTXiG1ez2rveZPHkeKNU15/Q99AknZx2fRf+9iHvFpEqP/ai6X 6hTirfXCYBgqZN7NOHX/3UHYAslR06lWTiYnZ0MnuNK9eorXNpN6Bjdg5zNDncxwBL0L Wofg== 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:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id :dkim-signature:arc-authentication-results; bh=oujGkCCNIeVV9JVZ2AgcLqiY5ycaOc9kFCXNpC5ZTNg=; b=V18v4Ngr6j4zJvPnZ/XvBkN6cVDh7uTqlyMt12YFvREX6FUS+ZymGvsjJDBQa8mTvc j1tIZT8/9Auf/XTQQ0fjWlmf2Fuj1SJmojsEjxUaeCX1woraRdzxEJSnZCI13lmC6jxf 89uC3laH+SsoWg9UqTwWeg+wybzNgaKZdZ5TDL1pIBFrOyelvyiD4sAmb2qGpSXHGII7 kyrLokz/t24MxkFsFn0JNIpGJF416oLt5Socn0P+Ri5z56CQ+cx0nA8bFxZUY/9/061l I7ysbM+aI9xQmbhKSCArV70pfURKomvZpmQxq774n85cc7hn7cATseOExgbg11+ikxWp Nu0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@hansenpartnership.com header.s=20151216 header.b=RB3Ykfa1; 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=hansenpartnership.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h16-v6si4222229pli.14.2018.06.20.22.27.17; Wed, 20 Jun 2018 22:27:43 -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; dkim=fail header.i=@hansenpartnership.com header.s=20151216 header.b=RB3Ykfa1; 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=hansenpartnership.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932666AbeFUF0O (ORCPT + 99 others); Thu, 21 Jun 2018 01:26:14 -0400 Received: from bedivere.hansenpartnership.com ([66.63.167.143]:39210 "EHLO bedivere.hansenpartnership.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932465AbeFUF0N (ORCPT ); Thu, 21 Jun 2018 01:26:13 -0400 Received: from localhost (localhost [127.0.0.1]) by bedivere.hansenpartnership.com (Postfix) with ESMTP id 826308EE1DB; Wed, 20 Jun 2018 22:26:12 -0700 (PDT) Received: from bedivere.hansenpartnership.com ([127.0.0.1]) by localhost (bedivere.hansenpartnership.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id IwOpI50e4AEZ; Wed, 20 Jun 2018 22:26:12 -0700 (PDT) Received: from jarvis (161.21.149.210.rev.iijmobile.jp [210.149.21.161]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by bedivere.hansenpartnership.com (Postfix) with ESMTPSA id B1B1C8EE01C; Wed, 20 Jun 2018 22:26:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=hansenpartnership.com; s=20151216; t=1529558772; bh=nEicptZxq2GEAOPsCisFzNo/8PRq3UtmbgKeSZ0PIOc=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=RB3Ykfa1LxRUS5XrDjTZGpguXK3E9LFINaQyIToeXjgafQBPafouq/ejLhIhehWMT uk/cVQQ/G4VyRPZ/GIw43HIfvKXHj6lsUU44QGe7cFj3bEf71QeVLwK4tUbzJtGHuO YbdoQ3nLWrjk/J/sJKjV9Q1QwI1z7yMB7uOt6ne0= Message-ID: <1529558767.3118.1.camel@HansenPartnership.com> Subject: Re: [PATCH v3 0/2] tpm: add support for nonblocking operation From: James Bottomley To: Tadeusz Struk , Tadeusz Struk , 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, "Dock, Deneen T" Date: Thu, 21 Jun 2018 14:26:07 +0900 In-Reply-To: <0e46c2e9-af2b-550f-2b3d-98cbc1840bc1@gmail.com> References: <152882630662.30206.8805136953394285180.stgit@tstruk-mobl1.jf.intel.com> <20180619131046.GC5609@linux.intel.com> <1529539176.4163.2.camel@HansenPartnership.com> <0e46c2e9-af2b-550f-2b3d-98cbc1840bc1@gmail.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.22.6 Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 2018-06-20 at 18:24 -0700, Tadeusz Struk wrote: > On 06/20/2018 04:59 PM, James Bottomley wrote: > > I'm slightly surprised by this statement.  I thought IoT Node.js > > runtimes (of which there are far too many, so I haven't looked at > > all of them) use libuv or one of the forks: > > > > http://libuv.org/ > > > > As the basis for their I/O handling?  While libuv can do polling > > for event driven interfaces it also support the worker thread model > > just as easily: > > > > http://docs.libuv.org/en/v1.x/threadpool.html > > Yes, it does polling: > http://docs.libuv.org/en/v1.x/design.html#the-i-o-loop But that's for networking. You'll be talking to the TPM RM over the file descriptor so that follows the thread pool model in http://docs.libuv.org/en/v1.x/design.html#file-i-o This precisely describes the current file descriptor abstraction we'd use for the TPM. > > > Similarly embedded applications, which are basically just a > > > single threaded event loop, quite often don't use threads because > > > of resources constrains. > > > > It's hard for me, as a kernel developer, to imagine any embedded > > scenario using the Linux kernel that would not allow threads unless > > the writers simply didn't bother with synchronization: The kernel > > schedules at the threads level and can't be configured not to use > > them plus threads are inherently more lightweight than processes so > > they're a natural fit for resource constrained scenarios. > > > > That's still not to say we shouldn't do this, but I've got to say I > > think the only consumers would be old fashioned C code: the code we > > used to write before we had thread libraries that did use signals > > and poll() for a single threaded event driven monolith (think green > > threads), because all the new webby languages use threading either > > explicitly or at the core of their operation. > > Regardless of how it actually might be used, I'm happy that we agree > on that this *is* the right thing to do. I didn't say that. I think using a single worker thread queue is the correct abstraction for the TPM. If there's a legacy use case for poll(), I don't see why not since the code seems to be fairly small and self contained, but I don't really see it as correct or necessary to do it that way. James