mbox series

[0/7] Fix issues and factorize arm/arm64 capacity information code

Message ID 20170119143757.14537-1-juri.lelli@arm.com
Headers show
Series Fix issues and factorize arm/arm64 capacity information code | expand

Message

Juri Lelli Jan. 19, 2017, 2:37 p.m. UTC
Hi,

arm and arm64 topology.c share a lot of code related to parsing of capacity
information. This set of patches proposes a solution (based on Will's,
Catalin's and Mark's off-line suggestions) to move such common code in a single
place: drivers/base/arch_topology.c (by creating such file and conditionally
compiling it for arm and arm64 only).

First 5 patches are actually fixes for the current code.

Patch 6 is the actual refactoring.

Last patch removes one of the extern symbols by changing a bit the now common
code. We still remain with some other externs, which are not nice. Moving them
in some header file solves the issue, should I just create a new include/
linux/arch_topology.h file and move them there?

The set is based on top of linux/master (4.10-rc4 fb1d8e0e2c50) and it is also
available from:

 git://linux-arm.org/linux-jl.git upstream/default_caps_factorize

Best,

- Juri

Juri Lelli (7):
  Documentation: arm: fix wrong reference number in DT definition
  Documentation/ABI: add information about cpu_capacity
  arm: fix return value of parse_cpu_capacity
  arm: remove wrong CONFIG_PROC_SYSCTL ifdef
  arm64: remove wrong CONFIG_PROC_SYSCTL ifdef
  arm, arm64: factorize common cpu capacity default code
  arm,arm64,drivers: reduce scope of cap_parsing_failed

 Documentation/ABI/testing/sysfs-devices-system-cpu |   7 +
 Documentation/devicetree/bindings/arm/cpus.txt     |   4 +-
 arch/arm/Kconfig                                   |   1 +
 arch/arm/kernel/topology.c                         | 216 +------------------
 arch/arm64/Kconfig                                 |   1 +
 arch/arm64/kernel/topology.c                       | 218 +------------------
 drivers/base/Kconfig                               |   8 +
 drivers/base/Makefile                              |   1 +
 drivers/base/arch_topology.c                       | 240 +++++++++++++++++++++
 9 files changed, 269 insertions(+), 427 deletions(-)
 create mode 100644 drivers/base/arch_topology.c

-- 
2.10.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

Comments

Russell King (Oracle) Jan. 19, 2017, 2:53 p.m. UTC | #1
On Thu, Jan 19, 2017 at 02:37:56PM +0000, Juri Lelli wrote:
> +extern unsigned long

> +arch_scale_cpu_capacity(struct sched_domain *sd, int cpu);

> +extern void set_capacity_scale(unsigned int cpu, unsigned long capacity);


These should be in a header file (please run your code through sparse).

> +extern bool cap_parsing_failed;

> +extern void normalize_cpu_capacity(void);

> +extern int __init parse_cpu_capacity(struct device_node *cpu_node, int cpu);


Same for these.

> diff --git a/drivers/base/arch_topology.c b/drivers/base/arch_topology.c

> new file mode 100644

> index 000000000000..3faf89518892

> --- /dev/null

> +++ b/drivers/base/arch_topology.c

> @@ -0,0 +1,240 @@

