linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH 0/4] ARM: remove big.LITTLE switcher support
@ 2016-06-27 11:26 Bartlomiej Zolnierkiewicz
  2016-06-27 11:26 ` [RFC PATCH 1/4] " Bartlomiej Zolnierkiewicz
                   ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2016-06-27 11:26 UTC (permalink / raw)
  To: Nicolas Pitre, Lorenzo Pieralisi, Russell King, Viresh Kumar,
	Sudeep Holla
  Cc: Dave Martin, Sudeep KarkadaNagesha, Rafael J. Wysocki,
	Thomas Gleixner, Jason Cooper, Marc Zyngier, Krzysztof Kozlowski,
	linux-arm-kernel, linux-pm, linux-kernel, b.zolnierkie

Hi,

It seems that in mainline kernel big.LITTLE switcher support
may be usable only on ARM Versatile Express TC2 platform
(but even this platform doesn't enable it in its defconfig).

The following patchset removes big.LITTLE switcher support
(from both ARM core and arm_big_little CPUfreq driver) in
favor of using HMP.

Since HMP support at scheduler level is not yet merged this
patchset is probably premature and thus is marked as RFC.

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics


Bartlomiej Zolnierkiewicz (4):
  ARM: remove big.LITTLE switcher support
  cpufreq: arm_big_little: remove big.LITTLE switcher support
  cpufreq: exynos: remove big.LITTLE switcher dependency
  irqchip/gic: remove big.LITTLE switcher support

 arch/arm/Kconfig                       |  19 +-
 arch/arm/common/Makefile               |   2 -
 arch/arm/common/bL_switcher.c          | 802 ---------------------------------
 arch/arm/common/bL_switcher_dummy_if.c |  71 ---
 arch/arm/include/asm/bL_switcher.h     |  77 ----
 drivers/cpufreq/arm_big_little.c       | 379 +---------------
 drivers/cpufreq/cpufreq-dt-platdev.c   |   2 -
 drivers/irqchip/irq-gic.c              | 137 ------
 8 files changed, 25 insertions(+), 1464 deletions(-)
 delete mode 100644 arch/arm/common/bL_switcher.c
 delete mode 100644 arch/arm/common/bL_switcher_dummy_if.c
 delete mode 100644 arch/arm/include/asm/bL_switcher.h

-- 
1.9.1

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [RFC PATCH 1/4] ARM: remove big.LITTLE switcher support
  2016-06-27 11:26 [RFC PATCH 0/4] ARM: remove big.LITTLE switcher support Bartlomiej Zolnierkiewicz
@ 2016-06-27 11:26 ` Bartlomiej Zolnierkiewicz
  2016-06-27 11:26 ` [RFC PATCH 2/4] cpufreq: arm_big_little: " Bartlomiej Zolnierkiewicz
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2016-06-27 11:26 UTC (permalink / raw)
  To: Nicolas Pitre, Lorenzo Pieralisi, Russell King, Viresh Kumar,
	Sudeep Holla
  Cc: Dave Martin, Sudeep KarkadaNagesha, Rafael J. Wysocki,
	Thomas Gleixner, Jason Cooper, Marc Zyngier, Krzysztof Kozlowski,
	linux-arm-kernel, linux-pm, linux-kernel, b.zolnierkie

It seems that in mainline kernel big.LITTLE switcher support
may be usable only on ARM Versatile Express TC2 platform
(but even this platform doesn't enable it in its defconfig).

Remove big.LITTLE switcher support in favor of using HMP.

Cc: Nicolas Pitre <nico@linaro.org>
Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Cc: Dave Martin <dave.martin@linaro.org>
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
---
 arch/arm/Kconfig                       |  19 +-
 arch/arm/common/Makefile               |   2 -
 arch/arm/common/bL_switcher.c          | 802 ---------------------------------
 arch/arm/common/bL_switcher_dummy_if.c |  71 ---
 arch/arm/include/asm/bL_switcher.h     |  77 ----
 5 files changed, 1 insertion(+), 970 deletions(-)
 delete mode 100644 arch/arm/common/bL_switcher.c
 delete mode 100644 arch/arm/common/bL_switcher_dummy_if.c
 delete mode 100644 arch/arm/include/asm/bL_switcher.h

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 397e7f5..8c0f70d6 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -1361,23 +1361,6 @@ config BIG_LITTLE
 	  This option enables support selections for the big.LITTLE
 	  system architecture.
 
-config BL_SWITCHER
-	bool "big.LITTLE switcher support"
-	depends on BIG_LITTLE && MCPM && HOTPLUG_CPU && ARM_GIC
-	select CPU_PM
-	help
-	  The big.LITTLE "switcher" provides the core functionality to
-	  transparently handle transition between a cluster of A15's
-	  and a cluster of A7's in a big.LITTLE system.
-
-config BL_SWITCHER_DUMMY_IF
-	tristate "Simple big.LITTLE switcher user interface"
-	depends on BL_SWITCHER && DEBUG_KERNEL
-	help
-	  This is a simple and dummy char dev interface to control
-	  the big.LITTLE switcher core code.  It is meant for
-	  debugging purposes only.
-
 choice
 	prompt "Memory split"
 	depends on MMU
@@ -2137,7 +2120,7 @@ config ARCH_SUSPEND_POSSIBLE
 	def_bool y
 
 config ARM_CPU_SUSPEND
-	def_bool PM_SLEEP || BL_SWITCHER || ARM_PSCI_FW
+	def_bool PM_SLEEP || ARM_PSCI_FW
 	depends on ARCH_SUSPEND_POSSIBLE
 
 config ARCH_HIBERNATION_POSSIBLE
diff --git a/arch/arm/common/Makefile b/arch/arm/common/Makefile
index 27f23b1..b464a9b 100644
--- a/arch/arm/common/Makefile
+++ b/arch/arm/common/Makefile
@@ -15,5 +15,3 @@ obj-$(CONFIG_MCPM)		+= mcpm_head.o mcpm_entry.o mcpm_platsmp.o vlock.o
 CFLAGS_REMOVE_mcpm_entry.o	= -pg
 AFLAGS_mcpm_head.o		:= -march=armv7-a
 AFLAGS_vlock.o			:= -march=armv7-a
-obj-$(CONFIG_BL_SWITCHER)	+= bL_switcher.o
-obj-$(CONFIG_BL_SWITCHER_DUMMY_IF) += bL_switcher_dummy_if.o
diff --git a/arch/arm/common/bL_switcher.c b/arch/arm/common/bL_switcher.c
deleted file mode 100644
index 37dc0fe..0000000
--- a/arch/arm/common/bL_switcher.c
+++ /dev/null
@@ -1,802 +0,0 @@
-/*
- * arch/arm/common/bL_switcher.c -- big.LITTLE cluster switcher core driver
- *
- * Created by:	Nicolas Pitre, March 2012
- * Copyright:	(C) 2012-2013  Linaro Limited
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-
-#include <linux/atomic.h>
-#include <linux/init.h>
-#include <linux/kernel.h>
-#include <linux/module.h>
-#include <linux/sched.h>
-#include <linux/interrupt.h>
-#include <linux/cpu_pm.h>
-#include <linux/cpu.h>
-#include <linux/cpumask.h>
-#include <linux/kthread.h>
-#include <linux/wait.h>
-#include <linux/time.h>
-#include <linux/clockchips.h>
-#include <linux/hrtimer.h>
-#include <linux/tick.h>
-#include <linux/notifier.h>
-#include <linux/mm.h>
-#include <linux/mutex.h>
-#include <linux/smp.h>
-#include <linux/spinlock.h>
-#include <linux/string.h>
-#include <linux/sysfs.h>
-#include <linux/irqchip/arm-gic.h>
-#include <linux/moduleparam.h>
-
-#include <asm/smp_plat.h>
-#include <asm/cputype.h>
-#include <asm/suspend.h>
-#include <asm/mcpm.h>
-#include <asm/bL_switcher.h>
-
-#define CREATE_TRACE_POINTS
-#include <trace/events/power_cpu_migrate.h>
-
-
-/*
- * Use our own MPIDR accessors as the generic ones in asm/cputype.h have
- * __attribute_const__ and we don't want the compiler to assume any
- * constness here as the value _does_ change along some code paths.
- */
-
-static int read_mpidr(void)
-{
-	unsigned int id;
-	asm volatile ("mrc p15, 0, %0, c0, c0, 5" : "=r" (id));
-	return id & MPIDR_HWID_BITMASK;
-}
-
-/*
- * bL switcher core code.
- */
-
-static void bL_do_switch(void *_arg)
-{
-	unsigned ib_mpidr, ib_cpu, ib_cluster;
-	long volatile handshake, **handshake_ptr = _arg;
-
-	pr_debug("%s\n", __func__);
-
-	ib_mpidr = cpu_logical_map(smp_processor_id());
-	ib_cpu = MPIDR_AFFINITY_LEVEL(ib_mpidr, 0);
-	ib_cluster = MPIDR_AFFINITY_LEVEL(ib_mpidr, 1);
-
-	/* Advertise our handshake location */
-	if (handshake_ptr) {
-		handshake = 0;
-		*handshake_ptr = &handshake;
-	} else
-		handshake = -1;
-
-	/*
-	 * Our state has been saved at this point.  Let's release our
-	 * inbound CPU.
-	 */
-	mcpm_set_entry_vector(ib_cpu, ib_cluster, cpu_resume);
-	sev();
-
-	/*
-	 * From this point, we must assume that our counterpart CPU might
-	 * have taken over in its parallel world already, as if execution
-	 * just returned from cpu_suspend().  It is therefore important to
-	 * be very careful not to make any change the other guy is not
-	 * expecting.  This is why we need stack isolation.
-	 *
-	 * Fancy under cover tasks could be performed here.  For now
-	 * we have none.
-	 */
-
-	/*
-	 * Let's wait until our inbound is alive.
-	 */
-	while (!handshake) {
-		wfe();
-		smp_mb();
-	}
-
-	/* Let's put ourself down. */
-	mcpm_cpu_power_down();
-
-	/* should never get here */
-	BUG();
-}
-
-/*
- * Stack isolation.  To ensure 'current' remains valid, we just use another
- * piece of our thread's stack space which should be fairly lightly used.
- * The selected area starts just above the thread_info structure located
- * at the very bottom of the stack, aligned to a cache line, and indexed
- * with the cluster number.
- */
-#define STACK_SIZE 512
-extern void call_with_stack(void (*fn)(void *), void *arg, void *sp);
-static int bL_switchpoint(unsigned long _arg)
-{
-	unsigned int mpidr = read_mpidr();
-	unsigned int clusterid = MPIDR_AFFINITY_LEVEL(mpidr, 1);
-	void *stack = current_thread_info() + 1;
-	stack = PTR_ALIGN(stack, L1_CACHE_BYTES);
-	stack += clusterid * STACK_SIZE + STACK_SIZE;
-	call_with_stack(bL_do_switch, (void *)_arg, stack);
-	BUG();
-}
-
-/*
- * Generic switcher interface
- */
-
-static unsigned int bL_gic_id[MAX_CPUS_PER_CLUSTER][MAX_NR_CLUSTERS];
-static int bL_switcher_cpu_pairing[NR_CPUS];
-
-/*
- * bL_switch_to - Switch to a specific cluster for the current CPU
- * @new_cluster_id: the ID of the cluster to switch to.
- *
- * This function must be called on the CPU to be switched.
- * Returns 0 on success, else a negative status code.
- */
-static int bL_switch_to(unsigned int new_cluster_id)
-{
-	unsigned int mpidr, this_cpu, that_cpu;
-	unsigned int ob_mpidr, ob_cpu, ob_cluster, ib_mpidr, ib_cpu, ib_cluster;
-	struct completion inbound_alive;
-	long volatile *handshake_ptr;
-	int ipi_nr, ret;
-
-	this_cpu = smp_processor_id();
-	ob_mpidr = read_mpidr();
-	ob_cpu = MPIDR_AFFINITY_LEVEL(ob_mpidr, 0);
-	ob_cluster = MPIDR_AFFINITY_LEVEL(ob_mpidr, 1);
-	BUG_ON(cpu_logical_map(this_cpu) != ob_mpidr);
-
-	if (new_cluster_id == ob_cluster)
-		return 0;
-
-	that_cpu = bL_switcher_cpu_pairing[this_cpu];
-	ib_mpidr = cpu_logical_map(that_cpu);
-	ib_cpu = MPIDR_AFFINITY_LEVEL(ib_mpidr, 0);
-	ib_cluster = MPIDR_AFFINITY_LEVEL(ib_mpidr, 1);
-
-	pr_debug("before switch: CPU %d MPIDR %#x -> %#x\n",
-		 this_cpu, ob_mpidr, ib_mpidr);
-
-	this_cpu = smp_processor_id();
-
-	/* Close the gate for our entry vectors */
-	mcpm_set_entry_vector(ob_cpu, ob_cluster, NULL);
-	mcpm_set_entry_vector(ib_cpu, ib_cluster, NULL);
-
-	/* Install our "inbound alive" notifier. */
-	init_completion(&inbound_alive);
-	ipi_nr = register_ipi_completion(&inbound_alive, this_cpu);
-	ipi_nr |= ((1 << 16) << bL_gic_id[ob_cpu][ob_cluster]);
-	mcpm_set_early_poke(ib_cpu, ib_cluster, gic_get_sgir_physaddr(), ipi_nr);
-
-	/*
-	 * Let's wake up the inbound CPU now in case it requires some delay
-	 * to come online, but leave it gated in our entry vector code.
-	 */
-	ret = mcpm_cpu_power_up(ib_cpu, ib_cluster);
-	if (ret) {
-		pr_err("%s: mcpm_cpu_power_up() returned %d\n", __func__, ret);
-		return ret;
-	}
-
-	/*
-	 * Raise a SGI on the inbound CPU to make sure it doesn't stall
-	 * in a possible WFI, such as in bL_power_down().
-	 */
-	gic_send_sgi(bL_gic_id[ib_cpu][ib_cluster], 0);
-
-	/*
-	 * Wait for the inbound to come up.  This allows for other
-	 * tasks to be scheduled in the mean time.
-	 */
-	wait_for_completion(&inbound_alive);
-	mcpm_set_early_poke(ib_cpu, ib_cluster, 0, 0);
-
-	/*
-	 * From this point we are entering the switch critical zone
-	 * and can't take any interrupts anymore.
-	 */
-	local_irq_disable();
-	local_fiq_disable();
-	trace_cpu_migrate_begin(ktime_get_real_ns(), ob_mpidr);
-
-	/* redirect GIC's SGIs to our counterpart */
-	gic_migrate_target(bL_gic_id[ib_cpu][ib_cluster]);
-
-	tick_suspend_local();
-
-	ret = cpu_pm_enter();
-
-	/* we can not tolerate errors at this point */
-	if (ret)
-		panic("%s: cpu_pm_enter() returned %d\n", __func__, ret);
-
-	/* Swap the physical CPUs in the logical map for this logical CPU. */
-	cpu_logical_map(this_cpu) = ib_mpidr;
-	cpu_logical_map(that_cpu) = ob_mpidr;
-
-	/* Let's do the actual CPU switch. */
-	ret = cpu_suspend((unsigned long)&handshake_ptr, bL_switchpoint);
-	if (ret > 0)
-		panic("%s: cpu_suspend() returned %d\n", __func__, ret);
-
-	/* We are executing on the inbound CPU at this point */
-	mpidr = read_mpidr();
-	pr_debug("after switch: CPU %d MPIDR %#x\n", this_cpu, mpidr);
-	BUG_ON(mpidr != ib_mpidr);
-
-	mcpm_cpu_powered_up();
-
-	ret = cpu_pm_exit();
-
-	tick_resume_local();
-
-	trace_cpu_migrate_finish(ktime_get_real_ns(), ib_mpidr);
-	local_fiq_enable();
-	local_irq_enable();
-
-	*handshake_ptr = 1;
-	dsb_sev();
-
-	if (ret)
-		pr_err("%s exiting with error %d\n", __func__, ret);
-	return ret;
-}
-
-struct bL_thread {
-	spinlock_t lock;
-	struct task_struct *task;
-	wait_queue_head_t wq;
-	int wanted_cluster;
-	struct completion started;
-	bL_switch_completion_handler completer;
-	void *completer_cookie;
-};
-
-static struct bL_thread bL_threads[NR_CPUS];
-
-static int bL_switcher_thread(void *arg)
-{
-	struct bL_thread *t = arg;
-	struct sched_param param = { .sched_priority = 1 };
-	int cluster;
-	bL_switch_completion_handler completer;
-	void *completer_cookie;
-
-	sched_setscheduler_nocheck(current, SCHED_FIFO, &param);
-	complete(&t->started);
-
-	do {
-		if (signal_pending(current))
-			flush_signals(current);
-		wait_event_interruptible(t->wq,
-				t->wanted_cluster != -1 ||
-				kthread_should_stop());
-
-		spin_lock(&t->lock);
-		cluster = t->wanted_cluster;
-		completer = t->completer;
-		completer_cookie = t->completer_cookie;
-		t->wanted_cluster = -1;
-		t->completer = NULL;
-		spin_unlock(&t->lock);
-
-		if (cluster != -1) {
-			bL_switch_to(cluster);
-
-			if (completer)
-				completer(completer_cookie);
-		}
-	} while (!kthread_should_stop());
-
-	return 0;
-}
-
-static struct task_struct *bL_switcher_thread_create(int cpu, void *arg)
-{
-	struct task_struct *task;
-
-	task = kthread_create_on_node(bL_switcher_thread, arg,
-				      cpu_to_node(cpu), "kswitcher_%d", cpu);
-	if (!IS_ERR(task)) {
-		kthread_bind(task, cpu);
-		wake_up_process(task);
-	} else
-		pr_err("%s failed for CPU %d\n", __func__, cpu);
-	return task;
-}
-
-/*
- * bL_switch_request_cb - Switch to a specific cluster for the given CPU,
- *      with completion notification via a callback
- *
- * @cpu: the CPU to switch
- * @new_cluster_id: the ID of the cluster to switch to.
- * @completer: switch completion callback.  if non-NULL,
- *	@completer(@completer_cookie) will be called on completion of
- *	the switch, in non-atomic context.
- * @completer_cookie: opaque context argument for @completer.
- *
- * This function causes a cluster switch on the given CPU by waking up
- * the appropriate switcher thread.  This function may or may not return
- * before the switch has occurred.
- *
- * If a @completer callback function is supplied, it will be called when
- * the switch is complete.  This can be used to determine asynchronously
- * when the switch is complete, regardless of when bL_switch_request()
- * returns.  When @completer is supplied, no new switch request is permitted
- * for the affected CPU until after the switch is complete, and @completer
- * has returned.
- */
-int bL_switch_request_cb(unsigned int cpu, unsigned int new_cluster_id,
-			 bL_switch_completion_handler completer,
-			 void *completer_cookie)
-{
-	struct bL_thread *t;
-
-	if (cpu >= ARRAY_SIZE(bL_threads)) {
-		pr_err("%s: cpu %d out of bounds\n", __func__, cpu);
-		return -EINVAL;
-	}
-
-	t = &bL_threads[cpu];
-
-	if (IS_ERR(t->task))
-		return PTR_ERR(t->task);
-	if (!t->task)
-		return -ESRCH;
-
-	spin_lock(&t->lock);
-	if (t->completer) {
-		spin_unlock(&t->lock);
-		return -EBUSY;
-	}
-	t->completer = completer;
-	t->completer_cookie = completer_cookie;
-	t->wanted_cluster = new_cluster_id;
-	spin_unlock(&t->lock);
-	wake_up(&t->wq);
-	return 0;
-}
-EXPORT_SYMBOL_GPL(bL_switch_request_cb);
-
-/*
- * Activation and configuration code.
- */
-
-static DEFINE_MUTEX(bL_switcher_activation_lock);
-static BLOCKING_NOTIFIER_HEAD(bL_activation_notifier);
-static unsigned int bL_switcher_active;
-static unsigned int bL_switcher_cpu_original_cluster[NR_CPUS];
-static cpumask_t bL_switcher_removed_logical_cpus;
-
-int bL_switcher_register_notifier(struct notifier_block *nb)
-{
-	return blocking_notifier_chain_register(&bL_activation_notifier, nb);
-}
-EXPORT_SYMBOL_GPL(bL_switcher_register_notifier);
-
-int bL_switcher_unregister_notifier(struct notifier_block *nb)
-{
-	return blocking_notifier_chain_unregister(&bL_activation_notifier, nb);
-}
-EXPORT_SYMBOL_GPL(bL_switcher_unregister_notifier);
-
-static int bL_activation_notify(unsigned long val)
-{
-	int ret;
-
-	ret = blocking_notifier_call_chain(&bL_activation_notifier, val, NULL);
-	if (ret & NOTIFY_STOP_MASK)
-		pr_err("%s: notifier chain failed with status 0x%x\n",
-			__func__, ret);
-	return notifier_to_errno(ret);
-}
-
-static void bL_switcher_restore_cpus(void)
-{
-	int i;
-
-	for_each_cpu(i, &bL_switcher_removed_logical_cpus) {
-		struct device *cpu_dev = get_cpu_device(i);
-		int ret = device_online(cpu_dev);
-		if (ret)
-			dev_err(cpu_dev, "switcher: unable to restore CPU\n");
-	}
-}
-
-static int bL_switcher_halve_cpus(void)
-{
-	int i, j, cluster_0, gic_id, ret;
-	unsigned int cpu, cluster, mask;
-	cpumask_t available_cpus;
-
-	/* First pass to validate what we have */
-	mask = 0;
-	for_each_online_cpu(i) {
-		cpu = MPIDR_AFFINITY_LEVEL(cpu_logical_map(i), 0);
-		cluster = MPIDR_AFFINITY_LEVEL(cpu_logical_map(i), 1);
-		if (cluster >= 2) {
-			pr_err("%s: only dual cluster systems are supported\n", __func__);
-			return -EINVAL;
-		}
-		if (WARN_ON(cpu >= MAX_CPUS_PER_CLUSTER))
-			return -EINVAL;
-		mask |= (1 << cluster);
-	}
-	if (mask != 3) {
-		pr_err("%s: no CPU pairing possible\n", __func__);
-		return -EINVAL;
-	}
-
-	/*
-	 * Now let's do the pairing.  We match each CPU with another CPU
-	 * from a different cluster.  To get a uniform scheduling behavior
-	 * without fiddling with CPU topology and compute capacity data,
-	 * we'll use logical CPUs initially belonging to the same cluster.
-	 */
-	memset(bL_switcher_cpu_pairing, -1, sizeof(bL_switcher_cpu_pairing));
-	cpumask_copy(&available_cpus, cpu_online_mask);
-	cluster_0 = -1;
-	for_each_cpu(i, &available_cpus) {
-		int match = -1;
-		cluster = MPIDR_AFFINITY_LEVEL(cpu_logical_map(i), 1);
-		if (cluster_0 == -1)
-			cluster_0 = cluster;
-		if (cluster != cluster_0)
-			continue;
-		cpumask_clear_cpu(i, &available_cpus);
-		for_each_cpu(j, &available_cpus) {
-			cluster = MPIDR_AFFINITY_LEVEL(cpu_logical_map(j), 1);
-			/*
-			 * Let's remember the last match to create "odd"
-			 * pairings on purpose in order for other code not
-			 * to assume any relation between physical and
-			 * logical CPU numbers.
-			 */
-			if (cluster != cluster_0)
-				match = j;
-		}
-		if (match != -1) {
-			bL_switcher_cpu_pairing[i] = match;
-			cpumask_clear_cpu(match, &available_cpus);
-			pr_info("CPU%d paired with CPU%d\n", i, match);
-		}
-	}
-
-	/*
-	 * Now we disable the unwanted CPUs i.e. everything that has no
-	 * pairing information (that includes the pairing counterparts).
-	 */
-	cpumask_clear(&bL_switcher_removed_logical_cpus);
-	for_each_online_cpu(i) {
-		cpu = MPIDR_AFFINITY_LEVEL(cpu_logical_map(i), 0);
-		cluster = MPIDR_AFFINITY_LEVEL(cpu_logical_map(i), 1);
-
-		/* Let's take note of the GIC ID for this CPU */
-		gic_id = gic_get_cpu_id(i);
-		if (gic_id < 0) {
-			pr_err("%s: bad GIC ID for CPU %d\n", __func__, i);
-			bL_switcher_restore_cpus();
-			return -EINVAL;
-		}
-		bL_gic_id[cpu][cluster] = gic_id;
-		pr_info("GIC ID for CPU %u cluster %u is %u\n",
-			cpu, cluster, gic_id);
-
-		if (bL_switcher_cpu_pairing[i] != -1) {
-			bL_switcher_cpu_original_cluster[i] = cluster;
-			continue;
-		}
-
-		ret = device_offline(get_cpu_device(i));
-		if (ret) {
-			bL_switcher_restore_cpus();
-			return ret;
-		}
-		cpumask_set_cpu(i, &bL_switcher_removed_logical_cpus);
-	}
-
-	return 0;
-}
-
-/* Determine the logical CPU a given physical CPU is grouped on. */
-int bL_switcher_get_logical_index(u32 mpidr)
-{
-	int cpu;
-
-	if (!bL_switcher_active)
-		return -EUNATCH;
-
-	mpidr &= MPIDR_HWID_BITMASK;
-	for_each_online_cpu(cpu) {
-		int pairing = bL_switcher_cpu_pairing[cpu];
-		if (pairing == -1)
-			continue;
-		if ((mpidr == cpu_logical_map(cpu)) ||
-		    (mpidr == cpu_logical_map(pairing)))
-			return cpu;
-	}
-	return -EINVAL;
-}
-
-static void bL_switcher_trace_trigger_cpu(void *__always_unused info)
-{
-	trace_cpu_migrate_current(ktime_get_real_ns(), read_mpidr());
-}
-
-int bL_switcher_trace_trigger(void)
-{
-	int ret;
-
-	preempt_disable();
-
-	bL_switcher_trace_trigger_cpu(NULL);
-	ret = smp_call_function(bL_switcher_trace_trigger_cpu, NULL, true);
-
-	preempt_enable();
-
-	return ret;
-}
-EXPORT_SYMBOL_GPL(bL_switcher_trace_trigger);
-
-static int bL_switcher_enable(void)
-{
-	int cpu, ret;
-
-	mutex_lock(&bL_switcher_activation_lock);
-	lock_device_hotplug();
-	if (bL_switcher_active) {
-		unlock_device_hotplug();
-		mutex_unlock(&bL_switcher_activation_lock);
-		return 0;
-	}
-
-	pr_info("big.LITTLE switcher initializing\n");
-
-	ret = bL_activation_notify(BL_NOTIFY_PRE_ENABLE);
-	if (ret)
-		goto error;
-
-	ret = bL_switcher_halve_cpus();
-	if (ret)
-		goto error;
-
-	bL_switcher_trace_trigger();
-
-	for_each_online_cpu(cpu) {
-		struct bL_thread *t = &bL_threads[cpu];
-		spin_lock_init(&t->lock);
-		init_waitqueue_head(&t->wq);
-		init_completion(&t->started);
-		t->wanted_cluster = -1;
-		t->task = bL_switcher_thread_create(cpu, t);
-	}
-
-	bL_switcher_active = 1;
-	bL_activation_notify(BL_NOTIFY_POST_ENABLE);
-	pr_info("big.LITTLE switcher initialized\n");
-	goto out;
-
-error:
-	pr_warn("big.LITTLE switcher initialization failed\n");
-	bL_activation_notify(BL_NOTIFY_POST_DISABLE);
-
-out:
-	unlock_device_hotplug();
-	mutex_unlock(&bL_switcher_activation_lock);
-	return ret;
-}
-
-#ifdef CONFIG_SYSFS
-
-static void bL_switcher_disable(void)
-{
-	unsigned int cpu, cluster;
-	struct bL_thread *t;
-	struct task_struct *task;
-
-	mutex_lock(&bL_switcher_activation_lock);
-	lock_device_hotplug();
-
-	if (!bL_switcher_active)
-		goto out;
-
-	if (bL_activation_notify(BL_NOTIFY_PRE_DISABLE) != 0) {
-		bL_activation_notify(BL_NOTIFY_POST_ENABLE);
-		goto out;
-	}
-
-	bL_switcher_active = 0;
-
-	/*
-	 * To deactivate the switcher, we must shut down the switcher
-	 * threads to prevent any other requests from being accepted.
-	 * Then, if the final cluster for given logical CPU is not the
-	 * same as the original one, we'll recreate a switcher thread
-	 * just for the purpose of switching the CPU back without any
-	 * possibility for interference from external requests.
-	 */
-	for_each_online_cpu(cpu) {
-		t = &bL_threads[cpu];
-		task = t->task;
-		t->task = NULL;
-		if (!task || IS_ERR(task))
-			continue;
-		kthread_stop(task);
-		/* no more switch may happen on this CPU at this point */
-		cluster = MPIDR_AFFINITY_LEVEL(cpu_logical_map(cpu), 1);
-		if (cluster == bL_switcher_cpu_original_cluster[cpu])
-			continue;
-		init_completion(&t->started);
-		t->wanted_cluster = bL_switcher_cpu_original_cluster[cpu];
-		task = bL_switcher_thread_create(cpu, t);
-		if (!IS_ERR(task)) {
-			wait_for_completion(&t->started);
-			kthread_stop(task);
-			cluster = MPIDR_AFFINITY_LEVEL(cpu_logical_map(cpu), 1);
-			if (cluster == bL_switcher_cpu_original_cluster[cpu])
-				continue;
-		}
-		/* If execution gets here, we're in trouble. */
-		pr_crit("%s: unable to restore original cluster for CPU %d\n",
-			__func__, cpu);
-		pr_crit("%s: CPU %d can't be restored\n",
-			__func__, bL_switcher_cpu_pairing[cpu]);
-		cpumask_clear_cpu(bL_switcher_cpu_pairing[cpu],
-				  &bL_switcher_removed_logical_cpus);
-	}
-
-	bL_switcher_restore_cpus();
-	bL_switcher_trace_trigger();
-
-	bL_activation_notify(BL_NOTIFY_POST_DISABLE);
-
-out:
-	unlock_device_hotplug();
-	mutex_unlock(&bL_switcher_activation_lock);
-}
-
-static ssize_t bL_switcher_active_show(struct kobject *kobj,
-		struct kobj_attribute *attr, char *buf)
-{
-	return sprintf(buf, "%u\n", bL_switcher_active);
-}
-
-static ssize_t bL_switcher_active_store(struct kobject *kobj,
-		struct kobj_attribute *attr, const char *buf, size_t count)
-{
-	int ret;
-
-	switch (buf[0]) {
-	case '0':
-		bL_switcher_disable();
-		ret = 0;
-		break;
-	case '1':
-		ret = bL_switcher_enable();
-		break;
-	default:
-		ret = -EINVAL;
-	}
-
-	return (ret >= 0) ? count : ret;
-}
-
-static ssize_t bL_switcher_trace_trigger_store(struct kobject *kobj,
-		struct kobj_attribute *attr, const char *buf, size_t count)
-{
-	int ret = bL_switcher_trace_trigger();
-
-	return ret ? ret : count;
-}
-
-static struct kobj_attribute bL_switcher_active_attr =
-	__ATTR(active, 0644, bL_switcher_active_show, bL_switcher_active_store);
-
-static struct kobj_attribute bL_switcher_trace_trigger_attr =
-	__ATTR(trace_trigger, 0200, NULL, bL_switcher_trace_trigger_store);
-
-static struct attribute *bL_switcher_attrs[] = {
-	&bL_switcher_active_attr.attr,
-	&bL_switcher_trace_trigger_attr.attr,
-	NULL,
-};
-
-static struct attribute_group bL_switcher_attr_group = {
-	.attrs = bL_switcher_attrs,
-};
-
-static struct kobject *bL_switcher_kobj;
-
-static int __init bL_switcher_sysfs_init(void)
-{
-	int ret;
-
-	bL_switcher_kobj = kobject_create_and_add("bL_switcher", kernel_kobj);
-	if (!bL_switcher_kobj)
-		return -ENOMEM;
-	ret = sysfs_create_group(bL_switcher_kobj, &bL_switcher_attr_group);
-	if (ret)
-		kobject_put(bL_switcher_kobj);
-	return ret;
-}
-
-#endif  /* CONFIG_SYSFS */
-
-bool bL_switcher_get_enabled(void)
-{
-	mutex_lock(&bL_switcher_activation_lock);
-
-	return bL_switcher_active;
-}
-EXPORT_SYMBOL_GPL(bL_switcher_get_enabled);
-
-void bL_switcher_put_enabled(void)
-{
-	mutex_unlock(&bL_switcher_activation_lock);
-}
-EXPORT_SYMBOL_GPL(bL_switcher_put_enabled);
-
-/*
- * Veto any CPU hotplug operation on those CPUs we've removed
- * while the switcher is active.
- * We're just not ready to deal with that given the trickery involved.
- */
-static int bL_switcher_hotplug_callback(struct notifier_block *nfb,
-					unsigned long action, void *hcpu)
-{
-	if (bL_switcher_active) {
-		int pairing = bL_switcher_cpu_pairing[(unsigned long)hcpu];
-		switch (action & 0xf) {
-		case CPU_UP_PREPARE:
-		case CPU_DOWN_PREPARE:
-			if (pairing == -1)
-				return NOTIFY_BAD;
-		}
-	}
-	return NOTIFY_DONE;
-}
-
-static bool no_bL_switcher;
-core_param(no_bL_switcher, no_bL_switcher, bool, 0644);
-
-static int __init bL_switcher_init(void)
-{
-	int ret;
-
-	if (!mcpm_is_available())
-		return -ENODEV;
-
-	cpu_notifier(bL_switcher_hotplug_callback, 0);
-
-	if (!no_bL_switcher) {
-		ret = bL_switcher_enable();
-		if (ret)
-			return ret;
-	}
-
-#ifdef CONFIG_SYSFS
-	ret = bL_switcher_sysfs_init();
-	if (ret)
-		pr_err("%s: unable to create sysfs entry\n", __func__);
-#endif
-
-	return 0;
-}
-
-late_initcall(bL_switcher_init);
diff --git a/arch/arm/common/bL_switcher_dummy_if.c b/arch/arm/common/bL_switcher_dummy_if.c
deleted file mode 100644
index 3f47f12..0000000
--- a/arch/arm/common/bL_switcher_dummy_if.c
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * arch/arm/common/bL_switcher_dummy_if.c -- b.L switcher dummy interface
- *
- * Created by:	Nicolas Pitre, November 2012
- * Copyright:	(C) 2012-2013  Linaro Limited
- *
- * Dummy interface to user space for debugging purpose only.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-
-#include <linux/init.h>
-#include <linux/module.h>
-#include <linux/fs.h>
-#include <linux/miscdevice.h>
-#include <asm/uaccess.h>
-#include <asm/bL_switcher.h>
-
-static ssize_t bL_switcher_write(struct file *file, const char __user *buf,
-			size_t len, loff_t *pos)
-{
-	unsigned char val[3];
-	unsigned int cpu, cluster;
-	int ret;
-
-	pr_debug("%s\n", __func__);
-
-	if (len < 3)
-		return -EINVAL;
-
-	if (copy_from_user(val, buf, 3))
-		return -EFAULT;
-
-	/* format: <cpu#>,<cluster#> */
-	if (val[0] < '0' || val[0] > '9' ||
-	    val[1] != ',' ||
-	    val[2] < '0' || val[2] > '1')
-		return -EINVAL;
-
-	cpu = val[0] - '0';
-	cluster = val[2] - '0';
-	ret = bL_switch_request(cpu, cluster);
-
-	return ret ? : len;
-}
-
-static const struct file_operations bL_switcher_fops = {
-	.write		= bL_switcher_write,
-	.owner	= THIS_MODULE,
-};
-
-static struct miscdevice bL_switcher_device = {
-	MISC_DYNAMIC_MINOR,
-	"b.L_switcher",
-	&bL_switcher_fops
-};
-
-static int __init bL_switcher_dummy_if_init(void)
-{
-	return misc_register(&bL_switcher_device);
-}
-
-static void __exit bL_switcher_dummy_if_exit(void)
-{
-	misc_deregister(&bL_switcher_device);
-}
-
-module_init(bL_switcher_dummy_if_init);
-module_exit(bL_switcher_dummy_if_exit);
diff --git a/arch/arm/include/asm/bL_switcher.h b/arch/arm/include/asm/bL_switcher.h
deleted file mode 100644
index 1714800..0000000
--- a/arch/arm/include/asm/bL_switcher.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * arch/arm/include/asm/bL_switcher.h
- *
- * Created by:  Nicolas Pitre, April 2012
- * Copyright:   (C) 2012-2013  Linaro Limited
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-
-#ifndef ASM_BL_SWITCHER_H
-#define ASM_BL_SWITCHER_H
-
-#include <linux/compiler.h>
-#include <linux/types.h>
-
-typedef void (*bL_switch_completion_handler)(void *cookie);
-
-int bL_switch_request_cb(unsigned int cpu, unsigned int new_cluster_id,
-			 bL_switch_completion_handler completer,
-			 void *completer_cookie);
-static inline int bL_switch_request(unsigned int cpu, unsigned int new_cluster_id)
-{
-	return bL_switch_request_cb(cpu, new_cluster_id, NULL, NULL);
-}
-
-/*
- * Register here to be notified about runtime enabling/disabling of
- * the switcher.
- *
- * The notifier chain is called with the switcher activation lock held:
- * the switcher will not be enabled or disabled during callbacks.
- * Callbacks must not call bL_switcher_{get,put}_enabled().
- */
-#define BL_NOTIFY_PRE_ENABLE	0
-#define BL_NOTIFY_POST_ENABLE	1
-#define BL_NOTIFY_PRE_DISABLE	2
-#define BL_NOTIFY_POST_DISABLE	3
-
-#ifdef CONFIG_BL_SWITCHER
-
-int bL_switcher_register_notifier(struct notifier_block *nb);
-int bL_switcher_unregister_notifier(struct notifier_block *nb);
-
-/*
- * Use these functions to temporarily prevent enabling/disabling of
- * the switcher.
- * bL_switcher_get_enabled() returns true if the switcher is currently
- * enabled.  Each call to bL_switcher_get_enabled() must be followed
- * by a call to bL_switcher_put_enabled().  These functions are not
- * recursive.
- */
-bool bL_switcher_get_enabled(void);
-void bL_switcher_put_enabled(void);
-
-int bL_switcher_trace_trigger(void);
-int bL_switcher_get_logical_index(u32 mpidr);
-
-#else
-static inline int bL_switcher_register_notifier(struct notifier_block *nb)
-{
-	return 0;
-}
-
-static inline int bL_switcher_unregister_notifier(struct notifier_block *nb)
-{
-	return 0;
-}
-
-static inline bool bL_switcher_get_enabled(void) { return false; }
-static inline void bL_switcher_put_enabled(void) { }
-static inline int bL_switcher_trace_trigger(void) { return 0; }
-static inline int bL_switcher_get_logical_index(u32 mpidr) { return -EUNATCH; }
-#endif /* CONFIG_BL_SWITCHER */
-
-#endif
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [RFC PATCH 2/4] cpufreq: arm_big_little: remove big.LITTLE switcher support
  2016-06-27 11:26 [RFC PATCH 0/4] ARM: remove big.LITTLE switcher support Bartlomiej Zolnierkiewicz
  2016-06-27 11:26 ` [RFC PATCH 1/4] " Bartlomiej Zolnierkiewicz
