Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1718106 > unrolled thread

[PATCH] doc: coresight: correct usage for '/dev/cpu_dma_latency'

Started byLeo Yan <leo.yan@linaro.org>
First post2017-08-23 09:30 +0200
Last post2017-08-23 18:10 +0200
Articles 4 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] doc: coresight: correct usage for '/dev/cpu_dma_latency' Leo Yan <leo.yan@linaro.org> - 2017-08-23 09:30 +0200
    Re: [PATCH] doc: coresight: correct usage for '/dev/cpu_dma_latency' Sudeep Holla <sudeep.holla@arm.com> - 2017-08-23 11:20 +0200
      Re: [PATCH] doc: coresight: correct usage for '/dev/cpu_dma_latency' Leo Yan <leo.yan@linaro.org> - 2017-08-23 13:10 +0200
    Re: [PATCH] doc: coresight: correct usage for  '/dev/cpu_dma_latency' Kim Phillips <kim.phillips@arm.com> - 2017-08-23 18:10 +0200

#1718106 — [PATCH] doc: coresight: correct usage for '/dev/cpu_dma_latency'

FromLeo Yan <leo.yan@linaro.org>
Date2017-08-23 09:30 +0200
Subject[PATCH] doc: coresight: correct usage for '/dev/cpu_dma_latency'
Message-ID<uhygW-5YE-23@gated-at.bofh.it>
In the coresight CPU debug document it suggests to use 'echo' command
to set latency request to /dev/cpu_dma_latency so can disable all CPU
idle states, but in fact this doesn't work.

This is because when the command 'echo' exits, it releases the device
node's file descriptor and the kernel release function removes the QoS
constraint; finally when the command 'echo' finished there have no
constraint imposed on cpu_dma_latency.

This patch changes to use 'exec' to access '/dev/cpu_dma_latency', the
command 'exec' can avoid the file descriptor to be closed so we can
keep the constraint on cpu_dma_latency.

This patch also corrects the description when set latency = 0uS, in
this case the idle state0 still can be selected by CPUIdle governor so
this means on ARM platform the 'WFI' state is still enabled, but all
other deeper states have been disabled so CPUs will not be powered off.

Cc: Kim Phillips <kim.phillips@arm.com>
Reported-by: Kim Phillips <kim.phillips@arm.com>
Signed-off-by: Leo Yan <leo.yan@linaro.org>
---
 Documentation/trace/coresight-cpu-debug.txt | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/Documentation/trace/coresight-cpu-debug.txt b/Documentation/trace/coresight-cpu-debug.txt
index b3da1f9..17ff8ed 100644
--- a/Documentation/trace/coresight-cpu-debug.txt
+++ b/Documentation/trace/coresight-cpu-debug.txt
@@ -150,8 +150,10 @@ If you want to limit idle states at boot time, you can use "nohlt" or
 At the runtime you can disable idle states with below methods:
 
 Set latency request to /dev/cpu_dma_latency to disable all CPUs specific idle
-states (if latency = 0uS then disable all idle states):
-# echo "what_ever_latency_you_need_in_uS" > /dev/cpu_dma_latency
+states (if latency = 0uS then CPU Idle governor selects idle state0, so this
+means 'WFI' is still enabled but other deeper states have be disabled, this
+can avoid power off CPUs):
+# exec 3<> /dev/cpu_dma_latency; echo "what_ever_latency_you_need_in_uS" >&3
 
 Disable specific CPU's specific idle state:
 # echo 1 > /sys/devices/system/cpu/cpu$cpu/cpuidle/state$state/disable
-- 
2.7.4

[toc] | [next] | [standalone]


#1718182

FromSudeep Holla <sudeep.holla@arm.com>
Date2017-08-23 11:20 +0200
Message-ID<uhzZo-780-21@gated-at.bofh.it>
In reply to#1718106

On 23/08/17 08:23, Leo Yan wrote:
> In the coresight CPU debug document it suggests to use 'echo' command
> to set latency request to /dev/cpu_dma_latency so can disable all CPU
> idle states, but in fact this doesn't work.
> 
> This is because when the command 'echo' exits, it releases the device
> node's file descriptor and the kernel release function removes the QoS
> constraint; finally when the command 'echo' finished there have no
> constraint imposed on cpu_dma_latency.
> 
> This patch changes to use 'exec' to access '/dev/cpu_dma_latency', the
> command 'exec' can avoid the file descriptor to be closed so we can
> keep the constraint on cpu_dma_latency.
> 
> This patch also corrects the description when set latency = 0uS, in
> this case the idle state0 still can be selected by CPUIdle governor so
> this means on ARM platform the 'WFI' state is still enabled, but all
> other deeper states have been disabled so CPUs will not be powered off.
> 


