Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp3188264ybt; Mon, 22 Jun 2020 17:51:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzWOCS5Io/lLaAxprjHIeN+1QADf2kgNmGsJn87SEL2YLrOffBp9KjyBuKd/Q/uxxMhpfQ3 X-Received: by 2002:a17:907:94ca:: with SMTP id dn10mr17380807ejc.348.1592873466419; Mon, 22 Jun 2020 17:51:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592873466; cv=none; d=google.com; s=arc-20160816; b=WhPUnmf8gZyXbMI4oljPeBhD1k1OLRBkknbCgD+9KPdXcUMtKYlWKtxaHyPsqjg/35 rorwrfSJ8+ifLS9j3IBkoTm/ZHirOawA+zyu8tKJ7kaNMEugVvNO4rjni7xhXBOv9+b1 V7aAVwxfgdpIMGl8IklMHGUdgi6MybmckB+dNJ06q/39UYpXEWwXQjDnO4XdcVOTix5T nOJIHDZTfKBOuJ8IazTgjlOOngCr5/vsUzOM88wmxPXW6+B9tgAuoSEzpkCRlR2YZ/Le PxqP52ku1y480BG4jN6zsbMvDeI4Mjc2J020aST20SuzJ3F734ciA2p9AxNj2VfBdVj6 kWpQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:organization:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:ironport-sdr:ironport-sdr; bh=Tb8LAbLznSFBTGh0Nr7UKU3PBUxgAROHBkRPMDBDboo=; b=a5e9p8grWBt58K9wnCOC9RYLoe9C7IsStCKs4TjieCyWpOu5NPT1UQGSMEEnvNnUkV elEmNiokD0WEjCGuzbzvedd2uulNqEJDnuYlzBDuGpcGQhuDPu7s2KkN1RStvmC40rys XND6hPOfxerodtCdaIybGc4joNNCThfX4TUb2Hp/I7+0YrXAUuoQ8JkpbF/XSuWnOFli XHyE0NS7tbVZ11dASGPCOau2tyR5nlyvpZB8lcAySFnW32kkTyncfJfB1HlSw1D8JlWL +hxjn0yRMMHP86KgR1oEzUfl8f8odaM0BlXgeg6CCyYxXpUFvmINRDNGFraGIk1HhBtH imbA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id c1si9474831edr.485.2020.06.22.17.50.43; Mon, 22 Jun 2020 17:51:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1732317AbgFWAsV (ORCPT + 99 others); Mon, 22 Jun 2020 20:48:21 -0400 Received: from mga09.intel.com ([134.134.136.24]:23082 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731716AbgFWAsU (ORCPT ); Mon, 22 Jun 2020 20:48:20 -0400 IronPort-SDR: xcbKq55JFyPn2Z7U8E0/rcd0GOQD0Xsbhoi4YsCsgHD2bacIy/rS/HLrgQ1x+50DWvtB12BkXd Z7cZV+iHuG+w== X-IronPort-AV: E=McAfee;i="6000,8403,9660"; a="145420202" X-IronPort-AV: E=Sophos;i="5.75,268,1589266800"; d="scan'208";a="145420202" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jun 2020 17:48:19 -0700 IronPort-SDR: 9jEEJuxfpBhX37hxIAiIqJr7MzUGTlfXJVnvnstDhgdyY8D03DaTh7iAXHM34LgVacTLSlUS2/ c/icCE4uxyQA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,268,1589266800"; d="scan'208";a="275173913" Received: from jczajka-mobl.ger.corp.intel.com (HELO localhost) ([10.249.40.133]) by orsmga003.jf.intel.com with ESMTP; 22 Jun 2020 17:48:14 -0700 Date: Tue, 23 Jun 2020 03:48:13 +0300 From: Jarkko Sakkinen To: David Gibson Cc: stefanb@linux.ibm.com, mpe@ellerman.id.au, peterhuewe@gmx.de, jgg@ziepe.ca, nayna@linux.ibm.com, paulus@samba.org, linuxppc-dev@lists.ozlabs.org, linux-integrity@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCHv2] tpm: ibmvtpm: Wait for ready buffer before probing for TPM2 attributes Message-ID: <20200623004813.GB28795@linux.intel.com> References: <20200619033040.121412-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200619033040.121412-1-david@gibson.dropbear.id.au> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jun 19, 2020 at 01:30:40PM +1000, David Gibson wrote: > The tpm2_get_cc_attrs_tbl() call will result in TPM commands being issued, > which will need the use of the internal command/response buffer. But, > we're issuing this *before* we've waited to make sure that buffer is > allocated. > > This can result in intermittent failures to probe if the hypervisor / TPM > implementation doesn't respond quickly enough. I find it fails almost > every time with an 8 vcpu guest under KVM with software emulated TPM. > > To fix it, just move the tpm2_get_cc_attrs_tlb() call after the > existing code to wait for initialization, which will ensure the buffer > is allocated. > > Fixes: 18b3670d79ae9 ("tpm: ibmvtpm: Add support for TPM2") > Signed-off-by: David Gibson Reviewed-by: Jarkko Sakkinen /Jarkko