@ 2016-06-27 11:26 ` Bartlomiej Zolnierkiewicz
  2016-06-27 11:26 ` [RFC PATCH 3/4] cpufreq: exynos: remove big.LITTLE switcher dependency Bartlomiej Zolnierkiewicz
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2016-06-27 11:26 UTC (permalink / raw)
  To: Nicolas Pitre, Lorenzo Pieralisi, Russell King, Viresh Kumar,
	Sudeep Holla
  Cc: Dave Martin, Sudeep KarkadaNagesha, Rafael J. Wysocki,
	Thomas Gleixner, Jason Cooper, Marc Zyngier, Krzysztof Kozlowski,
	linux-arm-kernel, linux-pm, linux-kernel, b.zolnierkie

Remove no longer needed big.LITTLE switcher support from
arm_big_little CPUfreq driver.

The arm_big_little CPUfreq driver itself may also be removed
at later time (after converting platforms using it to use
cpufreq-dt CPUfreq driver instead).

Cc: Sudeep Holla <sudeep.holla@arm.com>
Cc: Sudeep KarkadaNagesha <sudeep.karkadanagesha@arm.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
---
 drivers/cpufreq/arm_big_little.c | 379 +++------------------------------------
 1 file changed, 24 insertions(+), 355 deletions(-)

