Messages in this thread | | | Date | Wed, 5 Oct 2022 16:59:59 -0700 | From | Ricardo Neri <> | Subject | Re: [RFC PATCH 15/23] thermal: intel: hfi: Report per-cpu class-specific performance scores |
| |
On Tue, Sep 27, 2022 at 01:59:15PM +0200, Peter Zijlstra wrote: > On Fri, Sep 09, 2022 at 04:11:57PM -0700, Ricardo Neri wrote: > > Support the arch_get_task_class_score() interface of the scheduler. Use the > > data that Intel Thread Director provides to inform the scheduler the > > performance of a class of tasks when placed on a given CPU. > > > > > +static void get_one_hfi_cap(struct hfi_instance *hfi_instance, s16 index, > > + struct hfi_cpu_data *hfi_caps, int class) > > +{ > > + struct hfi_cpu_data *caps; > > + > > + /* Find the capabilities of @cpu */ > > + caps = hfi_instance->data + index * hfi_features.cpu_stride + > > + class * hfi_features.class_stride; > > + memcpy(hfi_caps, caps, sizeof(*hfi_caps)); > > +} > > + > > +int intel_hfi_get_task_class_score(int class, int cpu) > > +{ > > + struct hfi_cpu_info *info = &per_cpu(hfi_cpu_info, cpu); > > + struct hfi_instance *instance; > > + struct hfi_cpu_data caps; > > + unsigned long flags; > > + int cap; > > + > > + if (cpu < 0 || cpu >= nr_cpu_ids) > > + return -EINVAL; > > + > > + if (class == TASK_CLASS_UNCLASSIFIED) > > + return -EINVAL; > > + > > + if (class >= (int)hfi_features.nr_classes) > > + return -EINVAL; > > + > > + instance = info->hfi_instance; > > + if (!instance) > > + return -ENOENT; > > + > > + raw_spin_lock_irqsave(&instance->table_lock, flags); > > + get_one_hfi_cap(instance, info->index, &caps, class); > > + cap = caps.perf_cap; > > + raw_spin_unlock_irqrestore(&instance->table_lock, flags); > > + > > + return cap; > > +} > > Does any of that data actually ever change? Isn't the class score fixed > per CPU type?
Yes, data can change. The Intel SDM Vol 3 Section 14.6.7 states that the table can be updated during runtime.
Thanks and BR, Ricardo
| |