* [PATCH 0/2 resend] show isolated & nohz_full cpus in sysfs
@ 2015-04-24 19:24 riel
2015-04-24 19:24 ` [PATCH 1/2] show isolated " riel
` (2 more replies)
0 siblings, 3 replies; 10+ messages in thread
From: riel @ 2015-04-24 19:24 UTC (permalink / raw)
To: linux-kernel; +Cc: tj, umgwanakikbuti, lizefan, fweisbec, gregkh
Currently there is no good way to get the isolated and nohz_full
CPUs at runtime, because the kernel may have changed the CPUs
specified on the commandline (when specifying all CPUs as
isolated, or CPUs that do not exist, ...)
This series adds two files to /sys/devices/system/cpu, which can
be used by system management tools like libvirt, openstack, etc.
to ensure proper task placement.
These patches were kind of (but not formally) acked by
Mike and Frederic, see https://lkml.org/lkml/2015/3/27/852
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 1/2] show isolated cpus in sysfs
2015-04-24 19:24 [PATCH 0/2 resend] show isolated & nohz_full cpus in sysfs riel
@ 2015-04-24 19:24 ` riel
2015-04-24 21:11 ` Frederic Weisbecker
2015-04-24 19:24 ` [PATCH 2/2] show nohz_full " riel
2015-04-25 5:29 ` [PATCH 0/2 resend] show isolated & " Mike Galbraith
2 siblings, 1 reply; 10+ messages in thread
From: riel @ 2015-04-24 19:24 UTC (permalink / raw)
To: linux-kernel; +Cc: tj, umgwanakikbuti, lizefan, fweisbec, gregkh
From: Rik van Riel <riel@redhat.com>
After system bootup, there is no totally reliable way to see
which CPUs are isolated, because the kernel may modify the
CPUs specified on the isolcpus= kernel command line option.
Export the CPU list that actually got isolated in sysfs,
specifically in the file /sys/devices/system/cpu/isolated
This can be used by system management tools like libvirt,
openstack, and others to ensure proper placement of tasks.
Suggested-by: Li Zefan <lizefan@huawei.com>
Signed-off-by: Rik van Riel <riel@redhat.com>
---
drivers/base/cpu.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c
index f160ea44a86d..ea23ee7b545b 100644
--- a/drivers/base/cpu.c
+++ b/drivers/base/cpu.c
@@ -265,6 +265,17 @@ static ssize_t print_cpus_offline(struct device *dev,
}
static DEVICE_ATTR(offline, 0444, print_cpus_offline, NULL);
+static ssize_t print_cpus_isolated(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ int n = 0, len = PAGE_SIZE-2;
+
+ n = scnprintf(buf, len, "%*pbl\n", cpumask_pr_args(cpu_isolated_map));
+
+ return n;
+}
+static DEVICE_ATTR(isolated, 0444, print_cpus_isolated, NULL);
+
static void cpu_device_release(struct device *dev)
{
/*
@@ -431,6 +442,7 @@ static struct attribute *cpu_root_attrs[] = {
&cpu_attrs[2].attr.attr,
&dev_attr_kernel_max.attr,
&dev_attr_offline.attr,
+ &dev_attr_isolated.attr,
#ifdef CONFIG_GENERIC_CPU_AUTOPROBE
&dev_attr_modalias.attr,
#endif
--
2.1.0
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 2/2] show nohz_full cpus in sysfs
2015-04-24 19:24 [PATCH 0/2 resend] show isolated & nohz_full cpus in sysfs riel
2015-04-24 19:24 ` [PATCH 1/2] show isolated " riel
@ 2015-04-24 19:24 ` riel
2015-04-28 19:18 ` Chris Metcalf
2015-04-25 5:29 ` [PATCH 0/2 resend] show isolated & " Mike Galbraith
2 siblings, 1 reply; 10+ messages in thread
From: riel @ 2015-04-24 19:24 UTC (permalink / raw)
To: linux-kernel; +Cc: tj, umgwanakikbuti, lizefan, fweisbec, gregkh
From: Rik van Riel <riel@redhat.com>
Currently there is no way to query which CPUs are in nohz_full
mode from userspace.
Export the CPU list running in nohz_full mode in sysfs,
specifically in the file /sys/devices/system/cpu/nohz_full
This can be used by system management tools like libvirt,
openstack, and others to ensure proper task placement.
Signed-off-by: Rik van Riel <riel@redhat.com>
---
drivers/base/cpu.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c
index ea23ee7b545b..78720e706176 100644
--- a/drivers/base/cpu.c
+++ b/drivers/base/cpu.c
@@ -16,6 +16,7 @@
#include <linux/acpi.h>
#include <linux/of.h>
#include <linux/cpufeature.h>
+#include <linux/tick.h>
#include "base.h"
@@ -276,6 +277,19 @@ static ssize_t print_cpus_isolated(struct device *dev,
}
static DEVICE_ATTR(isolated, 0444, print_cpus_isolated, NULL);
+#ifdef CONFIG_NO_HZ_FULL
+static ssize_t print_cpus_nohz_full(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ int n = 0, len = PAGE_SIZE-2;
+
+ n = scnprintf(buf, len, "%*pbl\n", cpumask_pr_args(tick_nohz_full_mask));
+
+ return n;
+}
+static DEVICE_ATTR(nohz_full, 0444, print_cpus_nohz_full, NULL);
+#endif
+
static void cpu_device_release(struct device *dev)
{
/*
@@ -443,6 +457,9 @@ static struct attribute *cpu_root_attrs[] = {
&dev_attr_kernel_max.attr,
&dev_attr_offline.attr,
&dev_attr_isolated.attr,
+#ifdef CONFIG_NO_HZ_FULL
+ &dev_attr_nohz_full.attr,
+#endif
#ifdef CONFIG_GENERIC_CPU_AUTOPROBE
&dev_attr_modalias.attr,
#endif
--
2.1.0
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH 1/2] show isolated cpus in sysfs
2015-04-24 19:24 ` [PATCH 1/2] show isolated " riel
@ 2015-04-24 21:11 ` Frederic Weisbecker
2015-04-24 21:16 ` Tejun Heo
2015-04-24 21:22 ` Rik van Riel
0 siblings, 2 replies; 10+ messages in thread
From: Frederic Weisbecker @ 2015-04-24 21:11 UTC (permalink / raw)
To: riel, Peter Zijlstra; +Cc: linux-kernel, tj, umgwanakikbuti, lizefan, gregkh
On Fri, Apr 24, 2015 at 03:24:27PM -0400, riel@redhat.com wrote:
> From: Rik van Riel <riel@redhat.com>
>
> After system bootup, there is no totally reliable way to see
> which CPUs are isolated, because the kernel may modify the
> CPUs specified on the isolcpus= kernel command line option.
>
> Export the CPU list that actually got isolated in sysfs,
> specifically in the file /sys/devices/system/cpu/isolated
>
> This can be used by system management tools like libvirt,
> openstack, and others to ensure proper placement of tasks.
>
> Suggested-by: Li Zefan <lizefan@huawei.com>
> Signed-off-by: Rik van Riel <riel@redhat.com>
This patch should go through Peterz.
> ---
> drivers/base/cpu.c | 12 ++++++++++++
> 1 file changed, 12 insertions(+)
>
> diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c
> index f160ea44a86d..ea23ee7b545b 100644
> --- a/drivers/base/cpu.c
> +++ b/drivers/base/cpu.c
> @@ -265,6 +265,17 @@ static ssize_t print_cpus_offline(struct device *dev,
> }
> static DEVICE_ATTR(offline, 0444, print_cpus_offline, NULL);
>
> +static ssize_t print_cpus_isolated(struct device *dev,
> + struct device_attribute *attr, char *buf)
> +{
> + int n = 0, len = PAGE_SIZE-2;
> +
> + n = scnprintf(buf, len, "%*pbl\n", cpumask_pr_args(cpu_isolated_map));
> +
> + return n;
> +}
> +static DEVICE_ATTR(isolated, 0444, print_cpus_isolated, NULL);
> +
> static void cpu_device_release(struct device *dev)
> {
> /*
> @@ -431,6 +442,7 @@ static struct attribute *cpu_root_attrs[] = {
> &cpu_attrs[2].attr.attr,
> &dev_attr_kernel_max.attr,
> &dev_attr_offline.attr,
> + &dev_attr_isolated.attr,
> #ifdef CONFIG_GENERIC_CPU_AUTOPROBE
> &dev_attr_modalias.attr,
> #endif
> --
> 2.1.0
>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 1/2] show isolated cpus in sysfs
2015-04-24 21:11 ` Frederic Weisbecker
@ 2015-04-24 21:16 ` Tejun Heo
2015-04-24 21:22 ` Rik van Riel
1 sibling, 0 replies; 10+ messages in thread
From: Tejun Heo @ 2015-04-24 21:16 UTC (permalink / raw)
To: Frederic Weisbecker
Cc: riel, Peter Zijlstra, linux-kernel, umgwanakikbuti, lizefan, gregkh
On Fri, Apr 24, 2015 at 11:11:29PM +0200, Frederic Weisbecker wrote:
> > Suggested-by: Li Zefan <lizefan@huawei.com>
> > Signed-off-by: Rik van Riel <riel@redhat.com>
>
> This patch should go through Peterz.
Right, that's why the two patches kinda got lost. Rik, sorry about
that and yes these two should go through Peterz.
Thanks.
--
tejun
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 1/2] show isolated cpus in sysfs
2015-04-24 21:11 ` Frederic Weisbecker
2015-04-24 21:16 ` Tejun Heo
@ 2015-04-24 21:22 ` Rik van Riel
2015-04-24 21:49 ` Greg KH
1 sibling, 1 reply; 10+ messages in thread
From: Rik van Riel @ 2015-04-24 21:22 UTC (permalink / raw)
To: Frederic Weisbecker, Peter Zijlstra
Cc: linux-kernel, tj, umgwanakikbuti, lizefan, gregkh
On 04/24/2015 05:11 PM, Frederic Weisbecker wrote:
> On Fri, Apr 24, 2015 at 03:24:27PM -0400, riel@redhat.com wrote:
>> From: Rik van Riel <riel@redhat.com>
>>
>> After system bootup, there is no totally reliable way to see
>> which CPUs are isolated, because the kernel may modify the
>> CPUs specified on the isolcpus= kernel command line option.
>>
>> Export the CPU list that actually got isolated in sysfs,
>> specifically in the file /sys/devices/system/cpu/isolated
>>
>> This can be used by system management tools like libvirt,
>> openstack, and others to ensure proper placement of tasks.
>>
>> Suggested-by: Li Zefan <lizefan@huawei.com>
>> Signed-off-by: Rik van Riel <riel@redhat.com>
>
> This patch should go through Peterz.
Oh, fun. That's what I get for getting the get_maintainer.pl
script, which told me to go through Greg KH instead :)
$ ./scripts/get_maintainer.pl -f drivers/base/cpu.c
Greg Kroah-Hartman <gregkh@linuxfoundation.org> (supporter:DRIVER CORE,
KOBJ...)
linux-kernel@vger.kernel.org (open list)
--
All rights reversed
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 1/2] show isolated cpus in sysfs
2015-04-24 21:22 ` Rik van Riel
@ 2015-04-24 21:49 ` Greg KH
2015-05-04 21:15 ` Rik van Riel
0 siblings, 1 reply; 10+ messages in thread
From: Greg KH @ 2015-04-24 21:49 UTC (permalink / raw)
To: Rik van Riel
Cc: Frederic Weisbecker, Peter Zijlstra, linux-kernel, tj,
umgwanakikbuti, lizefan
On Fri, Apr 24, 2015 at 05:22:12PM -0400, Rik van Riel wrote:
> On 04/24/2015 05:11 PM, Frederic Weisbecker wrote:
> > On Fri, Apr 24, 2015 at 03:24:27PM -0400, riel@redhat.com wrote:
> >> From: Rik van Riel <riel@redhat.com>
> >>
> >> After system bootup, there is no totally reliable way to see
> >> which CPUs are isolated, because the kernel may modify the
> >> CPUs specified on the isolcpus= kernel command line option.
> >>
> >> Export the CPU list that actually got isolated in sysfs,
> >> specifically in the file /sys/devices/system/cpu/isolated
> >>
> >> This can be used by system management tools like libvirt,
> >> openstack, and others to ensure proper placement of tasks.
> >>
> >> Suggested-by: Li Zefan <lizefan@huawei.com>
> >> Signed-off-by: Rik van Riel <riel@redhat.com>
> >
> > This patch should go through Peterz.
>
> Oh, fun. That's what I get for getting the get_maintainer.pl
> script, which told me to go through Greg KH instead :)
>
> $ ./scripts/get_maintainer.pl -f drivers/base/cpu.c
> Greg Kroah-Hartman <gregkh@linuxfoundation.org> (supporter:DRIVER CORE,
> KOBJ...)
> linux-kernel@vger.kernel.org (open list)
That's right, I can take this, I missed this the last time Rik sent
these, that's my fault.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 0/2 resend] show isolated & nohz_full cpus in sysfs
2015-04-24 19:24 [PATCH 0/2 resend] show isolated & nohz_full cpus in sysfs riel
2015-04-24 19:24 ` [PATCH 1/2] show isolated " riel
2015-04-24 19:24 ` [PATCH 2/2] show nohz_full " riel
@ 2015-04-25 5:29 ` Mike Galbraith
2 siblings, 0 replies; 10+ messages in thread
From: Mike Galbraith @ 2015-04-25 5:29 UTC (permalink / raw)
To: riel; +Cc: linux-kernel, tj, lizefan, fweisbec, gregkh
On Fri, 2015-04-24 at 15:24 -0400, riel@redhat.com wrote:
> Currently there is no good way to get the isolated and nohz_full
> CPUs at runtime, because the kernel may have changed the CPUs
> specified on the commandline (when specifying all CPUs as
> isolated, or CPUs that do not exist, ...)
>
> This series adds two files to /sys/devices/system/cpu, which can
> be used by system management tools like libvirt, openstack, etc.
> to ensure proper task placement.
>
> These patches were kind of (but not formally) acked by
> Mike and Frederic, see https://lkml.org/lkml/2015/3/27/852
Acked-by: Mike Galbraith <umgwanakikbuti@gmail.com>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 2/2] show nohz_full cpus in sysfs
2015-04-24 19:24 ` [PATCH 2/2] show nohz_full " riel
@ 2015-04-28 19:18 ` Chris Metcalf
0 siblings, 0 replies; 10+ messages in thread
From: Chris Metcalf @ 2015-04-28 19:18 UTC (permalink / raw)
To: riel, linux-kernel; +Cc: tj, umgwanakikbuti, lizefan, fweisbec, gregkh
On 04/24/2015 03:24 PM, riel@redhat.com wrote:
> From: Rik van Riel<riel@redhat.com>
>
> Currently there is no way to query which CPUs are in nohz_full
> mode from userspace.
>
> Export the CPU list running in nohz_full mode in sysfs,
> specifically in the file /sys/devices/system/cpu/nohz_full
>
> This can be used by system management tools like libvirt,
> openstack, and others to ensure proper task placement.
>
> Signed-off-by: Rik van Riel<riel@redhat.com>
> ---
> drivers/base/cpu.c | 17 +++++++++++++++++
> 1 file changed, 17 insertions(+)
In the arch/tile distribution with our "dataplane" support, we have
traditionally had a /sys/devices/system/cpu/dataplane file with
the same semantics you are proposing. It's definitely helpful
to userspace applications figuring out how to appropriately take
over the machine they are being run on.
Acked-by: Chris Metcalf <cmetcalf@ezchip.com>
--
Chris Metcalf, EZChip Semiconductor
http://www.ezchip.com
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 1/2] show isolated cpus in sysfs
2015-04-24 21:49 ` Greg KH
@ 2015-05-04 21:15 ` Rik van Riel
0 siblings, 0 replies; 10+ messages in thread
From: Rik van Riel @ 2015-05-04 21:15 UTC (permalink / raw)
To: Greg KH
Cc: Frederic Weisbecker, Peter Zijlstra, linux-kernel, tj,
umgwanakikbuti, lizefan
On 04/24/2015 05:49 PM, Greg KH wrote:
> On Fri, Apr 24, 2015 at 05:22:12PM -0400, Rik van Riel wrote:
>> On 04/24/2015 05:11 PM, Frederic Weisbecker wrote:
>>> On Fri, Apr 24, 2015 at 03:24:27PM -0400, riel@redhat.com wrote:
>>>> From: Rik van Riel <riel@redhat.com>
>>>>
>>>> After system bootup, there is no totally reliable way to see
>>>> which CPUs are isolated, because the kernel may modify the
>>>> CPUs specified on the isolcpus= kernel command line option.
>>>>
>>>> Export the CPU list that actually got isolated in sysfs,
>>>> specifically in the file /sys/devices/system/cpu/isolated
>>>>
>>>> This can be used by system management tools like libvirt,
>>>> openstack, and others to ensure proper placement of tasks.
>>>>
>>>> Suggested-by: Li Zefan <lizefan@huawei.com>
>>>> Signed-off-by: Rik van Riel <riel@redhat.com>
>>>
>>> This patch should go through Peterz.
>>
>> Oh, fun. That's what I get for getting the get_maintainer.pl
>> script, which told me to go through Greg KH instead :)
>>
>> $ ./scripts/get_maintainer.pl -f drivers/base/cpu.c
>> Greg Kroah-Hartman <gregkh@linuxfoundation.org> (supporter:DRIVER CORE,
>> KOBJ...)
>> linux-kernel@vger.kernel.org (open list)
>
> That's right, I can take this, I missed this the last time Rik sent
> these, that's my fault.
Ping?
Let me harass you before we both forget and this
thing falls through the cracks again :)
--
All rights reversed
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2015-05-04 21:16 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-24 19:24 [PATCH 0/2 resend] show isolated & nohz_full cpus in sysfs riel
2015-04-24 19:24 ` [PATCH 1/2] show isolated " riel
2015-04-24 21:11 ` Frederic Weisbecker
2015-04-24 21:16 ` Tejun Heo
2015-04-24 21:22 ` Rik van Riel
2015-04-24 21:49 ` Greg KH
2015-05-04 21:15 ` Rik van Riel
2015-04-24 19:24 ` [PATCH 2/2] show nohz_full " riel
2015-04-28 19:18 ` Chris Metcalf
2015-04-25 5:29 ` [PATCH 0/2 resend] show isolated & " Mike Galbraith
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.