From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754351AbdLHQSC (ORCPT ); Fri, 8 Dec 2017 11:18:02 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:39236 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753959AbdLHQSB (ORCPT ); Fri, 8 Dec 2017 11:18:01 -0500 Subject: Re: [Regression 4.15-rc2] New messages `tpm tpm0: A TPM error (2314) occurred continue selftest` From: Mimi Zohar To: Jason Gunthorpe , Alexander.Steffen@infineon.com Cc: pmenzel@molgen.mpg.de, linux-integrity@vger.kernel.org, linux-kernel@vger.kernel.org Date: Fri, 08 Dec 2017 11:17:51 -0500 In-Reply-To: <20171208155641.GA2883@ziepe.ca> References: <32b0e6c1292f4818825e9e0e9bff4d39@infineon.com> <20171207183743.GB16884@ziepe.ca> <37b47bbcce5d4cf1b1fad32576e501d4@infineon.com> <20171208155641.GA2883@ziepe.ca> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.20.5 (3.20.5-1.fc24) Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 x-cbid: 17120816-0020-0000-0000-000003D5E8C0 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17120816-0021-0000-0000-0000426B79F9 Message-Id: <1512749871.4364.9.camel@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-12-08_08:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1712080222 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 2017-12-08 at 08:56 -0700, Jason Gunthorpe wrote: > On Fri, Dec 08, 2017 at 12:14:04PM +0000, Alexander.Steffen@infineon.com wrote: > > > Is it really that ugly? I still need delay_msec to increase the > > delay each round. I can see the benefit of your suggestion when it > > is important to get the timing exactly right (and also account for > > time spent elsewhere, when our code might not be executing). But in > > this case having delays that are approximately right (or longer than > > intended) is sufficient. > > For timeouts like this we really need to be above the TPM specified > delay in all cases, even if usleep_range selected something > smaller/larger.. The only way to do that is with an absolute timeout.. > > > > Anyway, from the log messages it is clear that tpm_msleep got called > > seven times with delays of 20/40/80/160/320/640/1280ms. But still > > all timestamps lie within the same second. How can this be with a > > cumulated delay of ~2.5s? > > Yes, that does seem to be the bug, our sleep function doesn't work > aynmore for some reason :| > > > Also, I've just noticed that despite the name tpm_msleep calls > > usleep_range, not msleep. Can this have an influence? Should > > tpm_msleep call msleep for longer delays, as suggested by > > Documentation/timers/timers-howto.txt? > > This change was introduced recently and is probably the source of this > regression. msleep() waited a lot longer than the requested time, causing long delays.  Using usleep_range() still waits more than the requested time, but less than msleep(). static inline void tpm_msleep(unsigned int delay_msec) {         usleep_range((delay_msec * 1000) - TPM_TIMEOUT_RANGE_US,                      delay_msec * 1000); }; Other TPM performance improvements have not yet been upstreamed. Mimi