> +/*

> + * driver/base/arch_topology.c - Arch specific cpu topology information

> + *

> + * Written by: Juri Lelli, ARM Ltd.

> + *

> + * Copyright (C) 2016, ARM Ltd.

> + *

> + * All rights reserved.

> + *

> + * This program is free software; you can redistribute it and/or modify

> + * it under the terms of the GNU General Public License as published by

> + * the Free Software Foundation; either version 2 of the License, or

> + * (at your option) any later version.


The files that you've taken this code from are GPLv2, but you've thrown
a GPLv2+ header on a file that's merely a copy of the original code.
As some of the code you've moved to this new file is from Nicolas and
Vincent, you need to seek their approval to make this change of license
terms, or keep the original license terms.

-- 
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Dietmar Eggemann Jan. 19, 2017, 4 p.m. UTC | #2
On 19/01/17 14:37, Juri Lelli wrote:
> arm and arm64 share lot of code relative to parsing CPU capacity

> information from DT, using that information for appropriate scaling and

> exposing a sysfs interface for chaging such values at runtime.

> 

> Factorize such code in a common place (driver/base/arch_topology.c) in

> preparation for further additions.

> 

> Suggested-by: Will Deacon <will.deacon@arm.com>

> Suggested-by: Mark Rutland <mark.rutland@arm.com>

> Suggested-by: Catalin Marinas <catalin.marinas@arm.com>

> Cc: Russell King <linux@armlinux.org.uk>

> Cc: Catalin Marinas <catalin.marinas@arm.com>

> Cc: Will Deacon <will.deacon@arm.com>

> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

> Signed-off-by: Juri Lelli <juri.lelli@arm.com>

> ---

>  arch/arm/Kconfig             |   1 +

>  arch/arm/kernel/topology.c   | 213 ++------------------------------------

>  arch/arm64/Kconfig           |   1 +

>  arch/arm64/kernel/topology.c | 213 +-------------------------------------

>  drivers/base/Kconfig         |   8 ++

>  drivers/base/Makefile        |   1 +

>  drivers/base/arch_topology.c | 240 +++++++++++++++++++++++++++++++++++++++++++

>  7 files changed, 260 insertions(+), 417 deletions(-)

>  create mode 100644 drivers/base/arch_topology.c


[...]

> +extern unsigned long

> +arch_scale_cpu_capacity(struct sched_domain *sd, int cpu);


How about adding a driver specific prefix 'foo_' to all driver interfaces?

I'm asking because I would rather like to do a

#define arch_scale_cpu_capacity foo_scale_cpu_capacity

then a

#define arch_scale_cpu_capacity arch_scale_cpu_capacity

in arch/arm64/include/asm/topology.h

later to wire cpu-invariant load-tracking support up to the task
scheduler for ARM64.

That's probably true too for all the 'driver' interfaces which get used
in arch/arm{,64}/kernel/topology.c.

[...]



_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Juri Lelli Jan. 30, 2017, 12:29 p.m. UTC | #3
Hi,

ping.

I'd need more advice on this set, especially on how and if patch 6 could fly.

Thanks,

- Juri

On 19/01/17 14:37, Juri Lelli wrote:
> Hi,

> 

> arm and arm64 topology.c share a lot of code related to parsing of capacity

> information. This set of patches proposes a solution (based on Will's,

> Catalin's and Mark's off-line suggestions) to move such common code in a single

> place: drivers/base/arch_topology.c (by creating such file and conditionally

> compiling it for arm and arm64 only).

> 

> First 5 patches are actually fixes for the current code.

> 

> Patch 6 is the actual refactoring.

> 

> Last patch removes one of the extern symbols by changing a bit the now common

> code. We still remain with some other externs, which are not nice. Moving them

> in some header file solves the issue, should I just create a new include/

> linux/arch_topology.h file and move them there?

> 

> The set is based on top of linux/master (4.10-rc4 fb1d8e0e2c50) and it is also

> available from:

> 

>  git://linux-arm.org/linux-jl.git upstream/default_caps_factorize

> 

> Best,

> 

> - Juri

> 

> Juri Lelli (7):

>   Documentation: arm: fix wrong reference number in DT definition

>   Documentation/ABI: add information about cpu_capacity

>   arm: fix return value of parse_cpu_capacity

>   arm: remove wrong CONFIG_PROC_SYSCTL ifdef

>   arm64: remove wrong CONFIG_PROC_SYSCTL ifdef

>   arm, arm64: factorize common cpu capacity default code

>   arm,arm64,drivers: reduce scope of cap_parsing_failed

> 

>  Documentation/ABI/testing/sysfs-devices-system-cpu |   7 +

>  Documentation/devicetree/bindings/arm/cpus.txt     |   4 +-

>  arch/arm/Kconfig                                   |   1 +

>  arch/arm/kernel/topology.c                         | 216 +------------------

>  arch/arm64/Kconfig                                 |   1 +

>  arch/arm64/kernel/topology.c                       | 218 +------------------

>  drivers/base/Kconfig                               |   8 +

>  drivers/base/Makefile                              |   1 +

>  drivers/base/arch_topology.c                       | 240 +++++++++++++++++++++

>  9 files changed, 269 insertions(+), 427 deletions(-)

>  create mode 100644 drivers/base/arch_topology.c

> 

> -- 

> 2.10.0

> 


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel