For ease of debugging, let's expose the assigned ID of a performance domain through debugfs (e.g., /sys/kernel/debug/energy_model/cpu0/id).
Unified · Split
| @@ -126,6 +126,16 @@ static int em_debug_flags_show(struct seq_file *s, void *unused) · 125 unmodified lines | |||
| 126 | } | 126 | } |
| 127 | DEFINE_SHOW_ATTRIBUTE(em_debug_flags); | 127 | DEFINE_SHOW_ATTRIBUTE(em_debug_flags); |
| 128 | 128 | ||
| 129 | static int em_debug_id_show(struct seq_file *s, void *unused) | ||
| 130 | { | ||
| 131 | struct em_perf_domain *pd = s->private; | ||
| 132 | |||
| 133 | seq_printf(s, "%d\n", pd->id); | ||
| 134 | |||
| 135 | return 0; | ||
| 136 | } | ||
| 137 | DEFINE_SHOW_ATTRIBUTE(em_debug_id); | ||
| 138 | |||
| 129 | static void em_debug_create_pd(struct device *dev) | 139 | static void em_debug_create_pd(struct device *dev) |
| 130 | { | 140 | { |
| 131 | struct em_dbg_info *em_dbg; | 141 | struct em_dbg_info *em_dbg; |
| @@ -142,6 +152,8 @@ static void em_debug_create_pd(struct device *dev) · 10 unmodified lines | |||
| 142 | debugfs_create_file("flags", 0444, d, dev->em_pd, | 152 | debugfs_create_file("flags", 0444, d, dev->em_pd, |
| 143 | &em_debug_flags_fops); | 153 | &em_debug_flags_fops); |
| 144 | 154 | ||
| 155 | debugfs_create_file("id", 0444, d, dev->em_pd, &em_debug_id_fops); | ||
| 156 | |||
| 145 | em_dbg = devm_kcalloc(dev, dev->em_pd->nr_perf_states, | 157 | em_dbg = devm_kcalloc(dev, dev->em_pd->nr_perf_states, |
| 146 | sizeof(*em_dbg), GFP_KERNEL); | 158 | sizeof(*em_dbg), GFP_KERNEL); |
| 147 | if (!em_dbg) | 159 | if (!em_dbg) |