Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp5402158rwd; Wed, 24 May 2023 00:54:49 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4Q0AHR6ecZdRVTrZ1Wp5AqtUG5r3ZKT88IzQgGZCcPZ+pvQp0cHZmZlZJddox29G4uq5Sl X-Received: by 2002:a17:90a:af96:b0:253:5375:bf57 with SMTP id w22-20020a17090aaf9600b002535375bf57mr15848960pjq.26.1684914889002; Wed, 24 May 2023 00:54:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684914888; cv=none; d=google.com; s=arc-20160816; b=dtWeMhqVQEhxMj4WrhIsXo0wOAKLa6LfWZEV33xjNAHpeb5bejiIkmJBoCM9eDrAZN nVMI52C2Lek+fcyM+ixpoVVCG3J11Xjx1zRxaqef+FoL/fkVfM9Gs+iZB1JEKbD1l4Ti AUip0LPkwCrok2GZMDzb0PWWvnqcbljs8tjTJy7Yt6GmixggGvGunhhPheJXix6aekgA lsVNhZwPUzkgm+2th2HqIsia+CnjZ2HB4oSQJS1YcsKNdVXWuX7AHnSxAlQcBr6QWEv5 yU0fNyN9JPWrqxysmP4k3kC+dv3Zw+BNi3jQNWXQpI3SMpz5j0hN6tB5wq+VK9UIuC7F 46eA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=osutzWXc2ZGbqTa3rZXeNM6sdhryspVAiKAmZGKwkW0=; b=WNuR6jitD4q6Hdr8VqFMcDdEMjmZYl25PtsnaVS/sc7VNuEkonlAwky4pRozMyEs7I 2PMRWyT5fwZ8ZpcGc+CD8LbQ7huVoAKiqwfsPyg7XCPHawtlh/pA1gq7OnpFfJqVYJOz 9Xvbd19MBljy/kuMuBZEK4kayNTAN0X5JL1NmmCLGpmmBrfBm9MMrp2gAllGMUWxUs93 JtaTBL1HqdNX+EkdmG3k6dlf+OK8ACC5hS2TuKQy2jw5CuwcxpNFdO3wyCF7syGwTJX7 tdneGUcpvYKH3QXZcQFLqpgjJIrUh582lEP/gEVFmotV90BVqeOj5KJRJ+x9/zwN46hl WAgg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q34-20020a17090a4fa500b00237155f2303si868938pjh.136.2023.05.24.00.54.36; Wed, 24 May 2023 00:54:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239763AbjEXH3k (ORCPT + 99 others); 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) X-Spam-Status: No, score=-2.4 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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