Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp4061157rwd; Tue, 23 May 2023 02:29:28 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4vjR1xjuCJ4d4VYziYyH2wSxbcDIvPDDxUJuellZqqhiUTv2nexuo1PKQcTFIcbjj5YMbB X-Received: by 2002:a17:903:22c1:b0:1ac:5c53:2c1b with SMTP id y1-20020a17090322c100b001ac5c532c1bmr15701416plg.66.1684834167733; Tue, 23 May 2023 02:29:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684834167; cv=none; d=google.com; s=arc-20160816; b=goAaegSrN1sohl5NZQo/xDEd825aZz+kRp3EABN+tY+U4OsJnqTU4Gt0NVCqfu3olQ 1LBCLO9JxJPzNr0ePplzLLf+06XB+c0HeseFR40jO0+6sEFjWrkUS7LFVI64ET6Ogwcl qtYgdVChfZwmE/sP40I07ua2Ti4YVEkfrdSMw3kM1Xnijl9pYEZ35N65N253b4zPDzZs VEA7V/GuCGGov9gPb3MNYQ3u+fjsPs7+PgJ6HETy+E1vLpkUuXlhbzLoV1GcfLPq4UEE 7sCThZjLYzMloEDsLHmbr/fWHYezEgGj4B1H1jifQJfmvV7Z1enYcrDP3D4jd37DE9T+ GCQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=WhHMv+fcasv5DnoGsYIUc6kwnxcmAXll33uKxW+Lriw=; b=OTR9q9eHbgU3qzHGwqorGqt2v3YaeGRX+iI+CpNVebGoYVSWasBM5QB2vdpBTVWOmF 0qY2hGZiMGt3tNoN7vd+c0GFmBnebrMkVXc5PRezCzI4WrAxuPaHdO6AxgBZu2mR/jwd FlWF92GarKqXiGX+YWE+6k+xu2OHMWjWXse/yqzq7QaymDzC5ekH5AwwQvTyMGg85ujN K4HElf/ckyH/OdVplv3x3DsmLLTgXOkx7STUhxLTAmoiG7LRiLPpfY/5oE86NUWJqNKS cObgDRJZaHltgfROV9HAhHSPpkG4Itq0kf0kMF6gvVvah9P7umDW/H6AthWoUtQiDZ46 qK7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=mA1I47F3; 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=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j21-20020a170902c3d500b001a691f376e8si6114610plj.415.2023.05.23.02.29.12; Tue, 23 May 2023 02:29:27 -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=@intel.com header.s=Intel header.b=mA1I47F3; 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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236192AbjEWJNp (ORCPT + 99 others); Tue, 23 May 2023 05:13:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42790 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235332AbjEWJNm (ORCPT ); Tue, 23 May 2023 05:13:42 -0400 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4539294; Tue, 23 May 2023 02:13:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1684833214; x=1716369214; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=tG8tyz16iPziryCvAdBKNZ60+DgIUiN6eZydjnc0lAM=; b=mA1I47F3RtHCEZ8laY3U3UoVCnQgG1UWLk2ichTMD8VQfaazD7L3gIJ2 FQGcOUCDU40v1ZdozpoNOT7MfNy3X2XEioTW2QfnZuVCrFWSbI0aQRMUK v95ZPK62p1i8bqrzvFoqR/hjN3hbebP92lCG/fNfz7Khym0fkB1DFTuEl truRh+ZpJc0rBoPdjayifGcuq0bATjOsDNVWntdCKP8sSsl40n8lc5Kf9 lftqcuoBqZE09SPPUdT3KT7WWKUU9bjgNLTUN9IQO7aMtu7ARdoxE1QPy 1KI0Rrz/2J+hrr9iC0OVvumcBzW6e8h/TOpJ0akmDUrVlgLyHyNEKEdSm A==; X-IronPort-AV: E=McAfee;i="6600,9927,10718"; a="350692717" X-IronPort-AV: E=Sophos;i="6.00,185,1681196400"; d="scan'208";a="350692717" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 May 2023 02:13:33 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10718"; a="816047490" X-IronPort-AV: E=Sophos;i="6.00,185,1681196400"; d="scan'208";a="816047490" Received: from nmkenne1-mobl2.ger.corp.intel.com (HELO [10.252.53.154]) ([10.252.53.154]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 May 2023 02:13:29 -0700 Message-ID: <98f7dc1a-6bed-a66f-650e-10caeb7d0bca@linux.intel.com> Date: Tue, 23 May 2023 12:14:28 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Firefox/102.0 Thunderbird/102.11.0 Subject: Re: [PATCH 1/2] tpm, tpm_tis: Handle interrupt storm Content-Language: en-US To: Lukas Wunner Cc: Lino Sanfilippo , peterhuewe@gmx.de, jarkko@kernel.org, jgg@ziepe.ca, jsnitsel@redhat.com, hdegoede@redhat.com, oe-lkp@lists.linux.dev, lkp@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 References: <20230522143105.8617-1-LinoSanfilippo@gmx.de> <20230523074443.GA21236@wunner.de> From: =?UTF-8?Q?P=c3=a9ter_Ujfalusi?= In-Reply-To: <20230523074443.GA21236@wunner.de> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 23/05/2023 10:44, Lukas Wunner wrote: > On Tue, May 23, 2023 at 09:48:23AM +0300, Péter Ujfalusi wrote: >> On 22/05/2023 17:31, Lino Sanfilippo wrote: > [...] >> This looked promising, however it looks like the UPX-i11 needs the DMI >> quirk. > > Why is that? Is there a fundamental problem with the patch or is it > a specific issue with that device? The flood is not detected (if there is a flood at all), interrupt stops working after about 200 interrupts - in the latest boot at 118th. I can check this later, likely tomorrow. >>> --- a/drivers/char/tpm/tpm_tis_core.c >>> +++ b/drivers/char/tpm/tpm_tis_core.c >>> @@ -752,6 +752,55 @@ static bool tpm_tis_req_canceled(struct tpm_chip *chip, u8 status) >>> return status == TPM_STS_COMMAND_READY; >>> } >>> >>> +static void tpm_tis_handle_irq_storm(struct tpm_chip *chip) >>> +{ >>> + struct tpm_tis_data *priv = dev_get_drvdata(&chip->dev); >>> + int intmask = 0; >>> + >>> + dev_err(&chip->dev, HW_ERR >>> + "TPM interrupt storm detected, polling instead\n"); >> >> Should this be dev_warn or even dev_info level? > > The corresponding message emitted in tpm_tis_core_init() for > an interrupt that's *never* asserted uses dev_err(), so using > dev_err() here as well serves consistency: > > dev_err(&chip->dev, FW_BUG > "TPM interrupt not working, polling instead\n"); > > That way the same severity is used both for the never asserted and > the never deasserted interrupt case. Oh, OK. Is there anything the user can do to have a ERROR less boot? > >>> + if (priv->unhandled_irqs > MAX_UNHANDLED_IRQS) >>> + tpm_tis_handle_irq_storm(chip); >> >> Will the kernel step in and disbale the IRQ before we would have >> detected the storm? > > No. The detection of spurious interrupts in note_interrupt() > hinges on handlers returning IRQ_NONE. And this patch makes > tis_int_handler() always return IRQ_HANDLED, thus pretending > success to genirq code. True, thanks! > >>> rc = tpm_tis_write32(priv, TPM_INT_STATUS(priv->locality), interrupt); >>> tpm_tis_relinquish_locality(chip, 0); >>> if (rc < 0) >>> - return IRQ_NONE; >>> + goto unhandled; >> >> This is more like an error than just unhandled IRQ. Yes, it was ignored, >> probably because it is common? > > The interrupt may be shared and then it's not an error. but this is tpm_tis_write32() failing, no? If it is shared interrupt and we return IRQ_HANDLED unconditionally then I think the core will think that the interrupt was for this device and it was handled. -- Péter