Received: by 2002:ac0:e34a:0:0:0:0:0 with SMTP id g10csp66769imn; Tue, 26 Jul 2022 22:59:25 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vbGCvOKjoRwkj5uNOeCDZ0QV+B2mInPNOOuSW6Zn5Q2UDfPqaV2nJ0HeYb0r7uuG/Oe8Tj X-Received: by 2002:a17:906:58d6:b0:72f:25c0:af2b with SMTP id e22-20020a17090658d600b0072f25c0af2bmr16362609ejs.326.1658901565682; Tue, 26 Jul 2022 22:59:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658901565; cv=none; d=google.com; s=arc-20160816; b=QchPgpAwbOMpURciU/vynzryKRYdl+9wi+p85qBj6A6i/R0b8eB6om1WAeKzGY2IyX lRZu3HdrpMekkQqLI5sKAO4xCvQHOb2XR7zGOX00vRAJtMcFDrN/npuArniDK3xR0VAP uEzlDA5Swi7xz7Hh49eLHPBHwRE9GHd1exeDqr+JQ+ALs89gN9SYwjKMpGKrfWcw5mGp cjMKl5HOfsGm3AZaoaP977LyJ3s1qang/lgYIPwQK/bGFYNhq/Z7x5NsCUkR4IO10nF8 nKydmCEtfXIZBlxFg2S7mgMhORX3xrF79czBZL7jkgmJhI0mproFOzjixVE8nvW/gt88 pliA== 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:subject:user-agent:mime-version:date:message-id :dkim-signature; bh=MtmX0s8i4cNE7xExfXRCYeHMOOSpKYgD35C7D1141sc=; b=c1oghJ2B3EQmKmvcQIgs5V1dGniQMv6TplPGAw0Db+IY11dBp0JB4pbUrDoMDHds/X 4zQRiY/tEviydP/2I4R0BBrHzfxshBSiitzMF0vtiN7owmWXTU/KTr1BzFVupYfOds8a dvsNHc58jple/nFQJit8sSXgl1MQc10GlR2wp5GYPE5/4VWnrfGCgrwf6QdQ31Ps2Reh /VSQ5jSkzKqlRFhKNIAGp62nODDet5P6TXl/u251PrXbw3SCf4S0jRI7hfN4stgJ55E2 /vBYpHXQ7vsGKaDCM8UtFvCypjSJmLry6EC8r5aBZzocNH9l8tuaiaIChsbbBvgx+GRv v2gA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=rXMYA6Yp; 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=NONE sp=NONE dis=NONE) header.from=bytedance.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id du11-20020a17090772cb00b0070d08e9f4fbsi17604124ejc.615.2022.07.26.22.58.58; Tue, 26 Jul 2022 22:59:25 -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=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=rXMYA6Yp; 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=NONE sp=NONE dis=NONE) header.from=bytedance.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231168AbiG0FgJ (ORCPT + 99 others); Wed, 27 Jul 2022 01:36:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41892 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231147AbiG0FgH (ORCPT ); Wed, 27 Jul 2022 01:36:07 -0400 Received: from mail-pg1-x531.google.com (mail-pg1-x531.google.com [IPv6:2607:f8b0:4864:20::531]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A034533A0B for ; Tue, 26 Jul 2022 22:36:05 -0700 (PDT) Received: by mail-pg1-x531.google.com with SMTP id bf13so15005037pgb.11 for ; Tue, 26 Jul 2022 22:36:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20210112.gappssmtp.com; s=20210112; h=message-id:date:mime-version:user-agent:subject:to:cc:references :from:in-reply-to:content-transfer-encoding; bh=MtmX0s8i4cNE7xExfXRCYeHMOOSpKYgD35C7D1141sc=; b=rXMYA6YpckLQ7Md7MwHHskIesm3XD7YZSBd75z21WpAASuPYeeksPydQsM3ZEqQF8f uhGygijSmwcjS4XmM8u/vzqTO0ieJ+oFf6qmZkkBbbawoGfSN8sZRSi9ss+QkQuq/C4l xovBCQDq0STP3FI7+Iu1H2oh+nokrkF7MoRG2JDXKrkrQv/VssghHvrTfM/+hgvF+ygJ QjFLbBGh7MPWxzrFu1xMqVDiDP/Mr1q5E1h1XjFgVIg7heJrfFpm78t3KBSis41FI+58 Mf2q3SNLFuvlXVynUKJyEbhgI7hhhC6xa8TUeh+6zYfXkS9ykk/u0kd5D5CeTG1T5I/E B1Mw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :to:cc:references:from:in-reply-to:content-transfer-encoding; bh=MtmX0s8i4cNE7xExfXRCYeHMOOSpKYgD35C7D1141sc=; b=oQSL7fOuTei7T5ONKTlwm9enxHd9Knfw1m/WvdyM9ZiPgrpTEEBj1nu50DPaMgh6t2 K0FKM7blrO4t/qcvNcbDjRR85nK7oWCTp1oscD5JdgDrvS0gKEc2rgzp/hYeh9+nKELG 2zkCls/InQ3ZqxTmpOx7B2K7M6GZNSJY0lorIv+SbB+G8l2RyQw5+etO8iNN5nwTWait zupuYUAlJUJNWKFuqtGyVAI+xnesop/xjYUAEbuqn+sSrn8PfsVbMMfTjfxhyewZqnz8 ZXqOtc9uOuW8l+H8hrPp+t64O2Zj4h1P/1e2P75gPV2mse8bWJyTrEocReZbDZSnG0Re TDtQ== X-Gm-Message-State: AJIora8LdXCmXiyHBRFuaJPyXnFrbVp1Kv/R7djZg1jCoF4fKEkueNcM 5xocFzLHsnTeFPmX/x4S4WjkZw== X-Received: by 2002:a63:180e:0:b0:41b:42d0:7d59 with SMTP id y14-20020a63180e000000b0041b42d07d59mr2010864pgl.160.1658900165003; Tue, 26 Jul 2022 22:36:05 -0700 (PDT) Received: from [10.2.192.95] ([61.120.150.78]) by smtp.gmail.com with ESMTPSA id o16-20020a170902d4d000b0016bdc98730bsm12707960plg.151.2022.07.26.22.36.01 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 26 Jul 2022 22:36:04 -0700 (PDT) Message-ID: Date: Wed, 27 Jul 2022 13:35:56 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.2.0 Subject: Re: [PATCH v3] PCI/ERR: Use pcie_aer_is_native() to judge whether OS owns AER To: Sathyanarayanan Kuppuswamy , ruscur@russell.cc, oohall@gmail.com, bhelgaas@google.com Cc: lukas@wunner.de, jan.kiszka@siemens.com, stuart.w.hayes@gmail.com, linuxppc-dev@lists.ozlabs.org, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org References: <20220727035334.9997-1-chenzhuo.1@bytedance.com> From: =?UTF-8?B?6ZmI5Y2T?= In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS 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 On 7/26/22 9:02 PM, Sathyanarayanan Kuppuswamy wrote: > > > On 7/26/22 8:53 PM, Zhuo Chen wrote: >> Use pcie_aer_is_native() in place of "host->native_aer || >> pcie_ports_native" to judge whether OS has native control of AER >> in pcie_do_recovery(). >> >> Replace "dev->aer_cap && (pcie_ports_native || host->native_aer)" in >> get_port_device_capability() with pcie_aer_is_native(), which has no >> functional changes. >> >> Signed-off-by: Zhuo Chen >> --- > > Patch looks better now. It looks like following two changes > can also be replaced with pcie_aer_is_native() check. > > drivers/pci/pcie/aer.c:1407: if ((host->native_aer || pcie_ports_native) && aer) { > drivers/pci/pcie/aer.c:1426: if ((host->native_aer || pcie_ports_native) && aer) { Good advice. But I wonder is there a scenario that dev->rcec ("root") is NULL meanwhile dev->aer_cap is not NULL? If so, replace "(host->native_aer || pcie_ports_native) && aer" with pcie_aer_is_native() will change original function. > > > >> Changelog: >> v3: >> - Simplify why we use pcie_aer_is_native(). >> - Revert modification of pci_aer_clear_nonfatal_status() and comments. >> v2: >> - Add details and note in commit log. >> --- >> drivers/pci/pcie/err.c | 3 +-- >> drivers/pci/pcie/portdrv_core.c | 3 +-- >> 2 files changed, 2 insertions(+), 4 deletions(-) >> >> diff --git a/drivers/pci/pcie/err.c b/drivers/pci/pcie/err.c >> index 0c5a143025af..121a53338e44 100644 >> --- a/drivers/pci/pcie/err.c >> +++ b/drivers/pci/pcie/err.c >> @@ -184,7 +184,6 @@ pci_ers_result_t pcie_do_recovery(struct pci_dev *dev, >> int type = pci_pcie_type(dev); >> struct pci_dev *bridge; >> pci_ers_result_t status = PCI_ERS_RESULT_CAN_RECOVER; >> - struct pci_host_bridge *host = pci_find_host_bridge(dev->bus); >> >> /* >> * If the error was detected by a Root Port, Downstream Port, RCEC, >> @@ -243,7 +242,7 @@ pci_ers_result_t pcie_do_recovery(struct pci_dev *dev, >> * it is responsible for clearing this status. In that case, the >> * signaling device may not even be visible to the OS. >> */ >> - if (host->native_aer || pcie_ports_native) { >> + if (pcie_aer_is_native(dev)) { >> pcie_clear_device_status(dev); >> pci_aer_clear_nonfatal_status(dev); >> } >> diff --git a/drivers/pci/pcie/portdrv_core.c b/drivers/pci/pcie/portdrv_core.c >> index 604feeb84ee4..98c18f4a01b2 100644 >> --- a/drivers/pci/pcie/portdrv_core.c >> +++ b/drivers/pci/pcie/portdrv_core.c >> @@ -221,8 +221,7 @@ static int get_port_device_capability(struct pci_dev *dev) >> } >> >> #ifdef CONFIG_PCIEAER >> - if (dev->aer_cap && pci_aer_available() && >> - (pcie_ports_native || host->native_aer)) { >> + if (pcie_aer_is_native(dev) && pci_aer_available()) { >> services |= PCIE_PORT_SERVICE_AER; >> >> /* > Thanks, Zhuo Chen