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]
Date:   Fri, 8 Mar 2019 12:45:11 +0100
From:   Dietmar Eggemann <dietmar.eggemann@....com>
To:     Lingutla Chandrasekhar <clingutla@...eaurora.org>,
        quentin.perret@....com, sudeep.holla@....com,
        gregkh@...uxfoundation.org
Cc:     will.deacon@....com, catalin.marinas@....com,
        morten.rasmussen@....com, linux-arm-kernel@...ts.infradead.org,
        jeremy.linton@....com, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v1] arch_topology: Make cpu_capacity sysfs node as
 ready-only

On 3/6/19 4:27 PM, Lingutla Chandrasekhar wrote:

[...]

> @@ -51,37 +50,7 @@ static ssize_t cpu_capacity_show(struct device *dev,
>   static void update_topology_flags_workfn(struct work_struct *work);
>   static DECLARE_WORK(update_topology_flags_work, update_topology_flags_workfn);
>   
> -static ssize_t cpu_capacity_store(struct device *dev,
> -				  struct device_attribute *attr,
> -				  const char *buf,
> -				  size_t count)
> -{
> -	struct cpu *cpu = container_of(dev, struct cpu, dev);
> -	int this_cpu = cpu->dev.id;
> -	int i;
> -	unsigned long new_capacity;
> -	ssize_t ret;
> -
> -	if (!count)
> -		return 0;
> -
> -	ret = kstrtoul(buf, 0, &new_capacity);
> -	if (ret)
> -		return ret;
> -	if (new_capacity > SCHED_CAPACITY_SCALE)
> -		return -EINVAL;
> -
> -	mutex_lock(&cpu_scale_mutex);

Since we can't write to cpu_scale from here anymore, we could get rid of 
cpu_scale_mutex. 
topology_normalize_cpu_scale()->topology_set_cpu_scale() is now only 
called from:

[    0.202628]  topology_normalize_cpu_scale+0x28/0x30
[    0.207529]  init_cpu_topology+0x168/0x1e8
[    0.211644]  smp_prepare_cpus+0x2c/0x108
[    0.215585]  kernel_init_freeable+0x104/0x518
[    0.219963]  kernel_init+0x18/0x110
[    0.223469]  ret_from_fork+0x10/0x1c

for dts capacity-dmips-mhz properties

and

[    3.130180]  topology_normalize_cpu_scale.part.0+0xac/0xd0
[    3.135619]  init_cpu_capacity_callback+0x100/0x178
[    3.140459]  notifier_call_chain+0x5c/0xa0
[    3.144522]  blocking_notifier_call_chain+0x64/0x88
[    3.149363]  cpufreq_set_policy+0xd8/0x3c8
[    3.153427]  cpufreq_init_policy+0x78/0xc8

for cpufreq max frequency related adjustments to cpu capacity.

The mutex was introduced for the sysfs interface here: 
https://lore.kernel.org/lkml/1468932048-31635-8-git-send-email-juri.lelli@arm.com

> -	for_each_cpu(i, &cpu_topology[this_cpu].core_sibling)
> -		topology_set_cpu_scale(i, new_capacity);
> -	mutex_unlock(&cpu_scale_mutex);
> -
> -	schedule_work(&update_topology_flags_work);
> -
> -	return count;
> -}
> -
> -static DEVICE_ATTR_RW(cpu_capacity);
> +static DEVICE_ATTR_RO(cpu_capacity);
>   
>   static int register_cpu_capacity_sysctl(void)
>   {
> 

Tested-by: Dietmar Eggemann <dietmar.eggemann@....com>

on Arm64 Juno with v5.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