All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Metcalf <cmetcalf@mellanox.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Russell King <linux@arm.linux.org.uk>,
	Thomas Gleixner <tglx@linutronix.de>,
	Aaron Tomlin <atomlin@redhat.com>, Ingo Molnar <mingo@redhat.com>,
	Andrew Morton <akpm@osdl.org>,
	Daniel Thompson <daniel.thompson@linaro.org>,
	x86@kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org
Subject: Re: [PATCH v2 4/4] nmi_backtrace: generate one-line reports for idle cpus
Date: Mon, 21 Mar 2016 12:15:12 -0400	[thread overview]
Message-ID: <56F01E10.6030909@mellanox.com> (raw)
In-Reply-To: <20160321154201.GA6344@twins.programming.kicks-ass.net>

On 03/21/2016 11:42 AM, Peter Zijlstra wrote:
> On Wed, Mar 16, 2016 at 01:02:13PM -0400, Chris Metcalf wrote:
>> diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c
>> index 9f7c21c22477..d569ae7fde37 100644
>> --- a/arch/x86/kernel/process.c
>> +++ b/arch/x86/kernel/process.c
>> @@ -298,7 +298,7 @@ void arch_cpu_idle(void)
>>   /*
>>    * We use this if we don't have any better idle routine..
>>    */
>> -void default_idle(void)
>> +void __cpuidle default_idle(void)
>>   {
>>   	trace_cpu_idle_rcuidle(1, smp_processor_id());
>>   	safe_halt();
>> @@ -413,7 +413,7 @@ static int prefer_mwait_c1_over_halt(const struct cpuinfo_x86 *c)
>>    * with interrupts enabled and no flags, which is backwards compatible with the
>>    * original MWAIT implementation.
>>    */
>> -static void mwait_idle(void)
>> +static __cpuidle void mwait_idle(void)
>>   {
>>   	if (!current_set_polling_and_test()) {
>>   		trace_cpu_idle_rcuidle(1, smp_processor_id());
> The most common idle function for x86 is: mwait_idle_with_hints(),
> trouble is, its an inline, so I'm not sure adding __cpuidle to it does
> anything.

No, you're right, it wouldn't help.  I didn't look at the drivers/cpuidle
subsystem at all in my patch, since I'm not that familiar with it,
but it seems like tagging acpi_processor_ffh_cstate_enter(), as the
only user of mwait_idle_with_hints(), will do the job.

I do see that native_play_dead() also uses mwait/monitor, but since
that's hotplug I don't think it's relevant to this patch series.

> I've yet to find the magic objdump incantation to check. Or rather
> objdump -h doesn't appear to list .cpuidle.text at all :/
>
> I'm probably doing something silly...

The easiest way to check for a given function is just to look
at the "nm -n" output and see that all the functions you expect
to reflect idle behavior are in the cpuidle begin/end range.
Or, to look at "objdump -dr" and search for monitor/mwait.

objdump -h certainly works to show .cpuidle.text if you look at
individual objects (e.g. arch/x86/kernel/process.o) but by the time
you're looking at the linked vmlinux image they have all been linked
into the giant .text section.

-- 
Chris Metcalf, Mellanox Technologies
http://www.mellanox.com

WARNING: multiple messages have this Message-ID (diff)
From: cmetcalf@mellanox.com (Chris Metcalf)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 4/4] nmi_backtrace: generate one-line reports for idle cpus
Date: Mon, 21 Mar 2016 12:15:12 -0400	[thread overview]
Message-ID: <56F01E10.6030909@mellanox.com> (raw)
In-Reply-To: <20160321154201.GA6344@twins.programming.kicks-ass.net>

On 03/21/2016 11:42 AM, Peter Zijlstra wrote:
> On Wed, Mar 16, 2016 at 01:02:13PM -0400, Chris Metcalf wrote:
>> diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c
>> index 9f7c21c22477..d569ae7fde37 100644
>> --- a/arch/x86/kernel/process.c
>> +++ b/arch/x86/kernel/process.c
>> @@ -298,7 +298,7 @@ void arch_cpu_idle(void)
>>   /*
>>    * We use this if we don't have any better idle routine..
>>    */
>> -void default_idle(void)
>> +void __cpuidle default_idle(void)
>>   {
>>   	trace_cpu_idle_rcuidle(1, smp_processor_id());
>>   	safe_halt();
>> @@ -413,7 +413,7 @@ static int prefer_mwait_c1_over_halt(const struct cpuinfo_x86 *c)
>>    * with interrupts enabled and no flags, which is backwards compatible with the
>>    * original MWAIT implementation.
>>    */
>> -static void mwait_idle(void)
>> +static __cpuidle void mwait_idle(void)
>>   {
>>   	if (!current_set_polling_and_test()) {
>>   		trace_cpu_idle_rcuidle(1, smp_processor_id());
> The most common idle function for x86 is: mwait_idle_with_hints(),
> trouble is, its an inline, so I'm not sure adding __cpuidle to it does
> anything.

No, you're right, it wouldn't help.  I didn't look at the drivers/cpuidle
subsystem at all in my patch, since I'm not that familiar with it,
but it seems like tagging acpi_processor_ffh_cstate_enter(), as the
only user of mwait_idle_with_hints(), will do the job.

I do see that native_play_dead() also uses mwait/monitor, but since
that's hotplug I don't think it's relevant to this patch series.

> I've yet to find the magic objdump incantation to check. Or rather
> objdump -h doesn't appear to list .cpuidle.text at all :/
>
> I'm probably doing something silly...

The easiest way to check for a given function is just to look
at the "nm -n" output and see that all the functions you expect
to reflect idle behavior are in the cpuidle begin/end range.
Or, to look at "objdump -dr" and search for monitor/mwait.

objdump -h certainly works to show .cpuidle.text if you look at
individual objects (e.g. arch/x86/kernel/process.o) but by the time
you're looking at the linked vmlinux image they have all been linked
into the giant .text section.

-- 
Chris Metcalf, Mellanox Technologies
http://www.mellanox.com

WARNING: multiple messages have this Message-ID (diff)
From: Chris Metcalf <cmetcalf@mellanox.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Russell King <linux@arm.linux.org.uk>,
	Thomas Gleixner <tglx@linutronix.de>,
	Aaron Tomlin <atomlin@redhat.com>, Ingo Molnar <mingo@redhat.com>,
	Andrew Morton <akpm@osdl.org>,
	Daniel Thompson <daniel.thompson@linaro.org>, <x86@kernel.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>, <linux-arch@vger.kernel.org>
Subject: Re: [PATCH v2 4/4] nmi_backtrace: generate one-line reports for idle cpus
Date: Mon, 21 Mar 2016 12:15:12 -0400	[thread overview]
Message-ID: <56F01E10.6030909@mellanox.com> (raw)
In-Reply-To: <20160321154201.GA6344@twins.programming.kicks-ass.net>

On 03/21/2016 11:42 AM, Peter Zijlstra wrote:
> On Wed, Mar 16, 2016 at 01:02:13PM -0400, Chris Metcalf wrote:
>> diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c
>> index 9f7c21c22477..d569ae7fde37 100644
>> --- a/arch/x86/kernel/process.c
>> +++ b/arch/x86/kernel/process.c
>> @@ -298,7 +298,7 @@ void arch_cpu_idle(void)
>>   /*
>>    * We use this if we don't have any better idle routine..
>>    */
>> -void default_idle(void)
>> +void __cpuidle default_idle(void)
>>   {
>>   	trace_cpu_idle_rcuidle(1, smp_processor_id());
>>   	safe_halt();
>> @@ -413,7 +413,7 @@ static int prefer_mwait_c1_over_halt(const struct cpuinfo_x86 *c)
>>    * with interrupts enabled and no flags, which is backwards compatible with the
>>    * original MWAIT implementation.
>>    */
>> -static void mwait_idle(void)
>> +static __cpuidle void mwait_idle(void)
>>   {
>>   	if (!current_set_polling_and_test()) {
>>   		trace_cpu_idle_rcuidle(1, smp_processor_id());
> The most common idle function for x86 is: mwait_idle_with_hints(),
> trouble is, its an inline, so I'm not sure adding __cpuidle to it does
> anything.

No, you're right, it wouldn't help.  I didn't look at the drivers/cpuidle
subsystem at all in my patch, since I'm not that familiar with it,
but it seems like tagging acpi_processor_ffh_cstate_enter(), as the
only user of mwait_idle_with_hints(), will do the job.

I do see that native_play_dead() also uses mwait/monitor, but since
that's hotplug I don't think it's relevant to this patch series.

> I've yet to find the magic objdump incantation to check. Or rather
> objdump -h doesn't appear to list .cpuidle.text at all :/
>
> I'm probably doing something silly...

The easiest way to check for a given function is just to look
at the "nm -n" output and see that all the functions you expect
to reflect idle behavior are in the cpuidle begin/end range.
Or, to look at "objdump -dr" and search for monitor/mwait.

objdump -h certainly works to show .cpuidle.text if you look at
individual objects (e.g. arch/x86/kernel/process.o) but by the time
you're looking at the linked vmlinux image they have all been linked
into the giant .text section.

-- 
Chris Metcalf, Mellanox Technologies
http://www.mellanox.com

  reply	other threads:[~2016-03-21 16:15 UTC|newest]

Thread overview: 121+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-29 21:40 [PATCH 0/4] improvements to the nmi_backtrace code Chris Metcalf
2016-02-29 21:40 ` Chris Metcalf
2016-02-29 21:40 ` [PATCH 1/4] nmi_backtrace: add more trigger_*_cpu_backtrace() methods Chris Metcalf
2016-02-29 21:40   ` Chris Metcalf
2016-02-29 21:40 ` [PATCH 2/4] nmi_backtrace: generate one-line reports for idle cpus Chris Metcalf
2016-03-01 14:23   ` Daniel Thompson
2016-03-01 16:01     ` Chris Metcalf
2016-03-07  8:26       ` Daniel Thompson
2016-03-07 17:05         ` Chris Metcalf
2016-03-07  9:48       ` Peter Zijlstra
2016-03-07 17:38         ` Chris Metcalf
2016-03-07 20:43           ` Peter Zijlstra
2016-03-16 17:02             ` [PATCH v2 0/4] improvements to the nmi_backtrace code Chris Metcalf
2016-03-16 17:02               ` Chris Metcalf
2016-03-16 17:02               ` Chris Metcalf
2016-03-16 17:02               ` Chris Metcalf
2016-03-16 17:02               ` [PATCH v2 1/4] nmi_backtrace: add more trigger_*_cpu_backtrace() methods Chris Metcalf
2016-03-16 17:02                 ` Chris Metcalf
2016-03-17 19:36                 ` Peter Zijlstra
2016-03-17 19:36                   ` Peter Zijlstra
2016-03-17 22:31                   ` Chris Metcalf
2016-03-17 22:31                     ` Chris Metcalf
2016-03-17 22:38                     ` Peter Zijlstra
2016-03-17 22:38                       ` Peter Zijlstra
2016-03-17 22:41                       ` Chris Metcalf
2016-03-17 22:41                         ` Chris Metcalf
2016-03-17 23:14                         ` Peter Zijlstra
2016-03-17 23:14                           ` Peter Zijlstra
2016-03-17 22:55                   ` Paul E. McKenney
2016-03-17 22:55                     ` Paul E. McKenney
2016-03-17 23:09                     ` Peter Zijlstra
2016-03-17 23:09                       ` Peter Zijlstra
2016-03-17 23:11                     ` Peter Zijlstra
2016-03-17 23:11                       ` Peter Zijlstra
2016-03-18  0:28                       ` Paul E. McKenney
2016-03-18  0:28                         ` Paul E. McKenney
2016-03-18  0:17                     ` Chris Metcalf
2016-03-18  0:17                       ` Chris Metcalf
2016-03-18  0:33                       ` Paul E. McKenney
2016-03-18  0:33                         ` Paul E. McKenney
2016-03-18  9:40                         ` Daniel Thompson
2016-03-18  9:40                           ` Daniel Thompson
2016-03-18 23:54                           ` Paul E. McKenney
2016-03-18 23:54                             ` Paul E. McKenney
2016-03-16 17:02               ` [PATCH v2 2/4] nmi_backtrace: do a local dump_stack() instead of a self-NMI Chris Metcalf
2016-03-16 17:02                 ` Chris Metcalf
2016-03-16 17:02               ` [PATCH v2 3/4] arch/tile: adopt the new nmi_backtrace framework Chris Metcalf
2016-03-16 17:02               ` [PATCH v2 4/4] nmi_backtrace: generate one-line reports for idle cpus Chris Metcalf
2016-03-16 17:02                 ` Chris Metcalf
2016-03-16 17:02                 ` Chris Metcalf
2016-03-16 18:46                 ` kbuild test robot
2016-03-16 18:46                   ` kbuild test robot
2016-03-16 18:46                   ` kbuild test robot
2016-03-16 18:46                   ` kbuild test robot
2016-03-21 15:38                 ` Peter Zijlstra
2016-03-21 15:38                   ` Peter Zijlstra
2016-03-21 15:38                   ` Peter Zijlstra
2016-03-21 15:46                   ` Chris Metcalf
2016-03-21 15:46                     ` Chris Metcalf
2016-03-21 15:46                     ` Chris Metcalf
2016-03-21 15:46                     ` Chris Metcalf
2016-03-21 15:42                 ` Peter Zijlstra
2016-03-21 15:42                   ` Peter Zijlstra
2016-03-21 16:15                   ` Chris Metcalf [this message]
2016-03-21 16:15                     ` Chris Metcalf
2016-03-21 16:15                     ` Chris Metcalf
2016-03-21 16:32                     ` Peter Zijlstra
2016-03-21 16:32                       ` Peter Zijlstra
2016-03-21 17:12                       ` Chris Metcalf
2016-03-21 17:12                         ` Chris Metcalf
2016-03-21 17:12                         ` Chris Metcalf
2016-03-21 17:12                         ` Chris Metcalf
2016-03-21 17:17                         ` Peter Zijlstra
2016-03-21 17:17                           ` Peter Zijlstra
2016-03-21 16:48                 ` Peter Zijlstra
2016-03-21 16:48                   ` Peter Zijlstra
2016-03-21 21:49                 ` Peter Zijlstra
2016-03-21 21:49                   ` Peter Zijlstra
2016-03-22 17:19                   ` [PATCH v3 0/4] improvements to the nmi_backtrace code Chris Metcalf
2016-03-22 17:19                     ` Chris Metcalf
2016-03-22 17:19                     ` Chris Metcalf
2016-03-22 17:19                     ` Chris Metcalf
2016-03-22 17:19                     ` [PATCH v3 1/4] nmi_backtrace: add more trigger_*_cpu_backtrace() methods Chris Metcalf
2016-03-22 17:19                       ` Chris Metcalf
2016-03-22 17:19                     ` [PATCH v3 2/4] nmi_backtrace: do a local dump_stack() instead of a self-NMI Chris Metcalf
2016-03-22 17:19                       ` Chris Metcalf
2016-03-22 17:19                     ` [PATCH v3 3/4] arch/tile: adopt the new nmi_backtrace framework Chris Metcalf
2016-03-22 17:19                     ` [PATCH v3 4/4] nmi_backtrace: generate one-line reports for idle cpus Chris Metcalf
2016-03-22 17:19                       ` Chris Metcalf
2016-03-22 17:19                       ` Chris Metcalf
2016-03-22 17:30                       ` Peter Zijlstra
2016-03-22 17:30                         ` Peter Zijlstra
2016-03-22 22:28                         ` Rafael J. Wysocki
2016-03-22 22:28                           ` Rafael J. Wysocki
2016-03-22 22:31                       ` Rafael J. Wysocki
2016-03-22 22:31                         ` Rafael J. Wysocki
2016-03-22 22:45                         ` Peter Zijlstra
2016-03-22 22:45                           ` Peter Zijlstra
2016-03-23  0:50                           ` Rafael J. Wysocki
2016-03-23  0:50                             ` Rafael J. Wysocki
2016-03-23  7:53                             ` Peter Zijlstra
2016-03-23  7:53                               ` Peter Zijlstra
2016-03-30 17:16                             ` [PATCH v4 0/4] improvements to the nmi_backtrace code Chris Metcalf
2016-03-30 17:16                               ` Chris Metcalf
2016-03-30 17:16                               ` Chris Metcalf
2016-03-30 17:16                               ` Chris Metcalf
2016-03-30 17:16                               ` [PATCH v4 1/4] nmi_backtrace: add more trigger_*_cpu_backtrace() methods Chris Metcalf
2016-03-30 17:16                                 ` Chris Metcalf
2016-03-30 17:16                               ` [PATCH v4 2/4] nmi_backtrace: do a local dump_stack() instead of a self-NMI Chris Metcalf
2016-03-30 17:16                                 ` Chris Metcalf
2016-03-30 17:16                               ` [PATCH v4 3/4] arch/tile: adopt the new nmi_backtrace framework Chris Metcalf
2016-03-30 17:16                               ` [PATCH v4 4/4] nmi_backtrace: generate one-line reports for idle cpus Chris Metcalf
2016-03-30 17:16                                 ` Chris Metcalf
2016-03-30 17:16                                 ` Chris Metcalf
2016-02-29 21:40 ` [PATCH 3/4] nmi_backtrace: do a local dump_stack() instead of a self-NMI Chris Metcalf
2016-02-29 21:40   ` Chris Metcalf
2016-02-29 21:40 ` [PATCH 4/4] arch/tile: adopt the new nmi_backtrace framework Chris Metcalf
2016-03-01  0:49 ` [PATCH 0/4] improvements to the nmi_backtrace code Andrew Morton
2016-03-01  0:49   ` Andrew Morton
2016-03-01 10:01   ` Petr Mladek
2016-03-01 10:01     ` Petr Mladek

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=56F01E10.6030909@mellanox.com \
    --to=cmetcalf@mellanox.com \
    --cc=akpm@osdl.org \
    --cc=atomlin@redhat.com \
    --cc=daniel.thompson@linaro.org \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.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 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.