mirror of
https://github.com/adulau/aha.git
synced 2024-12-27 19:26:25 +00:00
ACPI, cpuidle: Clarify C-state description in sysfs
Add a new sysfs entry under cpuidle states. desc - can be used by driver to communicate to userspace any specific information about the state. This helps in identifying the exact hardware C-states behind the ACPI C-state definition. Idea is to export this through powertop, which will help to map the C-state reported by powertop to actual hardware C-state. Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
This commit is contained in:
parent
e760e716d4
commit
4fcb2fcd4d
6 changed files with 34 additions and 7 deletions
|
@ -126,6 +126,8 @@ int acpi_processor_ffh_cstate_probe(unsigned int cpu,
|
||||||
printk(KERN_DEBUG "Monitor-Mwait will be used to enter C-%d "
|
printk(KERN_DEBUG "Monitor-Mwait will be used to enter C-%d "
|
||||||
"state\n", cx->type);
|
"state\n", cx->type);
|
||||||
}
|
}
|
||||||
|
snprintf(cx->desc, ACPI_CX_DESC_LEN, "ACPI FFH INTEL MWAIT 0x%x",
|
||||||
|
cx->address);
|
||||||
|
|
||||||
out:
|
out:
|
||||||
set_cpus_allowed(current, saved_mask);
|
set_cpus_allowed(current, saved_mask);
|
||||||
|
|
|
@ -945,11 +945,16 @@ static int acpi_processor_get_power_info_cst(struct acpi_processor *pr)
|
||||||
* Otherwise, ignore this info and continue.
|
* Otherwise, ignore this info and continue.
|
||||||
*/
|
*/
|
||||||
cx.entry_method = ACPI_CSTATE_HALT;
|
cx.entry_method = ACPI_CSTATE_HALT;
|
||||||
|
snprintf(cx.desc, ACPI_CX_DESC_LEN, "ACPI HLT");
|
||||||
} else {
|
} else {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
snprintf(cx.desc, ACPI_CX_DESC_LEN, "ACPI IOPORT 0x%x",
|
||||||
|
cx.address);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
obj = &(element->package.elements[2]);
|
obj = &(element->package.elements[2]);
|
||||||
if (obj->type != ACPI_TYPE_INTEGER)
|
if (obj->type != ACPI_TYPE_INTEGER)
|
||||||
continue;
|
continue;
|
||||||
|
@ -1643,6 +1648,11 @@ static int acpi_processor_setup_cpuidle(struct acpi_processor *pr)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < CPUIDLE_STATE_MAX; i++) {
|
||||||
|
dev->states[i].name[0] = '\0';
|
||||||
|
dev->states[i].desc[0] = '\0';
|
||||||
|
}
|
||||||
|
|
||||||
for (i = 1; i < ACPI_PROCESSOR_MAX_POWER && i <= max_cstate; i++) {
|
for (i = 1; i < ACPI_PROCESSOR_MAX_POWER && i <= max_cstate; i++) {
|
||||||
cx = &pr->power.states[i];
|
cx = &pr->power.states[i];
|
||||||
state = &dev->states[count];
|
state = &dev->states[count];
|
||||||
|
@ -1659,6 +1669,7 @@ static int acpi_processor_setup_cpuidle(struct acpi_processor *pr)
|
||||||
cpuidle_set_statedata(state, cx);
|
cpuidle_set_statedata(state, cx);
|
||||||
|
|
||||||
snprintf(state->name, CPUIDLE_NAME_LEN, "C%d", i);
|
snprintf(state->name, CPUIDLE_NAME_LEN, "C%d", i);
|
||||||
|
strncpy(state->desc, cx->desc, CPUIDLE_DESC_LEN);
|
||||||
state->exit_latency = cx->latency;
|
state->exit_latency = cx->latency;
|
||||||
state->target_residency = cx->latency * latency_factor;
|
state->target_residency = cx->latency * latency_factor;
|
||||||
state->power_usage = cx->power;
|
state->power_usage = cx->power;
|
||||||
|
|
|
@ -219,7 +219,8 @@ static void poll_idle_init(struct cpuidle_device *dev)
|
||||||
|
|
||||||
cpuidle_set_statedata(state, NULL);
|
cpuidle_set_statedata(state, NULL);
|
||||||
|
|
||||||
snprintf(state->name, CPUIDLE_NAME_LEN, "C0 (poll idle)");
|
snprintf(state->name, CPUIDLE_NAME_LEN, "C0");
|
||||||
|
snprintf(state->desc, CPUIDLE_DESC_LEN, "CPUIDLE CORE POLL IDLE");
|
||||||
state->exit_latency = 0;
|
state->exit_latency = 0;
|
||||||
state->target_residency = 0;
|
state->target_residency = 0;
|
||||||
state->power_usage = -1;
|
state->power_usage = -1;
|
||||||
|
|
|
@ -218,16 +218,23 @@ static ssize_t show_state_##_name(struct cpuidle_state *state, char *buf) \
|
||||||
return sprintf(buf, "%u\n", state->_name);\
|
return sprintf(buf, "%u\n", state->_name);\
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t show_state_name(struct cpuidle_state *state, char *buf)
|
#define define_show_state_str_function(_name) \
|
||||||
{
|
static ssize_t show_state_##_name(struct cpuidle_state *state, char *buf) \
|
||||||
return sprintf(buf, "%s\n", state->name);
|
{ \
|
||||||
|
if (state->_name[0] == '\0')\
|
||||||
|
return sprintf(buf, "<null>\n");\
|
||||||
|
return sprintf(buf, "%s\n", state->_name);\
|
||||||
}
|
}
|
||||||
|
|
||||||
define_show_state_function(exit_latency)
|
define_show_state_function(exit_latency)
|
||||||
define_show_state_function(power_usage)
|
define_show_state_function(power_usage)
|
||||||
define_show_state_function(usage)
|
define_show_state_function(usage)
|
||||||
define_show_state_function(time)
|
define_show_state_function(time)
|
||||||
|
define_show_state_str_function(name)
|
||||||
|
define_show_state_str_function(desc)
|
||||||
|
|
||||||
define_one_state_ro(name, show_state_name);
|
define_one_state_ro(name, show_state_name);
|
||||||
|
define_one_state_ro(desc, show_state_desc);
|
||||||
define_one_state_ro(latency, show_state_exit_latency);
|
define_one_state_ro(latency, show_state_exit_latency);
|
||||||
define_one_state_ro(power, show_state_power_usage);
|
define_one_state_ro(power, show_state_power_usage);
|
||||||
define_one_state_ro(usage, show_state_usage);
|
define_one_state_ro(usage, show_state_usage);
|
||||||
|
@ -235,6 +242,7 @@ define_one_state_ro(time, show_state_time);
|
||||||
|
|
||||||
static struct attribute *cpuidle_state_default_attrs[] = {
|
static struct attribute *cpuidle_state_default_attrs[] = {
|
||||||
&attr_name.attr,
|
&attr_name.attr,
|
||||||
|
&attr_desc.attr,
|
||||||
&attr_latency.attr,
|
&attr_latency.attr,
|
||||||
&attr_power.attr,
|
&attr_power.attr,
|
||||||
&attr_usage.attr,
|
&attr_usage.attr,
|
||||||
|
|
|
@ -32,9 +32,11 @@
|
||||||
#define DOMAIN_COORD_TYPE_SW_ANY 0xfd
|
#define DOMAIN_COORD_TYPE_SW_ANY 0xfd
|
||||||
#define DOMAIN_COORD_TYPE_HW_ALL 0xfe
|
#define DOMAIN_COORD_TYPE_HW_ALL 0xfe
|
||||||
|
|
||||||
#define ACPI_CSTATE_SYSTEMIO (0)
|
#define ACPI_CSTATE_SYSTEMIO 0
|
||||||
#define ACPI_CSTATE_FFH (1)
|
#define ACPI_CSTATE_FFH 1
|
||||||
#define ACPI_CSTATE_HALT (2)
|
#define ACPI_CSTATE_HALT 2
|
||||||
|
|
||||||
|
#define ACPI_CX_DESC_LEN 32
|
||||||
|
|
||||||
/* Power Management */
|
/* Power Management */
|
||||||
|
|
||||||
|
@ -74,6 +76,7 @@ struct acpi_processor_cx {
|
||||||
u64 time;
|
u64 time;
|
||||||
struct acpi_processor_cx_policy promotion;
|
struct acpi_processor_cx_policy promotion;
|
||||||
struct acpi_processor_cx_policy demotion;
|
struct acpi_processor_cx_policy demotion;
|
||||||
|
char desc[ACPI_CX_DESC_LEN];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct acpi_processor_power {
|
struct acpi_processor_power {
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
|
|
||||||
#define CPUIDLE_STATE_MAX 8
|
#define CPUIDLE_STATE_MAX 8
|
||||||
#define CPUIDLE_NAME_LEN 16
|
#define CPUIDLE_NAME_LEN 16
|
||||||
|
#define CPUIDLE_DESC_LEN 32
|
||||||
|
|
||||||
struct cpuidle_device;
|
struct cpuidle_device;
|
||||||
|
|
||||||
|
@ -29,6 +30,7 @@ struct cpuidle_device;
|
||||||
|
|
||||||
struct cpuidle_state {
|
struct cpuidle_state {
|
||||||
char name[CPUIDLE_NAME_LEN];
|
char name[CPUIDLE_NAME_LEN];
|
||||||
|
char desc[CPUIDLE_DESC_LEN];
|
||||||
void *driver_data;
|
void *driver_data;
|
||||||
|
|
||||||
unsigned int flags;
|
unsigned int flags;
|
||||||
|
|
Loading…
Reference in a new issue