Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1214414 > unrolled thread
| Started by | Shilpasri G Bhat <shilpa.bhat@linux.vnet.ibm.com> |
|---|---|
| First post | 2015-08-27 11:20 +0200 |
| Last post | 2015-08-27 12:30 +0200 |
| Articles | 3 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH] cpufreq: powernv: Export frequency throttle state of the chip through sysfs Shilpasri G Bhat <shilpa.bhat@linux.vnet.ibm.com> - 2015-08-27 11:20 +0200
Re: [PATCH] cpufreq: powernv: Export frequency throttle state of the chip through sysfs Michael Ellerman <mpe@ellerman.id.au> - 2015-08-27 11:40 +0200
Re: [PATCH] cpufreq: powernv: Export frequency throttle state of the chip through sysfs Shilpasri G Bhat <shilpa.bhat@linux.vnet.ibm.com> - 2015-08-27 12:30 +0200
| From | Shilpasri G Bhat <shilpa.bhat@linux.vnet.ibm.com> |
|---|---|
| Date | 2015-08-27 11:20 +0200 |
| Subject | [PATCH] cpufreq: powernv: Export frequency throttle state of the chip through sysfs |
| Message-ID | <q21vI-8z-25@gated-at.bofh.it> |
Create a sysfs 'throttle' attribute per-chip(per-numa-node) to reflect
the throttle state of the chip. The usersapce programs can poll on
this attribute to keep an eye on the throttle state. Currently we
print a log message to notify the user of throttling event. The
performance-sensitive applications can monitor the throttle state
using this attribute.
Following file is created in sysfs:
/sys/devices/system/node/nodeN/throttle
'throttle' attribute has the following values:
0 : frequency is unthrottled
1 : frequency is throttled
Suggested-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Signed-off-by: Shilpasri G Bhat <shilpa.bhat@linux.vnet.ibm.com>
---
This patch is based on top of linux-next/master
drivers/cpufreq/powernv-cpufreq.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/drivers/cpufreq/powernv-cpufreq.c b/drivers/cpufreq/powernv-cpufreq.c
index 64994e1..aed6c34 100644
--- a/drivers/cpufreq/powernv-cpufreq.c
+++ b/drivers/cpufreq/powernv-cpufreq.c
@@ -28,6 +28,8 @@
#include <linux/of.h>
#include <linux/reboot.h>
#include <linux/slab.h>
+#include <linux/device.h>
+#include <linux/node.h>
#include <asm/cputhreads.h>
#include <asm/firmware.h>
@@ -413,6 +415,23 @@ static struct notifier_block powernv_cpufreq_reboot_nb = {
.notifier_call = powernv_cpufreq_reboot_notifier,
};
+static ssize_t throttle_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ int i;
+
+ for (i = 0; i < nr_chips; i++)
+ if (chips[i].id == dev->id) {
+ smp_call_function_any(&chips[i].mask,
+ powernv_cpufreq_throttle_check,
+ NULL, 1);
+ return sprintf(buf, "%d\n", throttled ||
+ chips[i].throttled);
+ }
+}
+
+static DEVICE_ATTR(throttle, 0400, throttle_show, NULL);
+
void powernv_cpufreq_work_fn(struct work_struct *work)
{
struct chip *chip = container_of(work, struct chip, throttle);
@@ -570,6 +589,8 @@ static int init_chip_info(void)
cpumask_copy(&chips[i].mask, cpumask_of_node(chip[i]));
INIT_WORK(&chips[i].throttle, powernv_cpufreq_work_fn);
chips[i].restore = false;
+ device_create_file(&node_devices[chip[i]]->dev,
+ &dev_attr_throttle);
}
return 0;
--
1.9.3
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [next] | [standalone]
| From | Michael Ellerman <mpe@ellerman.id.au> |
|---|---|
| Date | 2015-08-27 11:40 +0200 |
| Subject | Re: [PATCH] cpufreq: powernv: Export frequency throttle state of the chip through sysfs |
| Message-ID | <q21P3-v3-9@gated-at.bofh.it> |
| In reply to | #1214414 |
On Thu, 2015-08-27 at 14:43 +0530, Shilpasri G Bhat wrote: > Create a sysfs 'throttle' attribute per-chip(per-numa-node) to reflect > the throttle state of the chip. The usersapce programs can poll on > this attribute to keep an eye on the throttle state. Currently we > print a log message to notify the user of throttling event. The > performance-sensitive applications can monitor the throttle state > using this attribute. Performance sensitive applications can *poll* on a sysfs file, which does a loop over all chips and potentially spams the console with pr_crit() messages ? That does not sound like a recipe for success. What problem are we actually trying to solve here? cheers -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Shilpasri G Bhat <shilpa.bhat@linux.vnet.ibm.com> |
|---|---|
| Date | 2015-08-27 12:30 +0200 |
| Subject | Re: [PATCH] cpufreq: powernv: Export frequency throttle state of the chip through sysfs |
| Message-ID | <q22Bs-1Fk-19@gated-at.bofh.it> |
| In reply to | #1214430 |
On 08/27/2015 03:01 PM, Michael Ellerman wrote: > On Thu, 2015-08-27 at 14:43 +0530, Shilpasri G Bhat wrote: >> Create a sysfs 'throttle' attribute per-chip(per-numa-node) to reflect >> the throttle state of the chip. The usersapce programs can poll on >> this attribute to keep an eye on the throttle state. Currently we >> print a log message to notify the user of throttling event. The >> performance-sensitive applications can monitor the throttle state >> using this attribute. > > Performance sensitive applications can *poll* on a sysfs file, which does a > loop over all chips and potentially spams the console with pr_crit() messages ? > > That does not sound like a recipe for success. Okay. > > What problem are we actually trying to solve here? How to export the throttle information to the user space, such that it is consumable by the applications (for example to discard the benchmark run if the frequency was throttled)? We already print the throttle information to console. Can we extend this to notify/broadcast as an event to the applications? Thanks and Regards, Shilpa -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web