From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DF581C77B73 for ; Wed, 24 May 2023 07:29:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236332AbjEXH3k (ORCPT ); Wed, 24 May 2023 03:29:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34456 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239561AbjEXH3j (ORCPT ); Wed, 24 May 2023 03:29:39 -0400 Received: from bmailout1.hostsharing.net (bmailout1.hostsharing.net [IPv6:2a01:37:1000::53df:5f64:0]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BE3E7A1; Wed, 24 May 2023 00:29:33 -0700 (PDT) Received: from h08.hostsharing.net (h08.hostsharing.net [83.223.95.28]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "*.hostsharing.net", Issuer "RapidSSL Global TLS RSA4096 SHA256 2022 CA1" (verified OK)) by bmailout1.hostsharing.net (Postfix) with ESMTPS id 9C6F230025BE0; Wed, 24 May 2023 09:29:31 +0200 (CEST) Received: by h08.hostsharing.net (Postfix, from userid 100393) id 8DF7A31373E; Wed, 24 May 2023 09:29:31 +0200 (CEST) Date: Wed, 24 May 2023 09:29:31 +0200 From: Lukas Wunner To: Jarkko Sakkinen Cc: Lino Sanfilippo , peterhuewe@gmx.de, jgg@ziepe.ca, jsnitsel@redhat.com, hdegoede@redhat.com, oe-lkp@lists.linux.dev, lkp@intel.com, peter.ujfalusi@linux.intel.com, peterz@infradead.org, linux@mniewoehner.de, linux-integrity@vger.kernel.org, linux-kernel@vger.kernel.org, l.sanfilippo@kunbus.com, p.rosenberger@kunbus.com Subject: Re: [PATCH 1/2] tpm, tpm_tis: Handle interrupt storm Message-ID: <20230524072931.GA31483@wunner.de> References: <20230522143105.8617-1-LinoSanfilippo@gmx.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-integrity@vger.kernel.org On Wed, May 24, 2023 at 06:58:08AM +0300, Jarkko Sakkinen wrote: > On Mon May 22, 2023 at 5:31 PM EEST, Lino Sanfilippo wrote: > > + /* > > + * The worker to free the TPM interrupt (free_irq_work) may already > > + * be scheduled, so make sure it is not scheduled again. > > + */ > > + if (!(chip->flags & TPM_CHIP_FLAG_IRQ)) > > + return; > > + > > + if (time_after(jiffies, priv->last_unhandled_irq + HZ/10)) > > + priv->unhandled_irqs = 1; > > + else > > + priv->unhandled_irqs++; > > + > > + priv->last_unhandled_irq = jiffies; > > + > > + if (priv->unhandled_irqs > MAX_UNHANDLED_IRQS) > > + tpm_tis_handle_irq_storm(chip); > > Why wouldn't we switch to polling mode even when there is a single > unhandled IRQ? An unhandled IRQ can be legitimate if the interrupt is shared with other devices and the IRQ was raised by one of them. So you only want to switch to polling if there's a significant amount of unhandled IRQs in a short period of time. Thanks, Lukas