Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp6136023imb; Fri, 8 Mar 2019 10:02:41 -0800 (PST) X-Google-Smtp-Source: APXvYqxNxNzdaKRKlh5GKzK+MHPQ2yGSscAXluT/1qNjeyJ7qlj44mDz9Mjy6WIGPfYzBf+0YbCF X-Received: by 2002:a17:902:854b:: with SMTP id d11mr19450604plo.224.1552068161489; Fri, 08 Mar 2019 10:02:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1552068161; cv=none; d=google.com; s=arc-20160816; b=LSUC5Qhi2vtyE7dG1lLDc7dvOpfFncYvreXSc5SjfGIoCEvto/lJBdO8ycwoTq6Ryt fxUBCoVagJZghVH0FgF4FdUtVR4pBMCy8aU5BYiutGiAN0EZ65bovB8wDO7L2bEFD8rW piN6X3+sC7PFBr38zw8USPKBSk9RKGqkE46plAz7F+24S8gxRun8Yi49JmM3dE/m9nda 4zISpgOu+55NYzHoGalpc7bb8XSPWKbFjKqJaYhzpZvvRWKHgkR4VfgDZRU539b0gH6O knoAfm0LQFmdSaFD5+JmJPdKK5HMRNDH80jeoVWC9PniEuF1PNMWls+jKL+C6l3qEJTh lMzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:content-disposition :mime-version:message-id:subject:cc:to:from:date:dkim-signature; bh=liEU7hq9f10HwBvv6rCnEcbtwUqwMiRwXVpsDawBYoY=; b=HkdWLMH/2TDhFQpFsRkFrkKPchmVRjY2ngEGACfMYfagJuRFLu+bI/R5CdnG3u3qvb caqacmWiozoE03YPM0F2xXud6uByriaYluVPkTbN0X/VX9K6AgzM7ahUpaomLK714PkO teJIJ00GdnFIQ1nwr0ymzNTnKkeNhuv46AGKEx6p0RZ/K3BUEGCXV2TthC1/4vQQaIob 7uYvEWqQRfNv7KK3CHNRBJQcCNPwQhbcbwq2WydpmZXcRAWV9sA/QfHTnEqyomUJBez/ NohX697avxgrigB6zHCbz6fdcoriCpSTO005MdxntLcZKJBIcAUPdFqGf1/Kr8m+RnkM jh6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=PIEw29+v; 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 s78si7427091pfa.161.2019.03.08.10.02.25; Fri, 08 Mar 2019 10:02:41 -0800 (PST) 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=PIEw29+v; 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 S1727026AbfCHSBx (ORCPT + 99 others); Fri, 8 Mar 2019 13:01:53 -0500 Received: from mail.kernel.org ([198.145.29.99]:55486 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726452AbfCHSBw (ORCPT ); Fri, 8 Mar 2019 13:01:52 -0500 Received: from localhost (173-25-63-173.client.mchsi.com [173.25.63.173]) (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 8999C20851; Fri, 8 Mar 2019 18:01:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1552068111; bh=a50geIOnOjK6X0A0X4iFC5JeQKpHie3qNWwacCLaewM=; h=Date:From:To:Cc:Subject:From; b=PIEw29+vLmmxnM4FCsF4pgWc2PidN2E3l8RP08Hea/er4e9gQSTWYW7dBaNdmXzzJ rHySB1SbVO1OJF8S7G3UIovRiweK0QRSgzcR7RDqw47YanhshEHT7Bmz/1uGx6IDef PXEDQh0jKbsnsemWDpY/HR9IRCzVTupHSeb+CU6U= Date: Fri, 8 Mar 2019 12:01:49 -0600 From: Bjorn Helgaas To: linux-pci@vger.kernel.org Cc: Keith Busch , Lukas Wunner , Russell Currey , Sam Bobroff , Oliver O'Halloran , Andy Shevchenko , "Rafael J. Wysocki" , Sinan Kaya , Mika Westerberg , Matthew Wilcox , Frederick Lawler , linux-kernel@vger.kernel.org Subject: [RFC] Log PCIe service info with pci_dev, not pcie_device Message-ID: <20190308180149.GD214730@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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 This is strictly a discussion starter, obviously not for application. The portdrv driver binds to pci_dev for PCIe Root Ports and Switch Ports. It creates additional pcie_devices for each "service" (Power Management events, AER, hotplug, Downstream Port Containment, etc). These pcie_devices have their own struct device, in addition to the one in the struct pci_dev. Service drivers can then bind to those pcie_devices, and their dev_printk output is typically associated with those, e.g., pciehp 0000:80:10.0:pcie004: Slot #36 ... The "pcie004" is a bitmask that identifies the particular service, but I don't think it's very useful to users, especially since we already have "pciehp" as the driver name. I think the fact that pcie_device has its own struct device is probably a design mistake and it would be better if those "services" were more tightly integrated into the PCI core. Changing that would be a big project that I don't want to tackle right now, but I think a small step would be to simplify the dmesg logging by doing it with the underlying pci_dev instead of the pcie_device. For example, we could do something like the patch below, which would change the dmesg output like this: - pciehp 0000:80:10.0:pcie004: Slot #36 AttnBtn- PwrCtrl- MRL- AttnInd+ PwrInd+ HotPlug+ Surprise+ Interlock- NoCompl- LLActRep+ + pcieport 0000:80:10.0: pciehp: Slot #36 AttnBtn- PwrCtrl- MRL- AttnInd+ PwrInd+ HotPlug+ Surprise+ Interlock- NoCompl- LLActRep+ Please discuss :) diff --git a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c index 7dd443aea5a5..2761778f2ecc 100644 --- a/drivers/pci/hotplug/pciehp_hpc.c +++ b/drivers/pci/hotplug/pciehp_hpc.c @@ -868,7 +868,7 @@ struct controller *pcie_init(struct pcie_device *dev) PCI_EXP_SLTSTA_MRLSC | PCI_EXP_SLTSTA_CC | PCI_EXP_SLTSTA_DLLSC | PCI_EXP_SLTSTA_PDC); - ctrl_info(ctrl, "Slot #%d AttnBtn%c PwrCtrl%c MRL%c AttnInd%c PwrInd%c HotPlug%c Surprise%c Interlock%c NoCompl%c LLActRep%c%s\n", + pci_info(pdev, "Slot #%d AttnBtn%c PwrCtrl%c MRL%c AttnInd%c PwrInd%c HotPlug%c Surprise%c Interlock%c NoCompl%c LLActRep%c%s\n", (slot_cap & PCI_EXP_SLTCAP_PSN) >> 19, FLAG(slot_cap, PCI_EXP_SLTCAP_ABP), FLAG(slot_cap, PCI_EXP_SLTCAP_PCP),