Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1339475

Re: [PATCH 1/2] cpufreq: governor: Fix race in dbs_update_util_handler()

From "Rafael J. Wysocki" <rafael@kernel.org>
Newsgroups linux.kernel
Subject Re: [PATCH 1/2] cpufreq: governor: Fix race in dbs_update_util_handler()
Date 2016-02-22 14:40 +0100
Message-ID <r4YSu-6vs-9@gated-at.bofh.it> (permalink)
References <r4rMR-799-3@gated-at.bofh.it> <r4rMR-799-1@gated-at.bofh.it> <r4Reh-Ny-5@gated-at.bofh.it> <r4XMK-5Nd-19@gated-at.bofh.it> <r4Ypt-6jn-45@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Mon, Feb 22, 2016 at 2:04 PM, Viresh Kumar <viresh.kumar@linaro.org> wrote:
> On 22-02-16, 13:26, Rafael J. Wysocki wrote:
>> On Mon, Feb 22, 2016 at 6:23 AM, Viresh Kumar <viresh.kumar@linaro.org> wrote:
>> > On 21-02-16, 03:14, Rafael J. Wysocki wrote:
>> >> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

[cut]

>> > I think we should be doing this here:
>> >
>> >         delta_ns = time - ACCESS_ONCE(policy_dbs->last_sample_time);
>> >         if ((s64)delta_ns < policy_dbs->sample_delay_ns) {
>> >                 atomic_set(&policy_dbs->work_count, 0);
>> >                 return;
>> >         }
>> >
>> > There is no point running the routine again, we already have ->work_count
>> > incremented for us, lets do the check right now.
>>
>> No, we need to check work_in_progress too.
>
> Then maybe move first half of this routine into a separate function
> and call it from the beginning and here ?

That won't help.   The time value is still going to be stale.

Thanks,
Rafael

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 1/2] cpufreq: governor: Fix race in dbs_update_util_handler() "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2016-02-21 03:20 +0100
  Re: [PATCH 1/2] cpufreq: governor: Fix race in  dbs_update_util_handler() Viresh Kumar <viresh.kumar@linaro.org> - 2016-02-22 06:30 +0100
    Re: [PATCH 1/2] cpufreq: governor: Fix race in dbs_update_util_handler() "Rafael J. Wysocki" <rafael@kernel.org> - 2016-02-22 13:30 +0100
      Re: [PATCH 1/2] cpufreq: governor: Fix race in  dbs_update_util_handler() Viresh Kumar <viresh.kumar@linaro.org> - 2016-02-22 14:10 +0100
        Re: [PATCH 1/2] cpufreq: governor: Fix race in dbs_update_util_handler() "Rafael J. Wysocki" <rafael@kernel.org> - 2016-02-22 14:40 +0100
  [PATCH v2 1/2] cpufreq: governor: Fix race in dbs_update_util_handler() "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2016-02-22 14:20 +0100
    Re: [PATCH v2 1/2] cpufreq: governor: Fix race in  dbs_update_util_handler() Viresh Kumar <viresh.kumar@linaro.org> - 2016-02-22 14:50 +0100

csiph-web