platform/kernel/linux-arm64.git
10 years agoUpdated README.md with the v0.3-Juno release information
Liviu Dudau [Tue, 13 May 2014 09:36:45 +0000 (10:36 +0100)]
Updated README.md with the v0.3-Juno release information

Signed-off-by: Liviu Dudau <Liviu.Dudau@arm.com>
10 years agoarm64: Updated defconfig to enable Juno peripherals and Android configs
Liviu Dudau [Mon, 12 May 2014 13:42:38 +0000 (14:42 +0100)]
arm64: Updated defconfig to enable Juno peripherals and Android configs

Signed-off-by: Liviu Dudau <Liviu.Dudau@arm.com>
10 years agoMerge branch 'juno-hmp' into juno-release
Liviu Dudau [Mon, 12 May 2014 12:33:47 +0000 (13:33 +0100)]
Merge branch 'juno-hmp' into juno-release

Conflicts:
arch/arm64/kernel/topology.c

10 years agoMerge branch 'juno-dev' into juno-release
Liviu Dudau [Mon, 12 May 2014 12:32:38 +0000 (13:32 +0100)]
Merge branch 'juno-dev' into juno-release

10 years agoMerge branch 'hdlcd-upstream' into juno-release
Liviu Dudau [Mon, 12 May 2014 12:32:28 +0000 (13:32 +0100)]
Merge branch 'hdlcd-upstream' into juno-release

10 years agoMerge tag 'v3.15-rc5' into juno-release
Liviu Dudau [Mon, 12 May 2014 12:32:12 +0000 (13:32 +0100)]
Merge tag 'v3.15-rc5' into juno-release

Linux 3.15-rc5

10 years agoHDLCD: correct the mapping of RGB signals into the TDA998x HDMI transmitter.
Liviu Dudau [Fri, 14 Mar 2014 00:21:45 +0000 (00:21 +0000)]
HDLCD: correct the mapping of RGB signals into the TDA998x HDMI transmitter.

Signed-off-by: Liviu Dudau <Liviu.Dudau@arm.com>
10 years agodrm: Replace calls to dma_{alloc,free}_writecombine with dma_{alloc,free}_attrs.
Liviu Dudau [Wed, 18 Dec 2013 16:13:02 +0000 (16:13 +0000)]
drm: Replace calls to dma_{alloc,free}_writecombine with dma_{alloc,free}_attrs.

Only two platforms define the dma_{alloc,free}_writecombine functions, and
those are mostly wrappers around dma_{alloc,free}_attrs with the correct
DMA_ATTRS set for the relevant parameter. Use the base functions directly,
to avoid adding more per-arch function definitions.

Signed-off-by: Liviu Dudau <Liviu.Dudau@arm.com>
10 years agodrm: i2c: Add support for Silicon Image SiI9022 HDMI transmitter.
Liviu Dudau [Thu, 12 Dec 2013 18:52:31 +0000 (18:52 +0000)]
drm: i2c: Add support for Silicon Image SiI9022 HDMI transmitter.

SiI9022 is a old HDMI transmitter part found on ARM's VExpress
boards and obsolete OMAP Zoom dev boards among others. This adds
supports for the device to act as a drm_encoder_slave to DRM
drivers.

Signed-off-by: Liviu Dudau <Liviu.Dudau@arm.com>
10 years agodrm: encoder_slave: respect of_node on i2c encoder init
Sebastian Hesselbarth [Mon, 10 Jun 2013 21:23:42 +0000 (23:23 +0200)]
drm: encoder_slave: respect of_node on i2c encoder init

Current DRM slave encoder API conflicts with auto-registration of i2c client
when using DT probed clients. To allow DRM slave encoders passed by DT, this
patch adds a check to drm_i2c_encoder_init for a non-NULL .of_node on
i2c_board_info and calls an of_i2c helper to get the i2c client device
instead of registering a new device.

Liviu: Updated the name of the header file containing
of_find_i2c_device_by_node()

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Signed-off-by: Liviu Dudau <Liviu.Dudau@arm.com>
10 years agoarm: vexpress: Update the hdlcd node in DT to match bindings.
Liviu Dudau [Thu, 12 Dec 2013 18:27:00 +0000 (18:27 +0000)]
arm: vexpress: Update the hdlcd node in DT to match bindings.

Signed-off-by: Liviu Dudau <Liviu.Dudau@arm.com>
10 years agodrm: arm: Add DT bindings documentation for HDLCD driver.
Liviu Dudau [Thu, 12 Dec 2013 18:23:35 +0000 (18:23 +0000)]
drm: arm: Add DT bindings documentation for HDLCD driver.

Signed-off-by: Liviu Dudau <Liviu.Dudau@arm.com>
10 years agodrm: Add support for ARM's HDLCD controller.
Liviu Dudau [Thu, 12 Dec 2013 17:23:38 +0000 (17:23 +0000)]
drm: Add support for ARM's HDLCD controller.

The HDLCD controller is a display controller that supports resolutions
up to 2048x2048 pixels. It is present on various development boards
produced by ARM Ltd and emulated by the latest Fast Models from the
company.

Signed-off-by: Liviu Dudau <Liviu.Dudau@arm.com>
10 years agodrm: Cleanup code when checking for reduced blanking support.
Liviu Dudau [Thu, 12 Dec 2013 15:58:39 +0000 (15:58 +0000)]
drm: Cleanup code when checking for reduced blanking support.

Rather than check the result of drm_monitor_supports_rb() and do a
big if where the only difference is the result of the condition,
use the return value directly as a parameter of drm_mode_find_dmt.

Signed-off-by: Liviu Dudau <Liviu.Dudau@arm.com>
10 years agoDocumentation: drm: Use '->' when describing access through pointers.
Liviu Dudau [Thu, 12 Dec 2013 15:52:34 +0000 (15:52 +0000)]
Documentation: drm: Use '->' when describing access through pointers.

The documentation is trying to describe accessing a field through a
pointer, but it is using '-<' instead of '->'. Fix that.

Signed-off-by: Liviu Dudau <Liviu.Dudau@arm.com>
10 years agocpufreq: [HORRIBLE DIRTY HACK] get arm_big_little compiling on arm64
Sudeep Holla [Fri, 9 May 2014 12:17:32 +0000 (13:17 +0100)]
cpufreq: [HORRIBLE DIRTY HACK] get arm_big_little compiling on arm64

*******!!!!!!!!****** ONLY FOR TESTING *************!!!!!!!!!***************

Currently the addition of switcher code has created too much dependencies
to get this driver compiling on ARM64. For time being add dirty compilation
hacks to test CPUFreq on Juno.

****!!!!!!!***** THIS NEEDS TO BE REWORKED *********!!!!!!!!****************

Not-at-all-Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
10 years agoarm64: Add Juno platform support
Liviu Dudau [Thu, 6 Jun 2013 09:41:39 +0000 (10:41 +0100)]
arm64: Add Juno platform support

Signed-off-by: Liviu Dudau <Liviu.Dudau@arm.com>
10 years agoarm64: Create link to include/dt-bindings to enable C preprocessor use.
Liviu Dudau [Tue, 4 Mar 2014 10:22:28 +0000 (10:22 +0000)]
arm64: Create link to include/dt-bindings to enable C preprocessor use.

DT files used in the compilation phase can be preprocessed by the C
preprocessor. This requires an include/dt-bindings directory to be
present in the arch/arm64/boot/dts directory.

