linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Frederick Lawler <fred@fredlawl.com>
To: Heiner Kallweit <hkallweit1@gmail.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>,
	"linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>
Subject: Re: [PATCH RFC v3 3/3] PCI/ASPM: add sysfs attribute for controlling ASPM
Date: Thu, 16 May 2019 19:12:38 -0500	[thread overview]
Message-ID: <9bc7c84f-5508-46b1-9f61-7ea8023e65ee@fredlawl.com> (raw)
In-Reply-To: <061c2def-8998-d62e-a268-c5d1426b14f9@gmail.com>

Heiner,

Heiner Kallweit wrote on 5/12/19 8:54 AM:> [snip]
> +static ssize_t aspm_link_states_show(struct device *dev,
> +				     struct device_attribute *attr, char *buf)
> +{
> +	struct pci_dev *pdev = to_pci_dev(dev);
> +	struct pcie_link_state *link;
> +	int len = 0, i;
> +
> +	link = aspm_get_parent_link(pdev);
> +	if (!link)
> +		return -EOPNOTSUPP;
> +
> +	mutex_lock(&aspm_lock);
> +
> +	for (i = 0; i < ARRAY_SIZE(aspm_sysfs_states); i++) {
> +		const struct aspm_sysfs_state *st = aspm_sysfs_states + i;
> +
> +		if (link->aspm_enabled & st->mask)
> +			len += scnprintf(buf + len, PAGE_SIZE - len, "[%s] ",
> +					 st->name);
> +		else
> +			len += scnprintf(buf + len, PAGE_SIZE - len, "%s ",
> +					 st->name);
> +	}

   # echo "-L1" > aspm_link_states
   # cat aspm_link_states
   L0S L1 L1.1 L1.2 [CLKPM]

   # echo "+L1" > aspm_link_states
   # cat aspm_link_states
   L0S [L1] L1.1 L1.2 [CLKPM]

In v1 & v2 [STATE] was used to show that a state was disabled, now 
[STATE] is used to show enabled. Is that intended?

> +
> +	if (link->clkpm_enabled)
> +		len += scnprintf(buf + len, PAGE_SIZE - len, "[CLKPM] ");
> +	else
> +		len += scnprintf(buf + len, PAGE_SIZE - len, "CLKPM ");
> +

Same as above...

> +	mutex_unlock(&aspm_lock);
> +
> +	len += scnprintf(buf + len, PAGE_SIZE - len, "\n");
> +
> +	return len;
> +}

Other than the above, v3 works as expected on my machine. Good work :)

Frederick Lawler


  reply	other threads:[~2019-05-17  0:16 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-12 13:52 [PATCH RFC v3 0/3] PCI/ASPM: add sysfs attribute for controlling ASPM Heiner Kallweit
2019-05-12 13:53 ` [PATCH RFC v3 1/3] PCI/ASPM: add L1 sub-state support to pci_disable_link_state Heiner Kallweit
2019-05-12 13:54 ` [PATCH RFC v3 2/3] PCI/ASPM: allow to re-enable Clock PM Heiner Kallweit
2019-05-12 13:54 ` [PATCH RFC v3 3/3] PCI/ASPM: add sysfs attribute for controlling ASPM Heiner Kallweit
2019-05-17  0:12   ` Frederick Lawler [this message]
2019-05-20 19:16     ` Heiner Kallweit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9bc7c84f-5508-46b1-9f61-7ea8023e65ee@fredlawl.com \
    --to=fred@fredlawl.com \
    --cc=bhelgaas@google.com \
    --cc=hkallweit1@gmail.com \
    --cc=linux-pci@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).