diff --git a/drivers/cpufreq/arm_big_little.c b/drivers/cpufreq/arm_big_little.c
index 4180422..02bf55b 100644
--- a/drivers/cpufreq/arm_big_little.c
+++ b/drivers/cpufreq/arm_big_little.c
@@ -36,116 +36,37 @@
 #include "arm_big_little.h"
 
 /* Currently we support only two clusters */
-#define A15_CLUSTER	0
-#define A7_CLUSTER	1
 #define MAX_CLUSTERS	2
 
-#ifdef CONFIG_BL_SWITCHER
-#include <asm/bL_switcher.h>
-static bool bL_switching_enabled;
-#define is_bL_switching_enabled()	bL_switching_enabled
-#define set_switching_enabled(x)	(bL_switching_enabled = (x))
-#else
-#define is_bL_switching_enabled()	false
-#define set_switching_enabled(x)	do { } while (0)
-#define bL_switch_request(...)		do { } while (0)
-#define bL_switcher_put_enabled()	do { } while (0)
-#define bL_switcher_get_enabled()	do { } while (0)
-#endif
-
-#define ACTUAL_FREQ(cluster, freq)  ((cluster == A7_CLUSTER) ? freq << 1 : freq)
-#define VIRT_FREQ(cluster, freq)    ((cluster == A7_CLUSTER) ? freq >> 1 : freq)
-
 static struct thermal_cooling_device *cdev[MAX_CLUSTERS];
 static struct cpufreq_arm_bL_ops *arm_bL_ops;
 static struct clk *clk[MAX_CLUSTERS];