Signed-off-by: Liviu Dudau <Liviu.Dudau@arm.com>
10 years agoarm64: Restrict CMA allocation to 32-bit PA
Liviu Dudau [Tue, 29 Apr 2014 10:23:18 +0000 (11:23 +0100)]
arm64: Restrict CMA allocation to 32-bit PA

Juno devices are 32bit and cannot use memory allocated by CMA with
a physical address larger than 4GB. Restrict the CMA allocation
to the first 4GB PA.

Signed-off-by: Liviu Dudau <Liviu.Dudau@arm.com>
10 years agoinput: Request a shared interrupt for AMBA KMI devices.
Liviu Dudau [Thu, 13 Mar 2014 11:19:33 +0000 (11:19 +0000)]
input: Request a shared interrupt for AMBA KMI devices.

Recent ARM boards have the KMI devices share one interrupt line rather
than having dedicated IRQs. Update the driver to take that into account.

Signed-off-by: Liviu Dudau <Liviu.Dudau@arm.com>
10 years agodrm: tda998x: Add support for CEC addresses other than 0x34.
Liviu Dudau [Wed, 26 Mar 2014 15:57:10 +0000 (15:57 +0000)]
drm: tda998x: Add support for CEC addresses other than 0x34.

Signed-off-by: Liviu Dudau <Liviu.Dudau@arm.com>
10 years agousb: Enable support for 64bit EHCI host controllers in arm64.
Liviu Dudau [Mon, 10 Mar 2014 10:55:37 +0000 (10:55 +0000)]
usb: Enable support for 64bit EHCI host controllers in arm64.

arm64 architecture handles correctly 64bit DMAs and can enable
support for 64bit EHCI host controllers.

Signed-off-by: Liviu Dudau <Liviu.Dudau@arm.com>
10 years agousb: Use usb_hub_set_port_power() in hub_power_on() rather than equivalent code.
Liviu Dudau [Mon, 10 Mar 2014 10:49:22 +0000 (10:49 +0000)]
usb: Use usb_hub_set_port_power() in hub_power_on() rather than equivalent code.

hub_power_on() uses code to set port power that is equivalent to usb_hub_set_port_power().
Use that function directly and reduce code size.

Signed-off-by: Liviu Dudau <Liviu.Dudau@arm.com>
10 years agousb: Add support for Synopsis H20AHB EHCI host controller.
Liviu Dudau [Tue, 4 Mar 2014 11:03:13 +0000 (11:03 +0000)]
usb: Add support for Synopsis H20AHB EHCI host controller.

Signed-off-by: Liviu Dudau <Liviu.Dudau@arm.com>
10 years agophy: Add SMSC USB334x PHY IDs.
Liviu Dudau [Tue, 4 Mar 2014 11:22:32 +0000 (11:22 +0000)]
phy: Add SMSC USB334x PHY IDs.

Signed-off-by: Liviu Dudau <Liviu.Dudau@arm.com>
10 years agophy: Enable USB PHY support for arm64.
Liviu Dudau [Tue, 4 Mar 2014 11:21:41 +0000 (11:21 +0000)]
phy: Enable USB PHY support for arm64.

Signed-off-by: Liviu Dudau <Liviu.Dudau@arm.com>
10 years agoDMA: Fix allocation size for PL330 data buffer depth.
Liviu Dudau [Mon, 3 Mar 2014 14:41:59 +0000 (14:41 +0000)]
DMA: Fix allocation size for PL330 data buffer depth.

The datasheet for PL330 says that the data buffer value in the CRD
register is 10bits wide. However, the value stored is "minus one",
which the driver corrects for. Maximum value that the data buffer
depth can have is 1024 lines, which requires 11 bits for storage.

While making updates I found printing the peripheral ID as a hex
value to be more useful as the datasheet shows the values that way.

Signed-off-by: Liviu Dudau <Liviu.Dudau@arm.com>
10 years agocpufreq: arm_big_little: add SPCI interface driver
Sudeep Holla [Thu, 8 May 2014 16:47:48 +0000 (17:47 +0100)]
cpufreq: arm_big_little: add SPCI interface driver

On some ARM based systems, a separate Cortex-M based System Control
Processor(SCP) provides the overall power, clock, reset and system
control including CPU DVFS. SCPI Message Protocol is used to
communicate with the SCPI.

This patch adds a interface driver for adding OPPs and registering
the arm_big_little cpufreq driver for such systems.

Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
10 years agoclk: add support for clocks provided by system control processor
Sudeep Holla [Thu, 24 Apr 2014 15:58:11 +0000 (16:58 +0100)]
clk: add support for clocks provided by system control processor

On some ARM based systems, a separate Cortex-M based System Control
Processor(SCP) provides the overall power, clock, reset and system
control. System Control and Power Interface(SCPI) Message Protocol
is defined for the communication between the Application Cores(AP)
and the SCP.

This patch adds support for the clocks provided by SCP using SCPI
protocol.

Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
10 years agomailbox: add support for System Control and Power Interface(SCPI) protocol
Sudeep Holla [Tue, 15 Apr 2014 15:09:42 +0000 (16:09 +0100)]
mailbox: add support for System Control and Power Interface(SCPI) protocol

This patch add supports for System Control and Power Interface (SCPI)
Message Protocol used between the Application Cores(AP) and the System
Control Processor(SCP). The MHU peripheral provides a mechanism for
inter-processor communication between SCP's M3 processor and AP.

SCP offers control and management of the core/cluster power states,
various power domain DVFS including the core/cluster, certain system
clocks configuration, thermal sensors and many others.

This protocol library provides interface for all the client drivers using
SCPI to make use of the features offered by the SCP.

Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
10 years agomailbox: add support for ARM Message Handling Unit(MHU) controller
Sudeep Holla [Tue, 15 Apr 2014 14:14:27 +0000 (15:14 +0100)]
mailbox: add support for ARM Message Handling Unit(MHU) controller

This patch adds support for ARM Message Handling Unit(MHU) controller
that provides control logic and interrupt generation to support
inter-processor communication between the Application Processor and
the System Control Processor(SCP).

This support is built on the existing common mailbox framework for
client/protocol drivers and controller drivers of Inter Processor
Communication(IPC). SCP controls most of the power managament on the
Application Processors.

Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
10 years agoarm64: add ARCH_HAS_OPP to allow enabling OPP library
Sudeep Holla [Thu, 8 May 2014 15:15:07 +0000 (16:15 +0100)]
arm64: add ARCH_HAS_OPP to allow enabling OPP library

The Operating Performance Point (OPP) Layer library is a generic
library used by CPUFREQ and DEVFREQ. It can be enabled only on the
platforms that specify ARCH_HAS_OPP option.

This patch selects that option in order to allow ARM64 based platforms
to use OPP library.

Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
10 years agoarm64: restore alphabetic order in Kconfig
Sudeep Holla [Thu, 8 May 2014 15:12:43 +0000 (16:12 +0100)]
arm64: restore alphabetic order in Kconfig

Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
10 years agoarm64: use cpu_online_mask when using forced irq_set_affinity
Sudeep Holla [Thu, 8 May 2014 08:49:13 +0000 (09:49 +0100)]
arm64: use cpu_online_mask when using forced irq_set_affinity

Commit 01f8fa4f01d8("genirq: Allow forcing cpu affinity of interrupts")
enabled the forced irq_set_affinity which previously refused to route an
interrupt to an offline cpu.

Commit ffde1de64012("irqchip: Gic: Support forced affinity setting")
implements this force logic and disables the cpu online check for GIC
interrupt controller.

