Merge lp:~bladernr/checkbox/1078897-dont-offline-cpu0 into lp:checkbox

Proposed by Jeff Lane 
Status: Merged
Approved by: Daniel Manrique
Approved revision: 2093
Merged at revision: 2093
Proposed branch: lp:~bladernr/checkbox/1078897-dont-offline-cpu0
Merge into: lp:checkbox
Diff against target: 78 lines (+29/-14)
2 files modified
debian/changelog (+4/-1)
scripts/cpu_offlining (+25/-13)
To merge this branch: bzr merge lp:~bladernr/checkbox/1078897-dont-offline-cpu0
Reviewer Review Type Date Requested Status
Daniel Manrique (community) Approve
Review via email: mp+161662@code.launchpad.net

Description of the change

script no longer offlines cpu0. Also fixed output so it only appears on failure, where it is needed for debug, not on success where a simple result message will suffice.

Also tested on x86 systems and an AC100 for arm compatibility, the original failure seen on ARM is no longer an issue with these changes on the system I reported the problem against.

To post a comment you must log in.
Revision history for this message
Daniel Manrique (roadmr) wrote :

Looks good and works fine, thanks! I'm not sure how much of an issue not testing offlining of CPU0 on intel systems will be, but in reality, if we offlined it and the script is still working, it means something else is weird. This is more correct behavior I think.

review: Approve
Revision history for this message
Daniel Manrique (roadmr) wrote :

Apologies, the failure of canonical's web servers killed tarmac last night. I restarted it, expect this merge to be processed in about 40 minutes from this comment.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2013-04-26 17:26:20 +0000
3+++ debian/changelog 2013-04-30 17:42:34 +0000
4@@ -1,6 +1,9 @@
5 checkbox (0.16.1) UNRELEASED; urgency=low
6
7- * Incremented version
8+ [ Jeff Lane ]
9+ * scripts/cpu_offlining: Modified script to no longer offline cpu0 to resolve
10+ a bug on ARM. Modified output so most of it is redirected to stderr for
11+ fail cases, we don't need that much for success cases. (LP: #1078897)
12
13 -- Brendan Donegan <brendan.donegan@canonical.com> Fri, 26 Apr 2013 18:23:03 +0100
14
15
16=== modified file 'scripts/cpu_offlining'
17--- scripts/cpu_offlining 2012-07-11 01:31:30 +0000
18+++ scripts/cpu_offlining 2013-04-30 17:42:34 +0000
19@@ -1,19 +1,23 @@
20 #!/bin/bash
21
22-echo "Beginning CPU Offlining Test"
23+echo "Beginning CPU Offlining Test" 1>&2
24
25 result=0
26+cpu_count=0
27
28 # Turn CPU cores off
29 for cpu_num in `ls /sys/devices/system/cpu | grep -o cpu[0-9]*`; do
30 if [ -f /sys/devices/system/cpu/$cpu_num/online ]; then
31- echo "Offlining $cpu_num"
32- echo 0 > /sys/devices/system/cpu/$cpu_num/online
33+ if [ "$cpu_num" != "cpu0" ]; then
34+ ((cpu_count++))
35+ echo "Offlining $cpu_num" 1>&2
36+ echo 0 > /sys/devices/system/cpu/$cpu_num/online
37
38- grep -w -i -q $cpu_num /proc/interrupts
39- if [ $? -eq 0 ]; then
40- echo "ERROR: Failed to offline $cpu_num" >&2
41- result=1
42+ grep -w -i -q $cpu_num /proc/interrupts
43+ if [ $? -eq 0 ]; then
44+ echo "ERROR: Failed to offline $cpu_num" 1>&2
45+ result=1
46+ fi
47 fi
48 fi
49 done
50@@ -21,14 +25,22 @@
51 # Back on again
52 for cpu_num in `ls /sys/devices/system/cpu | grep -o cpu[0-9]*`; do
53 if [ -f /sys/devices/system/cpu/$cpu_num/online ]; then
54- echo "Onlining $cpu_num"
55- echo 1 > /sys/devices/system/cpu/$cpu_num/online
56- grep -w -i -q $cpu_num /proc/interrupts
57- if [ $? -eq 1 ]; then
58- echo "ERROR: Failed to online $cpu_num" >&2
59- result=1
60+ if [ "$cpu_num" != "cpu0" ]; then
61+ echo "Onlining $cpu_num" 1>&2
62+ echo 1 > /sys/devices/system/cpu/$cpu_num/online
63+ grep -w -i -q $cpu_num /proc/interrupts
64+ if [ $? -eq 1 ]; then
65+ echo "ERROR: Failed to online $cpu_num" 1>&2
66+ result=1
67+ fi
68 fi
69 fi
70 done
71
72+if [ $result -eq 0 ]; then
73+ echo "Successfully turned $cpu_count cores off and back on"
74+else
75+ echo "Error with offlining one or more cores." 1>&2
76+fi
77+
78 exit $result

Subscribers

People subscribed via source and target branches