From: Andrej Gelenberg <andrej.gelenberg@udo.edu>
To: "Américo Wang" <xiyou.wangcong@gmail.com>
Cc: linux@brodo.de, ashok.raj@intel.com, jacob.shin@amd.com,
linux-kernel@vger.kernel.org, akpm@linux-foundation.org
Subject: Re: [PATCH] [CPUFREQ] fix race condition in store_scaling_governor
Date: Fri, 14 May 2010 12:48:29 +0200 [thread overview]
Message-ID: <4BED2A7D.1070801@udo.edu> (raw)
In-Reply-To: <20100512080837.GD5718@cr0.nay.redhat.com>
[-- Attachment #1: Type: text/plain, Size: 395 bytes --]
Hi,
i found the cause for the bug: it was commit "[CPUFREQ] remove rwsem
lock from CPUFREQ_GOV_STOP call (second call site)".
It release the rwsem lock in the middle of __cpufreq_set_policy, that is
not a good idea. There are no dead lock, which that patch solved,
because cpufreq_ondemand and cpufreq_conservative don't use the rwsem
lock in do_dbs_timer anymore.
Regards,
Andrej Gelenberg
[-- Attachment #2: 0001-CPUFREQ-Revert-CPUFREQ-remove-rwsem-lock-from-CPUFRE.patch --]
[-- Type: text/plain, Size: 1430 bytes --]
>From a6f3a23ac011af636e544cd107379bc22c4dba7f Mon Sep 17 00:00:00 2001
From: Andrej Gelenberg <andrej.gelenberg@udo.edu>
Date: Fri, 14 May 2010 12:39:22 +0200
Subject: [PATCH] [CPUFREQ] Revert "[CPUFREQ] remove rwsem lock from CPUFREQ_GOV_STOP call (second call site)"
That patch is not needed, because there is no rwsem lock in cpufreq_ondemand and
cpufreq_conservativ anymore. Lock should not be released until the work done.
Bug: https://bugzilla.kernel.org/show_bug.cgi?id=1594
Signed-off-by: Andrej Gelenberg <andrej.gelenberg@udo.edu>
---
drivers/cpufreq/cpufreq.c | 11 +----------
1 files changed, 1 insertions(+), 10 deletions(-)
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 75d293e..634757f 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -1774,17 +1774,8 @@ static int __cpufreq_set_policy(struct cpufreq_policy *data,
dprintk("governor switch\n");
/* end old governor */
- if (data->governor) {
- /*
- * Need to release the rwsem around governor
- * stop due to lock dependency between
- * cancel_delayed_work_sync and the read lock
- * taken in the delayed work handler.
- */
- unlock_policy_rwsem_write(data->cpu);
+ if (data->governor)
__cpufreq_governor(data, CPUFREQ_GOV_STOP);
- lock_policy_rwsem_write(data->cpu);
- }
/* start new governor */
data->governor = policy->governor;
--
1.7.1
next prev parent reply other threads:[~2010-05-14 10:49 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-11 14:20 [PATCH] [CPUFREQ] fix race condition in store_scaling_governor Andrej Gelenberg
2010-05-12 8:08 ` Américo Wang
2010-05-12 9:01 ` Andrej Gelenberg
2010-05-14 10:48 ` Andrej Gelenberg [this message]
2010-05-12 22:00 ` Andrew Morton
2010-05-12 23:58 ` Andrej Gelenberg
2010-05-13 9:13 ` Américo Wang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4BED2A7D.1070801@udo.edu \
--to=andrej.gelenberg@udo.edu \
--cc=akpm@linux-foundation.org \
--cc=ashok.raj@intel.com \
--cc=jacob.shin@amd.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@brodo.de \
--cc=xiyou.wangcong@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.