cpu idle ticks show twice in xen pvm guest
Subsystems (2)
PATCH 1/1 cpu idle ticks show twice in xen pvm guest
Run below test on xen pvm.
# x=$(cat /proc/stat | grep cpu0 | awk '{print $5}') && sleep 60 \
&& y=$(cat /proc/stat | grep cpu0 | awk '{print $5}') \
&& echo -e "X:$x\nY:$y\nIDLE:" $(echo "scale=3; ($y-$x)/6000*100" | bc)
@ X:58562301
@ Y:58574282
@ IDLE: 199.600
Normal idle percent should be around 100%.xen_timer_interrupt called account_idle_ticks to account hypervisor stolen idle ticks but these ticks will be accounted again when idle ticks restarted.
arch/x86/xen/time.c +0 -1
@@ -151,7 +151,6 @@ static void do_stolen_accounting(void) ticks =iter_div_u64_rem (blocked,NS_PER_TICK , &blocked);__this_cpu_write (xen_residual_blocked, blocked); -account_idle_ticks (ticks); }/* Get the TSC speed from Xen */
Quoted 9 lines · Zhenzhong Duan
Run below test on xen pvm.
# x=$(cat/proc/stat| grep cpu0 | awk '{print $5}') && sleep 60 \
&& y=$(cat/proc/stat| grep cpu0 | awk '{print $5}') \
&& echo -e "X:$x\nY:$y\nIDLE:" $(echo "scale=3; ($y-$x)/6000*100" | bc)@ X:58562301
@ Y:58574282
@ IDLE: 199.600
Quoted 6 lines
Normal idle percent should be around 100%.
xen_timer_interruptcalledaccount_idle_ticksto account hypervisor stolen idle ticks but these ticks will be accounted again when idle ticks restarted.Signed-off-by Zhenzhong Duan <[email protected]>Signed-off-by Joe Jin <[email protected]>
Please in the future also CC the maintainers (you can get that using the scripts/get_maintainer.pl).
Jeremy, any thoughts?
Quoted 18 lines
arch/x86/xen/time.c +0
-2@@ -151,7 +151,6 @@ static void do_stolen_accounting(void) ticks =iter_div_u64_rem (blocked,NS_PER_TICK , &blocked);__this_cpu_write (xen_residual_blocked, blocked); -account_idle_ticks (ticks); }/* Get the TSC speed from Xen */ --To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Quoted 14 lines · Konrad Rzeszutek Wilk
Quoted 13 lines · Zhenzhong Duan
Run below test on xen pvm.
# x=$(cat/proc/stat| grep cpu0 | awk '{print $5}') && sleep 60 \
&& y=$(cat/proc/stat| grep cpu0 | awk '{print $5}') \
&& echo -e "X:$x\nY:$y\nIDLE:" $(echo "scale=3; ($y-$x)/6000*100" | bc)@ X:58562301
@ Y:58574282
@ IDLE: 199.600Normal idle percent should be around 100%.
xen_timer_interruptcalledaccount_idle_ticksto account hypervisor stolen idle ticks but these ticks will be accounted again when idle ticks restarted.
Quoted 6 lines
Quoted 2 lines
Signed-off-by Zhenzhong Duan <[email protected]>Signed-off-by Joe Jin <[email protected]>Please in the future also CC the maintainers (you can get that using the
scripts/get_maintainer.pl).Jeremy, any thoughts?
Does this affect the accounting of stolen ticks? If it does, that's not necessarily a showstopper for this patch, but we'll need to do some more thinking about it. Certainly, accurate accounting for idleness is important.
J
Quoted 17 lines
Quoted 17 lines
arch/x86/xen/time.c +0
-2@@ -151,7 +151,6 @@ static void do_stolen_accounting(void) ticks =iter_div_u64_rem (blocked,NS_PER_TICK , &blocked);__this_cpu_write (xen_residual_blocked, blocked); -account_idle_ticks (ticks); }/* Get the TSC speed from Xen */ --To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Quoted 25 lines · Jeremy Fitzhardinge
Quoted 14 lines · Konrad Rzeszutek Wilk
Quoted 12 lines · Zhenzhong Duan
Run below test on xen pvm.
# x=$(cat/proc/stat| grep cpu0 | awk '{print $5}') && sleep 60 \
&& y=$(cat/proc/stat| grep cpu0 | awk '{print $5}') \
&& echo -e "X:$x\nY:$y\nIDLE:" $(echo "scale=3; ($y-$x)/6000*100" | bc)@ X:58562301
@ Y:58574282
@ IDLE: 199.600Normal idle percent should be around 100%.
xen_timer_interruptcalledaccount_idle_ticksto account hypervisor stolen idle ticks but these ticks will be accounted again when idle ticks restarted.Quoted 8 lines
Quoted 3 lines
Signed-off-by Zhenzhong Duan <[email protected]>Signed-off-by Joe Jin <[email protected]>Please in the future also CC the maintainers (you can get that using the
scripts/get_maintainer.pl).Jeremy, any thoughts?
Quoted 8 lines
Does this affect the accounting of stolen ticks? If it does, that's not necessarily a showstopper for this patch, but we'll need to do some more thinking about it. Certainly, accurate accounting for idleness is important.
J
Thanks Konrad for point out that.
In Original kernel, tick_nohz_restart_sched_tick and do_stolen_accounting both called account_idle_ticks. For a idle pvm, idle/iowait maybe doubled apparently.
Normally Y-X should get close to 6000 in idle system, but in my test it's 11981.
But I am still not sure if patch has any impact to other part. Thanks
Quoted 20 lines
Quoted 18 lines
Quoted 18 lines
arch/x86/xen/time.c +0
-2@@ -151,7 +151,6 @@ static void do_stolen_accounting(void) ticks =iter_div_u64_rem (blocked,NS_PER_TICK , &blocked);__this_cpu_write (xen_residual_blocked, blocked); -account_idle_ticks (ticks); }/* Get the TSC speed from Xen */ --To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Signature · 5 lines
Regards zhenzhong -- Oracle Building, No.24 Building, Zhongguancun Software Park Haidian District, Beijing 100193, China
Quoted 15 lines · Jeremy Fitzhardinge
Quoted 15 lines · Zhenzhong Duan
Quoted 14 lines
Run below test on xen pvm.
# x=$(cat/proc/stat| grep cpu0 | awk '{print $5}') && sleep 60 \
&& y=$(cat/proc/stat| grep cpu0 | awk '{print $5}') \
&& echo -e "X:$x\nY:$y\nIDLE:" $(echo "scale=3; ($y-$x)/6000*100" | bc)@ X:58562301
@ Y:58574282
@ IDLE: 199.600Normal idle percent should be around 100%.
xen_timer_interruptcalledaccount_idle_ticksto account hypervisor stolen idle ticks but these ticks will be accounted again when idle ticks restarted.
Quoted 7 lines
Quoted 2 lines
Quoted 2 lines
Signed-off-by Zhenzhong Duan <[email protected]>Signed-off-by Joe Jin <[email protected]>Does this affect the accounting of stolen ticks? If it does, that's not necessarily a showstopper for this patch, but we'll need to do some more thinking about it. Certainly, accurate accounting for idleness is important.
Please see also http://thread.gmane.org/gmane.linux.kernel/734441, where I found that the counter doubling isn't always present under 2.6.26. However, after going to 2.6.32 (Debian lenny-backports kernel, 4th of April on the graph below) that instability seems to disappear. Please note that the following graph shows halved idle and iowait percentages.
(I haven't collected steal values, so the numbers don't sum up to 100%.) I'd be grateful if this discrepancy could be cleared up eventually! It's heartening to see some progress after more than three years. :)
Actually, as Munin doesn't half the idle and iowait values, but truncates the (then overflowing) graph at 100%, I was rather surprised to see iowait completely disappear after the kernel upgrade, and concluded that it was somehow converted into buggy-looping in blkfront. Now I see this isn't the case, but the steadily increasing system CPU usage between reboots is still a mystery. I'll start a separate thread for that, just wanted to provide some motivation for this topic. --
Thanks,
Feri.
Quoted 25 lines · Ferenc Wagner
Quoted 15 lines · Jeremy Fitzhardinge
Quoted 15 lines · Zhenzhong Duan
Quoted 14 lines
Run below test on xen pvm.
# x=$(cat/proc/stat| grep cpu0 | awk '{print $5}') && sleep 60 \
&& y=$(cat/proc/stat| grep cpu0 | awk '{print $5}') \
&& echo -e "X:$x\nY:$y\nIDLE:" $(echo "scale=3; ($y-$x)/6000*100" | bc)@ X:58562301
@ Y:58574282
@ IDLE: 199.600Normal idle percent should be around 100%.
xen_timer_interruptcalledaccount_idle_ticksto account hypervisor stolen idle ticks but these ticks will be accounted again when idle ticks restarted.Quoted 7 lines
Quoted 2 lines
Quoted 2 lines
Signed-off-by Zhenzhong Duan <[email protected]>Signed-off-by Joe Jin <[email protected]>Does this affect the accounting of stolen ticks? If it does, that's not necessarily a showstopper for this patch, but we'll need to do some more thinking about it. Certainly, accurate accounting for idleness is important.
Quoted 6 lines
Please see also http://thread.gmane.org/gmane.linux.kernel/734441, where I found that the counter doubling isn't always present under 2.6.26. However, after going to 2.6.32 (Debian lenny-backports kernel, 4th of April on the graph below) that instability seems to disappear. Please note that the following graph shows halved idle and iowait percentages.
What happenend in Feb?
Quoted 5 lines
(I haven't collected steal values, so the numbers don't sum up to 100%.) I'd be grateful if this discrepancy could be cleared up eventually! It's heartening to see some progress after more than three years. :)
Quoted 7 lines
Actually, as Munin doesn't half the idle and iowait values, but truncates the (then overflowing) graph at 100%, I was rather surprised to see iowait completely disappear after the kernel upgrade, and concluded that it was somehow converted into buggy-looping in blkfront. Now I see this isn't the case, but the steadily increasing system CPU usage between reboots is still a mystery. I'll start a separate thread for that, just wanted to provide some motivation for this topic.
Did you add more memory in the system?
Quoted 3 lines
--
Thanks,
Feri.
Quoted 27 lines · Konrad Rzeszutek Wilk
Quoted 25 lines · Ferenc Wagner
Quoted 22 lines · Jeremy Fitzhardinge
Quoted 11 lines · Zhenzhong Duan
Quoted 10 lines
Run below test on xen pvm.
# x=$(cat/proc/stat| grep cpu0 | awk '{print $5}') && sleep 60 \
&& y=$(cat/proc/stat| grep cpu0 | awk '{print $5}') \
&& echo -e "X:$x\nY:$y\nIDLE:" $(echo "scale=3; ($y-$x)/6000*100" | bc)@ X:58562301
@ Y:58574282
@ IDLE: 199.600Quoted 6 lines
Quoted 6 lines
Normal idle percent should be around 100%.
xen_timer_interruptcalledaccount_idle_ticksto account hypervisor stolen idle ticks but these ticks will be accounted again when idle ticks restarted.Signed-off-by Zhenzhong Duan <[email protected]>Signed-off-by Joe Jin <[email protected]>Does this affect the accounting of stolen ticks? If it does, that's not necessarily a showstopper for this patch, but we'll need to do some more thinking about it. Certainly, accurate accounting for idleness is important.
Quoted 7 lines
Quoted 5 lines
Please see also http://thread.gmane.org/gmane.linux.kernel/734441, where I found that the counter doubling isn't always present under 2.6.26. However, after going to 2.6.32 (Debian lenny-backports kernel, 4th of April on the graph below) that instability seems to disappear. Please note that the following graph shows halved idle and iowait percentages.
What happenend in Feb?
Probably a live migration or a reboot, I can't remember. See
http://article.gmane.org/gmane.comp.emulators.xen.devel/57771, where I described a very similar occurence in detail.
Quoted 12 lines
Quoted 11 lines
(I haven't collected steal values, so the numbers don't sum up to 100%.) I'd be grateful if this discrepancy could be cleared up eventually! It's heartening to see some progress after more than three years. :)
Actually, as Munin doesn't half the idle and iowait values, but truncates the (then overflowing) graph at 100%, I was rather surprised to see iowait completely disappear after the kernel upgrade, and concluded that it was somehow converted into buggy-looping in blkfront. Now I see this isn't the case, but the steadily increasing system CPU usage between reboots is still a mystery. I'll start a separate thread for that, just wanted to provide some motivation for this topic.
Quoted 1 line
Did you add more memory in the system?
I didn't. Neither in February (when idle and iowait accounting temporarily doubled), nor in April (since when the accounting is stable and the system CPU usage is growing between reboots under the new kernel).
Signature · 2 lines
Thanks, Feri.