Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\power\energy_model.c Create Date:2022-07-28 10:04:47
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:m_register_perf_domain() - Register the Energy Model of a performance domain*@span : Mask of CPUs in the performance domain*@nr_states : Number of capacity states to register*@cb : Callback functions providing the data of the Energy Model* Create Energy

Proto:int em_register_perf_domain(cpumask_t *span, unsigned int nr_states, struct em_data_callback *cb)

Type:int

Parameter:

TypeParameterName
cpumask_t *span
unsigned intnr_states
struct em_data_callback *cb
202  prev_cap = 0
204  ret = 0
206  If Not span || Not nr_states || Not cb Then Return -EINVAL
213  mutex_lock( & Mutex serializing the registrations of performance domains and letting* callbacks defined by drivers sleep.)
217  If READ_ONCE(per_cpu(Mapping of each CPU to the performance domain to which it belongs. , cpu)) Then
218  ret = -EEXIST
219  Go to unlock
226  cap = arch_scale_cpu_capacity(cpu)
227  If prev_cap && prev_cap != cap Then
228  pr_err("CPUs of %*pbl must have the same capacity\n", cpumask_pr_args - printf args to output a cpumask*@maskp: cpumask to be printed* Can be used to provide arguments for '%*pb[l]' when printing a cpumask.(span))
230  ret = -EINVAL
231  Go to unlock
233  prev_cap = cap
237  pd = em_create_pd(span, nr_states, cb)
238  If Not pd Then
239  ret = -EINVAL
240  Go to unlock
249  smp_store_release(per_cpu_ptr( & Mapping of each CPU to the performance domain to which it belongs. , cpu), pd)
252  pr_debug("Created perf domain %*pbl\n", cpumask_pr_args - printf args to output a cpumask*@maskp: cpumask to be printed* Can be used to provide arguments for '%*pb[l]' when printing a cpumask.(span))
253  unlock :
254  mutex_unlock - release the mutex*@lock: the mutex to be released* Unlock a mutex that has been locked by this task previously.* This function must not be used in interrupt context. Unlocking* of a not locked mutex is not allowed.
256  Return ret