Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1352577pxu; Mon, 23 Nov 2020 19:48:55 -0800 (PST) X-Google-Smtp-Source: ABdhPJx9K7miP6yY1lC2u+GMES0DxTOFv+jtDop4UQtdAANxyoAArbrQu2rbZxNpwA8w55GWuzwF X-Received: by 2002:a05:6402:17d1:: with SMTP id s17mr2131296edy.2.1606189735651; Mon, 23 Nov 2020 19:48:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606189735; cv=none; d=google.com; s=arc-20160816; b=Ufu8dFBw73d1RfzhPCSJ2NgJgarahzJBY323AmRGtaXQl3+TRnTzmt8FsCW2JZ5kOC KNUw4gfzWsQ27oD4wi2+wD/Dw1iwhxKGPC/xoXSNriE67BNUatyBdnufbNfxhmCSkBpf hayPoTzZJPhiJOfiOP039OnZ/MVCy/VU28sHH2Z0yCO+jJxnLzRlysE/mygTza+RNBB1 C6udMENt3IQE2ZLW9Rmqt9VT6aUYWx2sphrY0unYq8yBspIuicHRdA7SJtD18nWQvx6F TwH2nVhmADITttVby4EV14X74EdLiFB8S3dsorC+j1lpuUdg2oi6Y8qUcbp6QJb2B1u1 m81w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=WbRfbzfa2U2uhbf8px+V48PS4vnZ6pPnOcRKDoQ1w74=; b=vdJCTpsIY9H8Pn759XSWWBMFyjkVv1fs3NOP8bd5QprZKv7cZ4PB8ngCvOHPglglUO lyR941JQNyfw4LNeyQoehVjgZ+hupif+oyEJ/YQJ6IQK7tnlvg0iiq9k1zQhdXsF2VnU QpusRi5mBUtP9I4GfCQNP5xUSzg01CoJBLZId/7baB2ZOQf8qQ731VuAIwLXTesSfWNN eM9wqNFuITKxFY7ej4DZsQEyKbMU85sBzzzEPxKXdUNZZ55zFT6GSLEZqR9RQyR8wprA gG7VNY2cOPPerN6gBjVjYy535u/02yiaLgBKX1qB1MzzGP1mFaoH/thT27CxMzqimHaV 0fNg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=m6dCqSOP; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b5si8046862edw.262.2020.11.23.19.48.32; Mon, 23 Nov 2020 19:48:55 -0800 (PST) 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; dkim=pass header.i=@kernel.org header.s=default header.b=m6dCqSOP; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728939AbgKXD37 (ORCPT + 99 others); Mon, 23 Nov 2020 22:29:59 -0500 Received: from mail.kernel.org ([198.145.29.99]:41730 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726528AbgKXD36 (ORCPT ); Mon, 23 Nov 2020 22:29:58 -0500 Received: from kernel.org (83-245-197-237.elisa-laajakaista.fi [83.245.197.237]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 1297A20857; Tue, 24 Nov 2020 03:29:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1606188597; bh=KxuNoYem00459KvpZFX2tDubg4MIGBJzs3eCzDnYQIM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=m6dCqSOPQODQMM+UdWvJAfQpIX4qtvHlBZQkqos0RND4VxaBYgt7MGh1gTjGe5cfR /zeZsf2W4XNTLgdqEXS15a8sy2VwCcmRtCcSaa8SVBpDYXqUTBETOax8ihw5v2q+L6 0b0dnCut/JwI4K1qfe0z8LKanjCayaKy9nqbLJjo= Date: Tue, 24 Nov 2020 05:29:52 +0200 From: Jarkko Sakkinen To: Hans de Goede Cc: Jerry Snitselaar , Matthew Garrett , linux-integrity , Linux Kernel Mailing List , Peter Huewe , Jason Gunthorpe , James Bottomley Subject: Re: [PATCH] tpm_tis: Disable interrupts on ThinkPad T490s Message-ID: <20201124032952.GA40270@kernel.org> References: <20201015214430.17937-1-jsnitsel@redhat.com> <87d009c0pn.fsf@redhat.com> <77498b10-cf2c-690b-8dad-78cbd61712ba@redhat.com> <20201124032725.GB40007@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201124032725.GB40007@kernel.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Nov 24, 2020 at 05:27:30AM +0200, Jarkko Sakkinen wrote: > On Thu, Nov 19, 2020 at 03:42:35PM +0100, Hans de Goede wrote: > > Hi, > > > > On 11/19/20 7:36 AM, Jerry Snitselaar wrote: > > > > > > Matthew Garrett @ 2020-10-15 15:39 MST: > > > > > >> On Thu, Oct 15, 2020 at 2:44 PM Jerry Snitselaar wrote: > > >>> > > >>> There is a misconfiguration in the bios of the gpio pin used for the > > >>> interrupt in the T490s. When interrupts are enabled in the tpm_tis > > >>> driver code this results in an interrupt storm. This was initially > > >>> reported when we attempted to enable the interrupt code in the tpm_tis > > >>> driver, which previously wasn't setting a flag to enable it. Due to > > >>> the reports of the interrupt storm that code was reverted and we went back > > >>> to polling instead of using interrupts. Now that we know the T490s problem > > >>> is a firmware issue, add code to check if the system is a T490s and > > >>> disable interrupts if that is the case. This will allow us to enable > > >>> interrupts for everyone else. If the user has a fixed bios they can > > >>> force the enabling of interrupts with tpm_tis.interrupts=1 on the > > >>> kernel command line. > > >> > > >> I think an implication of this is that systems haven't been > > >> well-tested with interrupts enabled. In general when we've found a > > >> firmware issue in one place it ends up happening elsewhere as well, so > > >> it wouldn't surprise me if there are other machines that will also be > > >> unhappy with interrupts enabled. Would it be possible to automatically > > >> detect this case (eg, if we get more than a certain number of > > >> interrupts in a certain timeframe immediately after enabling the > > >> interrupt) and automatically fall back to polling in that case? It > > >> would also mean that users with fixed firmware wouldn't need to pass a > > >> parameter. > > > > > > I believe Matthew is correct here. I found another system today > > > with completely different vendor for both the system and the tpm chip. > > > In addition another Lenovo model, the L490, has the issue. > > > > > > This initial attempt at a solution like Matthew suggested works on > > > the system I found today, but I imagine it is all sorts of wrong. > > > In the 2 systems where I've seen it, there are about 100000 interrupts > > > in around 1.5 seconds, and then the irq code shuts down the interrupt > > > because they aren't being handled. > > > > Is that with your patch? The IRQ should be silenced as soon as > > devm_free_irq(chip->dev.parent, priv->irq, chip); is called. > > > > Depending on if we can get your storm-detection to work or not, > > we might also choose to just never try to use the IRQ (at least on > > x86 systems). AFAIK the TPM is never used for high-throughput stuff > > so the polling overhead should not be a big deal (and I'm getting the feeling > > that Windows always polls). > > > > Regards, > > > > Hans > > Yeah, this is what I've been wondering for a while. Why could not we > just strip off IRQ code? Why does it matter? And we DO NOT use interrupts in tpm_crb and nobody has ever complained. /Jarkko