Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp4971992rwd; Tue, 23 May 2023 15:55:36 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6Zf76pIhAIy23t7ynu8non1QYZo1UzGb/ZcyKHAWVth8OsqNhBgBgV1L6907Ck879pJa1r X-Received: by 2002:a05:6a20:1f12:b0:10c:62b3:7dc4 with SMTP id dn18-20020a056a201f1200b0010c62b37dc4mr3022202pzb.55.1684882536606; Tue, 23 May 2023 15:55:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684882536; cv=none; d=google.com; s=arc-20160816; b=nAB5D5pD3J9OG/X7epF5YAVh+VLyQb91xA4Q0Fb6F3BjHK6VJ7epF6akOIpydXhWIj XTYk+g3yxih0KTkVpUcq4TLyWRPeiaKfO5d//hwhWVRaow6rVPFzoObKt5TxPAAPg9wH ceoL0HdAtO/9JaNKqyZbGcxHhqs5h9PnN02JCsewtIlo8XN7KPJF7S42Gzcf0q0fZ+2i SY7STXNAfVz01CUtyBtn+3S3zEUg6i97khBBCjSX/vMs+Tc++inyPBfi3WqPEu8swuOH zQYwt/BPTG6TJ6OpOOpOaFyYyr7DIQMzzFaVva/jAB8tLQUiYXXPHOC2gcWc/m20X3UH eVMQ== 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=CfRD3GZSe/po2Yvx+fZzXZZZfdk+kXJVJcq8DZsV4Kg=; b=PW4aYI2nNOTDC2ihjUsXkq4M510qxLUgqZFxJCKwTMUkv0tVlzakO+bgWJrFEI+bts fF/Hj5LnAsnMkfeILsR4X54y3Rq/mwS1dh6i6IDSERynWOSizLwFzuwd4oKwD6i7HnLj cXenB8bHiXf5AEXVQE0ranjU4pberb/PZScaWT53dE58quvZpUqFvx+uzkkEreo4teTm z9GvB0bR2IG24EyGf9YMRxoa2VPWDxH/XE8G2gvkeeZxIrEjd0uhqBbOY9aKOumOviyG 0NnpcYLhkxQ8qKam4KThBEvibN1L3oy+/kby2c/KZ7a9LTeZpq3u5jVm/S5eH3uBSlTt //VA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=NWHMKun8; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o22-20020a637e56000000b00517a9e737c6si1876451pgn.311.2023.05.23.15.55.24; Tue, 23 May 2023 15:55:36 -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; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=NWHMKun8; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236206AbjEWWdq (ORCPT + 99 others); Tue, 23 May 2023 18:33:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58604 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230006AbjEWWdn (ORCPT ); Tue, 23 May 2023 18:33:43 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 38AB1BF for ; Tue, 23 May 2023 15:32:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684881174; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=CfRD3GZSe/po2Yvx+fZzXZZZfdk+kXJVJcq8DZsV4Kg=; b=NWHMKun8dl+ocNZby2V22xrhGysTrP1XoEhYvPa8NenEl3zsyg4avSE/7MzFqp9FiE80nL 2M8oiVM3gy3kORHn3uXTEqujoWE1zbdTgCUI8FNeNJYtki9GSX5UVmS1K9ySP1z1/iveEi cCGlrJ5TOyIa/xDK7iHfa72JFkB/+Yc= Received: from mail-qv1-f69.google.com (mail-qv1-f69.google.com [209.85.219.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-271-lNOpGVaZNdqeabcbheZEgA-1; Tue, 23 May 2023 18:32:53 -0400 X-MC-Unique: lNOpGVaZNdqeabcbheZEgA-1 Received: by mail-qv1-f69.google.com with SMTP id 6a1803df08f44-62386d1f3ecso1139166d6.2 for ; Tue, 23 May 2023 15:32:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684881172; x=1687473172; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=CfRD3GZSe/po2Yvx+fZzXZZZfdk+kXJVJcq8DZsV4Kg=; b=WR6dtIOM+MByxd+gYq2s4HwlGSBCO7nHIHKvYBFg3m5fDQ5p2618NPc680X/HTIYa7 UNkPwUg1zXtCnru266KeXBxLqwzEairEp6PEHVy7BRPTz7dc0niauSjd1usrhVUlRomb Ih85BacxtCcczEYnZNT42nQojPRl9toEywnWg7RhKZm3wu1uh26Tehuldd/F7G32iFWH yK6gRbLQUrG0EAPAKfsNppcQS1t5yEWWHLWC4fwbkq7VJQCL2BR9NIwP4/6Q4YvxydQk 92cDaRmdfcWoTU2aNT7mB+yrLwBS21j11L8tNx1X0gFoeKDOx61gIDise4wV2N2eYnwb /Jpw== X-Gm-Message-State: AC+VfDz+QvFbqPzKNc8q/L97+pKV59mMpvu+3yZhilU8mXL+DGIz3len BrovFape4mIefTBJgmj2+Vu1nDm2nualKXjhGdvrhYyiuO8KXhCv0K4DG+u091Bmz8T3429BViJ nspn0C1L+1afLlbJiMYSYgzxeQbl9aQDO X-Received: by 2002:a05:6214:1251:b0:623:690c:3cd7 with SMTP id r17-20020a056214125100b00623690c3cd7mr26478319qvv.47.1684881172542; Tue, 23 May 2023 15:32:52 -0700 (PDT) X-Received: by 2002:a05:6214:1251:b0:623:690c:3cd7 with SMTP id r17-20020a056214125100b00623690c3cd7mr26478302qvv.47.1684881172259; Tue, 23 May 2023 15:32:52 -0700 (PDT) Received: from localhost (ip98-179-76-75.ph.ph.cox.net. [98.179.76.75]) by smtp.gmail.com with ESMTPSA id v16-20020a0ccd90000000b00604ee171d99sm3043919qvm.106.2023.05.23.15.32.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 May 2023 15:32:51 -0700 (PDT) Date: Tue, 23 May 2023 15:32:50 -0700 From: Jerry Snitselaar To: Jarkko Sakkinen Cc: Lino Sanfilippo , peterhuewe@gmx.de, jgg@ziepe.ca, 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, lukas@wunner.de, p.rosenberger@kunbus.com Subject: Re: [PATCH 1/2] tpm, tpm_tis: Handle interrupt storm Message-ID: References: <20230522143105.8617-1-LinoSanfilippo@gmx.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 Tue, May 23, 2023 at 10:12:49PM +0300, Jarkko Sakkinen wrote: > On Tue May 23, 2023 at 9:53 PM EEST, Jarkko Sakkinen wrote: > > On Mon May 22, 2023 at 5:31 PM EEST, Lino Sanfilippo wrote: > > > From: Lino Sanfilippo > > > > > > Commit e644b2f498d2 ("tpm, tpm_tis: Enable interrupt test") enabled > > > interrupts instead of polling on all capable TPMs. Unfortunately, on some > > > products the interrupt line is either never asserted or never deasserted. > > > > > > The former causes interrupt timeouts and is detected by > > > tpm_tis_core_init(). The latter results in interrupt storms. > > > > > > Recent reports concern the Lenovo ThinkStation P360 Tiny, Lenovo ThinkPad > > > L490 and Inspur NF5180M6: > > > > > > https://lore.kernel.org/linux-integrity/20230511005403.24689-1-jsnitsel@redhat.com/ > > > https://lore.kernel.org/linux-integrity/d80b180a569a9f068d3a2614f062cfa3a78af5a6.camel@kernel.org/ > > > > > > The current approach to avoid those storms is to disable interrupts by > > > adding a DMI quirk for the concerned device. > > > > > > However this is a maintenance burden in the long run, so use a generic > > > approach: > > > > I'm trying to comprehend how you evaluate, how big maintenance burden > > this would be. Adding even a few dozen table entries is not a > > maintenance burden. I do worry about how many cases will be reported once 6.4 is released, and this eventually makes its way into distributions. In either case the dmi table will need to be maintained. The UPX-11i case is a different issue, and IIRC the L490 it needed a DMI entry, because trying to catch the irq storm wasn't solving the issue there. I imagine other odd cases will be popping up as well. So far we have 2 irq storm reports with peterz's P360 Tiny, and I guess that Inspur system reported by the kernel test robot. Then there is whatever is going on with Peter Ujfalusi's UPX-11i. > > > > On the other hand any new functionality is objectively a maintanance > > burden of some measure (applies to any functionality). So how do we know > > that taking this change is less of a maintenance burden than just add > > new table entries, as they come up? > > > > > Detect an interrupt storm by counting the number of unhandled interrupts > > > within a 10 ms time interval. In case that more than 1000 were unhandled > > > deactivate interrupts, deregister the handler and fall back to polling. > > > > I know it can be sometimes hard to evaluate but can you try to explain > > how you came up to the 10 ms sampling period and 1000 interrupt > > threshold? I just don't like abritrary numbers. > > Also here I wonder how you came up with this computational model. This > is not same as saying it is wrong. There's just whole stack of options. > > Out of top of my head you could e.g. window average the duration between > IRQs. When the average goes beyond threshold, then you shutdown > interrupts. Just to make sure I have it clear in my head, you mean when the average is shorter than the threshold duration between interrupts, yes? My brain wants to read 'When the average goes beyond threshold' as 'threshold < average'. Does the check need to be a rolling window like 1/2 currently has? I expect that if the problem exists it will be noticed in the first window checked. I think what I originally tried was to check over some interval from when the handler first ran, disable interrupts if needed, and then skip the check from then on when the handler ran. Regards, Jerry > > The pro I would see in this that it is much easier intuitively discuss > how much there should be time in-between interrupts that the kernel > handles it, than how many IRQs you can stack into time interval, which > blows my head tbh. > > BR, Jarkko