mirror of
https://github.com/torvalds/linux.git
synced 2026-11-06 21:58:01 +01:00
PM / QoS: add lockless read for flags
Add a lockless read for QoS flags similar to the lockless read for resume latency (dev_pm_qos_raw_resume_latency) which may be called from atomic context (e.g. genpd governors running under a raw spinlock or in the syscore suspend path), where taking that sleeping lock would be invalid on PREEMPT_RT. dev_pm_qos_raw_flags() now reads dev->power.qos->flags.effective_flags with READ_ONCE() so also add corresponding WRITE_ONCE() to the two effective_flags writes, the same way pm_qos_set_value() already does for target_value/pm_qos_read_value(). Reviewed-by: Kendall Willis <k-willis@ti.com> Acked-by: Rafael J. Wysocki (Intel) <rafael@kernel.org> Signed-off-by: Kevin Hilman (TI) <khilman@baylibre.com> Signed-off-by: Ulf Hansson <ulfh@kernel.org>
This commit is contained in:
parent
4ff08254de
commit
b7cbbc33bc
|
|
@ -219,6 +219,12 @@ static inline s32 dev_pm_qos_raw_resume_latency(struct device *dev)
|
|||
PM_QOS_RESUME_LATENCY_NO_CONSTRAINT :
|
||||
pm_qos_read_value(&dev->power.qos->resume_latency);
|
||||
}
|
||||
|
||||
static inline s32 dev_pm_qos_raw_flags(struct device *dev)
|
||||
{
|
||||
return IS_ERR_OR_NULL(dev->power.qos) ?
|
||||
0 : READ_ONCE(dev->power.qos->flags.effective_flags);
|
||||
}
|
||||
#else
|
||||
static inline enum pm_qos_flags_status __dev_pm_qos_flags(struct device *dev,
|
||||
s32 mask)
|
||||
|
|
@ -300,6 +306,7 @@ static inline s32 dev_pm_qos_raw_resume_latency(struct device *dev)
|
|||
{
|
||||
return PM_QOS_RESUME_LATENCY_NO_CONSTRAINT;
|
||||
}
|
||||
static inline s32 dev_pm_qos_raw_flags(struct device *dev) { return 0; }
|
||||
#endif
|
||||
|
||||
static inline int freq_qos_request_active(struct freq_qos_request *req)
|
||||
|
|
|
|||
|
|
@ -159,7 +159,7 @@ static void pm_qos_flags_remove_req(struct pm_qos_flags *pqf,
|
|||
list_for_each_entry(req, &pqf->list, node)
|
||||
val |= req->flags;
|
||||
|
||||
pqf->effective_flags = val;
|
||||
WRITE_ONCE(pqf->effective_flags, val);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -193,7 +193,7 @@ bool pm_qos_update_flags(struct pm_qos_flags *pqf,
|
|||
req->flags = val;
|
||||
INIT_LIST_HEAD(&req->node);
|
||||
list_add_tail(&req->node, &pqf->list);
|
||||
pqf->effective_flags |= val;
|
||||
WRITE_ONCE(pqf->effective_flags, pqf->effective_flags | val);
|
||||
break;
|
||||
default:
|
||||
/* no action */
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user