Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp7396430rwd; Tue, 6 Jun 2023 10:06:25 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4nastM22NYrO4i9NdftBJgxJDXRuYjDRKQiIJru+L25gv2wmga6l6pUlEBpz3yJ583S8IN X-Received: by 2002:a05:6a21:32a7:b0:10f:6529:5442 with SMTP id yt39-20020a056a2132a700b0010f65295442mr219546pzb.49.1686071184867; Tue, 06 Jun 2023 10:06:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686071184; cv=none; d=google.com; s=arc-20160816; b=mX4Bk3YsFxGfSvX8pRhang1ozM1NgeYPMi+6pf7uxAnCIww9/3lOXbXXyr5CVkbuXn f7E/nNoDEn+eqMHR4XzkmmIIXXEI2r0ZkI6oSTG1NEIqoeHflC+Z/vyupJ2mlJSCjc/p M37cKp+atmvqYXg7jSzE+LRrYRxUhuKT0rCGS8De4ya3oRcwxPApEOZBFEitKdBnADAQ /B26Y3rOebAqOX89C0ccCOr4IXr6oBFGvsdauO0CWJpGc7WHe02wTFYTJM5eQFytr918 Zf4eERBlR7PvOMJ2HaBe4d1bK9SIR4ny0Yv+fgi1/cc0EonkVSpkwGzG6tYm7+QODrA/ iUag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date; bh=V7jAuFquMvZOUZaOmcdf0o0NynAqgIpyywLpWYWl2OE=; b=Ve+ySLeYD803vTkJcU7CS8r08MNPsrdo5EIQpD9GVI8WdjU/WgUzEleXLCHCNy90Rf p8g2Sew4DJbLhvKLsK1DMoY+fcABU1hJAFKT2/hKgeD3/dKv1nlNivtjTtCchhKp4jF/ TMPAcZhutguHWRQM3/pYoVkBZCjCYRr7YZiOlc3OSYkyS/2G11AaLry8iRhAgzhH9qjW lvCK0sDnlhOxnMqRYUhBJ4+kxQ4twu40bDGWRpWwETE2wZcxtGwmUysgAboad6sxF1uV N29X0JYMHycFl892qaAFbVDfS3IHnYSKEek65Hi+Q2ydi4uLXHrcS6vEzC7e71gEjr/z fHxA== 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; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t202-20020a635fd3000000b0052856cec94csi7530528pgb.877.2023.06.06.10.06.10; Tue, 06 Jun 2023 10:06:24 -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; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236354AbjFFQna (ORCPT + 99 others); Tue, 6 Jun 2023 12:43:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39932 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238394AbjFFQnP (ORCPT ); Tue, 6 Jun 2023 12:43:15 -0400 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C160110EA; Tue, 6 Jun 2023 09:43:08 -0700 (PDT) Received: from lhrpeml500005.china.huawei.com (unknown [172.18.147.201]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4QbGSg50v1z6D8rj; Wed, 7 Jun 2023 00:41:07 +0800 (CST) Received: from localhost (10.202.227.76) by lhrpeml500005.china.huawei.com (7.191.163.240) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Tue, 6 Jun 2023 17:43:06 +0100 Date: Tue, 6 Jun 2023 17:43:05 +0100 From: Jonathan Cameron To: Yicong Yang CC: , , , , , , , , , , Subject: Re: [PATCH v4 5/5] hwtracing: hisi_ptt: Fix potential sleep in atomic context Message-ID: <20230606174305.00005a10@Huawei.com> In-Reply-To: <20230606142244.10939-6-yangyicong@huawei.com> References: <20230606142244.10939-1-yangyicong@huawei.com> <20230606142244.10939-6-yangyicong@huawei.com> Organization: Huawei Technologies Research and Development (UK) Ltd. X-Mailer: Claws Mail 4.1.0 (GTK 3.24.33; x86_64-w64-mingw32) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.202.227.76] X-ClientProxiedBy: lhrpeml100003.china.huawei.com (7.191.160.210) To lhrpeml500005.china.huawei.com (7.191.163.240) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS, 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 Tue, 6 Jun 2023 22:22:44 +0800 Yicong Yang wrote: > From: Yicong Yang > > We're using pci_irq_vector() to obtain the interrupt number and then > bind it to the CPU start perf under the protection of spinlock in > pmu::start(). pci_irq_vector() might sleep since [1] because it will > call msi_domain_get_virq() to get the MSI interrupt number and it > needs to acquire dev->msi.data->mutex. Getting a mutex will sleep on > contention. So use pci_irq_vector() in an atomic context is problematic. > > This patch cached the interrupt number in the probe() and uses the > cached data instead to avoid potential sleep. > > [1] commit 82ff8e6b78fc ("PCI/MSI: Use msi_get_virq() in pci_get_vector()") > Fixes: ff0de066b463 ("hwtracing: hisi_ptt: Add trace function support for HiSilicon PCIe Tune and Trace device") > Signed-off-by: Yicong Yang LGTM Reviewed-by: Jonathan Cameron