From: Hans de Goede <hdegoede@redhat.com>
To: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>, markgross@kernel.org
Cc: platform-driver-x86@vger.kernel.org, Patil.Reddy@amd.com
Subject: Re: [PATCH v1 10/15] platform/x86/amd/pmf: Add sysfs to toggle CnQF
Date: Wed, 27 Jul 2022 23:12:18 +0200 [thread overview]
Message-ID: <074a54e2-d71b-8b57-c691-97ee492b0d78@redhat.com> (raw)
In-Reply-To: <85479b1e-08d2-49da-f9ba-894594270113@redhat.com>
Hi,
On 7/27/22 22:52, Hans de Goede wrote:
> Hi,
>
> On 7/12/22 16:58, Shyam Sundar S K wrote:
>> Whether to turn CnQF on/off by default upon driver load would be decided
>> by a BIOS flag. Add a sysfs node to provide a way to the user whether to
>> use static slider or CnQF .
>>
>> Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
>
> Thanks, patch looks good to me:
>
> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Thinking more about this, there are userspace API questions here, see
my reply to patch 9/15.
Also ...
>> ---
>> drivers/platform/x86/amd/pmf/cnqf.c | 52 +++++++++++++++++++++++++++++
>> 1 file changed, 52 insertions(+)
>>
>> diff --git a/drivers/platform/x86/amd/pmf/cnqf.c b/drivers/platform/x86/amd/pmf/cnqf.c
>> index 8c6756faab25..2b03ae1ad37f 100644
>> --- a/drivers/platform/x86/amd/pmf/cnqf.c
>> +++ b/drivers/platform/x86/amd/pmf/cnqf.c
>> @@ -302,9 +302,59 @@ void amd_pmf_load_defaults_cnqf(struct amd_pmf_dev *dev)
>> config_store.trans_prio[i] = i;
>> }
>>
>> +static ssize_t feat_store(struct device *dev,
>> + struct device_attribute *attr,
>> + const char *buf, size_t count)
>> +{
>> + struct amd_pmf_dev *pdev = dev_get_drvdata(dev);
>> + int result, src;
>> + bool enabled;
>> + u8 mode;
>> +
>> + result = kstrtobool(buf, &enabled);
>> + if (result)
>> + return result;
>> +
>> + src = amd_pmf_get_power_source();
>> + pdev->cnqf_feat = enabled;
>> + if (pdev->cnqf_feat) {
>> + amd_pmf_handle_cnqf(pdev, SLIDER_OP_SET, src, config_store.current_mode, NULL);
>> + } else {
>> + pdev->cnqf_running = false;
>> + mode = amd_pmf_get_pprof_modes(pdev);
>> + amd_pmf_update_slider(pdev, SLIDER_OP_SET, mode, NULL);
This assumes that the static slider is always available on systems
with CnQF support, which is not checked anywhere.
Also work_buffer is still running here which will reset cnqf_running = true
after its first run, so this does not disable CnQF at all.
But maybe that is a bug in the amd_pmf_trans_cnqf() function ?
Maybe that function should not touch the cnqf_running flag; and it should
keep gathering statistics even when CqNF is disabled, but not actually
set the profile ?
Regards,
Hans
>> + }
>> +
>> + dev_dbg(pdev->dev, "Received CnQF %s\n", enabled ? "on" : "off");
>> + return count;
>> +}
>> +
>> +static ssize_t feat_show(struct device *dev,
>> + struct device_attribute *attr,
>> + char *buf)
>> +{
>> + struct amd_pmf_dev *pdev = dev_get_drvdata(dev);
>> +
>> + return sprintf(buf, "%s\n", pdev->cnqf_feat ? "on" : "off");
>> +}
>> +
>> +static DEVICE_ATTR_RW(feat);
>> +
>> +static struct attribute *cnqf_feature_attrs[] = {
>> + &dev_attr_feat.attr,
>> + NULL
>> +};
>> +
>> +static const struct attribute_group cnqf_feature_attribute_group = {
>> + .attrs = cnqf_feature_attrs,
>> + .name = "cnqf"
>> +};
>> +
>> void amd_pmf_deinit_cnqf(struct amd_pmf_dev *dev)
>> {
>> cancel_delayed_work_sync(&dev->work_buffer);
>> + sysfs_remove_group(&dev->dev->kobj, &cnqf_feature_attribute_group);
>> + kobject_uevent(&dev->dev->kobj, KOBJ_CHANGE);
>> }
>>
>> void amd_pmf_init_cnqf(struct amd_pmf_dev *dev)
>> @@ -324,4 +374,6 @@ void amd_pmf_init_cnqf(struct amd_pmf_dev *dev)
>> /* update the thermal for CnQF */
>> src = amd_pmf_get_power_source();
>> amd_pmf_handle_cnqf(dev, SLIDER_OP_SET, src, config_store.current_mode, NULL);
>> + ret = sysfs_create_group(&dev->dev->kobj, &cnqf_feature_attribute_group);
>> + kobject_uevent(&dev->dev->kobj, KOBJ_CHANGE);
>> }
next prev parent reply other threads:[~2022-07-27 21:12 UTC|newest]
Thread overview: 56+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-12 14:58 [PATCH v1 00/15] platform/x86/amd/pmf: Introduce AMD PMF Driver Shyam Sundar S K
2022-07-12 14:58 ` [PATCH v1 01/15] ACPI: platform_profile: Add support for notification chains Shyam Sundar S K
2022-07-12 15:03 ` Limonciello, Mario
2022-07-27 13:24 ` Hans de Goede
2022-07-27 20:38 ` Hans de Goede
2022-07-12 14:58 ` [PATCH v1 02/15] platform/x86/amd/pmf: Add support for PMF core layer Shyam Sundar S K
2022-07-27 13:57 ` Hans de Goede
2022-07-12 14:58 ` [PATCH v1 03/15] platform/x86/amd/pmf: Add support for PMF APCI layer Shyam Sundar S K
2022-07-27 13:57 ` Hans de Goede
2022-07-12 14:58 ` [PATCH v1 04/15] platform/x86/amd/pmf: Add support SPS PMF feature Shyam Sundar S K
2022-07-27 19:29 ` Hans de Goede
2022-07-27 20:26 ` Hans de Goede
2022-07-12 14:58 ` [PATCH v1 05/15] platform/x86/amd/pmf: Add debugfs information Shyam Sundar S K
2022-07-27 19:50 ` Hans de Goede
2022-07-12 14:58 ` [PATCH v1 06/15] platform/x86/amd/pmf: Add heartbeat signal support Shyam Sundar S K
2022-07-27 19:53 ` Hans de Goede
2022-07-12 14:58 ` [PATCH v1 07/15] platform/x86/amd/pmf: Add fan control support Shyam Sundar S K
2022-07-27 20:11 ` Hans de Goede
2022-07-12 14:58 ` [PATCH v1 08/15] platform/x86/amd/pmf: Get performance metrics from PMFW Shyam Sundar S K
2022-07-27 20:36 ` Hans de Goede
2022-07-12 14:58 ` [PATCH v1 09/15] platform/x86/amd/pmf: Add support for CnQF Shyam Sundar S K
2022-07-27 20:51 ` Hans de Goede
2022-07-27 21:00 ` Hans de Goede
2022-07-12 14:58 ` [PATCH v1 10/15] platform/x86/amd/pmf: Add sysfs to toggle CnQF Shyam Sundar S K
2022-07-27 20:52 ` Hans de Goede
2022-07-27 21:12 ` Hans de Goede [this message]
2022-07-12 14:58 ` [PATCH v1 11/15] Documentation/ABI/testing/sysfs-amd-pmf: Add ABI doc for AMD PMF Shyam Sundar S K
2022-07-27 20:52 ` Hans de Goede
2022-07-12 14:58 ` [PATCH v1 12/15] platform/x86/amd/pmf: Add support for Auto mode feature Shyam Sundar S K
2022-07-27 21:22 ` Hans de Goede
2022-07-28 12:57 ` Shyam Sundar S K
2022-07-28 13:15 ` Hans de Goede
2022-07-12 14:58 ` [PATCH v1 13/15] platform/x86/amd/pmf: Handle AMT and CQL events for Auto mode Shyam Sundar S K
2022-07-27 21:33 ` Hans de Goede
2022-07-27 21:44 ` Hans de Goede
2022-07-27 21:46 ` Hans de Goede
2022-07-27 23:52 ` Limonciello, Mario
2022-07-28 13:03 ` Hans de Goede
2022-07-28 13:43 ` Limonciello, Mario
2022-07-28 14:09 ` Hans de Goede
2022-07-28 14:38 ` Limonciello, Mario
2022-07-28 17:46 ` Hans de Goede
2022-07-28 18:06 ` Limonciello, Mario
2022-07-28 18:17 ` Hans de Goede
2022-07-28 21:01 ` Limonciello, Mario
2022-07-29 11:03 ` Hans de Goede
2022-07-29 15:43 ` Limonciello, Mario
2022-07-29 17:40 ` Shyam Sundar S K
2022-07-29 17:59 ` Hans de Goede
2022-08-01 10:29 ` Shyam Sundar S K
2022-08-01 11:08 ` Hans de Goede
2022-07-12 14:58 ` [PATCH v1 14/15] platform/x86/amd/pmf: Force load driver on older supported platforms Shyam Sundar S K
2022-07-27 21:40 ` Hans de Goede
2022-07-12 14:58 ` [PATCH v1 15/15] MAINTAINERS: Add AMD PMF driver entry Shyam Sundar S K
2022-07-27 21:41 ` Hans de Goede
2022-07-28 17:44 ` Shyam Sundar S K
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=074a54e2-d71b-8b57-c691-97ee492b0d78@redhat.com \
--to=hdegoede@redhat.com \
--cc=Patil.Reddy@amd.com \
--cc=Shyam-sundar.S-k@amd.com \
--cc=markgross@kernel.org \
--cc=platform-driver-x86@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).