Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp2308686imm; Thu, 11 Oct 2018 08:17:37 -0700 (PDT) X-Google-Smtp-Source: ACcGV63racvkq2lphydiSINQ+cOY09WT72Nm1s1f5Ylh5tuSxdDy46nQtnGWsnrMQ6xD2l3w68dy X-Received: by 2002:a17:902:5e3:: with SMTP id f90-v6mr2039892plf.286.1539271057303; Thu, 11 Oct 2018 08:17:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539271057; cv=none; d=google.com; s=arc-20160816; b=i8VH1lAp+wV3ow0LK7Kz4JMwuBPML7z0wEPBgPOEAF2euW6g5UADWWKejlaQWNXbm9 ajsOREFwxgABQf778qc7m88OKRWRplsAVPlxNLD6m5kNghM6E8DXQn0Mo8vqafR6+F/X xxZ7czbm1ihgsbRUwW/6zhl1r9EvNm6lIYWXv/bniguRiqS18AEUVSlky/fCxWG2lG5F HVivz07LjedfiVxE8cbmDUwGqH3P+B1zLFszPRWLLP5V5bSEZbvKMsSv6kOLEp/pk/kx lxkS2ZG1cfBHmuu51zeQaV6/gU7eeMqo0d6CMHJSVOMNy/npmjTTAisWNaD8YWHQ7m7q cipA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=0dIwq0nc1OT/7CamZf9zZKG70FEmSIW9PHehyCYaiOc=; b=KLjNe7HjHzxWDr5Lc3JBS1sX81QsdSkibFhMtym5CFEPRd0vNlaKePIyJsvPEGgzYQ TuNSrBGiWuJbYbrr7hcFc6+SD1oI/yzbWe6CzCTQRoHQR0SijoDHYrGQ44qAoYJku2sj 18FPEoTofr14DkG5bzLGIhnjuMXoJrnfJJXIgd4Badg09K6/ZTg2VooKvsor0sAQcn6Z /iSWaumCBXk6q4FTkcPij34quczPbC2ZmJmUZKUML9cg95RtMDhyeBE+Dk25JoQMAp+a PUPfdF3fSTmGgs7MAx6UQXlKah0hEfRvH4G1dNbpw3aDMIgogFIT70F0rTdKYefefqWx B1LA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=C658Mv4p; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k2-v6si24859920pgo.32.2018.10.11.08.17.21; Thu, 11 Oct 2018 08:17:37 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=C658Mv4p; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728361AbeJKWnt (ORCPT + 99 others); Thu, 11 Oct 2018 18:43:49 -0400 Received: from mail.kernel.org ([198.145.29.99]:49364 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726054AbeJKWnt (ORCPT ); Thu, 11 Oct 2018 18:43:49 -0400 Received: from localhost (unknown [204.56.7.10]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0CA7E2087A; Thu, 11 Oct 2018 15:16:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1539270972; bh=DptqWW1WxEbR39mwz5GXwHw+TiQ0F9ApQDa3GVdhhYo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=C658Mv4pSllGaggmZww19aUbrdj8nngEEdwGId+nmMJWtd7P59XO4181r4yD54u4o v8r2R+BDJP4Tt0eL2Tv1r17TzE+17RmiQVu7Jm+zAG+a/1gW86lbXKX5Nol0ktjiuX eKnoAqMAf0sYWn1rt9bkfNkkq7h4UBxtDuyjcVQ8= Date: Thu, 11 Oct 2018 10:16:10 -0500 From: Bjorn Helgaas To: Dongdong Liu Cc: "Derrick, Jonathan" , "linux-kernel@vger.kernel.org" , "okaya@kernel.org" , "willy@infradead.org" , "hch@lst.de" , "lukas@wunner.de" , "mika.westerberg@linux.intel.com" , "poza@codeaurora.org" , "linux-pci@vger.kernel.org" , "Busch, Keith" Subject: Re: [PATCH] PCI/portdrv: Enable error reporting on managed ports Message-ID: <20181011151610.GM5906@bhelgaas-glaptop.roam.corp.google.com> References: <1536085989-2956-1-git-send-email-jonathan.derrick@intel.com> <20181009175632.GB5906@bhelgaas-glaptop.roam.corp.google.com> <1539114641.8364.34.camel@intel.com> <20181009231915.GC5906@bhelgaas-glaptop.roam.corp.google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 11, 2018 at 07:58:47PM +0800, Dongdong Liu wrote: > Hi Bjorn > > > commit 15a6711649915ca3e9d1086dc88ff4b616b99aac > > Author: Bjorn Helgaas > > Date: Tue Oct 9 17:25:25 2018 -0500 > > > > PCI/AER: Enable reporting for ports enumerated after AER driver registration > > > > Previously we enabled AER error reporting only for Switch Ports that were > > enumerated prior to registering the AER service driver. Switch Ports > > enumerated after AER driver registration were left with error reporting > > disabled. > > > > A common order, which works correctly, is that we enumerate devices before > > registering portdrv and the AER driver: > > > > - Enumerate all the devices at boot-time > > > > - Register portdrv and bind it to all Root Ports and Switch Ports, which > > disables error reporting for these Ports > > > > - Register AER service driver and bind it to all Root Ports, which > > enables error reporting for the Root Ports and any Switch Ports below > > them > > > > But if we enumerate devices *after* registering portdrv and the AER driver, > > e.g., if a host bridge driver is loaded as a module, error reporting is not > > enabled correctly: > > > > - Register portdrv and AER driver (this happens at boot-time) > > > > - Enumerate a Root Port > > > > - Bind portdrv to Root Port, disabling its error reporting > > > > - Bind AER service driver to Root Port, enabling error reporting for it > > and its children (none, since we haven't enumerated them yet) > > > > - Enumerate Switch Port below the Root Port > > > > - Bind portdrv to Switch Port, disabling its error reporting > > > > - AER service driver doesn't bind to Switch Ports, so error reporting > > remains disabled > > > > Hot-adding a Switch fails similarly: error reporting is enabled correctly > > for the Root Port, but when the Switch is enumerated, the AER service > > driver doesn't claim it, so there's nothing to enable error reporting for > > the Switch Ports. > > > > Change the AER service driver so it binds to *all* PCIe ports, including > > Switch Upstream and Downstream Ports. For Switch Ports, enable AER error > > reporting. > > > > Link: https://lore.kernel.org/linux-pci/1536085989-2956-1-git-send-email-jonathan.derrick@intel.com > > Based-on-patch-by: Jon Derrick > > Signed-off-by: Bjorn Helgaas > > > > diff --git a/drivers/pci/pcie/aer.c b/drivers/pci/pcie/aer.c > > index 90b53abf621d..fe6c16461367 100644 > > --- a/drivers/pci/pcie/aer.c > > +++ b/drivers/pci/pcie/aer.c > > @@ -1316,12 +1316,6 @@ static void aer_enable_rootport(struct aer_rpc *rpc) > > pci_read_config_dword(pdev, aer_pos + PCI_ERR_UNCOR_STATUS, ®32); > > pci_write_config_dword(pdev, aer_pos + PCI_ERR_UNCOR_STATUS, reg32); > > > > - /* > > - * Enable error reporting for the root port device and downstream port > > - * devices. > > - */ > > - set_downstream_devices_error_reporting(pdev, true); > > - > > Delete the code will also disable error reporting for the root port as > the portdrv to Root Port has disabled its error reporting, > so need to enable enable error reporting for the root port. > +pci_enable_pcie_error_reporting(pdev); Oh, you're right, thank you! I'll post a "v3" to fix this, i.e., v1 - Jon's original post, https://lore.kernel.org/linux-pci/1536085989-2956-1-git-send-email-jonathan.derrick@intel.com v2 - My rework, https://lore.kernel.org/linux-pci/20181009231915.GC5906@bhelgaas-glaptop.roam.corp.google.com v3 - My rework + enable error reporting for Root Ports Bjorn