When __cpu_disable calls migrate_irqs, it disables the current cpu in
cpu_online_mask and uses forced irq_set_affinity to migrate the IRQs
away from the cpu but passes affinity mask with the cpu being offlined
also included in it.

When calling irq_set_affinity with force == true in a cpu hotplug path,
the caller must ensure that the cpu being offlined is not present in the
affinity mask or it may be selected as the target CPU, leading to the
interrupt not being migrated.

This patch uses cpu_online_mask when using forced irq_set_affinity so
that the IRQs are properly migrated away.

Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Marc Zyngier <marc.zyngier@arm.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
10 years agoarm: use cpu_online_mask when using forced irq_set_affinity
Sudeep Holla [Thu, 8 May 2014 18:04:00 +0000 (19:04 +0100)]
arm: use cpu_online_mask when using forced irq_set_affinity

Commit 01f8fa4f01d8("genirq: Allow forcing cpu affinity of interrupts")
enabled the forced irq_set_affinity which previously refused to route an
interrupt to an offline cpu.

Commit ffde1de64012("irqchip: Gic: Support forced affinity setting")
implements this force logic and disables the cpu online check for GIC
interrupt controller.

When __cpu_disable calls migrate_irqs, it disables the current cpu in
cpu_online_mask and uses forced irq_set_affinity to migrate the IRQs
away from the cpu but passes affinity mask with the cpu being offlined
also included in it.

When calling irq_set_affinity with force == true in a cpu hotplug path,
the caller must ensure that the cpu being offlined is not present in the
affinity mask or it may be selected as the target CPU, leading to the
interrupt not being migrated.

This patch uses cpu_online_mask when using forced irq_set_affinity so
that the IRQs are properly migrated away.

Tested on TC2 hotpluging CPU0 in and out. Without this patch the system
locks up as the IRQs are not migrated away from CPU0.

Cc: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
10 years agomailbox: Fix deleteing poll timer
LeyFoon Tan [Tue, 18 Mar 2014 18:46:39 +0000 (00:16 +0530)]
mailbox: Fix deleteing poll timer

Try to delete the timer only if it was init/used.

Signed-off-by: LeyFoon Tan <lftan.linux@gmail.com>
Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org>
10 years agomailbox: Fix TX completion init
LeyFoon Tan [Tue, 18 Mar 2014 18:46:16 +0000 (00:16 +0530)]
mailbox: Fix TX completion init

For fast TX the complete could be called before being initialized as follows
 mbox_send_message --> poll_txdone --> tx_tick --> complete(&chan->tx_complete)

Init the completion early enough to fix the race.

Signed-off-by: LeyFoon Tan <lftan.linux@gmail.com>
Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org>
10 years agomailbox: pl320: Introduce common API driver
jassisinghbrar@gmail.com [Tue, 18 Mar 2014 18:45:55 +0000 (00:15 +0530)]
mailbox: pl320: Introduce common API driver

Convert the PL320 controller driver to work with the common
mailbox API. Also convert the only user of PL320, highbank-cpufreq.c
to work with thee API. Drop the obsoleted driver pl320-ipc.c

Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org>
10 years agomailbox: Introduce framework for mailbox
jassisinghbrar@gmail.com [Tue, 18 Mar 2014 18:45:34 +0000 (00:15 +0530)]
mailbox: Introduce framework for mailbox

Introduce common framework for client/protocol drivers and
controller drivers of Inter-Processor-Communication (IPC).

Client driver developers should have a look at
 include/linux/mailbox_client.h to understand the part of
the API exposed to client drivers.
Similarly controller driver developers should have a look
at include/linux/mailbox_controller.h

Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org>
10 years agomailbox: rename pl320-ipc specific mailbox.h
Suman Anna [Tue, 18 Mar 2014 18:44:59 +0000 (00:14 +0530)]
mailbox: rename pl320-ipc specific mailbox.h

The patch 30058677 "ARM / highbank: add support for pl320 IPC"
added a pl320 IPC specific header file as a generic mailbox.h.
This file has been renamed appropriately to allow the
introduction of the generic mailbox API framework.

Acked-by: Mark Langsdorf <mark.langsdorf@calxeda.com>
Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Suman Anna <s-anna@ti.com>
10 years agoarm64: topology: Provide relative power numbers for cores
Mark Brown [Fri, 2 May 2014 20:38:32 +0000 (13:38 -0700)]
arm64: topology: Provide relative power numbers for cores

Provide performance numbers to the scheduler to help it fill the cores in
the system on big.LITTLE systems. With the current scheduler this may
perform poorly for applications that try to do OpenMP style work over all
cores but should help for more common workloads. The current 32 bit ARM
implementation provides a similar estimate so this helps ensure that
work to improve big.LITTLE systems on ARMv7 systems performs similarly
on ARMv8 systems.

The power numbers are the same as for ARMv7 since it seems that the
expected differential between the big and little cores is very similar on
both ARMv7 and ARMv8.  In both ARMv7 and ARMv8 cases the numbers were
based on the published DMIPS numbers.

These numbers are just an initial and basic approximation for use with
the current scheduler, it is likely that both experience with silicon
and ongoing work on improving the scheduler will lead to further tuning
or will tune automatically at runtime and so make the specific choice of
numbers here less critical.

Signed-off-by: Mark Brown <broonie@linaro.org>
10 years agoarm64: topology: Tell the scheduler about the relative power of cores
Mark Brown [Fri, 2 May 2014 20:38:31 +0000 (13:38 -0700)]
arm64: topology: Tell the scheduler about the relative power of cores

In heterogeneous systems like big.LITTLE systems the scheduler will be
able to make better use of the available cores if we provide power numbers
to it indicating their relative performance. Do this by parsing the CPU
nodes in the DT.

This code currently has no effect as no information on the relative
performance of the cores is provided.

Signed-off-by: Mark Brown <broonie@linaro.org>
10 years agoarm64: topology: add MPIDR-based detection
Zi Shen Lim [Fri, 2 May 2014 20:38:30 +0000 (13:38 -0700)]
arm64: topology: add MPIDR-based detection

Create cpu topology based on MPIDR. When hardware sets MPIDR to sane
values, this method will always work. Therefore it should also work well
as the fallback method. [1]

When we have multiple processing elements in the system, we create
the cpu topology by mapping each affinity level (from lowest to highest)
to threads (if they exist), cores, and clusters.

We combine data from all higher affinity levels into cluster_id
so we don't lose any information from MPIDR. [2]

[1] http://www.spinics.net/lists/arm-kernel/msg317445.html
[2] https://lkml.org/lkml/2014/4/23/703

[Raise the priority of the error message if we don't discover topology
now that we can read it from MPIDIR -- broonie]

Signed-off-by: Zi Shen Lim <zlim@broadcom.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
10 years agoarm64: topology: Add support for topology DT bindings
Mark Brown [Fri, 2 May 2014 20:38:29 +0000 (13:38 -0700)]
arm64: topology: Add support for topology DT bindings

Add support for parsing the explicit topology bindings to discover the
topology of the system.

Since it is not currently clear how to map multi-level clusters for the
scheduler all leaf clusters are presented to the scheduler at the same
level. This should be enough to provide good support for current systems.

Signed-off-by: Mark Brown <broonie@linaro.org>
Reviewed-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
10 years agoarm64: topology: Initialise default topology state immediately
Mark Brown [Fri, 2 May 2014 20:38:28 +0000 (13:38 -0700)]
arm64: topology: Initialise default topology state immediately

