Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp31945rwb; Mon, 26 Sep 2022 08:57:43 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7AeJaJilD0cVHBM6d3/xdVaUIuTBCobrp32CTwyUMXvo6OSOsehUpRSmcuSqC9M6JrUoOF X-Received: by 2002:a63:2444:0:b0:438:63d9:bd65 with SMTP id k65-20020a632444000000b0043863d9bd65mr20113086pgk.560.1664207863630; Mon, 26 Sep 2022 08:57:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664207863; cv=none; d=google.com; s=arc-20160816; b=PP/fosC1WqxTtTKwok7ucXbq7ovCCd0ScyxUs7NDhp9b6ebL57h5hyZP40i2Fy2T9h XBkn2wiZzgW6lfqz3TFJG0JhIV/j2XMtx8VPc4x5RM0yJyrqM3SrEHWurU2jHVnOXoVB tubmtrIijNKt0m7mpZuz9F5HDFVvaYpFd9XrjoJONmsPLL7y4SOsxiWPjKP7+AV9E7Dg abp7jXYZHvxOmZh3GEF6rOJv+zwMJIKYr9wzMjhuYpN9k5rB/TP+OGpRlL+P33EX2Fqq sdIG0XBzMgw8dIJi4nq4BwJlgf/o054wMG6J0h8zxwFQn/AJAdI2qGwsNOgN645X0tdM Jj+w== 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:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=1yGPnS7+tabIF9f3YGZrIJUzZlCgUowefj3Ak6tgbc8=; b=u6u999S+SvP9Lxl+8U3CiCTTpi5KX2jR78WWIwH7wbRmcPxuTqjdwRwye9MWI1R64K P7RhwpIIG/Rmh1YpNuIojOG+rrxQns5eRsKyroHjVojYCJQt2aP/sZm8dzR5+bqcalF3 R8rbx8QAxArPNnPRUTVBIMnirh0MZC9rfR2g0X5UjJFFHnYdpq/89lo07adp8w5VLO0B on96KNkA69wRvdZlDJftcKTMtem/GELmeA7QkHm+lMe0E9ub2kcgKltPIock7g9AxLXm jmKgEAr/1v46ZuRf1B2n/Rj9xFy9XJVOqDn+dVh8lS1ZUC2UocO8xTwIHHLvohF1/cMm +9IA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=Cml+idqK; 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 b25-20020a056a0002d900b00537d8aa3bc3si16334555pft.200.2022.09.26.08.57.32; Mon, 26 Sep 2022 08:57:43 -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=Cml+idqK; 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 S235972AbiIZPRK (ORCPT + 99 others); Mon, 26 Sep 2022 11:17:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36102 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235601AbiIZPQg (ORCPT ); Mon, 26 Sep 2022 11:16:36 -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 F035412ABC for ; Mon, 26 Sep 2022 07:02:04 -0700 (PDT) Received: by mail-pg1-x531.google.com with SMTP id 78so6602693pgb.13 for ; Mon, 26 Sep 2022 07:02:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date; bh=1yGPnS7+tabIF9f3YGZrIJUzZlCgUowefj3Ak6tgbc8=; b=Cml+idqKmgZLlpiIB8rfPG/ng2lFM3Uc9sHJGoyFG7EKF7hZNke7PI/XfWak9pHRFi efod9Ah4zEqgORi+dMraA2Sbgo/pbkOsElfL2aD04OOna/C7XRrRxw0DfgIIfFkuQBtl cmmg93A0HBEzFfB1+OSXJZfXPeyzl0IgyhatrNNxgm2ohJf5RdnnNFXZNdgo7YaW0/yv LuuQM2kgG/3u1LhXdaEb1jXfGr5iRHnQ+eWfqiHMVUElxVxahOJVNf9IRTzA3BIZLfv3 zqpVrMthiVdLVBUkfIC5c7/0nUDogIn6jR/lCahdK1UXLrg6UQyGo+qF4+waB/51xAs+ 2x6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date; bh=1yGPnS7+tabIF9f3YGZrIJUzZlCgUowefj3Ak6tgbc8=; b=s6AY1Xz+IrOukk8uX6W6lSsHtsaLbuLzJt6EaZi/eu+yTQOyYIJ8PBgFV/s6d9tHYO tNzqs1G58+rDhAoBvBOPz1cW89ZfnccePVvKMwTe8gRzQmKVBt3BfprS7d4E+bwjGziu bpskTSv7YG/RmqgjPdfnRii7vVHlCaYX902WXjbs8GymIYlIP0sovMLo6e1yqfnv78dl /RfU1LS390CHpZXgtXD2eIsf7DiX2Tfwa64bhWp/+w80TAs+iK8KaD8q+GDjHZbBprAI RkasIsXK/OX079TrO2gFa5nayCN4I+AtsvYtr+4GvIWr/pm3YJIFgyNVCzrS+afYCRmJ Lqsg== X-Gm-Message-State: ACrzQf3/EpqOQ6AiziGFMX7y96d/SsV4u3Q1EexoftfqkGmaJI6+W8r7 sa00aMtz07SsuizUcz81Cf165A== X-Received: by 2002:aa7:9f0c:0:b0:546:c556:ac86 with SMTP id g12-20020aa79f0c000000b00546c556ac86mr23732346pfr.55.1664200924322; Mon, 26 Sep 2022 07:02:04 -0700 (PDT) Received: from [10.2.223.68] ([61.120.150.77]) by smtp.gmail.com with ESMTPSA id b15-20020a63d30f000000b004393cb720afsm10769098pgg.38.2022.09.26.07.01.58 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 26 Sep 2022 07:02:03 -0700 (PDT) Message-ID: <1de80c28-33ec-b1bd-a557-91e4166d2da7@bytedance.com> Date: Mon, 26 Sep 2022 22:01:55 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.3.0 Subject: Re: [PATCH 2/3] PCI/ERR: Clear fatal status in pcie_do_recovery() Content-Language: en-US To: Bjorn Helgaas Cc: fancer.lancer@gmail.com, jdmason@kudzu.us, dave.jiang@intel.com, allenbh@gmail.com, bhelgaas@google.com, ruscur@russell.cc, oohall@gmail.com, james.smart@broadcom.com, dick.kennedy@broadcom.com, jejb@linux.ibm.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, ntb@lists.linux.dev, linuxppc-dev@lists.ozlabs.org References: <20220922210853.GA1335665@bhelgaas> From: Zhuo Chen In-Reply-To: <20220922210853.GA1335665@bhelgaas> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS 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 9/23/22 5:08 AM, Bjorn Helgaas wrote: > On Fri, Sep 02, 2022 at 02:16:33AM +0800, Zhuo Chen wrote: >> When state is pci_channel_io_frozen in pcie_do_recovery(), >> the severity is fatal and fatal status should be cleared. >> So we add pci_aer_clear_fatal_status(). > > Seems sensible to me. Did you find this by code inspection or by > debugging a problem? If the latter, it would be nice to mention the > symptoms of the problem in the commit log. I found this by code inspection so I may not enumerate what kind of problems this code will cause. > >> Since pcie_aer_is_native() in pci_aer_clear_fatal_status() >> and pci_aer_clear_nonfatal_status() contains the function of >> 'if (host->native_aer || pcie_ports_native)', so we move them >> out of it. > > Wrap commit log to fill 75 columns. > >> Signed-off-by: Zhuo Chen >> --- >> drivers/pci/pcie/err.c | 8 ++++++-- >> 1 file changed, 6 insertions(+), 2 deletions(-) >> >> diff --git a/drivers/pci/pcie/err.c b/drivers/pci/pcie/err.c >> index 0c5a143025af..e0a8ade4c3fe 100644 >> --- a/drivers/pci/pcie/err.c >> +++ b/drivers/pci/pcie/err.c >> @@ -243,10 +243,14 @@ 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 (host->native_aer || pcie_ports_native) >> pcie_clear_device_status(dev); > > pcie_clear_device_status() doesn't check for pcie_aer_is_native() > internally, but after 068c29a248b6 ("PCI/ERR: Clear PCIe Device Status > errors only if OS owns AER") and aa344bc8b727 ("PCI/ERR: Clear AER > status only when we control AER"), both callers check before calling > it. > > I think we should move the check inside pcie_clear_device_status(). > That could be a separate preliminary patch. > > There are a couple other places (aer_root_reset() and > get_port_device_capability()) that do the same check and could be > changed to use pcie_aer_is_native() instead. That could be another > preliminary patch. > Good suggestion. But I have only one doubt. In aer_root_reset(), if we use "if (pcie_aer_is_native(dev) && aer)", when dev->aer_cap is NULL and root->aer_cap is not NULL, pcie_aer_is_native() will return false. It's different from just using "(host->native_aer || pcie_ports_native)". Or if we can use "if (pcie_aer_is_native(root))", at this time a NULL pointer check should be added in pcie_aer_is_native() because root may be NULL. > >> + if (state == pci_channel_io_frozen) >> + pci_aer_clear_fatal_status(dev); >> + else >> pci_aer_clear_nonfatal_status(dev); >> - } >> + >> pci_info(bridge, "device recovery successful\n"); >> return status; >> >> -- >> 2.30.1 (Apple Git-130) >> -- Thanks, Zhuo Chen