From: Prarit Bhargava <prarit@redhat.com>
To: Saravana Kannan <skannan@codeaurora.org>
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>,
linux-kernel@vger.kernel.org,
Viresh Kumar <viresh.kumar@linaro.org>,
Lenny Szubowicz <lszubowi@redhat.com>,
linux-pm@vger.kernel.org
Subject: Re: [PATCH] cpufreq, store_scaling_governor requires policy->rwsem to be held for duration of changing governors [v2]
Date: Thu, 31 Jul 2014 06:21:33 -0400 [thread overview]
Message-ID: <53DA18AD.1020409@redhat.com> (raw)
In-Reply-To: <53DA177C.80504@redhat.com>
On 07/31/2014 06:16 AM, Prarit Bhargava wrote:
>
>
> On 07/30/2014 10:16 PM, Rafael J. Wysocki wrote:
>> On Wednesday, July 30, 2014 06:36:00 PM Saravana Kannan wrote:
>>> On 07/30/2014 02:40 PM, Rafael J. Wysocki wrote:
>>>> On Wednesday, July 30, 2014 10:18:25 AM Prarit Bhargava wrote:
>>>>>
>>>>> On 07/29/2014 08:03 PM, Rafael J. Wysocki wrote:
>>>>>> On Tuesday, July 29, 2014 07:46:02 AM Prarit Bhargava wrote:
>>>>
>>>> [cut]
>>>>
>>>>>>> This patch effectively reverts commit 955ef483.
>>>
>>> The issue reported in this patch is valid. We are seeing that internally
>>> too. I believe I reported it in another thread (within the past month).
>>>
>>> However, the original patch fixes a real deadlock issue (I'm too tired
>>> to look it up now). We can revet the original, but it's going to bring
>>> back the original issue. I just want to make sure Prarit and Raphael
>>> realize this before proceeding.
>
> Hi Saravana,
>
> Thanks for your input. I went back to the code and confirmed my original
> statement about this patch.
>
> Note: in a previous email I erroneously wrote "buffer->mutex" when I should
> have identified the lock as sysfs_mutex. Sorry 'bout that, and apologies
> for any confusion that may have caused.
>
> From my commit message:
>
> "In any case, the current linux.git code no longer can reproduce the original
> failure; the locking in the sysfs release code has changed."
>
> The original patch attempted to fix this deadlock:
>
> A cpufreq driver on a file read did:
>
> -> #0 (&per_cpu(cpu_policy_rwsem, cpu)){+++++.}:
> [<c0055253>] __lock_acquire+0xef3/0x13dc
> [<c0055a79>] lock_acquire+0x61/0xbc
> [<c03ee1f5>] down_read+0x25/0x30
> [<c02f6179>] lock_policy_rwsem_read+0x25/0x34
> [<c02f6edd>] show+0x21/0x58
> [<c00f9c0f>] sysfs_read_file+0x67/0xcc
> [<c00b40a7>] vfs_read+0x63/0xd8
> [<c00b41fb>] sys_read+0x2f/0x50
> [<c000cdc1>] ret_fast_syscall+0x1/0x52
>
> lock(s_active#41) [ which is actually the acquisition of sysfs_mutex ]
> lock(&per_cpu(cpu_policy_rwsem, cpu));
>
> and on the governor switch (notably the EXIT of the existing governor), the
> opposite occurs
>
> -> #1 (s_active#41){++++.+}:
> [<c0055a79>] lock_acquire+0x61/0xbc
> [<c00fabf1>] sysfs_addrm_finish+0xc1/0x128
> [<c00f9819>] sysfs_hash_and_remove+0x35/0x64
> [<c00fbe6f>] remove_files.isra.0+0x1b/0x24
> [<c00fbea5>] sysfs_remove_group+0x2d/0xa8
> [<c02f9a0b>] cpufreq_governor_interactive+0x13b/0x35c
> [<c02f61df>] __cpufreq_governor+0x2b/0x8c
> [<c02f6579>] __cpufreq_set_policy+0xa9/0xf8
> [<c02f6b75>] store_scaling_governor+0x61/0x100
> [<c02f6f4d>] store+0x39/0x60
> [<c00f9b81>] sysfs_write_file+0xed/0x114
> [<c00b3fd1>] vfs_write+0x65/0xd8
> [<c00b424b>] sys_write+0x2f/0x50
> [<c000cdc1>] ret_fast_syscall+0x1/0x52
>
>
> lock(&per_cpu(cpu_policy_rwsem, cpu));
> lock(s_active#41) [ which is actually the acquisition of sysfs_mutex ]
>
> The sysfs_mutex no longer blocks in the sysfs path, and I have built with
> LOCKDEP on and off to confirm that I do not see any tracebacks or hangs. I
> tested this by doing a few reads of the current governor, and then doing a
> governor switch (to at least initiate the LOCKDEP warning). IIUC the traceback
> above that is the way to reproduce this LOCKDEP warning.
^^^ this should not be taken as 'I did only a few reads ...'. I tested quite
extensively across 15 different systems and added a read of the scaling_governor
files in my little reproducer.
P.
next prev parent reply other threads:[~2014-07-31 10:21 UTC|newest]
Thread overview: 62+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-29 11:46 [PATCH] cpufreq, store_scaling_governor requires policy->rwsem to be held for duration of changing governors [v2] Prarit Bhargava
2014-07-30 0:03 ` Rafael J. Wysocki
2014-07-30 14:18 ` Prarit Bhargava
2014-07-30 21:40 ` Rafael J. Wysocki
2014-07-31 1:36 ` Saravana Kannan
2014-07-31 2:16 ` Rafael J. Wysocki
2014-07-31 2:07 ` Saravana Kannan
2014-07-31 10:16 ` Prarit Bhargava
2014-07-31 10:21 ` Prarit Bhargava [this message]
2014-07-31 10:23 ` Prarit Bhargava
2014-07-31 16:36 ` Rafael J. Wysocki
2014-07-31 17:57 ` Prarit Bhargava
2014-07-31 18:38 ` Rafael J. Wysocki
2014-07-31 18:26 ` Prarit Bhargava
2014-07-31 20:24 ` Saravana Kannan
2014-07-31 20:30 ` Prarit Bhargava
2014-07-31 20:38 ` Saravana Kannan
2014-07-31 21:08 ` Prarit Bhargava
2014-07-31 22:13 ` Saravana Kannan
2014-07-31 22:58 ` Prarit Bhargava
2014-08-01 0:55 ` Saravana Kannan
2014-08-01 10:24 ` Prarit Bhargava
2014-08-01 10:27 ` Prarit Bhargava
2014-08-01 17:18 ` Stephen Boyd
2014-08-01 19:15 ` Prarit Bhargava
2014-08-01 19:36 ` Stephen Boyd
2014-08-01 19:43 ` Prarit Bhargava
2014-08-01 19:54 ` Stephen Boyd
2014-08-01 21:25 ` Saravana Kannan
2014-08-04 10:11 ` Prarit Bhargava
2014-08-05 7:46 ` Viresh Kumar
2014-08-05 10:47 ` Prarit Bhargava
2014-08-05 10:53 ` Viresh Kumar
2014-08-05 22:06 ` Saravana Kannan
2014-08-05 22:20 ` Prarit Bhargava
2014-08-05 22:40 ` Saravana Kannan
2014-08-05 22:42 ` Prarit Bhargava
2014-08-05 22:51 ` Saravana Kannan
2014-08-13 19:57 ` Prarit Bhargava
2014-08-14 18:16 ` Saravana Kannan
2014-08-06 8:10 ` Viresh Kumar
2014-08-06 10:09 ` Prarit Bhargava
2014-08-06 15:08 ` Stephen Boyd
2014-08-07 6:36 ` Viresh Kumar
2014-08-07 10:12 ` Prarit Bhargava
2014-08-07 10:15 ` Viresh Kumar
2014-08-12 9:03 ` Viresh Kumar
2014-08-12 11:33 ` Prarit Bhargava
2014-08-13 7:39 ` Viresh Kumar
2014-08-13 9:58 ` Prarit Bhargava
2014-08-14 4:19 ` Viresh Kumar
2014-08-04 10:36 ` Viresh Kumar
2014-08-04 12:25 ` Prarit Bhargava
2014-08-04 13:38 ` Viresh Kumar
2014-08-04 14:00 ` Prarit Bhargava
2014-08-04 15:04 ` Prarit Bhargava
2014-08-04 20:16 ` Saravana Kannan
2014-08-05 6:14 ` Viresh Kumar
2014-08-05 6:29 ` skannan
2014-08-05 6:43 ` Viresh Kumar
2014-10-13 10:43 ` Viresh Kumar
2014-10-13 11:52 ` Prarit Bhargava
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=53DA18AD.1020409@redhat.com \
--to=prarit@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=lszubowi@redhat.com \
--cc=rjw@rjwysocki.net \
--cc=skannan@codeaurora.org \
--cc=viresh.kumar@linaro.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).