Merge "sched/walt: Fix invalid access of CPU cycle counter callback"

This commit is contained in:
Linux Build Service Account 2019-07-25 11:29:06 -07:00 committed by Gerrit - the friendly Code Review server
commit 896dbc4525
1 changed files with 6 additions and 1 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016-2018, The Linux Foundation. All rights reserved.
* Copyright (c) 2016-2019, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@ -323,14 +323,19 @@ update_window_start(struct rq *rq, u64 wallclock, int event)
int register_cpu_cycle_counter_cb(struct cpu_cycle_counter_cb *cb)
{
unsigned long flags;
mutex_lock(&cluster_lock);
if (!cb->get_cpu_cycle_counter) {
mutex_unlock(&cluster_lock);
return -EINVAL;
}
acquire_rq_locks_irqsave(cpu_possible_mask, &flags);
cpu_cycle_counter_cb = *cb;
use_cycle_counter = true;
release_rq_locks_irqrestore(cpu_possible_mask, &flags);
mutex_unlock(&cluster_lock);
return 0;