Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp3603971pxu; Tue, 8 Dec 2020 17:04:31 -0800 (PST) X-Google-Smtp-Source: ABdhPJxO9YVCf6ne0HmjmcJpm6SOYV7fX06W26CQ1/t4+9aINr+d8L4yORI1Byfcp6u6eJs3mzfm X-Received: by 2002:a17:907:2d0f:: with SMTP id gs15mr17235ejc.455.1607475871336; Tue, 08 Dec 2020 17:04:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607475871; cv=none; d=google.com; s=arc-20160816; b=rSKbH/v1dfq8XSoM43TYzHoTAlaHL4dUU48m3hrOIr2BNtN86vj/cmH0cj96dhpyxu 3LwFNmUSxYFIrsR0H00OFtnHU2HXravzolU0MaqCTw00rF3qIyQdLsT/BAUVSIOaH40d RXF7uYyCvv01bi7jiTONiTb/LOIkiBe3h/SvV1JF9rfOdBRnuLWu1zAKbTwigrgx27bP Z0AnQ9mYdzUy+c+W6CeTg3PmmxTJmw4lpYoswvKXwtdW9+jvZ1+mlQVIr7okPq0aPM/f CSgiK31Hpo6/J0EjV5fbXuoOl2NINwSbS1iWp7CleVPqBasVZ7h29GLAaiBZDYEspyvn hteQ== 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:dkim-signature:date; bh=Zr/Vxe2H4lI9jdfBPKVO0CGHpoeT+WSVhJ9wjZr2zoc=; b=Bbm3MbOIPDIkINTeXCONjJ9f+LGiSilj+4JwGXWyaCuVmzVUDY7XqRnXe7b94g7uie 8VuqFA5RIlqeQ+of4Rn1UrXhNAlYxiNDEtlXhtQG8z+odhEo32binCEm0MYCHIpvFPvh 5bpHe5RDGxiKQScQW0B8t35l97i4rlYFjAJzq6XNb8NDtMflYD3/frOHRwDmQ9EfZMzA FXZYSqIp8YzJnLIIiIYS94nwecmG5XLAj6V63NwfPz3R1b8ttR/f39DdtllACz9BrZiw KdT4DJf83uRHA+Vq3sXONR09M5Nd3sh7ym+MZnu/ekVe4s2+vPCO+DfGpfyyuhuRFY+Y PBNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Kjwf8bc9; 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 f12si120819ejl.311.2020.12.08.17.04.09; Tue, 08 Dec 2020 17:04:31 -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=k20201202 header.b=Kjwf8bc9; 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 S1730819AbgLHRoa (ORCPT + 99 others); Tue, 8 Dec 2020 12:44:30 -0500 Received: from mail.kernel.org ([198.145.29.99]:37234 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726810AbgLHRoa (ORCPT ); Tue, 8 Dec 2020 12:44:30 -0500 Date: Tue, 8 Dec 2020 19:43:44 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1607449429; bh=4jaDJ4cW63InYyAcO+7Mk8fItHOLvl2IgoGj31CddDo=; h=From:To:Cc:Subject:References:In-Reply-To:From; b=Kjwf8bc9wBpKUStdt/Oyw4IP3gAG4BibCF9WYfQgVPv+530xR3xCu2Guf/wEDpTZv odhZaT7q1+aavhFe4b2TwB68KYqEcC1kF2y9aUSB5cXcJiD941XmhB0McgOaLPIEJZ W6EZWxrOQyyvxUrb5Mf1z7g3bFls0bNk46P43gtUy1NO6N+uFlxU64F95VY7/6AWyG OWgWWRXFITVRhgvY37HEXXKb0NHWftCC9dIlynHB6m10QZ3d/yFn87P6/tvsnbzcv+ 57bNV7FET+rx6QNmQmTuf5rn0vCg/xB205fxkg3kHIYDsPhCRE+KLbVn//7RPnEhKi ZsEcFzQdWFaPA== From: Jarkko Sakkinen To: James Bottomley Cc: Jason Gunthorpe , Thomas Gleixner , Jerry Snitselaar , linux-kernel@vger.kernel.org, linux-integrity@vger.kernel.org, intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, Peter Huewe , Matthew Garrett , Hans de Goede Subject: Re: [PATCH v3 3/4] tpm_tis: Disable interrupts if interrupt storm detected Message-ID: <20201208174344.GC58213@kernel.org> References: <20201205014340.148235-1-jsnitsel@redhat.com> <20201205014340.148235-4-jsnitsel@redhat.com> <87tusy7n3b.fsf@nanos.tec.linutronix.de> <20201207192803.GH5487@ziepe.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Dec 07, 2020 at 11:58:44AM -0800, James Bottomley wrote: > On Mon, 2020-12-07 at 15:28 -0400, Jason Gunthorpe wrote: > > On Sun, Dec 06, 2020 at 08:26:16PM +0100, Thomas Gleixner wrote: > > > Just as a side note. I was looking at tpm_tis_probe_irq_single() > > > and that function is leaking the interrupt request if any of the > > > checks afterwards fails, except for the final interrupt probe check > > > which does a cleanup. That means on fail before that the interrupt > > > handler stays requested up to the point where the module is > > > removed. If that's a shared interrupt and some other device is > > > active on the same line, then each interrupt from that device will > > > call into the TPM code. Something like the below is needed. > > > > > > Also the X86 autoprobe mechanism is interesting: > > > > > > if (IS_ENABLED(CONFIG_X86)) > > > for (i = 3; i <= 15; i++) > > > if (!tpm_tis_probe_irq_single(chip, intmask, 0, > > > i)) > > > return; > > > > > > The third argument is 'flags' which is handed to request_irq(). So > > > that won't ever be able to probe a shared interrupt. But if an > > > interrupt number > 0 is handed to tpm_tis_core_init() the interrupt > > > is requested with IRQF_SHARED. Same issue when the chip has an > > > interrupt number in the register. It's also requested exclusive > > > which is pretty likely to fail on ancient x86 machines. > > > > It is very likely none of this works any more, it has been repeatedly > > reworked over the years and just left behind out of fear someone > > needs it. I've thought it should be deleted for a while now. > > > > I suppose the original logic was to try and probe without SHARED > > because a probe would need exclusive access to the interrupt to tell > > if the TPM was actually the source, not some other device. > > > > It is all very old and very out of step with current thinking, IMHO. > > I skeptical that TPM interrupts were ever valuable enough to deserve > > this in the first place. > > For what it's worth, I agree. Trying to probe all 15 ISA interrupts is > last millennium thinking we should completely avoid. If it's not > described in ACPI then you don't get an interrupt full stop. > > James Maybe you could add this as part of your patches? /Jarkko