-static struct cpufreq_frequency_table *freq_table[MAX_CLUSTERS + 1];
-static atomic_t cluster_usage[MAX_CLUSTERS + 1];
-
-static unsigned int clk_big_min;	/* (Big) clock frequencies */
-static unsigned int clk_little_max;	/* Maximum clock frequency (Little) */
-
-static DEFINE_PER_CPU(unsigned int, physical_cluster);
-static DEFINE_PER_CPU(unsigned int, cpu_last_req_freq);
-
-static struct mutex cluster_lock[MAX_CLUSTERS];
+static struct cpufreq_frequency_table *freq_table[MAX_CLUSTERS];
+static atomic_t cluster_usage[MAX_CLUSTERS];
 
 static inline int raw_cpu_to_cluster(int cpu)
 {
 	return topology_physical_package_id(cpu);
 }
 
-static inline int cpu_to_cluster(int cpu)
-{
-	return is_bL_switching_enabled() ?
-		MAX_CLUSTERS : raw_cpu_to_cluster(cpu);
-}
-
-static unsigned int find_cluster_maxfreq(int cluster)
-{
-	int j;
-	u32 max_freq = 0, cpu_freq;
-
-	for_each_online_cpu(j) {
-		cpu_freq = per_cpu(cpu_last_req_freq, j);
-
-		if ((cluster == per_cpu(physical_cluster, j)) &&
-				(max_freq < cpu_freq))
-			max_freq = cpu_freq;
-	}
-
-	pr_debug("%s: cluster: %d, max freq: %d\n", __func__, cluster,
-			max_freq);
-
-	return max_freq;
-}
-
 static unsigned int clk_get_cpu_rate(unsigned int cpu)
 {
-	u32 cur_cluster = per_cpu(physical_cluster, cpu);
+	u32 cur_cluster = raw_cpu_to_cluster(cpu);
 	u32 rate = clk_get_rate(clk[cur_cluster]) / 1000;
 
-	/* For switcher we use virtual A7 clock rates */
-	if (is_bL_switching_enabled())
-		rate = VIRT_FREQ(cur_cluster, rate);
-
 	pr_debug("%s: cpu: %d, cluster: %d, freq: %u\n", __func__, cpu,
 			cur_cluster, rate);
 
 	return rate;
 }
 