As a legacy of the way 32 bit ARM did things the topology code uses a null
topology map by default and then overwrites it by mapping cores with no
information to a cluster by themselves later. In order to make it simpler
to reset things as part of recovering from parse failures in firmware
information directly set this configuration on init. A core will always be
its own sibling so there should be no risk of confusion with firmware
provided information.

Signed-off-by: Mark Brown <broonie@linaro.org>
Reviewed-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
10 years agoarm64: sched: Remove unused mc_capable() and smt_capable()
Zi Shen Lim [Fri, 2 May 2014 20:38:27 +0000 (13:38 -0700)]
arm64: sched: Remove unused mc_capable() and smt_capable()

Remove unused and deprecated mc_capable() and smt_capable().

Both were added recently by f6e763b93a6c ("arm64: topology:
Implement basic CPU topology support"). Uses of both were removed
by 8e7fbcbc22c1 ("sched: Remove stale power aware scheduling
remnants and dysfunctional knobs").

Signed-off-by: Zi Shen Lim <zlim@broadcom.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
10 years agosched: hmp: fixup task_hot usage
Chris Redpath [Wed, 7 May 2014 13:49:12 +0000 (14:49 +0100)]
sched: hmp: fixup task_hot usage

Signed-off-by: Chris Redpath <chris.redpath@arm.com>
10 years agoarm64: Add misc HMP specific Kconfig options
Robin Randhawa [Wed, 30 Apr 2014 16:31:15 +0000 (17:31 +0100)]
arm64: Add misc HMP specific Kconfig options

These bring arm64 at par with the HMP specific options provided for arm.

10 years agoarm64: HMP: Add HMP support code to topology.c
Robin Randhawa [Wed, 30 Apr 2014 16:33:08 +0000 (17:33 +0100)]
arm64: HMP: Add HMP support code to topology.c

Conflicts:
arch/arm64/kernel/topology.c

10 years agoarm64: topology: Provide relative power numbers for cores
Mark Brown [Fri, 2 May 2014 20:38:32 +0000 (13:38 -0700)]
arm64: topology: Provide relative power numbers for cores

Provide performance numbers to the scheduler to help it fill the cores in
the system on big.LITTLE systems. With the current scheduler this may
perform poorly for applications that try to do OpenMP style work over all
cores but should help for more common workloads. The current 32 bit ARM
implementation provides a similar estimate so this helps ensure that
work to improve big.LITTLE systems on ARMv7 systems performs similarly
on ARMv8 systems.

The power numbers are the same as for ARMv7 since it seems that the
expected differential between the big and little cores is very similar on
both ARMv7 and ARMv8.  In both ARMv7 and ARMv8 cases the numbers were
based on the published DMIPS numbers.

These numbers are just an initial and basic approximation for use with
the current scheduler, it is likely that both experience with silicon
and ongoing work on improving the scheduler will lead to further tuning
or will tune automatically at runtime and so make the specific choice of
numbers here less critical.

Signed-off-by: Mark Brown <broonie@linaro.org>
10 years agoarm64: topology: Tell the scheduler about the relative power of cores
Mark Brown [Fri, 2 May 2014 20:38:31 +0000 (13:38 -0700)]
arm64: topology: Tell the scheduler about the relative power of cores

In heterogeneous systems like big.LITTLE systems the scheduler will be
able to make better use of the available cores if we provide power numbers
to it indicating their relative performance. Do this by parsing the CPU
nodes in the DT.

This code currently has no effect as no information on the relative
performance of the cores is provided.

Signed-off-by: Mark Brown <broonie@linaro.org>
10 years agoarm64: topology: add MPIDR-based detection
Zi Shen Lim [Fri, 2 May 2014 20:38:30 +0000 (13:38 -0700)]
arm64: topology: add MPIDR-based detection

Create cpu topology based on MPIDR. When hardware sets MPIDR to sane
values, this method will always work. Therefore it should also work well
as the fallback method. [1]

When we have multiple processing elements in the system, we create
the cpu topology by mapping each affinity level (from lowest to highest)
to threads (if they exist), cores, and clusters.

We combine data from all higher affinity levels into cluster_id
so we don't lose any information from MPIDR. [2]

[1] http://www.spinics.net/lists/arm-kernel/msg317445.html
[2] https://lkml.org/lkml/2014/4/23/703

[Raise the priority of the error message if we don't discover topology
now that we can read it from MPIDIR -- broonie]

Signed-off-by: Zi Shen Lim <zlim@broadcom.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
10 years agoarm64: topology: Add support for topology DT bindings
Mark Brown [Fri, 2 May 2014 20:38:29 +0000 (13:38 -0700)]
arm64: topology: Add support for topology DT bindings

Add support for parsing the explicit topology bindings to discover the
topology of the system.

Since it is not currently clear how to map multi-level clusters for the
scheduler all leaf clusters are presented to the scheduler at the same
level. This should be enough to provide good support for current systems.

Signed-off-by: Mark Brown <broonie@linaro.org>
Reviewed-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
10 years agoarm64: topology: Initialise default topology state immediately
Mark Brown [Fri, 2 May 2014 20:38:28 +0000 (13:38 -0700)]
arm64: topology: Initialise default topology state immediately

As a legacy of the way 32 bit ARM did things the topology code uses a null
topology map by default and then overwrites it by mapping cores with no
information to a cluster by themselves later. In order to make it simpler
to reset things as part of recovering from parse failures in firmware
information directly set this configuration on init. A core will always be
its own sibling so there should be no risk of confusion with firmware
provided information.

Signed-off-by: Mark Brown <broonie@linaro.org>
Reviewed-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
10 years agoarm64: sched: Remove unused mc_capable() and smt_capable()
Zi Shen Lim [Fri, 2 May 2014 20:38:27 +0000 (13:38 -0700)]
arm64: sched: Remove unused mc_capable() and smt_capable()

Remove unused and deprecated mc_capable() and smt_capable().

Both were added recently by f6e763b93a6c ("arm64: topology:
Implement basic CPU topology support"). Uses of both were removed
by 8e7fbcbc22c1 ("sched: Remove stale power aware scheduling
remnants and dysfunctional knobs").

Signed-off-by: Zi Shen Lim <zlim@broadcom.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
10 years agoarm64: audit: Add audit hook in syscall_trace_enter/exit()
AKASHI Takahiro [Wed, 30 Apr 2014 09:57:23 +0000 (18:57 +0900)]
arm64: audit: Add audit hook in syscall_trace_enter/exit()

This patch adds auditing functions on entry to or exit from
every system call invocation.

Acked-by: Richard Guy Briggs <rgb@redhat.com>
Acked-by Will Deacon <will.deacon@arm.com>

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
10 years agoarm64: Add audit support
AKASHI Takahiro [Wed, 30 Apr 2014 09:57:22 +0000 (18:57 +0900)]
arm64: Add audit support

On AArch64, audit is supported through generic lib/audit.c and
compat_audit.c, and so this patch adds arch specific definitions required.

Acked-by Will Deacon <will.deacon@arm.com>
Acked-by: Richard Guy Briggs <rgb@redhat.com>
Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
10 years agoarm64: ftrace: Add system call tracepoint
AKASHI Takahiro [Wed, 30 Apr 2014 09:54:36 +0000 (18:54 +0900)]
arm64: ftrace: Add system call tracepoint

This patch allows system call entry or exit to be traced as ftrace events,
ie. sys_enter_*/sys_exit_*, if CONFIG_FTRACE_SYSCALLS is enabled.
Those events appear and can be controlled under
    ${sysfs}/tracing/events/syscalls/

Please note that we can't trace compat system calls here because
AArch32 mode does not share the same syscall table with AArch64.
Just define ARCH_TRACE_IGNORE_COMPAT_SYSCALLS in order to avoid unexpected
results (bogus syscalls reported or even hang-up).

Acked-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
10 years agoarm64: ftrace: Add CALLER_ADDRx macros
AKASHI Takahiro [Wed, 30 Apr 2014 09:54:35 +0000 (18:54 +0900)]
arm64: ftrace: Add CALLER_ADDRx macros

CALLER_ADDRx returns caller's address at specified level in call stacks.
They are used for several tracers like irqsoff and preemptoff.
Strange to say, however, they are refered even without FTRACE.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
10 years agoarm64: ftrace: Add dynamic ftrace support
AKASHI Takahiro [Wed, 30 Apr 2014 09:54:34 +0000 (18:54 +0900)]
arm64: ftrace: Add dynamic ftrace support

This patch allows "dynamic ftrace" if CONFIG_DYNAMIC_FTRACE is enabled.
Here we can turn on and off tracing dynamically per-function base.

On arm64, this is done by patching single branch instruction to _mcount()
inserted by gcc -pg option. The branch is replaced to NOP initially at
kernel start up, and later on, NOP to branch to ftrace_caller() when
enabled or branch to NOP when disabled.
Please note that ftrace_caller() is a counterpart of _mcount() in case of
'static' ftrace.

More details on architecture specific requirements are described in
Documentation/trace/ftrace-design.txt.

Acked-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
10 years agoarm64: Add ftrace support
AKASHI Takahiro [Wed, 30 Apr 2014 09:54:33 +0000 (18:54 +0900)]
arm64: Add ftrace support

This patch implements arm64 specific part to support function tracers,
such as function (CONFIG_FUNCTION_TRACER), function_graph
(CONFIG_FUNCTION_GRAPH_TRACER) and function profiler
(CONFIG_FUNCTION_PROFILER).

With 'function' tracer, all the functions in the kernel are traced with
timestamps in ${sysfs}/tracing/trace. If function_graph tracer is
specified, call graph is generated.

The kernel must be compiled with -pg option so that _mcount() is inserted
at the beginning of functions. This function is called on every function's
entry as long as tracing is enabled.
In addition, function_graph tracer also needs to be able to probe function's
exit. ftrace_graph_caller() & return_to_handler do this by faking link
register's value to intercept function's return path.

More details on architecture specific requirements are described in
Documentation/trace/ftrace-design.txt.

Reviewed-by: Ganapatrao Kulkarni <ganapatrao.kulkarni@cavium.com>
Acked-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
10 years agoftrace: Add arm64 support to recordmcount
AKASHI Takahiro [Wed, 30 Apr 2014 09:54:32 +0000 (18:54 +0900)]
ftrace: Add arm64 support to recordmcount

Recordmcount utility under scripts is run, after compiling each object,
to find out all the locations of calling _mcount() and put them into
specific seciton named __mcount_loc.
Then linker collects all such information into a table in the kernel image
(between __start_mcount_loc and __stop_mcount_loc) for later use by ftrace.

This patch adds arm64 specific definitions to identify such locations.
There are two types of implementation, C and Perl. On arm64, only C version
is used to build the kernel now that CONFIG_HAVE_C_RECORDMCOUNT is on.
But Perl version is also maintained.

This patch also contains a workaround just in case where a header file,
elf.h, on host machine doesn't have definitions of EM_AARCH64 nor
R_AARCH64_ABS64. Without them, compiling C version of recordmcount will
fail.

Acked-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
10 years agoarm64: Add 'notrace' attribute to unwind_frame() for ftrace
AKASHI Takahiro [Wed, 30 Apr 2014 09:54:31 +0000 (18:54 +0900)]
arm64: Add 'notrace' attribute to unwind_frame() for ftrace

walk_stackframe() calls unwind_frame(), and if walk_stackframe() is
"notrace", unwind_frame() should be also "notrace".

Acked-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
10 years agoarm64: add __ASSEMBLY__ in asm/insn.h
AKASHI Takahiro [Wed, 30 Apr 2014 09:54:30 +0000 (18:54 +0900)]
arm64: add __ASSEMBLY__ in asm/insn.h

Since insn.h is indirectly included in asm/entry-ftrace.S,
we need to exclude some declarations by __ASSEMBLY__.

Acked-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
10 years agoftrace: make CALLER_ADDRx macros more generic
AKASHI Takahiro [Wed, 30 Apr 2014 09:54:29 +0000 (18:54 +0900)]
ftrace: make CALLER_ADDRx macros more generic

Most archs with HAVE_ARCH_CALLER_ADDR have the almost same definitions
of CALLER_ADDRx(n), and so put them into linux/ftrace.h.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
10 years agoarm64: is_compat_task is defined both in asm/compat.h and linux/compat.h
AKASHI Takahiro [Wed, 30 Apr 2014 09:51:32 +0000 (18:51 +0900)]
arm64: is_compat_task is defined both in asm/compat.h and linux/compat.h

Some kernel files may include both linux/compat.h and asm/compat.h directly
or indirectly. Since both header files contain is_compat_task() under
!CONFIG_COMPAT, compiling them with !CONFIG_COMPAT will eventually fail.
Such files include kernel/auditsc.c, kernel/seccomp.c and init/do_mountfs.c
(do_mountfs.c may read asm/compat.h via asm/ftrace.h once ftrace is
implemented).

So this patch proactively
1) removes is_compat_task() under !CONFIG_COMPAT from asm/compat.h
2) replaces asm/compat.h to linux/compat.h in kernel/*.c,
   but asm/compat.h is still necessary in ptrace.c and process.c because
   they use is_compat_thread().

Acked-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
10 years agoarm64: Add regs_return_value() in syscall.h
AKASHI Takahiro [Wed, 30 Apr 2014 09:51:31 +0000 (18:51 +0900)]
arm64: Add regs_return_value() in syscall.h

This macro, regs_return_value, is used mainly for audit to record system
call's results, but may also be used in test_kprobes.c.

Acked-by: Will Deacon <will.deacon@arm.com>
Acked-by: Richard Guy Briggs <rgb@redhat.com>
Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
10 years agoarm64: split syscall_trace() into separate functions for enter/exit
AKASHI Takahiro [Wed, 30 Apr 2014 09:51:30 +0000 (18:51 +0900)]
arm64: split syscall_trace() into separate functions for enter/exit

As done in arm, this change makes it easy to confirm we invoke syscall
related hooks, including syscall tracepoint, audit and seccomp which would
be implemented later, in correct order. That is, undoing operations in the
opposite order on exit that they were done on entry.

Acked-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
10 years agoarm64: make a single hook to syscall_trace() for all syscall features
AKASHI Takahiro [Wed, 30 Apr 2014 09:51:29 +0000 (18:51 +0900)]
arm64: make a single hook to syscall_trace() for all syscall features

Currently syscall_trace() is called only for ptrace.
With additional TIF_xx flags defined, it is now called in all the cases
of audit, ftrace and seccomp in addition to ptrace.

Acked-by: Richard Guy Briggs <rgb@redhat.com>
Acked-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
10 years agosched: HMP: Fix breakage due to changes in find_new_ilb()
Robin Randhawa [Fri, 7 Mar 2014 17:20:33 +0000 (17:20 +0000)]
sched: HMP: Fix breakage due to changes in find_new_ilb()

Commit 3dd0337d6df7d54c82ecebfa6485040f686bf8b1 cleaned up the
parameters to find_new_ilb() which make our HMP mods break.

This commit reintroduces the missing bits but without relying on the
now missing parameters to find_new_ilb().

10 years agoHMP: Fix rt task allowed cpu mask restriction code on 1x1 system
Dietmar Eggemann [Thu, 16 Jan 2014 11:53:14 +0000 (11:53 +0000)]
HMP: Fix rt task allowed cpu mask restriction code on 1x1 system

There is an error scenario where on a 1x1 HMP system (weight of the
hmp_slow_cpu_mask is 1) the short-cut of restricting the allowed cpu mask
of an rt tasks leads to triggering a kernel bug in the rt sched class
set_cpus_allowed function set_cpus_allowed_rt().

In case the task is on the run-queue and the weight of the required cpu mask
is 1 and this is different to the p->nr_cpus_allowed value, this back-end
function interprets this in such a way that a task changed from being
migratable to not migratable anymore and decrements the rt_nr_migratory
counter.  There is a BUG_ON(!rq->rt.rt_nr_migratory) check in this code
path which triggers in this situation.

To circumvent this issue, set the number of allowed cpus for a task p to
the weight of the hmp_slow_cpu_mask before calling do_set_cpus_allowed()
in __setscheduler(). It will be set to this value in do_set_cpus_allowed()
after the call to the sched class related backend function any way.  By
doing this, set_cpus_allowed_rt() returns without trying to update the
rt_nr_migratory counter.

This patch has been tested with a test device driver requiring a threaded
irq handler on a TC2 system with a reduced cpu mask (1 Cortex A15, 1
Cortex A7).

Signed-off-by: Dietmar Eggemann <dietmar.eggemann@arm.com>
Signed-off-by: Jon Medhurst <tixy@linaro.org>
10 years agosched: hmp: Fix potential task_struct memory leak
Chris Redpath [Fri, 10 Jan 2014 10:34:08 +0000 (10:34 +0000)]
sched: hmp: Fix potential task_struct memory leak

We use get_task_struct to increment the ref count on a task_struct
so that even if the task dies with a pending migration we are still
able to read the memory without causing a fault.

In the case of non-running tasks, we forgot to decrement the ref
count when we are done with the task.

Signed-off-by: Chris Redpath <chris.redpath@arm.com>
Signed-off-by: Jon Medhurst <tixy@linaro.org>
10 years agosched: hmp: Change TC2 packing config to disabled default if present
Chris Redpath [Thu, 9 Jan 2014 10:40:30 +0000 (10:40 +0000)]
sched: hmp: Change TC2 packing config to disabled default if present

Since TC2 power curves don't really have a utilisation hotspot where
packing makes sense, if it is present for a TC2 system at least make
it default to disabled.

Signed-off-by: Chris Redpath <chris.redpath@arm.com>
Signed-off-by: Jon Medhurst <tixy@linaro.org>
10 years agosched: hmp: Make idle balance behaviour normal when packing disabled
Chris Redpath [Thu, 9 Jan 2014 10:38:54 +0000 (10:38 +0000)]
sched: hmp: Make idle balance behaviour normal when packing disabled

The presence of packing permanently changed the idle balance
behaviour. Do not restrict idle balance on the smallest CPUs when
packing is present but disabled.

Signed-off-by: Chris Redpath <chris.redpath@arm.com>
Signed-off-by: Jon Medhurst <tixy@linaro.org>
10 years agosched: update runqueue clock before migrations away
Chris Redpath [Thu, 5 Dec 2013 17:57:46 +0000 (17:57 +0000)]
sched: update runqueue clock before migrations away

If we migrate a sleeping task away from a CPU which has the
tick stopped, then both the clock_task and decay_counter will
be out of date for that CPU and we will not decay load correctly
regardless of how often we update the blocked load.

This is only an issue for tasks which are not on a runqueue
(because otherwise that CPU would be awake) and simultaneously
the CPU the task previously ran on has had the tick stopped.

Signed-off-by: Chris Redpath <chris.redpath@arm.com>
Signed-off-by: Jon Medhurst <tixy@linaro.org>
10 years agosched: reset blocked load decay_count during synchronization
Chris Redpath [Thu, 5 Dec 2013 15:49:32 +0000 (15:49 +0000)]
sched: reset blocked load decay_count during synchronization

If an entity happens to sleep for less than one tick duration
the tracked load associated with that entity can be decayed by an
unexpectedly large amount if it is later migrated to a different
CPU. This can interfere with correct scheduling when entity load
is used for decision making.

The reason for this is that when an entity is dequeued and enqueued
quickly, such that se.avg.decay_count and cfs_rq.decay_counter
do not differ when that entity is enqueued again,
__synchronize_entity_decay skips the calculation step and also skips
clearing the decay_count. At a later time that entity may be
migrated and its load will be decayed incorrectly.

All users of this function expect decay_count to be zero'ed after
use.

Signed-off-by: Chris Redpath <chris.redpath@arm.com>
Signed-off-by: Jon Medhurst <tixy@linaro.org>
10 years agosched: hmp: Fix build breakage when not using CONFIG_SCHED_HMP
Chris Redpath [Fri, 22 Nov 2013 13:19:18 +0000 (13:19 +0000)]
sched: hmp: Fix build breakage when not using CONFIG_SCHED_HMP

hmp_variable_scale_convert was used without guards in
__update_entity_runnable_avg. Guard it.

Signed-off-by: Chris Redpath <chris.redpath@arm.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
Signed-off-by: Jon Medhurst <tixy@linaro.org>
10 years agosched: hmp: add read-only hmp domain sysfs file
Chris Redpath [Mon, 11 Nov 2013 16:29:29 +0000 (16:29 +0000)]
sched: hmp: add read-only hmp domain sysfs file

In order to allow userspace to restrict known low-load tasks to
little CPUs, we must export this knowledge from the kernel or
expect userspace to make their own attempts at figuring it out.

Since we now have a userspace requirement for an HMP implementation
to always have at least some sysfs files, change the integration
so that it only depends upon CONFIG_SCHED_HMP rather than
CONFIG_HMP_VARIABLE_SCALE. Fix Kconfig text to match.

Signed-off-by: Chris Redpath <chris.redpath@arm.com>
Signed-off-by: Jon Medhurst <tixy@linaro.org>
10 years agoHMP: Avoid using the cpu stopper to stop runnable tasks
Mathieu Poirier [Wed, 20 Nov 2013 14:20:42 +0000 (14:20 +0000)]
HMP: Avoid using the cpu stopper to stop runnable tasks

When migrating a runnable task, we use the CPU stopper on
the source CPU to ensure that the task to be moved is not
currently running. Before this patch, all forced migrations
(up, offload, idle pull) use the stopper for every migration.

Using the CPU stopper is mandatory only when a task is currently
running on a CPU.  Otherwise tasks can be moved by locking the
source and destination run queues.

This patch checks to see if the task to be moved are currently
running.  If not the task is moved directly without using the
stopper thread.

Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Jon Medhurst <tixy@linaro.org>
10 years agoarm64: Fix build due to HMP tracepoints
Mark Brown [Mon, 14 Oct 2013 12:37:36 +0000 (13:37 +0100)]
arm64: Fix build due to HMP tracepoints

Commit 2353c1f800 (arm: ipi raise/start/end tracing) added tracepoints for
IPIs in the generic GIC driver but only added definitions for them on ARM,
causing build failures on ARM64. Fix this by adding equivalent definitions
for arm64.

Signed-off-by: Mark Brown <broonie@linaro.org>
Acked-by: Liviu Dudau <Liviu.Dudau@arm.com>
10 years agoHMP: Implement task packing for small tasks in HMP systems
Chris Redpath [Fri, 11 Oct 2013 10:45:04 +0000 (11:45 +0100)]
HMP: Implement task packing for small tasks in HMP systems

If we wake up a task on a little CPU, fill CPUs rather than
spread. Adds 2 new files to sys/kernel/hmp to control packing
behaviour.

packing_enable: task packing enabled (1) or disabled (0)
packing_limit: Runqueues will be filled up to this load ratio.

This functionality is disabled by default on TC2 as it lacks per-cpu
power gating so packing small tasks there doesn't make sense.

Signed-off-by: Chris Redpath <chris.redpath@arm.com>
Signed-off-by: Liviu Dudau <Liviu.Dudau@arm.com>
Signed-off-by: Jon Medhurst <tixy@linaro.org>
10 years agohmp: Remove potential for task_struct access race
Chris Redpath [Fri, 11 Oct 2013 10:45:03 +0000 (11:45 +0100)]
hmp: Remove potential for task_struct access race

Accessing the task_struct can be racy in certain conditions, so
we need to only acquire the data when needed.

Signed-off-by: Chris Redpath <chris.redpath@arm.com>
Signed-off-by: Liviu Dudau <Liviu.Dudau@arm.com>
Signed-off-by: Jon Medhurst <tixy@linaro.org>
10 years agosched: HMP: fix potential logical errors
Chris Redpath [Fri, 11 Oct 2013 10:45:02 +0000 (11:45 +0100)]
sched: HMP: fix potential logical errors

The previous API for hmp_up_migration reset the destination
CPU every time, regardless of if a migration was desired. The code
using it assumed that the value would not be changed unless
a migration was required. In one rare circumstance, this could
have lead to a task migrating to a little CPU at the wrong time.

Fixing that lead to a slight logical tweak to make the surrounding
APIs operate a bit more obviously.

Signed-off-by: Chris Redpath <chris.redpath@arm.com>
Signed-off-by: Robin Randhawa <robin.randhawa@arm.com>
Signed-off-by: Liviu Dudau <Liviu.Dudau@arm.com>
Signed-off-by: Jon Medhurst <tixy@linaro.org>
10 years agoarm: ipi raise/start/end tracing
Chris Redpath [Fri, 11 Oct 2013 10:45:00 +0000 (11:45 +0100)]
arm: ipi raise/start/end tracing

Add tracepoints for IPI raise events, and start and end of the
ipi handler.

Used to inspect the source of CPU wake-ups which are not already
traced - all other reasons for a CPU to wake-up are already
covered.

Signed-off-by: Chris Redpath <chris.redpath@arm.com>
Signed-off-by: Liviu Dudau <Liviu.Dudau@arm.com>
Signed-off-by: Jon Medhurst <tixy@linaro.org>
10 years agosched: HMP: Additional trace points for debugging HMP behaviour
Chris Redpath [Fri, 11 Oct 2013 10:44:59 +0000 (11:44 +0100)]
sched: HMP: Additional trace points for debugging HMP behaviour

1. Replace magic numbers in code for migration trace.
   Trace points still emit a number as force=<n> field:
     force=0 : wakeup migration
     force=1 : forced migration
     force=2 : offload migration
     force=3 : idle pull migration

2. Add trace to expose offload decision-making.
   Also adds tracing rq->nr_running so that you can
   look back to see what state the RQ was in at the time.

Signed-off-by: Chris Redpath <chris.redpath@arm.com>
Signed-off-by: Liviu Dudau <Liviu.Dudau@arm.com>
Signed-off-by: Jon Medhurst <tixy@linaro.org>
10 years agosched: HMP: Change default HMP thresholds
Chris Redpath [Fri, 11 Oct 2013 10:44:58 +0000 (11:44 +0100)]
sched: HMP: Change default HMP thresholds

When the up-threshold is at 512 on TC2, behaviour looks OK since
the graphic-related tasks are very heavy due to lack of a GPU.
Increasing the up-threshold does not reduce power consumption.

When a GPU is present, graphic tasks are much less CPU-heavy and
so additional power may be saved by having a higher threshold.

Signed-off-by: Chris Redpath <chris.redpath@arm.com>
Signed-off-by: Liviu Dudau <Liviu.Dudau@arm.com>
Signed-off-by: Jon Medhurst <tixy@linaro.org>
10 years agoHMP: Update migration timer when we fork-migrate
Chris Redpath [Tue, 23 Jul 2013 13:56:45 +0000 (14:56 +0100)]
HMP: Update migration timer when we fork-migrate

Prevents fork-migration adversely interacting with normal
migration (i.e. runqueues containing forked tasks being
selected as migration targets when there is a better
choice available)

Signed-off-by: Chris Redpath <chris.redpath@arm.com>
Signed-off-by: Liviu Dudau <liviu.dudau@arm.com>
Signed-off-by: Jon Medhurst <tixy@linaro.org>
10 years agoHMP: Access runqueue task clocks directly.
Chris Redpath [Mon, 22 Jul 2013 14:56:28 +0000 (15:56 +0100)]
HMP: Access runqueue task clocks directly.

Avoids accesses through cfs_rq going bad when the cpu_rq doesn't
have a cfs member.

Signed-off-by: Chris Redpath <chris.redpath@arm.com>
Signed-off-by: Liviu Dudau <liviu.dudau@arm.com>
Signed-off-by: Jon Medhurst <tixy@linaro.org>
10 years agoHMP: Implement idle pull for HMP
Chris Redpath [Thu, 8 Aug 2013 15:41:26 +0000 (16:41 +0100)]
HMP: Implement idle pull for HMP

When an A15 goes idle, we should up-migrate anything which is
above the threshold and running on an A7.

Reuses the HMP force-migration spinlock, but adds its own new
cpu stopper client.

Signed-off-by: Chris Redpath <chris.redpath@arm.com>
Signed-off-by: Liviu Dudau <liviu.dudau@arm.com>
Signed-off-by: Jon Medhurst <tixy@linaro.org>
10 years agosched: HMP change nr_running offload metric
Chris Redpath [Thu, 8 Aug 2013 15:10:39 +0000 (16:10 +0100)]
sched: HMP change nr_running offload metric

rq->nr_running was better than cfs.nr_running, since it includes
all tasks actually on the CPU. However, it includes RT tasks which
we would rather ignore at this point.

Switching to cfs.h_nr_running includes all the CFS tasks but no
RT tasks.

Signed-off-by: Chris Redpath <chris.redpath@arm.com>
Signed-off-by: Liviu Dudau <liviu.dudau@arm.com>
Signed-off-by: Jon Medhurst <tixy@linaro.org>
10 years agoHMP: Explicitly implement all-load-is-max-load policy for HMP targets
Chris Redpath [Mon, 15 Jul 2013 15:06:44 +0000 (16:06 +0100)]
HMP: Explicitly implement all-load-is-max-load policy for HMP targets

Experimentally, one of the best policies for HMP migration CPU
selection is to completely ignore part-loaded CPUs and only look
for idle ones. If there are no idle ones, we will choose the one
which was least-recently-disturbed.

Signed-off-by: Chris Redpath <chris.redpath@arm.com>
Signed-off-by: Liviu Dudau <liviu.dudau@arm.com>
Signed-off-by: Jon Medhurst <tixy@linaro.org>
10 years agoHMP: Modify the runqueue stats to add a new child stat
Chris Redpath [Thu, 8 Aug 2013 15:32:31 +0000 (16:32 +0100)]
HMP: Modify the runqueue stats to add a new child stat

The original intent here was to track unweighted runqueue load
with less resolution so we could use the least-recently-disturbed
runqueue to choose between 'closely related' load levels.

However, after experimenting with the resolution it turns out
that the following algorithm is highly beneficial for mobile
workloads.

In hmp_domain_min_load:

  * If any CPU is zero, the overall load is zero
  * If no CPUs are idle, the domain is 'fully loaded'

Additionally, the time since last migration count is used to
discriminate between idle CPUs.

Signed-off-by: Chris Redpath <chris.redpath@arm.com>
Signed-off-by: Liviu Dudau <liviu.dudau@arm.com>
Signed-off-by: Jon Medhurst <tixy@linaro.org>
10 years agosched: track per-rq 'last migration time'
Chris Redpath [Thu, 8 Aug 2013 15:31:07 +0000 (16:31 +0100)]
sched: track per-rq 'last migration time'

Track when migrations were performed to runqueues.

Use this to decide between runqueues as migration targets when run
queues in an hmp domain have equal load.

Intention is to spread migration load amongst CPUs more fairly.

When all CPUs in an hmp domain are fully loaded, the existing code
always selects the last CPU as a migration target - this is unfair
and little better than doing no selection.

Signed-off-by: Chris Redpath <chris.redpath@arm.com>
Signed-off-by: Liviu Dudau <liviu.dudau@arm.com>
Signed-off-by: Jon Medhurst <tixy@linaro.org>
10 years agosched: HMP fix traversing the rb-tree from the curr pointer
Morten Rasmussen [Tue, 6 Aug 2013 15:14:19 +0000 (16:14 +0100)]
sched: HMP fix traversing the rb-tree from the curr pointer

The hmp_get_{lightest,heaviest}_task() need to use
__pick_first_entity() to get a pointer to a sched_entity on the rq.
The current is not kept on the rq while running, so its rb-tree node
pointers are no longer valid.

Signed-off-by: Chris Redpath <chris.redpath@arm.com>
Signed-off-by: Liviu Dudau <liviu.dudau@arm.com>
Signed-off-by: Jon Medhurst <tixy@linaro.org>
10 years agoHMP: select 'best' task for migration rather than 'current'
Chris Redpath [Thu, 8 Aug 2013 15:27:34 +0000 (16:27 +0100)]
HMP: select 'best' task for migration rather than 'current'

When we are looking for a task to migrate up, select the heaviest
one in the first 5 runnable on the runqueue.

Likewise, when looking for a task to offload, select the lightest
one in the first 5 runnable on the runqueue.

Ensure task selected is runnable in the target domain.

This change is necessary in order to implement idle pull in a
sensible manner, but here is used in up-migration and offload to
select the correct target task.

Signed-off-by: Chris Redpath <chris.redpath@arm.com>
Signed-off-by: Liviu Dudau <liviu.dudau@arm.com>
Signed-off-by: Jon Medhurst <tixy@linaro.org>
10 years agoHMP: Check the system has little cpus before forcing rt tasks onto them
Jon Medhurst (Tixy) [Fri, 2 Aug 2013 17:45:33 +0000 (18:45 +0100)]
HMP: Check the system has little cpus before forcing rt tasks onto them

It is sometimes desirable to run a kernel with HMP scheduling enabled
on a system which is not big.LITTLE, e.g. when building a multi-platform
kernel, or when testing a big.LITTLE system with one cluster disabled.

We should therefore allow for the situation where is no little domain.

Signed-off-by: Jon Medhurst <tixy@linaro.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
10 years agoHMP: experimental: Force all rt tasks to start on little domain.
Dietmar Eggemann [Fri, 21 Jun 2013 16:50:08 +0000 (17:50 +0100)]
HMP: experimental: Force all rt tasks to start on little domain.

This patch restricts the allowed cpu mask for rt tasks initially started
with a full cpu mask to the little domain.

An rt task is specified as real time in __setscheduler() which is finally
called for all rt tasks (kernel and user land). In this function we
restrict the allowed cpu mask to the little domain.

This also prevents that a rt tasks can later be pushed to the big domain
because the function find_lowest_rq() will only recognize the allowed cpu
mask of a task to find the new cpu the task runs on.

Current kludges of the patch:

* Since we do not have an API to get the cpu mask of the A7 cluster,
hmp_slow_cpu_mask is made global in arm/kernel/topology.c for now.

* The watchdog_enable() function calls sched_setscheduler() before
kthread_bind() for the cpu specific watchdog kernel threads. The order of
these two calls has to be changed to make this patch work.

Signed-off-by: Dietmar Eggemann <dietmar.eggemann@arm.com>
10 years agosched: Restrict nohz balance kicks to stay in the HMP domain
Chris Redpath [Mon, 17 Jun 2013 15:20:37 +0000 (16:20 +0100)]
sched: Restrict nohz balance kicks to stay in the HMP domain

There is little point in doing a nohz balance kick on a CPU from a
different HMP domain, since the unset SD_LOAD_BALANCE flag on the CPU
domain level prevents tasks from being balanced across clusters
except through the per-task load driven hmp_migrate/hmp_offload paths.

Further, the nohz balance kick is actively harmful to power usage if
all the tasks fit into the little domain since it causes the big
domain to wake up and do a lot of calculation to determine that
there is nothing to do.

A more generic solution is to walk the sched domain tree and determine
the intersection of potential idle balance cpus with visibility of
tasks on the current CPU, however HMP domains are more easily
accessible.

Signed-off-by: Chris Redpath <chris.redpath@arm.com>
10 years agoHMP: Force new non-kernel tasks onto big CPUs until load stabilises
Chris Redpath [Mon, 17 Jun 2013 15:08:40 +0000 (16:08 +0100)]
HMP: Force new non-kernel tasks onto big CPUs until load stabilises

Initialise the load stats for new tasks so that they do not
see the instability in early task life which makes it so hard to
decide which CPU is appropriate.

Also, change the fork balance algorithm so that the least loaded of
the CPUs in the big cluster is chosen regardless of the bigness of
the parent task.

This is intended to help performance for applications which use
many short-lived tasks. Although best practise is usually to use
a thread pool, apps which do not do this should not be subject to
the randomness of the early stats.

We should ignore real-time threads for forking on big CPUs, but
it is not possible to figure out if a new thread is real-time or
not at the fork stage. Instead, we prevent kernel threads from
getting the initial boost - when they later become real-time they
will only be on big if their compute requirements demand it.

Signed-off-by: Dietmar Eggemann <dietmar.eggemann@arm.com>
Signed-off-by: Chris Redpath <chris.redpath@arm.com>
10 years agoHMP: Avoid multiple calls to hmp_domain_min_load in fast path
Chris Redpath [Thu, 9 May 2013 15:21:29 +0000 (16:21 +0100)]
HMP: Avoid multiple calls to hmp_domain_min_load in fast path

When evaluating a migration we make two calls to hmp_domain_min_load.
This is unnecessary if we pass on the target CPU information from the
hmp_up_migration path.

In hmp_down_migration, we don't consider the load of the target CPUS.

Signed-off-by: Chris Redpath <chris.redpath@arm.com>