From: Morten Rasmussen <Morten.Rasmussen@arm.com>
To: Viresh Kumar <viresh.kumar@linaro.org>
Cc: "paulmck@linux.vnet.ibm.com" <paulmck@linux.vnet.ibm.com>,
"pjt@google.com" <pjt@google.com>,
"peterz@infradead.org" <peterz@infradead.org>,
"suresh.b.siddha@intel.com" <suresh.b.siddha@intel.com>,
"linaro-sched-sig@lists.linaro.org"
<linaro-sched-sig@lists.linaro.org>,
"linaro-dev@lists.linaro.org" <linaro-dev@lists.linaro.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Arvind Chauhan <Arvind.Chauhan@arm.com>,
Amit Kucheria <amit.kucheria@linaro.org>,
Robin Randhawa <Robin.Randhawa@arm.com>
Subject: Re: [RFC PATCH 06/10] ARM: sched: Use device-tree to provide fast/slow CPU list for HMP
Date: Wed, 10 Oct 2012 11:17:47 +0100 [thread overview]
Message-ID: <20121010101747.GD3729@e103034-lin> (raw)
In-Reply-To: <CAKohponvN+-rBxeBW6L1UiwzuDLJ+zymzawyoT3PdxMB31vxRw@mail.gmail.com>
On Thu, Oct 04, 2012 at 07:49:32AM +0100, Viresh Kumar wrote:
> On 22 September 2012 00:02, <morten.rasmussen@arm.com> wrote:
> > From: Morten Rasmussen <morten.rasmussen@arm.com>
> >
> > We can't rely on Kconfig options to set the fast and slow CPU lists for
> > HMP scheduling if we want a single kernel binary to support multiple
> > devices with different CPU topology. E.g. TC2 (ARM's Test-Chip-2
> > big.LITTLE system), Fast Models, or even non big.LITTLE devices.
> >
> > This patch adds the function arch_get_fast_and_slow_cpus() to generate
> > the lists at run-time by parsing the CPU nodes in device-tree; it
> > assumes slow cores are A7s and everything else is fast. The function
> > still supports the old Kconfig options as this is useful for testing the
> > HMP scheduler on devices without big.LITTLE.
>
> But this code is handling this case too at the end, with following logic:
>
> > + cpumask_setall(fast);
> > + cpumask_clear(slow);
>
> Am i missing something?
>
The HMP setup can be defined using Kconfig or DT. If both fails, it will
set all cpus to be fast cpus and effectively disable SCHED_HMP. The
Kconfig option is kept to allow testing of alternative HMP setups
without having to change the DT or use DT at all which might be handy
for non-ARM platforms. I hope that answers you question.
> > This patch is reuse of a patch by Jon Medhurst <tixy@linaro.org> with a
> > few bits left out.
>
> Then probably he must be the author of this commit? Also a SOB is required
> from him here.
>
I don't know what the correct procedure is for this sort of partial
patch reuse. Since I didn't know better, I adopted Tixy's own reference
style that he used in one of his patches which is an extension of a
previous patch by me. I will of course fix it to follow normal procedure
if there is one.
> > Signed-off-by: Morten Rasmussen <morten.rasmussen@arm.com>
> > ---
> > arch/arm/Kconfig | 4 ++-
> > arch/arm/kernel/topology.c | 69 ++++++++++++++++++++++++++++++++++++++++++++
> > 2 files changed, 72 insertions(+), 1 deletion(-)
> >
> > diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
> > index cb80846..f1271bc 100644
> > --- a/arch/arm/Kconfig
> > +++ b/arch/arm/Kconfig
> > @@ -1588,13 +1588,15 @@ config HMP_FAST_CPU_MASK
> > string "HMP scheduler fast CPU mask"
> > depends on SCHED_HMP
> > help
> > - Specify the cpuids of the fast CPUs in the system as a list string,
> > + Leave empty to use device tree information.
> > + Specify the cpuids of the fast CPUs in the system as a list string,
> > e.g. cpuid 0+1 should be specified as 0-1.
> >
> > config HMP_SLOW_CPU_MASK
> > string "HMP scheduler slow CPU mask"
> > depends on SCHED_HMP
> > help
> > + Leave empty to use device tree information.
> > Specify the cpuids of the slow CPUs in the system as a list string,
> > e.g. cpuid 0+1 should be specified as 0-1.
> >
> > diff --git a/arch/arm/kernel/topology.c b/arch/arm/kernel/topology.c
> > index 26c12c6..7682e12 100644
> > --- a/arch/arm/kernel/topology.c
> > +++ b/arch/arm/kernel/topology.c
> > @@ -317,6 +317,75 @@ void store_cpu_topology(unsigned int cpuid)
> > cpu_topology[cpuid].socket_id, mpidr);
> > }
> >
> > +
> > +#ifdef CONFIG_SCHED_HMP
> > +
> > +static const char * const little_cores[] = {
> > + "arm,cortex-a7",
> > + NULL,
> > +};
> > +
> > +static bool is_little_cpu(struct device_node *cn)
> > +{
> > + const char * const *lc;
> > + for (lc = little_cores; *lc; lc++)
> > + if (of_device_is_compatible(cn, *lc))
> > + return true;
> > + return false;
> > +}
> > +
> > +void __init arch_get_fast_and_slow_cpus(struct cpumask *fast,
> > + struct cpumask *slow)
> > +{
> > + struct device_node *cn = NULL;
> > + int cpu = 0;
> > +
> > + cpumask_clear(fast);
> > + cpumask_clear(slow);
> > +
> > + /*
> > + * Use the config options if they are given. This helps testing
> > + * HMP scheduling on systems without a big.LITTLE architecture.
> > + */
> > + if (strlen(CONFIG_HMP_FAST_CPU_MASK) && strlen(CONFIG_HMP_SLOW_CPU_MASK)) {
> > + if (cpulist_parse(CONFIG_HMP_FAST_CPU_MASK, fast))
> > + WARN(1, "Failed to parse HMP fast cpu mask!\n");
> > + if (cpulist_parse(CONFIG_HMP_SLOW_CPU_MASK, slow))
> > + WARN(1, "Failed to parse HMP slow cpu mask!\n");
> > + return;
> > + }
> > +
> > + /*
> > + * Else, parse device tree for little cores.
> > + */
> > + while ((cn = of_find_node_by_type(cn, "cpu"))) {
> > +
> > + if (cpu >= num_possible_cpus())
> > + break;
> > +
> > + if (is_little_cpu(cn))
> > + cpumask_set_cpu(cpu, slow);
> > + else
> > + cpumask_set_cpu(cpu, fast);
> > +
> > + cpu++;
> > + }
> > +
> > + if (!cpumask_empty(fast) && !cpumask_empty(slow))
> > + return;
> > +
> > + /*
> > + * We didn't find both big and little cores so let's call all cores
> > + * fast as this will keep the system running, with all cores being
> > + * treated equal.
> > + */
> > + cpumask_setall(fast);
> > + cpumask_clear(slow);
> > +}
> > +
> > +#endif /* CONFIG_SCHED_HMP */
>
> All above calls to of_*() routines have dependency on CONFIG_OF
>
It would be very easy to blame someone else here... :) I will fix it.
Thanks,
Morten
> --
> viresh
>
next prev parent reply other threads:[~2012-10-10 10:17 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-21 18:32 [RFC PATCH 00/10] sched: Task placement for heterogeneous MP systems morten.rasmussen
2012-09-21 18:32 ` [RFC PATCH 01/10] sched: entity load-tracking load_avg_ratio morten.rasmussen
2012-09-21 18:32 ` [RFC PATCH 02/10] sched: Task placement for heterogeneous systems based on task load-tracking morten.rasmussen
2012-10-04 6:02 ` Viresh Kumar
2012-10-04 6:54 ` Amit Kucheria
2012-10-09 15:56 ` Morten Rasmussen
2012-10-09 16:58 ` Viresh Kumar
2012-09-21 18:32 ` [RFC PATCH 03/10] sched: Forced task migration on heterogeneous systems morten.rasmussen
2012-10-04 6:18 ` Viresh Kumar
2012-09-21 18:32 ` [RFC PATCH 04/10] sched: Introduce priority-based task migration filter morten.rasmussen
2012-10-04 4:37 ` Viresh Kumar
2012-10-04 6:27 ` Viresh Kumar
2012-10-09 16:40 ` Morten Rasmussen
2012-10-24 2:32 ` li guang
2012-09-21 18:32 ` [RFC PATCH 05/10] ARM: Add HMP scheduling support for ARM architecture morten.rasmussen
2012-09-21 18:32 ` [RFC PATCH 06/10] ARM: sched: Use device-tree to provide fast/slow CPU list for HMP morten.rasmussen
2012-10-04 6:49 ` Viresh Kumar
2012-10-10 10:17 ` Morten Rasmussen [this message]
2012-10-10 10:33 ` Viresh Kumar
2012-10-10 11:04 ` Morten Rasmussen
2012-10-10 11:29 ` Jon Medhurst (Tixy)
2012-09-21 18:32 ` [RFC PATCH 07/10] ARM: sched: Setup SCHED_HMP domains morten.rasmussen
2012-10-04 6:58 ` Viresh Kumar
2012-10-10 13:29 ` Morten Rasmussen
2012-09-21 18:32 ` [RFC PATCH 08/10] sched: Add ftrace events for entity load-tracking morten.rasmussen
2012-09-21 18:32 ` [RFC PATCH 09/10] sched: Add HMP task migration ftrace event morten.rasmussen
2012-09-21 18:32 ` [RFC PATCH 10/10] sched: SCHED_HMP multi-domain task migration control morten.rasmussen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20121010101747.GD3729@e103034-lin \
--to=morten.rasmussen@arm.com \
--cc=Arvind.Chauhan@arm.com \
--cc=Robin.Randhawa@arm.com \
--cc=amit.kucheria@linaro.org \
--cc=linaro-dev@lists.linaro.org \
--cc=linaro-sched-sig@lists.linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=paulmck@linux.vnet.ibm.com \
--cc=peterz@infradead.org \
--cc=pjt@google.com \
--cc=suresh.b.siddha@intel.com \
--cc=viresh.kumar@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).