Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp840538pxb; Fri, 22 Apr 2022 12:18:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxcqyJDiohOLN5NCwdWZGBhRQjKxTeaWphjZvLom+QnaqI3DTLo6BjKvWmmxaqCl/OAPATP X-Received: by 2002:a17:903:1247:b0:156:25b4:4206 with SMTP id u7-20020a170903124700b0015625b44206mr6177119plh.146.1650655115502; Fri, 22 Apr 2022 12:18:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650655115; cv=none; d=google.com; s=arc-20160816; b=M7yp/eXot90VDqVB1qwwbyCYxuCNVK6ris1i2am9KDB6ekYFWCyN7Ks9smXl5bC11m bB6h+y8j/rTWmDU1rlPGULkxG1/L9cYPgp3kNLx1pj+DraERlpA0GdHcl3+AC06yT7EY 2kxNy8ho7uXHqfFrhw6a0Adh5RbyaVR60KeetPQHqvjEEOaWlBJiI87/FmfOOEx5ZLJA HtQznhC3PyAWNj8Ke/0IhlFVj01ZwvxJa+4iopZSVJ4MmGO4e/9yvQdLc5EQTLYySXqo RcDTi6+Z9U6nqk5G+XFT275OLVCZZok+PeSxJ8SSf1bjn7ureFGUIQ5eR/Imf6PvOn8O KUjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent :content-transfer-encoding:references:in-reply-to:date:cc:to:from :subject:message-id:dkim-signature; bh=eVvV0NifNtZwmykpaPmt9bX08imFT5KkTRDbVEAg1Cs=; b=uhIpijrI9vsu4+RI2Z4ZmN4zhNDjlVXkEFU9o6rEcm+Hco04ubhh8nCOFOhYjlYlC5 DY+CmfUEoaxDATgV8CuysSIJFTFgphHz0BBj2PiZcBYH1SXXGBmyYkByNee4IiGGHbG/ BBYnWcl84F7min9+q2qO/TyVSKCy2d4f1Qp2m5CO904kzTx3BwdfVqpZE5LJqTeF1+Kr ZyqYTYlHtFaA7m5CfHgrqtIVgkIKegnYADCmCqeZ/KCvwEt5ifymn3U01GwtEbynN2U+ kZUyk8RfL0x1/AU9F9iQF3l6Ouj0PZSpK4zK+/wrd0L5eP+s7eeWDp9rgY7hdjvZ1dz0 xOpg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=LmJJaYzW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1: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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id j189-20020a6255c6000000b0050ac8cd60e6si8492547pfb.183.2022.04.22.12.18.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 12:18:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=LmJJaYzW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1: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: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id A5EA0EB155; Fri, 22 Apr 2022 11:33:30 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1359399AbiDTFeQ (ORCPT + 99 others); Wed, 20 Apr 2022 01:34:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36386 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231815AbiDTFeL (ORCPT ); Wed, 20 Apr 2022 01:34:11 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3005736B6A; Tue, 19 Apr 2022 22:31:25 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 651ABB81D04; Wed, 20 Apr 2022 05:31:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D2778C385A0; Wed, 20 Apr 2022 05:31:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1650432683; bh=0tICag3wjBLWnC1CErQHOddo7JavOzZDqZo5vBzXRBk=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=LmJJaYzWw54mjurtZaBe3quCZMs1vYxJT0gXxwltWSk70Opmas18De47WEYSGr6MP ii2iXsg2MqMG8K7r42pPtA7w+4nKYhaTdOyLDpY8gjXqQgZMe+xNY+NuTnF5ZiFAmL VNRY7cbOz6PN52SHnTC7s5HCTS/cB++rxoTJ6qpX3cFHR9zyAYUqCrTaYgZnidlIU7 HPSb7vVA4hkFJN65/Lyjc7Ka40LFyj3aDD/oU07GMvd4dTzhZvGbr//DjqzEgXieyC t4UsxI7/nd+gf8dBWi9/4Pd9EYzVTiP7JNMLR7pZnmsVsKzj4wxKkXYd1RBDtWXN8K 5rkuOmHoxzTqA== Message-ID: Subject: Re: [PATCH v3 0/4] Fixes for TPM interrupt handling From: Jarkko Sakkinen To: Lino Sanfilippo , Michael =?ISO-8859-1?Q?Niew=F6hner?= Cc: peterhuewe@gmx.de, jgg@ziepe.ca, stefanb@linux.vnet.ibm.com, stefanb@linux.ibm.com, James.Bottomley@hansenpartnership.com, keescook@chromium.org, jsnitsel@redhat.com, ml.linux@elloe.vision, linux-integrity@vger.kernel.org, linux-kernel@vger.kernel.org, twawrzynczak@chromium.org Date: Wed, 20 Apr 2022 08:30:09 +0300 In-Reply-To: References: <20210501135727.17747-1-LinoSanfilippo@gmx.de> <20210501135727.17747-3-LinoSanfilippo@gmx.de> <6722bf6f-1a3f-ee9c-55e2-cf63c64266a9@gmx.de> <2a1a1cf61732eff1608aeae74054a0c135c1671f.camel@mniewoehner.de> <0d6c22b40a2f17d4b260f287d4c479a96a88b0b1.camel@mniewoehner.de> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.44.0 MIME-Version: 1.0 X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RDNS_NONE,SPF_HELO_NONE 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 n Sat, 2022-03-26 at 04:24 +0100, Lino Sanfilippo wrote: >=20 > Hi Michael, >=20 > On 25.03.22 at 13:32, Michael Niew=C3=B6hner wrote: > > > >=20 > > > > Lino, I'd be happy to test the patches, when you have time and inte= rest to > > > > work > > > > on this again! > > > >=20 > > > > Thanks, Michael > > >=20 > > > It's quite easy to test them out. Both fixes are in the mainline GIT = tree. > > > E.g. give a shot rc1, and please report if any issues persists to: > > >=20 > > > =C2=A0 linux-integrity@vger.kernel.org=C2=A0 > > >=20 > > > BR, Jarkko > >=20 > > I don't see Linos patches on mainline. Also, the series included four p= atches: > > [PATCH v3 0/4] Fixes for TPM interrupt handling > > [PATCH v3 1/4] tpm: Use a threaded interrupt handler > > [PATCH v3 2/4] tpm: Simplify locality handling > > [PATCH v3 3/4] tpm: Fix test for interrupts > > [PATCH v3 4/4] tpm: Only enable supported irqs > >=20 > > Three of them are relevant for the interrupt problem, which is still pr= esent in > > mainline, as these patches were refused: > > [PATCH v3 1/4] tpm: Use a threaded interrupt handler > > [PATCH v3 2/4] tpm: Simplify locality handling > > [PATCH v3 3/4] tpm: Fix test for interrupts > >=20 > > Michael > >=20 >=20 > You are right, the interrupts are still not working in the mainline kerne= l. > I would gladly make another attempt to fix this but rather step by step > than in a series that tries to fix (different) things at once. >=20 > A first step could be to have a sleepable context for the interrupt handl= ing, > since in case of SPI the accesses to the irq status register may sleep. >=20 > I sent a patch for this purpose once, but it seems to have gone lost: >=20 > https://lore.kernel.org/all/20210620023444.14684-1-LinoSanfilippo@gmx.de/ >=20 >=20 > Best regards, > Lino I went these through one by one. # Above linked patch=20 Boolean parameters are considered bad. I.e. use named flags instead. This is for above linked patch. # [PATCH v3 3/4] tpm: Fix test for interrupts 1. Please remove "unnecessarily complicated" sentence because it cannot be evaluated. It's your opinion, which might perhaps be correct, but it is irrelevant for any possible patch description. 2. There's no such thing as "fix by re-implementation". Please explain instead code change is relevant for the bug fix. 3. If set_bit() et al necessarily to fix a possible race condition you need to have a separate patch for that. To move forward, start with a better summary such as "tpm: move interrupt test to tpm_tis_probe_irq_single()" I'd also either revert the change for flags, or alternatively move it to separate patch explaining race condition. Otherwise, there's no argument of saying that using set_bit() is more=20 proper. This will make the change more localized. # [PATCH v3 2/4] tpm: Simplify locality handling "As a side-effect these modifications fix a bug which results in the following warning when using TPM 2:" Generally speaking, the simplifications should be done on top of code that does not have known bugs, even if the simplification renders out the bug. This is because then we have code that have potentially unknown unknown bugs. I hope you see my point. The problem with these patches were then and is still that they intermix bug fixes and other modifications and thus cannot be taken in. BR, Jarkko