Message ID | 20231213034637.2603013-2-haifeng.zhao@linux.intel.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp8161583vqy; Tue, 12 Dec 2023 19:48:21 -0800 (PST) X-Google-Smtp-Source: AGHT+IEnuAhms6KsGutPQJaFr+YEcvNgng+sJP9u63RSGq6+wx+MuUkFrg8LzLedZDEtmpbCOT2F X-Received: by 2002:a05:6808:3998:b0:3b5:6533:d2cb with SMTP id gq24-20020a056808399800b003b56533d2cbmr11273819oib.46.1702439280985; Tue, 12 Dec 2023 19:48:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702439280; cv=none; d=google.com; s=arc-20160816; b=I3344kdIcucfkfa47oYbghMlY/3cMbDicDqhCeFGhfQOF2Uge0/H2pG9CFRuspVOvu 97oCBeu7uajVZXpMXeOvmjqsV87T8iKzm+EncVETimRCC3Mqb67bDUF2pHuA9OkVhKDR RbzSpZ8G+w7p6iNbV2JtyA0A2zUMF9j374WUtqj4U6H6niLsI230kWyGHSc+JJu7r533 Y7EA4Y/ii+XfLsIZpWg1a9x0+gXRsUdMMpQNJrEp2d/vS8cO7N9YUoWTwxHL3ZBrQZOz 9Z3jtRKtdjZPwRdmxfrnY2DhpFH+NsL13XVs6keyD5ufs1PRS+h6ddsE/yW1HWTboUrf vJIg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=5EgGsxBwtN/mkxbKDd2rmgkAazFD6pgCNOEYwIGz1BE=; fh=vmzOgBHRo0b47ndbHKSjrphRxaDCuTUw5d6AQjVFIEo=; b=IokozQfCp9j1usshPpo4SjQYm9w7QyJqwceiH14d7X/Ks70pZ4yY95ae7QRf+ZgvNZ rLOS756I/H18JWeDQYCDqZegzyJFTDPskJsVf6MqXu4q7Xv6afbhBkloZRhP91I1qxeA 5cyLYoP0uQu+ZwC3UfLkfUOy6H3nvcA8g+M8CFt820vwO0ERZ6yx/59MdO2642QAI9Ya OUVQs2JkRk1SDiBd1hH7s0jJ6CtLByn/gzdyalCkGMPRV8wdOVE76AQmY/nlNrbb7h9e UDBKiEjtutRuHC4y6fA/zr9Cts16daewikbYNT9Ibf01rw9pOdnswY91iYNGgGAqtFmn 01AA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=clL4F5q2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id 19-20020a631753000000b005c61d17e6aasi8934239pgx.122.2023.12.12.19.48.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Dec 2023 19:48:00 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=clL4F5q2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 0DE72809C436; Tue, 12 Dec 2023 19:47:58 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378438AbjLMDrb (ORCPT <rfc822;dexuan.linux@gmail.com> + 99 others); Tue, 12 Dec 2023 22:47:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37976 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378428AbjLMDr3 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 12 Dec 2023 22:47:29 -0500 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4F1B69C; Tue, 12 Dec 2023 19:47:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1702439256; x=1733975256; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=TljuoHGjQTdNL/8N4wKTVKbm0YrUiASyUSEokPW3tOo=; b=clL4F5q2Ncf53dBZ+la6Gr/JknOVcE6qSif2EdYK2I/9MIB2yFcSKDfl hA+30f15HMPKqgfv4XpgGUWWuSLVd+aqJOcvX/FRU6V64xOBPGkaviMeM FyGNwr5wiAwO4JKepllKWqEza1lag8vVj04eCWUgOljniDW2j2G9oayOG avKEkA6iEPJuBFPDvafESm+RT6No/Pu8chWKhc17ARWlWW7O6QMR34kiO iodbzT91rpEuXYajxdtyzQ/m+eOnLDDspu4H9lhh7moDK2ChYGwKJFR/r 7jjgP79u3ANCMlJ7bD6M7r3iOIIgfmHlEgzmFvuliZYVseY/YwD9ceFm1 w==; X-IronPort-AV: E=McAfee;i="6600,9927,10922"; a="459227277" X-IronPort-AV: E=Sophos;i="6.04,272,1695711600"; d="scan'208";a="459227277" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Dec 2023 19:47:36 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10922"; a="897175460" X-IronPort-AV: E=Sophos;i="6.04,272,1695711600"; d="scan'208";a="897175460" Received: from ply01-vm-store.bj.intel.com ([10.238.153.201]) by orsmga004.jf.intel.com with ESMTP; 12 Dec 2023 19:47:33 -0800 From: Ethan Zhao <haifeng.zhao@linux.intel.com> To: bhelgaas@google.com, baolu.lu@linux.intel.com, dwmw2@infradead.org, will@kernel.org, robin.murphy@arm.com Cc: linux-pci@vger.kernel.org, iommu@lists.linux.dev, linux-kernel@vger.kernel.org, haifeng.zhao@linux.intel.com, Haorong Ye <yehaorong@bytedance.com> Subject: [PATCH 1/2] PCI: make pci_dev_is_disconnected() helper public for other drivers Date: Tue, 12 Dec 2023 22:46:36 -0500 Message-Id: <20231213034637.2603013-2-haifeng.zhao@linux.intel.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20231213034637.2603013-1-haifeng.zhao@linux.intel.com> References: <20231213034637.2603013-1-haifeng.zhao@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,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 morse.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Tue, 12 Dec 2023 19:47:58 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785136971292861785 X-GMAIL-MSGID: 1785136971292861785 |
Series |
fix vt-d hard lockup when hotplug ATS capable device
|
|
Commit Message
Ethan Zhao
Dec. 13, 2023, 3:46 a.m. UTC
move pci_dev_is_disconnected() from driver/pci/pci.h to public include/linux/pci.h for other driver's reference. no function change. Tested-by: Haorong Ye <yehaorong@bytedance.com> Signed-off-by: Ethan Zhao <haifeng.zhao@linux.intel.com> --- drivers/pci/pci.h | 5 ----- include/linux/pci.h | 5 +++++ 2 files changed, 5 insertions(+), 5 deletions(-)
Comments
On Tue, Dec 12, 2023 at 10:46:36PM -0500, Ethan Zhao wrote: > move pci_dev_is_disconnected() from driver/pci/pci.h to public > include/linux/pci.h for other driver's reference. > no function change. That's merely a prose description of the code. A reader can already see from the code what it's doing. You need to explain the *reason* for the change instead. E.g.: "Make pci_dev_is_disconnected() public so that it can be called from $DRIVER to speed up hot removal handling which may otherwise take seconds because of $REASONS." Thanks, Lukas
On 12/13/2023 6:49 PM, Lukas Wunner wrote: > On Tue, Dec 12, 2023 at 10:46:36PM -0500, Ethan Zhao wrote: >> move pci_dev_is_disconnected() from driver/pci/pci.h to public >> include/linux/pci.h for other driver's reference. >> no function change. > That's merely a prose description of the code. A reader can already > see from the code what it's doing. You need to explain the *reason* > for the change instead. E.g.: "Make pci_dev_is_disconnected() public > so that it can be called from $DRIVER to speed up hot removal > handling which may otherwise take seconds because of $REASONS." Yup, why I made it public. then how about " Make pci_dev_is_disconnected() public so that it can be called from Intel vt-d driver to check the device's hotplug removal state when issue devTLB flush request." Thanks, Ethan > > Thanks, > > Lukas
On Thu, Dec 14, 2023 at 08:58:49AM +0800, Ethan Zhao wrote: > On 12/13/2023 6:49 PM, Lukas Wunner wrote: > > On Tue, Dec 12, 2023 at 10:46:36PM -0500, Ethan Zhao wrote: > > > move pci_dev_is_disconnected() from driver/pci/pci.h to public > > > include/linux/pci.h for other driver's reference. > > > no function change. > > > > That's merely a prose description of the code. A reader can already > > see from the code what it's doing. You need to explain the *reason* > > for the change instead. E.g.: "Make pci_dev_is_disconnected() public > > so that it can be called from $DRIVER to speed up hot removal > > handling which may otherwise take seconds because of $REASONS." > > Yup, why I made it public. then how about > > "Make pci_dev_is_disconnected() public so that it can be called from > Intel vt-d driver to check the device's hotplug removal state when > issue devTLB flush request." Much better. You may optionally want to point out the location of the file in the source tree because not everyone may be familiar where to find the "Intel vt-d driver". Also, not every reader may know where issuing of devTLB flush requests occurs, so it might make sense to name the function where that happens. Finally, it is common to adhere to terms used in the PCIe Base Spec in commit messages, so "ATC Invalidate Request" might be preferable to "devTLB flush request". Thanks, Lukas
On 12/21/2023 6:51 PM, Lukas Wunner wrote: > On Thu, Dec 14, 2023 at 08:58:49AM +0800, Ethan Zhao wrote: >> On 12/13/2023 6:49 PM, Lukas Wunner wrote: >>> On Tue, Dec 12, 2023 at 10:46:36PM -0500, Ethan Zhao wrote: >>>> move pci_dev_is_disconnected() from driver/pci/pci.h to public >>>> include/linux/pci.h for other driver's reference. >>>> no function change. >>> That's merely a prose description of the code. A reader can already >>> see from the code what it's doing. You need to explain the *reason* >>> for the change instead. E.g.: "Make pci_dev_is_disconnected() public >>> so that it can be called from $DRIVER to speed up hot removal >>> handling which may otherwise take seconds because of $REASONS." >> Yup, why I made it public. then how about >> >> "Make pci_dev_is_disconnected() public so that it can be called from >> Intel vt-d driver to check the device's hotplug removal state when >> issue devTLB flush request." > Much better. > > You may optionally want to point out the location of the file in the > source tree because not everyone may be familiar where to find the > "Intel vt-d driver". Also, not every reader may know where issuing > of devTLB flush requests occurs, so it might make sense to name the > function where that happens. Finally, it is common to adhere to terms > used in the PCIe Base Spec in commit messages, so "ATC Invalidate Request" > might be preferable to "devTLB flush request". ATS Invalidate Request ? devTLB flush request has the same meaning, I thought all iommu/PCIe guys could understand. Thanks, Ethan > > Thanks, > > Lukas
diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h index 5ecbcf041179..75fa2084492f 100644 --- a/drivers/pci/pci.h +++ b/drivers/pci/pci.h @@ -366,11 +366,6 @@ static inline int pci_dev_set_disconnected(struct pci_dev *dev, void *unused) return 0; } -static inline bool pci_dev_is_disconnected(const struct pci_dev *dev) -{ - return dev->error_state == pci_channel_io_perm_failure; -} - /* pci_dev priv_flags */ #define PCI_DEV_ADDED 0 #define PCI_DPC_RECOVERED 1 diff --git a/include/linux/pci.h b/include/linux/pci.h index 60ca768bc867..869f2ec97a84 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -2503,6 +2503,11 @@ static inline struct pci_dev *pcie_find_root_port(struct pci_dev *dev) return NULL; } +static inline bool pci_dev_is_disconnected(const struct pci_dev *dev) +{ + return dev->error_state == pci_channel_io_perm_failure; +} + void pci_request_acs(void); bool pci_acs_enabled(struct pci_dev *pdev, u16 acs_flags); bool pci_acs_path_enabled(struct pci_dev *start,