Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754135AbcJLMQS (ORCPT ); Wed, 12 Oct 2016 08:16:18 -0400 Received: from mga04.intel.com ([192.55.52.120]:2047 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752653AbcJLMQL (ORCPT ); Wed, 12 Oct 2016 08:16:11 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,482,1473145200"; d="scan'208";a="18776961" Date: Wed, 12 Oct 2016 15:16:06 +0300 From: Jarkko Sakkinen To: Peter Huewe Cc: Jason Gunthorpe , tpmdd-devel@lists.sourceforge.net, Marcel Selhorst , open list Subject: Re: [PATCH] char/tpm: Check return code of wait_for_tpm_stat Message-ID: <20161012121606.GA11604@intel.com> References: <1476187261-29027-1-git-send-email-jarkko.sakkinen@linux.intel.com> <20161011171313.GD6881@obsidianresearch.com> <9174B547-9CD1-4F1B-A2A7-38B9A6AA3B33@gmx.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <9174B547-9CD1-4F1B-A2A7-38B9A6AA3B33@gmx.de> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1445 Lines: 28 On Tue, Oct 11, 2016 at 08:01:09PM +0200, Peter Huewe wrote: > > > Hi > Am 11. Oktober 2016 19:13:13 MESZ, schrieb Jason Gunthorpe : > >On Tue, Oct 11, 2016 at 03:01:01PM +0300, Jarkko Sakkinen wrote: > >> From: Peter Huewe > >> > >> In some weird cases it might be possible that the TPM does not set > >> STS.VALID within the given timeout time (or ever) but sets STS.EXPECT > >> (STS=0x0C) In this case the driver gets stuck in the while loop of > >> tpm_tis_send_data and loops endlessly. > > > >Doesn't that exchange mean the TPM has lost synchronization with the > >driver? Or maybe it crashed executing a command or something.. > > I saw that in the field on quite a few (similar) systems with our lpc tpms - so it affects end users. > Yes it is caused by some desynchronization or something similar. > > If you manually send a commandReady by mmaping the memory region you can un-stuck the driver and the situation was never seen again on that system. > > The exact reason how this happens is yet unknown, but the driver should definitely not be stuck in an endless loop (which zombies the application too) in that case but bail out as defined in the TIS protocol. The next access sends the cr which cures the unsynchronization. Even as a sanity check return codes should be checked so in any case I leaned towards applying this patch. It makes the driver more robust. /Jarkko