-static unsigned int bL_cpufreq_get_rate(unsigned int cpu)
-{
-	if (is_bL_switching_enabled()) {
-		pr_debug("%s: freq: %d\n", __func__, per_cpu(cpu_last_req_freq,
-					cpu));
-
-		return per_cpu(cpu_last_req_freq, cpu);
-	} else {
-		return clk_get_cpu_rate(cpu);
-	}
-}
-
 static unsigned int
 bL_cpufreq_set_rate(u32 cpu, u32 old_cluster, u32 new_cluster, u32 rate)
 {
-	u32 new_rate, prev_rate;
+	u32 new_rate;
 	int ret;
-	bool bLs = is_bL_switching_enabled();
-
-	mutex_lock(&cluster_lock[new_cluster]);
 
-	if (bLs) {
-		prev_rate = per_cpu(cpu_last_req_freq, cpu);
-		per_cpu(cpu_last_req_freq, cpu) = rate;
-		per_cpu(physical_cluster, cpu) = new_cluster;
-
-		new_rate = find_cluster_maxfreq(new_cluster);
-		new_rate = ACTUAL_FREQ(new_cluster, new_rate);
-	} else {
-		new_rate = rate;
-	}
+	new_rate = rate;
 
 	pr_debug("%s: cpu: %d, old cluster: %d, new cluster: %d, freq: %d\n",
 			__func__, cpu, old_cluster, new_cluster, new_rate);
@@ -167,43 +88,10 @@ bL_cpufreq_set_rate(u32 cpu, u32 old_cluster, u32 new_cluster, u32 rate)
 	if (WARN_ON(ret)) {
 		pr_err("clk_set_rate failed: %d, new cluster: %d\n", ret,
 				new_cluster);
-		if (bLs) {
-			per_cpu(cpu_last_req_freq, cpu) = prev_rate;
-			per_cpu(physical_cluster, cpu) = old_cluster;
-		}
-
-		mutex_unlock(&cluster_lock[new_cluster]);
 
 		return ret;
 	}
 
-	mutex_unlock(&cluster_lock[new_cluster]);
-
-	/* Recalc freq for old cluster when switching clusters */
-	if (old_cluster != new_cluster) {
-		pr_debug("%s: cpu: %d, old cluster: %d, new cluster: %d\n",
-				__func__, cpu, old_cluster, new_cluster);
-
-		/* Switch cluster */
-		bL_switch_request(cpu, new_cluster);
-
-		mutex_lock(&cluster_lock[old_cluster]);
-
-		/* Set freq of old cluster if there are cpus left on it */
-		new_rate = find_cluster_maxfreq(old_cluster);
-		new_rate = ACTUAL_FREQ(old_cluster, new_rate);
-
-		if (new_rate) {
-			pr_debug("%s: Updating rate of old cluster: %d, to freq: %d\n",
-					__func__, old_cluster, new_rate);
-
-			if (clk_set_rate(clk[old_cluster], new_rate * 1000))
-				pr_err("%s: clk_set_rate failed: %d, old cluster: %d\n",
-						__func__, ret, old_cluster);
-		}
-		mutex_unlock(&cluster_lock[old_cluster]);
-	}
-
 	return 0;
 }
 