IMO, we should just refer to cpuidle and PM QoS documents from here so
that any updates or changes in those documents are observed. Having a
copy of the text may result in it getting obsolete.

-- 
Regards,
Sudeep

[toc] | [prev] | [next] | [standalone]


#1718251

FromLeo Yan <leo.yan@linaro.org>
Date2017-08-23 13:10 +0200
Message-ID<uhBHQ-8bC-21@gated-at.bofh.it>
In reply to#1718182
Hi Sudeep,

On Wed, Aug 23, 2017 at 10:17:06AM +0100, Sudeep Holla wrote:
> 
> On 23/08/17 08:23, Leo Yan wrote:
> > In the coresight CPU debug document it suggests to use 'echo' command
> > to set latency request to /dev/cpu_dma_latency so can disable all CPU
> > idle states, but in fact this doesn't work.
> > 
> > This is because when the command 'echo' exits, it releases the device
> > node's file descriptor and the kernel release function removes the QoS
> > constraint; finally when the command 'echo' finished there have no
> > constraint imposed on cpu_dma_latency.
> > 
> > This patch changes to use 'exec' to access '/dev/cpu_dma_latency', the
> > command 'exec' can avoid the file descriptor to be closed so we can
> > keep the constraint on cpu_dma_latency.
> > 
> > This patch also corrects the description when set latency = 0uS, in
> > this case the idle state0 still can be selected by CPUIdle governor so
> > this means on ARM platform the 'WFI' state is still enabled, but all
> > other deeper states have been disabled so CPUs will not be powered off.
> > 
> 
> 
> IMO, we should just refer to cpuidle and PM QoS documents from here so
> that any updates or changes in those documents are observed. Having a
> copy of the text may result in it getting obsolete.

Agree, we should point to below docs:
Documentation/power/pm_qos_interface.txt, section 'From user mode';
Documentation/cpuidle/sysfs.txt;

Thanks for good suggestion.

> -- 
> Regards,
> Sudeep

[toc] | [prev] | [next] | [standalone]


#1718487 — Re: [PATCH] doc: coresight: correct usage for '/dev/cpu_dma_latency'

FromKim Phillips <kim.phillips@arm.com>
Date2017-08-23 18:10 +0200
SubjectRe: [PATCH] doc: coresight: correct usage for '/dev/cpu_dma_latency'
Message-ID<uhGoa-2JU-19@gated-at.bofh.it>
In reply to#1718106
On Wed, 23 Aug 2017 15:23:18 +0800
Leo Yan <leo.yan@linaro.org> wrote:

> Cc: Kim Phillips <kim.phillips@arm.com>
> Reported-by: Kim Phillips <kim.phillips@arm.com>

Thanks; typically only the latter is needed.

>  Set latency request to /dev/cpu_dma_latency to disable all CPUs specific idle
> -states (if latency = 0uS then disable all idle states):
> -# echo "what_ever_latency_you_need_in_uS" > /dev/cpu_dma_latency
> +states (if latency = 0uS then CPU Idle governor selects idle state0, so this
> +means 'WFI' is still enabled but other deeper states have be disabled, this
> +can avoid power off CPUs):
> +# exec 3<> /dev/cpu_dma_latency; echo "what_ever_latency_you_need_in_uS" >&3

not a fan of the "what_ever_latency_you_need_in_uS" (including and
especially the quotes which can create ambiguity in the user's mind):
just put a cut-n-pasteable example, clarifying the typically-default
value you chose, and its unit, in the text.

More to the point, how did you test this?  Are you sure that that the
value being echoed isn't being interpreted as a binary number?

kernel/power/qos.c:pm_qos_power_read() looks to be looking for a 32-bit
binary integer, but I'm not sure if that's where it gets read.

Certainly, this 2013 article uses a C example to write a binary integer:

https://access.redhat.com/articles/65410

Please double-check, thanks,

Kim

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web