lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJZ5v0jhqc0AQjoQC+tF1+0_D_0xpJRQ2n9o8+vpi84EwTsaOQ@mail.gmail.com>
Date:   Wed, 11 Jan 2017 03:32:44 +0100
From:   "Rafael J. Wysocki" <rafael@...nel.org>
To:     Srinivas Pandruvada <srinivas.pandruvada@...ux.intel.com>
Cc:     "Rafael J. Wysocki" <rjw@...ysocki.net>,
        Linux PM <linux-pm@...r.kernel.org>,
        LKML <linux-kernel@...r.kernel.org>
Subject: Re: [RFC][PATCH 1/2] cpufreq: intel_pstate: Expose global sysfs
 attributes upfront

On Tue, Jan 10, 2017 at 9:48 PM, Srinivas Pandruvada
<srinivas.pandruvada@...ux.intel.com> wrote:
> On Thu, 2017-01-05 at 02:51 +0100, Rafael J. Wysocki wrote:
>> From: Rafael J. Wysocki <rafael.j.wysocki@...el.com>
>>
>> Expose the intel_pstate's global sysfs attributes before registering
>> the driver to prepare for the addition of an attribute that also will
>> have to work if the driver is not registered.
>>
>> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@...el.com>
>> ---
>>
>
> [...]
>
>>  #ifdef CONFIG_ACPI
>> @@ -1055,12 +1058,22 @@ static ssize_t show_turbo_pct(struct kob
>>       int total, no_turbo, turbo_pct;
>>       uint32_t turbo_fp;
>>
>> +     mutex_lock(&intel_pstate_driver_lock);
>> +
>> +     if (!driver_registered) {
>> +             mutex_unlock(&intel_pstate_limits_lock);
> It should be
>                 mutex_unlock(&intel_pstate_driver_lock);
>
>> +             return -EAGAIN;
>> +     }
>> +
>>       cpu = all_cpu_data[0];
>>
>>
> [...]
>
>> @@ -1070,8 +1083,18 @@ static ssize_t show_num_pstates(struct k
>>       struct cpudata *cpu;
>>       int total;
>>
>> +     mutex_lock(&intel_pstate_driver_lock);
>> +
>> +     if (!driver_registered) {
>> +             mutex_unlock(&intel_pstate_limits_lock);
> Change to
>                 mutex_unlock(&intel_pstate_driver_lock);
>
>> +             return -EAGAIN;
>> +     }
>> +
>>       cpu = all_cpu_data[0];
>>       total = cpu->pstate.turbo_pstate - cpu->pstate.min_pstate +
>> 1;
>> +
>> +     mutex_unlock(&intel_pstate_driver_lock);
>> +
>>       return sprintf(buf, "%u\n", total);
>>  }
>>
>> @@ -1080,12 +1103,21 @@ static ssize_t show_no_turbo(struct kobj
>>  {
>>       ssize_t ret;
>>
>> +     mutex_lock(&intel_pstate_driver_lock);
>> +
>> +     if (!driver_registered) {
>> +             mutex_unlock(&intel_pstate_limits_lock);
> Same here
>                 mutex_unlock(&intel_pstate_driver_lock);
>
>> +             return -EAGAIN;
>> +     }
>> +
>>       update_turbo_state();
>>       if (limits->turbo_disabled)
>>               ret = sprintf(buf, "%u\n", limits->turbo_disabled);
>>       else
>>               ret = sprintf(buf, "%u\n", limits->no_turbo);
>>
>> +     mutex_unlock(&intel_pstate_driver_lock);
>> +
>>       return ret;
>>  }
>>
>> @@ -1099,6 +1131,13 @@ static ssize_t store_no_turbo(struct kob
>>       if (ret != 1)
>>               return -EINVAL;
>>
>> +     mutex_lock(&intel_pstate_driver_lock);
>> +
>> +     if (!driver_registered) {
>> +             mutex_unlock(&intel_pstate_driver_lock);
>> +             return -EAGAIN;
>> +     }
>> +
>>       mutex_lock(&intel_pstate_limits_lock);       if (limits-
>> >turbo_disabled) {
>>                 pr_warn("Turbo disabled by BIOS or unavailable on
>> processor\n");
>>                 mutex_unlock(&intel_pstate_limits_lock);
> Also
>                 mutex_unlock(&intel_pstate_driver_lock);>
>
>>                 return -EPERM;
>>         }
>>
>>       update_turbo_state();
>> @@ -1114,6 +1153,8 @@ static ssize_t store_no_turbo(struct kob
>>
>>       intel_pstate_update_policies();
>>
>> +     mutex_unlock(&intel_pstate_driver_lock);
>> +
>>       return count;
>>  }
>>

It looks like I sent an old version of the patch.  I'll send a correct
one shortly.

Thanks,
Rafael

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