@@ -211,91 +99,14 @@ bL_cpufreq_set_rate(u32 cpu, u32 old_cluster, u32 new_cluster, u32 rate)
 static int bL_cpufreq_set_target(struct cpufreq_policy *policy,
 		unsigned int index)
 {
-	u32 cpu = policy->cpu, cur_cluster, new_cluster, actual_cluster;
+	u32 cpu = policy->cpu, cur_cluster;
 	unsigned int freqs_new;
 
-	cur_cluster = cpu_to_cluster(cpu);
-	new_cluster = actual_cluster = per_cpu(physical_cluster, cpu);
+	cur_cluster = raw_cpu_to_cluster(cpu);
 
 	freqs_new = freq_table[cur_cluster][index].frequency;
 
-	if (is_bL_switching_enabled()) {
-		if ((actual_cluster == A15_CLUSTER) &&
-				(freqs_new < clk_big_min)) {
-			new_cluster = A7_CLUSTER;
-		} else if ((actual_cluster == A7_CLUSTER) &&
-				(freqs_new > clk_little_max)) {
-			new_cluster = A15_CLUSTER;
-		}
-	}
-
-	return bL_cpufreq_set_rate(cpu, actual_cluster, new_cluster, freqs_new);
-}
-
-static inline u32 get_table_count(struct cpufreq_frequency_table *table)
-{
-	int count;
-
-	for (count = 0; table[count].frequency != CPUFREQ_TABLE_END; count++)
-		;
-
-	return count;
-}
-
-/* get the minimum frequency in the cpufreq_frequency_table */
-static inline u32 get_table_min(struct cpufreq_frequency_table *table)
-{
-	struct cpufreq_frequency_table *pos;
-	uint32_t min_freq = ~0;
-	cpufreq_for_each_entry(pos, table)
-		if (pos->frequency < min_freq)
-			min_freq = pos->frequency;
-	return min_freq;
-}
-
-/* get the maximum frequency in the cpufreq_frequency_table */
-static inline u32 get_table_max(struct cpufreq_frequency_table *table)
-{
-	struct cpufreq_frequency_table *pos;
-	uint32_t max_freq = 0;
-	cpufreq_for_each_entry(pos, table)
-		if (pos->frequency > max_freq)
-			max_freq = pos->frequency;
-	return max_freq;
-}
-
-static int merge_cluster_tables(void)
-{
-	int i, j, k = 0, count = 1;
-	struct cpufreq_frequency_table *table;
-
-	for (i = 0; i < MAX_CLUSTERS; i++)
-		count += get_table_count(freq_table[i]);
-
-	table = kzalloc(sizeof(*table) * count, GFP_KERNEL);
-	if (!table)
-		return -ENOMEM;
-
-	freq_table[MAX_CLUSTERS] = table;
-
-	/* Add in reverse order to get freqs in increasing order */
-	for (i = MAX_CLUSTERS - 1; i >= 0; i--) {
-		for (j = 0; freq_table[i][j].frequency != CPUFREQ_TABLE_END;
-				j++) {
-			table[k].frequency = VIRT_FREQ(i,
-					freq_table[i][j].frequency);
-			pr_debug("%s: index: %d, freq: %d\n", __func__, k,
-					table[k].frequency);
-			k++;
-		}
-	}
-
-	table[k].driver_data = k;
-	table[k].frequency = CPUFREQ_TABLE_END;
-
-	pr_debug("%s: End, table: %p, count: %d\n", __func__, table, k);
-
-	return 0;
+	return bL_cpufreq_set_rate(cpu, cur_cluster, cur_cluster, freqs_new);
 }
 
 static void _put_cluster_clk_and_freq_table(struct device *cpu_dev,
@@ -316,27 +127,12 @@ static void _put_cluster_clk_and_freq_table(struct device *cpu_dev,
 static void put_cluster_clk_and_freq_table(struct device *cpu_dev,
 					   const struct cpumask *cpumask)
 {
-	u32 cluster = cpu_to_cluster(cpu_dev->id);
-	int i;
+	u32 cluster = raw_cpu_to_cluster(cpu_dev->id);
 
 	if (atomic_dec_return(&cluster_usage[cluster]))
 		return;
 
-	if (cluster < MAX_CLUSTERS)
-		return _put_cluster_clk_and_freq_table(cpu_dev, cpumask);
-
-	for_each_present_cpu(i) {
-		struct device *cdev = get_cpu_device(i);
-		if (!cdev) {
-			pr_err("%s: failed to get cpu%d device\n", __func__, i);
-			return;
-		}
-
-		_put_cluster_clk_and_freq_table(cdev, cpumask);
-	}
-
-	/* free virtual table */
-	kfree(freq_table[cluster]);
+	return _put_cluster_clk_and_freq_table(cpu_dev, cpumask);
 }
 
 static int _get_cluster_clk_and_freq_table(struct device *cpu_dev,
@@ -387,68 +183,22 @@ out:
 static int get_cluster_clk_and_freq_table(struct device *cpu_dev,
 					  const struct cpumask *cpumask)
 {
-	u32 cluster = cpu_to_cluster(cpu_dev->id);
-	int i, ret;
+	u32 cluster = raw_cpu_to_cluster(cpu_dev->id);
+	int ret;
 
 	if (atomic_inc_return(&cluster_usage[cluster]) != 1)
 		return 0;
 
-	if (cluster < MAX_CLUSTERS) {
-		ret = _get_cluster_clk_and_freq_table(cpu_dev, cpumask);
-		if (ret)
-			atomic_dec(&cluster_usage[cluster]);
-		return ret;
-	}
-
-	/*
-	 * Get data for all clusters and fill virtual cluster with a merge of
-	 * both
-	 */
-	for_each_present_cpu(i) {
-		struct device *cdev = get_cpu_device(i);
-		if (!cdev) {
-			pr_err("%s: failed to get cpu%d device\n", __func__, i);
-			return -ENODEV;
-		}
-
-		ret = _get_cluster_clk_and_freq_table(cdev, cpumask);
-		if (ret)
-			goto put_clusters;
-	}
-
-	ret = merge_cluster_tables();
+	ret = _get_cluster_clk_and_freq_table(cpu_dev, cpumask);
 	if (ret)
-		goto put_clusters;
-
-	/* Assuming 2 cluster, set clk_big_min and clk_little_max */
-	clk_big_min = get_table_min(freq_table[0]);
-	clk_little_max = VIRT_FREQ(1, get_table_max(freq_table[1]));
-
-	pr_debug("%s: cluster: %d, clk_big_min: %d, clk_little_max: %d\n",
-			__func__, cluster, clk_big_min, clk_little_max);
-
-	return 0;
-
-put_clusters:
-	for_each_present_cpu(i) {
-		struct device *cdev = get_cpu_device(i);
-		if (!cdev) {
-			pr_err("%s: failed to get cpu%d device\n", __func__, i);
-			return -ENODEV;
-		}
-
-		_put_cluster_clk_and_freq_table(cdev, cpumask);
-	}
-
-	atomic_dec(&cluster_usage[cluster]);
-
+		atomic_dec(&cluster_usage[cluster]);
 	return ret;
 }
 
 /* Per-CPU initialization */
 static int bL_cpufreq_init(struct cpufreq_policy *policy)
 {
-	u32 cur_cluster = cpu_to_cluster(policy->cpu);
+	u32 cur_cluster = raw_cpu_to_cluster(policy->cpu);
 	struct device *cpu_dev;
 	int ret;
 
@@ -459,17 +209,7 @@ static int bL_cpufreq_init(struct cpufreq_policy *policy)
 		return -ENODEV;
 	}
 
-	if (cur_cluster < MAX_CLUSTERS) {
-		int cpu;
-
-		cpumask_copy(policy->cpus, topology_core_cpumask(policy->cpu));
-
-		for_each_cpu(cpu, policy->cpus)
-			per_cpu(physical_cluster, cpu) = cur_cluster;
-	} else {
-		/* Assumption: during init, we are always running on A15 */
-		per_cpu(physical_cluster, policy->cpu) = A15_CLUSTER;
-	}
+	cpumask_copy(policy->cpus, topology_core_cpumask(policy->cpu));
 
 	ret = get_cluster_clk_and_freq_table(cpu_dev, policy->cpus);
 	if (ret)
@@ -489,9 +229,6 @@ static int bL_cpufreq_init(struct cpufreq_policy *policy)
 	else
 		policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL;
 
-	if (is_bL_switching_enabled())
-		per_cpu(cpu_last_req_freq, policy->cpu) = clk_get_cpu_rate(policy->cpu);
-
 	dev_info(cpu_dev, "%s: CPU %d initialized\n", __func__, policy->cpu);
 	return 0;
 }
@@ -499,12 +236,10 @@ static int bL_cpufreq_init(struct cpufreq_policy *policy)
 static int bL_cpufreq_exit(struct cpufreq_policy *policy)
 {
 	struct device *cpu_dev;
-	int cur_cluster = cpu_to_cluster(policy->cpu);
+	int cur_cluster = raw_cpu_to_cluster(policy->cpu);
 
-	if (cur_cluster < MAX_CLUSTERS) {
-		cpufreq_cooling_unregister(cdev[cur_cluster]);
-		cdev[cur_cluster] = NULL;
-	}
+	cpufreq_cooling_unregister(cdev[cur_cluster]);
+	cdev[cur_cluster] = NULL;
 
 	cpu_dev = get_cpu_device(policy->cpu);
 	if (!cpu_dev) {
@@ -522,13 +257,9 @@ static int bL_cpufreq_exit(struct cpufreq_policy *policy)
 static void bL_cpufreq_ready(struct cpufreq_policy *policy)
 {
 	struct device *cpu_dev = get_cpu_device(policy->cpu);
-	int cur_cluster = cpu_to_cluster(policy->cpu);
+	int cur_cluster = raw_cpu_to_cluster(policy->cpu);
 	struct device_node *np;
 
-	/* Do not register a cpu_cooling device if we are in IKS mode */
-	if (cur_cluster >= MAX_CLUSTERS)
-		return;
-
 	np = of_node_get(cpu_dev->of_node);
 	if (WARN_ON(!np))
 		return;
@@ -558,63 +289,16 @@ static struct cpufreq_driver bL_cpufreq_driver = {
 					CPUFREQ_NEED_INITIAL_FREQ_CHECK,
 	.verify			= cpufreq_generic_frequency_table_verify,
 	.target_index		= bL_cpufreq_set_target,
-	.get			= bL_cpufreq_get_rate,
+	.get			= clk_get_cpu_rate,
 	.init			= bL_cpufreq_init,
 	.exit			= bL_cpufreq_exit,
 	.ready			= bL_cpufreq_ready,
 	.attr			= cpufreq_generic_attr,
 };
 
-#ifdef CONFIG_BL_SWITCHER
-static int bL_cpufreq_switcher_notifier(struct notifier_block *nfb,
-					unsigned long action, void *_arg)
-{
-	pr_debug("%s: action: %ld\n", __func__, action);
-
-	switch (action) {
-	case BL_NOTIFY_PRE_ENABLE:
-	case BL_NOTIFY_PRE_DISABLE:
-		cpufreq_unregister_driver(&bL_cpufreq_driver);
-		break;
-
-	case BL_NOTIFY_POST_ENABLE:
-		set_switching_enabled(true);
-		cpufreq_register_driver(&bL_cpufreq_driver);
-		break;
-
-	case BL_NOTIFY_POST_DISABLE:
-		set_switching_enabled(false);
-		cpufreq_register_driver(&bL_cpufreq_driver);
-		break;
-
-	default:
-		return NOTIFY_DONE;
-	}
-
-	return NOTIFY_OK;
-}
-
-static struct notifier_block bL_switcher_notifier = {
-	.notifier_call = bL_cpufreq_switcher_notifier,
-};
-
-static int __bLs_register_notifier(void)
-{
-	return bL_switcher_register_notifier(&bL_switcher_notifier);
-}
-
-static int __bLs_unregister_notifier(void)
-{
-	return bL_switcher_unregister_notifier(&bL_switcher_notifier);
-}
-#else
-static int __bLs_register_notifier(void) { return 0; }
-static int __bLs_unregister_notifier(void) { return 0; }
-#endif
-
 int bL_cpufreq_register(struct cpufreq_arm_bL_ops *ops)
 {
-	int ret, i;
+	int ret;
 
 	if (arm_bL_ops) {
 		pr_debug("%s: Already registered: %s, exiting\n", __func__,
@@ -629,28 +313,16 @@ int bL_cpufreq_register(struct cpufreq_arm_bL_ops *ops)
 
 	arm_bL_ops = ops;
 
-	set_switching_enabled(bL_switcher_get_enabled());
-
-	for (i = 0; i < MAX_CLUSTERS; i++)
-		mutex_init(&cluster_lock[i]);
-
 	ret = cpufreq_register_driver(&bL_cpufreq_driver);
 	if (ret) {
 		pr_info("%s: Failed registering platform driver: %s, err: %d\n",
 				__func__, ops->name, ret);
 		arm_bL_ops = NULL;
 	} else {
-		ret = __bLs_register_notifier();
-		if (ret) {
-			cpufreq_unregister_driver(&bL_cpufreq_driver);
-			arm_bL_ops = NULL;
-		} else {
-			pr_info("%s: Registered platform driver: %s\n",
-					__func__, ops->name);
-		}
+		pr_info("%s: Registered platform driver: %s\n",
+				__func__, ops->name);
 	}
 
-	bL_switcher_put_enabled();
 	return ret;
 }
 EXPORT_SYMBOL_GPL(bL_cpufreq_register);
@@ -663,10 +335,7 @@ void bL_cpufreq_unregister(struct cpufreq_arm_bL_ops *ops)
 		return;
 	}
 
-	bL_switcher_get_enabled();
-	__bLs_unregister_notifier();
 	cpufreq_unregister_driver(&bL_cpufreq_driver);
-	bL_switcher_put_enabled();
 	pr_info("%s: Un-registered platform driver: %s\n", __func__,
 			arm_bL_ops->name);
 	arm_bL_ops = NULL;
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [RFC PATCH 3/4] cpufreq: exynos: remove big.LITTLE switcher dependency
  2016-06-27 11:26 [RFC PATCH 0/4] ARM: remove big.LITTLE switcher support Bartlomiej Zolnierkiewicz
  2016-06-27 11:26 ` [RFC PATCH 1/4] " Bartlomiej Zolnierkiewicz
  2016-06-27 11:26 ` [RFC PATCH 2/4] cpufreq: arm_big_little: " Bartlomiej Zolnierkiewicz
@ 2016-06-27 11:26 ` Bartlomiej Zolnierkiewicz
  2016-06-27 11:26 ` [RFC PATCH 4/4] irqchip/gic: remove big.LITTLE switcher support Bartlomiej Zolnierkiewicz
  2016-06-27 19:49 ` [RFC PATCH 0/4] ARM: " Nicolas Pitre
  4 siblings, 0 replies; 8+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2016-06-27 11:26 UTC (permalink / raw)
  To: Nicolas Pitre, Lorenzo Pieralisi, Russell King, Viresh Kumar,
	Sudeep Holla
  Cc: Dave Martin, Sudeep KarkadaNagesha, Rafael J. Wysocki,
	Thomas Gleixner, Jason Cooper, Marc Zyngier, Krzysztof Kozlowski,
	linux-arm-kernel, linux-pm, linux-kernel, b.zolnierkie

Remove no longeer needed workaround for big.LITTLE switcher support.

Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
---
 drivers/cpufreq/cpufreq-dt-platdev.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/cpufreq/cpufreq-dt-platdev.c b/drivers/cpufreq/cpufreq-dt-platdev.c
index 3646b14..88d4090 100644
--- a/drivers/cpufreq/cpufreq-dt-platdev.c
+++ b/drivers/cpufreq/cpufreq-dt-platdev.c
@@ -38,10 +38,8 @@ static const struct of_device_id machines[] __initconst = {
 	{ .compatible = "samsung,exynos4212", },
 	{ .compatible = "samsung,exynos4412", },
 	{ .compatible = "samsung,exynos5250", },
-#ifndef CONFIG_BL_SWITCHER
 	{ .compatible = "samsung,exynos5420", },
 	{ .compatible = "samsung,exynos5800", },
-#endif
 
 	{ .compatible = "renesas,emev2", },
 	{ .compatible = "renesas,r7s72100", },
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [RFC PATCH 4/4] irqchip/gic: remove big.LITTLE switcher support
  2016-06-27 11:26 [RFC PATCH 0/4] ARM: remove big.LITTLE switcher support Bartlomiej Zolnierkiewicz
                   ` (2 preceding siblings ...)
  2016-06-27 11:26 ` [RFC PATCH 3/4] cpufreq: exynos: remove big.LITTLE switcher dependency Bartlomiej Zolnierkiewicz
@ 2016-06-27 11:26 ` Bartlomiej Zolnierkiewicz
  2016-06-27 19:49 ` [RFC PATCH 0/4] ARM: " Nicolas Pitre
  4 siblings, 0 replies; 8+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2016-06-27 11:26 UTC (permalink / raw)
  To: Nicolas Pitre, Lorenzo Pieralisi, Russell King, Viresh Kumar,
	Sudeep Holla
  Cc: Dave Martin, Sudeep KarkadaNagesha, Rafael J. Wysocki,
	Thomas Gleixner, Jason Cooper, Marc Zyngier, Krzysztof Kozlowski,
	linux-arm-kernel, linux-pm, linux-kernel, b.zolnierkie

Remove no longer needed big.LITTLE switcher support.

Cc: Jason Cooper <jason@lakedaemon.net>
Cc: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
---
 drivers/irqchip/irq-gic.c | 137 ----------------------------------------------
 1 file changed, 137 deletions(-)

diff --git a/drivers/irqchip/irq-gic.c b/drivers/irqchip/irq-gic.c
index 1de07eb..9237dd2 100644
--- a/drivers/irqchip/irq-gic.c
+++ b/drivers/irqchip/irq-gic.c
@@ -788,144 +788,7 @@ static void gic_raise_softirq(const struct cpumask *mask, unsigned int irq)
 }
 #endif
 
-#ifdef CONFIG_BL_SWITCHER
-/*
- * gic_send_sgi - send a SGI directly to given CPU interface number
- *
- * cpu_id: the ID for the destination CPU interface
- * irq: the IPI number to send a SGI for
- */
-void gic_send_sgi(unsigned int cpu_id, unsigned int irq)
-{
-	BUG_ON(cpu_id >= NR_GIC_CPU_IF);
-	cpu_id = 1 << cpu_id;
-	/* this always happens on GIC0 */
-	writel_relaxed((cpu_id << 16) | irq, gic_data_dist_base(&gic_data[0]) + GIC_DIST_SOFTINT);
-}
-
-/*
- * gic_get_cpu_id - get the CPU interface ID for the specified CPU
- *
- * @cpu: the logical CPU number to get the GIC ID for.
- *
- * Return the CPU interface ID for the given logical CPU number,
- * or -1 if the CPU number is too large or the interface ID is
- * unknown (more than one bit set).
- */
-int gic_get_cpu_id(unsigned int cpu)
-{
-	unsigned int cpu_bit;
-
-	if (cpu >= NR_GIC_CPU_IF)
-		return -1;
-	cpu_bit = gic_cpu_map[cpu];
-	if (cpu_bit & (cpu_bit - 1))
-		return -1;
-	return __ffs(cpu_bit);
-}
-
-/*
- * gic_migrate_target - migrate IRQs to another CPU interface
- *
- * @new_cpu_id: the CPU target ID to migrate IRQs to
- *
- * Migrate all peripheral interrupts with a target matching the current CPU
- * to the interface corresponding to @new_cpu_id.  The CPU interface mapping
- * is also updated.  Targets to other CPU interfaces are unchanged.
- * This must be called with IRQs locally disabled.
- */
-void gic_migrate_target(unsigned int new_cpu_id)
-{
-	unsigned int cur_cpu_id, gic_irqs, gic_nr = 0;
-	void __iomem *dist_base;
-	int i, ror_val, cpu = smp_processor_id();
-	u32 val, cur_target_mask, active_mask;
-
-	BUG_ON(gic_nr >= CONFIG_ARM_GIC_MAX_NR);
-
-	dist_base = gic_data_dist_base(&gic_data[gic_nr]);
-	if (!dist_base)
-		return;
-	gic_irqs = gic_data[gic_nr].gic_irqs;
-
-	cur_cpu_id = __ffs(gic_cpu_map[cpu]);
-	cur_target_mask = 0x01010101 << cur_cpu_id;
-	ror_val = (cur_cpu_id - new_cpu_id) & 31;
-
-	raw_spin_lock(&irq_controller_lock);
-
-	/* Update the target interface for this logical CPU */
-	gic_cpu_map[cpu] = 1 << new_cpu_id;
-
-	/*
-	 * Find all the peripheral interrupts targetting the current
-	 * CPU interface and migrate them to the new CPU interface.
-	 * We skip DIST_TARGET 0 to 7 as they are read-only.
-	 */
-	for (i = 8; i < DIV_ROUND_UP(gic_irqs, 4); i++) {
-		val = readl_relaxed(dist_base + GIC_DIST_TARGET + i * 4);
-		active_mask = val & cur_target_mask;
-		if (active_mask) {
-			val &= ~active_mask;
-			val |= ror32(active_mask, ror_val);
-			writel_relaxed(val, dist_base + GIC_DIST_TARGET + i*4);
-		}
-	}
-
-	raw_spin_unlock(&irq_controller_lock);
-
-	/*
-	 * Now let's migrate and clear any potential SGIs that might be
-	 * pending for us (cur_cpu_id).  Since GIC_DIST_SGI_PENDING_SET
-	 * is a banked register, we can only forward the SGI using
-	 * GIC_DIST_SOFTINT.  The original SGI source is lost but Linux
-	 * doesn't use that information anyway.
-	 *
-	 * For the same reason we do not adjust SGI source information
-	 * for previously sent SGIs by us to other CPUs either.
-	 */
-	for (i = 0; i < 16; i += 4) {
-		int j;
-		val = readl_relaxed(dist_base + GIC_DIST_SGI_PENDING_SET + i);
-		if (!val)
-			continue;
-		writel_relaxed(val, dist_base + GIC_DIST_SGI_PENDING_CLEAR + i);
-		for (j = i; j < i + 4; j++) {
-			if (val & 0xff)
-				writel_relaxed((1 << (new_cpu_id + 16)) | j,
-						dist_base + GIC_DIST_SOFTINT);
-			val >>= 8;
-		}
-	}
-}
-
-/*
- * gic_get_sgir_physaddr - get the physical address for the SGI register
- *
- * REturn the physical address of the SGI register to be used
- * by some early assembly code when the kernel is not yet available.
- */
-static unsigned long gic_dist_physaddr;
-
-unsigned long gic_get_sgir_physaddr(void)
-{
-	if (!gic_dist_physaddr)
-		return 0;
-	return gic_dist_physaddr + GIC_DIST_SOFTINT;
-}
-
-void __init gic_init_physaddr(struct device_node *node)
-{
-	struct resource res;
-	if (of_address_to_resource(node, 0, &res) == 0) {
-		gic_dist_physaddr = res.start;
-		pr_info("GIC physical location is %#lx\n", gic_dist_physaddr);
-	}
-}
-
-#else
 #define gic_init_physaddr(node)  do { } while (0)
-#endif
 
 static int gic_irq_domain_map(struct irq_domain *d, unsigned int irq,
 				irq_hw_number_t hw)
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [RFC PATCH 0/4] ARM: remove big.LITTLE switcher support
  2016-06-27 11:26 [RFC PATCH 0/4] ARM: remove big.LITTLE switcher support Bartlomiej Zolnierkiewicz
                   ` (3 preceding siblings ...)
  2016-06-27 11:26 ` [RFC PATCH 4/4] irqchip/gic: remove big.LITTLE switcher support Bartlomiej Zolnierkiewicz
@ 2016-06-27 19:49 ` Nicolas Pitre
  2016-06-28  8:18   ` Bartlomiej Zolnierkiewicz
  4 siblings, 1 reply; 8+ messages in thread
From: Nicolas Pitre @ 2016-06-27 19:49 UTC (permalink / raw)
  To: Bartlomiej Zolnierkiewicz
  Cc: Lorenzo Pieralisi, Russell King, Viresh Kumar, Sudeep Holla,
	Dave Martin, Sudeep KarkadaNagesha, Rafael J. Wysocki,
	Thomas Gleixner, Jason Cooper, Marc Zyngier, Krzysztof Kozlowski,
	linux-arm-kernel, linux-pm, linux-kernel

On Mon, 27 Jun 2016, Bartlomiej Zolnierkiewicz wrote:

> Hi,
> 
> It seems that in mainline kernel big.LITTLE switcher support
> may be usable only on ARM Versatile Express TC2 platform
> (but even this platform doesn't enable it in its defconfig).

It is also used on some Samsung targets.

> The following patchset removes big.LITTLE switcher support
> (from both ARM core and arm_big_little CPUfreq driver) in
> favor of using HMP.
> 
> Since HMP support at scheduler level is not yet merged this
> patchset is probably premature and thus is marked as RFC.

It is premature indeed.

And before this is removed, comparison with power/performance benchmark 
numbers will have to be provided as well to justify this removal.  At 
the moment there is nothing else in mainline that can achieve what this 
code does.

We all agree that the scheduler based solution is the best way to do it. 
But this has been a couple years already and this is still work in 
progress.


Nicolas

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [RFC PATCH 0/4] ARM: remove big.LITTLE switcher support
  2016-06-27 19:49 ` [RFC PATCH 0/4] ARM: " Nicolas Pitre
@ 2016-06-28  8:18   ` Bartlomiej Zolnierkiewicz
  2016-06-28 16:13     ` Nicolas Pitre
  0 siblings, 1 reply; 8+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2016-06-28  8:18 UTC (permalink / raw)
  To: Nicolas Pitre
  Cc: Lorenzo Pieralisi, Russell King, Viresh Kumar, Sudeep Holla,
	Dave Martin, Sudeep KarkadaNagesha, Rafael J. Wysocki,
	Thomas Gleixner, Jason Cooper, Marc Zyngier, Krzysztof Kozlowski,
	linux-arm-kernel, linux-pm, linux-kernel


Hi,

On Monday, June 27, 2016 03:49:44 PM Nicolas Pitre wrote:
> On Mon, 27 Jun 2016, Bartlomiej Zolnierkiewicz wrote:
> 
> > Hi,
> > 
> > It seems that in mainline kernel big.LITTLE switcher support
> > may be usable only on ARM Versatile Express TC2 platform
> > (but even this platform doesn't enable it in its defconfig).
> 
> It is also used on some Samsung targets.

Could you please explain this more?  AFAIK mainline never
had working IKS solution (big.LITTLE switcher support +
arm_big_little CPUfreq driver support) on any Samsung SoC.

> > The following patchset removes big.LITTLE switcher support
> > (from both ARM core and arm_big_little CPUfreq driver) in
> > favor of using HMP.
> > 
> > Since HMP support at scheduler level is not yet merged this
> > patchset is probably premature and thus is marked as RFC.
> 
> It is premature indeed.
> 
> And before this is removed, comparison with power/performance benchmark 
> numbers will have to be provided as well to justify this removal.  At 
> the moment there is nothing else in mainline that can achieve what this 
> code does.

I agree given that this code has real users and according
to my research on mainline kernel it seems that the IKS
functionality (bL switcher core code together with
arm_bit_little CPUfreq driver support) is usable only on
TC2 and even this platform doesn't enable it by default.

IOW I would really like to get the confirmation that there
are platforms that are making use of IKS functionality
currently with the mainline  kernel.  Otherwise we should
either consider its removal or enable it on platforms that
are supposed to use it.

> We all agree that the scheduler based solution is the best way to do it. 
> But this has been a couple years already and this is still work in 
> progress.

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [RFC PATCH 0/4] ARM: remove big.LITTLE switcher support
  2016-06-28  8:18   ` Bartlomiej Zolnierkiewicz
@ 2016-06-28 16:13     ` Nicolas Pitre
  0 siblings, 0 replies; 8+ messages in thread
From: Nicolas Pitre @ 2016-06-28 16:13 UTC (permalink / raw)
  To: Bartlomiej Zolnierkiewicz
  Cc: Lorenzo Pieralisi, Russell King, Viresh Kumar, Sudeep Holla,
	Dave Martin, Sudeep KarkadaNagesha, Rafael J. Wysocki,
	Thomas Gleixner, Jason Cooper, Marc Zyngier, Krzysztof Kozlowski,
	linux-arm-kernel, linux-pm, linux-kernel

On Tue, 28 Jun 2016, Bartlomiej Zolnierkiewicz wrote:

> 
> Hi,
> 
> On Monday, June 27, 2016 03:49:44 PM Nicolas Pitre wrote:
> > On Mon, 27 Jun 2016, Bartlomiej Zolnierkiewicz wrote:
> > 
> > > Hi,
> > > 
> > > It seems that in mainline kernel big.LITTLE switcher support
> > > may be usable only on ARM Versatile Express TC2 platform
> > > (but even this platform doesn't enable it in its defconfig).
> > 
> > It is also used on some Samsung targets.
> 
> Could you please explain this more?  AFAIK mainline never
> had working IKS solution (big.LITTLE switcher support +
> arm_big_little CPUfreq driver support) on any Samsung SoC.

You might be right about mainline.  Out-of-tree support for some Samsung 
targets certainly exists though.

> > > The following patchset removes big.LITTLE switcher support
> > > (from both ARM core and arm_big_little CPUfreq driver) in
> > > favor of using HMP.
> > > 
> > > Since HMP support at scheduler level is not yet merged this
> > > patchset is probably premature and thus is marked as RFC.
> > 
> > It is premature indeed.
> > 
> > And before this is removed, comparison with power/performance benchmark 
> > numbers will have to be provided as well to justify this removal.  At 
> > the moment there is nothing else in mainline that can achieve what this 
> > code does.
> 
> I agree given that this code has real users and according
> to my research on mainline kernel it seems that the IKS
> functionality (bL switcher core code together with
> arm_bit_little CPUfreq driver support) is usable only on
> TC2 and even this platform doesn't enable it by default.

It is not enabled by default because it used to be experimental. And 
given that it pairs two A15's with two A7's leaving the third A7 
completely unused, some people didn't consider a good default for 
showing the complete platform capacity.  

But if you want predictable scheduler results right now with mainline on 
a b.L system then IKS is the only available solution. It also provides a 
good reference to do performance/power comparison against any solution 
meant to replace it. Enabling it by default on TC2 might not be such a 
bad idea at this point.  I certainly have it enabled in my local config.


Nicolas

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2016-06-28 16:13 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-27 11:26 [RFC PATCH 0/4] ARM: remove big.LITTLE switcher support Bartlomiej Zolnierkiewicz
2016-06-27 11:26 ` [RFC PATCH 1/4] " Bartlomiej Zolnierkiewicz
2016-06-27 11:26 ` [RFC PATCH 2/4] cpufreq: arm_big_little: " Bartlomiej Zolnierkiewicz
2016-06-27 11:26 ` [RFC PATCH 3/4] cpufreq: exynos: remove big.LITTLE switcher dependency Bartlomiej Zolnierkiewicz
2016-06-27 11:26 ` [RFC PATCH 4/4] irqchip/gic: remove big.LITTLE switcher support Bartlomiej Zolnierkiewicz
2016-06-27 19:49 ` [RFC PATCH 0/4] ARM: " Nicolas Pitre
2016-06-28  8:18   ` Bartlomiej Zolnierkiewicz
2016-06-28 16:13     ` Nicolas Pitre

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).