[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Thu, 8 Aug 2019 10:48:04 +0200
From: Christoph Hellwig <hch@....de>
To: "Rafael J. Wysocki" <rjw@...ysocki.net>
Cc: linux-nvme <linux-nvme@...ts.infradead.org>,
Keith Busch <kbusch@...nel.org>,
Mario Limonciello <Mario.Limonciello@...l.com>,
Kai-Heng Feng <kai.heng.feng@...onical.com>,
Keith Busch <keith.busch@...el.com>,
Christoph Hellwig <hch@....de>,
Sagi Grimberg <sagi@...mberg.me>,
Linux PM <linux-pm@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Rajat Jain <rajatja@...gle.com>,
Linux PCI <linux-pci@...r.kernel.org>,
Bjorn Helgaas <helgaas@...nel.org>
Subject: Re: [PATCH] nvme-pci: Allow PCI bus-level PM to be used if ASPM is
disabled
> - ndev->last_ps = 0;
> ret = nvme_get_power_state(ctrl, &ndev->last_ps);
> - if (ret < 0)
> + if (ret < 0 || ndev->last_ps == U32_MAX)
Is the intent of the magic U32_MAX check to see if the
nvme_get_power_state failed at the nvme level? In that case just
checking for any non-zero return value from nvme_get_power_state might
be the easier and more clear way to do it.
> Index: linux-pm/drivers/pci/pcie/aspm.c
> ===================================================================
> --- linux-pm.orig/drivers/pci/pcie/aspm.c
> +++ linux-pm/drivers/pci/pcie/aspm.c
Shouldn't we split PCI vs nvme in two patches?
> @@ -1170,6 +1170,26 @@ static int pcie_aspm_get_policy(char *bu
> module_param_call(policy, pcie_aspm_set_policy, pcie_aspm_get_policy,
> NULL, 0644);
>
> +/*
> + * pcie_aspm_enabled - Return the mask of enabled ASPM link states.
> + * @pci_device: Target device.
> + */
> +u32 pcie_aspm_enabled(struct pci_dev *pci_device)
pcie_aspm_enabled sounds like it returns a boolean. Shouldn't there be
a mask or so in the name better documenting what it returns?
> +{
> + struct pci_dev *bridge = pci_upstream_bridge(pci_device);
> + u32 ret;
> +
> + if (!bridge)
> + return 0;
> +
> + mutex_lock(&aspm_lock);
> + ret = bridge->link_state ? bridge->link_state->aspm_enabled : 0;
> + mutex_unlock(&aspm_lock);
> +
> + return ret;
> +}
I think this will need a EXPORT_SYMBOL_GPL thrown in so that modular
nvme continues working.
> +
> +
> #ifdef CONFIG_PCIEASPM_DEBUG
Nit: double blank line here.
Powered by blists - more mailing lists