From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marek Marczykowski Subject: Re: S3 testing, etc Date: Wed, 10 Apr 2013 23:19:13 +0200 Message-ID: <5165D751.4080900@invisiblethingslab.com> References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============4307742048366676213==" Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Ben Guthro Cc: George Dunlap , xen-devel List-Id: xen-devel@lists.xenproject.org This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --===============4307742048366676213== Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig0C162D78186D9043492F7190" This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig0C162D78186D9043492F7190 Content-Type: multipart/mixed; boundary="------------000802060503080509070608" This is a multi-part message in MIME format. --------------000802060503080509070608 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 10.04.2013 12:31, Ben Guthro wrote: > I had an off-list discussion with George Dunlap yesterday, who > suggested that it might be helpful to have an ability to test the S3 > functionality in a bit more of an end-to-end fashion, and possibly > introduce an ability to do all of the S3 related things without > actually putting the machine to sleep. >=20 > Attached is a very simple patch to xen that introduces a command line > argument "fake_s3" that will do just that. >=20 > Also attached is a shell script that will put a system to sleep, and > wake it back up after a number of seconds by programming the RTC. > This does so at the kernel interface level, which is not as complete > as the pm-utils functionality, but since different linux distros seem > to vary in implementations of how to go into sleep, I used the sysfs > interface directly. A more complete cli interface may be more > appropriate for specific distros. >=20 > Finally, since this does require functionality not yet accepted into > the mainline kernel, one of Konrad's acpi-s3-vX branches is necessary: > I can vouch for the functionality in v9 - but there is also a newer v10= : > http://git.kernel.org/cgit/linux/kernel/git/konrad/xen.git/log/?h=3Ddev= el/acpi-s3.v9 > http://git.kernel.org/cgit/linux/kernel/git/konrad/xen.git/log/?h=3Ddev= el/acpi-s3.v10 >=20 > The hope here is that this might be somehow worked into the automated > testing to maybe catch regressions in S3 sooner. I've used extended version of similar script, with PXE, compilation done = on separate machine and automatically collecting test results - suitable to = use with "git bisect run". It mainly does: 1. xen-compile.sh compiles the hypervisor and place it in TFTP accessible= directory; then signal test machine to reboot (assuming there is autotest= 2.sh script running). 2. Test machine starts from PXE (using above hypervisor), then automatica= lly (rc.local) launch autotest2.sh. 3. The script checks for testrun kernel parameter (if missing - abort tes= t - this is the way to easily get system to normal); then run test.sh to chec= k system state before suspend (just to be sure) 4. Then schedule wakeup using rtcwake (here Ben's method is simpler) and = go into sleep using pm-suspend util (can be also changed to direct sysfs wri= te, as in Ben's script) 5. After resume it check system state (test.sh again) and send result bac= k to compile host using netcat. 5a. If system rebooted during suspend/resume this is also detected by pre= sence of flag file, and also reported to compile host. 6. Test can be automatically repeated (eg. require 3 consecutive successf= ul suspend/resumes) 7. After the test (regardless of result) wait for next reboot signal to t= est another revision. Some unsolved problem is what to do if network isn't working after resume= =2E I've tried some workarounds like module reload, but it isn't always enoug= h. I was thinking about some other communication media like serial console, bu= t didn't implemented it. Scripts are written for my setup, so some paths and parameters may needs adjustment. I've already removed Qubes-specific parts (hope didn't break anything). Attached files: 1. xen-compile.sh - script to use on compile host/PXE server; this script= should be called from xen working directory, can be directly used as bise= ct run script. 2. xen-debug - PXE configuration, place in /var/lib/tftpboot/pxelinux.cfg= / (or whatever location is used by TFTP server); you can either rename this fil= e to "default" to be used by all hosts, or make symlinks for individual machin= es (my case - see below); you also need update kernel parameters there - especially root=3D 3. autotest2.sh - place in /root/s3-debug on test hardware; add it to rc.= local 4. test.sh - place in /root/s3-debug on test hardware - this script shoul= d test after resume if everything is ok - most likely you need update this script for currently investigated problem; attached version checks for presence of C3 ACPI c-state (problem described in "High CPU temp, suspend= problem - xen 4.1.5-pre, linux 3.7.x" thread) Additionally some files from syslinux are needed (pxelinux.0, mboot.32). = And of course DHCP and TFTP services set accordingly. Some directory listings: /var/lib/tftpboot/: -rw-r--r--. 1 22961209 Mar 25 04:56 initramfs-3.7.4-3.pvops.qubes.x86_64.= img lrwxrwxrwx. 1 40 Mar 26 17:31 initrd.img -> initramfs-3.7.4-3.pvops.qubes.x86_64.img -rw-r--r--. 1 34396 Mar 24 00:36 mboot.c32 -rw-r--r--. 1 26460 Mar 24 00:35 pxelinux.0 drwxr-xr-x. 2 4096 Apr 2 01:30 pxelinux.cfg lrwxrwxrwx. 1 34 Mar 26 17:31 vmlinuz -> vmlinuz-3.7.4-3.pvops.qube= s.x86_64 -rw-r--r--. 1 3672928 Mar 22 20:58 vmlinuz-3.7.4-3.pvops.qubes.x86_64 -rw-r--r--. 1 756887 Apr 2 01:30 xen.gz /var/lib/tftpboot/pxelinux.cfg/: lrwxrwxrwx. 1 9 Mar 29 00:57 01-00-13-77-b7-eb-48 -> xen-debug lrwxrwxrwx. 1 9 Mar 24 01:07 01-5c-26-0a-79-f6-7a -> xen-debug -rw-r--r--. 1 438 Apr 2 01:30 xen-debug --=20 Best Regards / Pozdrawiam, Marek Marczykowski Invisible Things Lab --------------000802060503080509070608 Content-Type: application/x-sh; name="autotest2.sh" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="autotest2.sh" #!/bin/sh FLAGFILE=3D/root/s3-debug/test-running SERVER_IP=3D192.168.0.1 result() { rm -f $FLAGFILE echo result: $1 echo $1 | nc $SERVER_IP 8889 if [ $? -gt 0 ]; then echo "failed to sent result" exit 1 fi } wait_and_reboot() { iptables -I INPUT -p tcp --dport 8889 -j ACCEPT nc -l 8889 reboot } =09 if ! grep -q testrun /proc/cmdline; then exit 0 fi if [ -n "$1" ]; then result "$1" wait_and_reboot exit 0 fi sleep 20 unset DISPLAY cd /root/s3-debug exec >>autotest.log 2>&1 date if [ -e $FLAGFILE ]; then result "fail - reset `cat $FLAGFILE`" wait_and_reboot exit 0 fi touch $FLAGFILE sync cat /proc/cmdline if ! ./test.sh; then result "fail before suspend" wait_and_reboot fi TESTCOUNT=3D`grep -o 'testcount=3D[0-9]*' /proc/cmdline|cut -f 2 -d =3D` [ -z "$TESTCOUNT" ] && TESTCOUNT=3D1 for testnum in `seq $TESTCOUNT`; do=20 echo $testnum > $FLAGFILE sync sleep 5 while ! rtcwake -m no -t `date -d '+30sec' +%s` -v; do sleep 1; done pm-suspend sleep 5 if ! ./test.sh; then result "fail $testnum: after suspend" break else result "ok $testnum" fi done wait_and_reboot --------------000802060503080509070608 Content-Type: application/x-sh; name="xen-compile.sh" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="xen-compile.sh" #!/bin/sh TESTCOUNT=3D2 CLIENT_IP=3D192.168.0.66 #make -s clean #make -s -j4 xen || exit 125 make -s -j4 xen || exit 125 cat dist/install/boot/xen.gz > /var/lib/tftpboot/xen.gz COMMIT_ID=3D`git show -s --pretty=3Dformat:%h` sed -i "s/testrun[^ ]*/testrun=3D$COMMIT_ID/" /var/lib/tftpboot/pxelinux.= cfg/xen-debug sed -i "s/testcount=3D[^ ]*/testcount=3D$TESTCOUNT/" /var/lib/tftpboot/px= elinux.cfg/xen-debug echo compiled, sending reboot signal # signal reboot echo reboot ready | nc $CLIENT_IP 8889 #wait for result for num in `seq $TESTCOUNT`; do nc -l 8889 > autotest-result || exit 125 echo -n "***** result ****** " cat autotest-result result=3D`cut -f1 -d ' ' autotest-result` if [ "$result" !=3D "ok" ]; then exit 1 fi done exit 0 --------------000802060503080509070608 Content-Type: text/plain; charset=UTF-8; name="xen-debug" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="xen-debug" dGltZW91dCA1CmRlZmF1bHQgc3RhcnQKCgpsYWJlbCBzdGFydAoJa2VybmVsIG1ib290LmMz MgoJYXBwZW5kIHhlbi5neiBjcHVmcmVxPXZlcmJvc2UgbG9nbHZsPWFsbCBndWVzdF9sb2ds dmw9YWxsIGNvbTE9MTE1MjAwLDhuMSAgYXBpY192ZXJib3NpdHk9ZGVidWcgY29uc3dpdGNo PWIgc3luY19jb25zb2xlIGNvbnNvbGU9Y29tMSx2Z2EgLS0tIHZtbGludXogcm9vdD0vZGV2 L21hcHBlci9xdWJlc190ZXN0NTAwLXJvb3RfdGVzdCBybyByZC5sdm0ubHY9cXViZXNfdGVz dDUwMC9yb290X3Rlc3QgcmQubHZtLmx2PXF1YmVzX3Rlc3Q1MDAvbHZfc3dhcCByZC5sdWtz PTAgcmQubWQuMCByZC5kbT0wIGNvbnNvbGU9dHR5MCBjb25zb2xlPWh2YzAgbm9fY29uc29s ZV9zdXNwZW5kIHRlc3RydW49OTViZTkzNCB0ZXN0Y291bnQ9MiAtLS0gaW5pdHJkLmltZwo= --------------000802060503080509070608 Content-Type: application/x-sh; name="test.sh" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="test.sh" #!/bin/sh xl debug-key c xl dmesg|tail -10 |grep C3: || exit 1 exit 0 --------------000802060503080509070608-- --------------enig0C162D78186D9043492F7190 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.13 (GNU/Linux) Comment: Using GnuPG with undefined - http://www.enigmail.net/ iQEcBAEBAgAGBQJRZddRAAoJENuP0xzK19csj7MH/ijhg/JX37hO1RDnC0gEysp0 5tfQ9xI9gZmGphHLwIsjzTOjWukKysGtRfrLAasLygFElnsSXRnP5l3ZQpbxPR1V BTufysQ5KZV48t3zPBeaxTGhSI1W4N278YtU/kv+cgd/MAmPEPCh8C4qcPYACBGk 4X0CQ1fVC4KWdjTuw9TEDhUfaHJogcIdhn5d3WQqD0astAkkMO/Rb9F46mw+HB8F 6YWVK+yXGqyc6ZmITdK2u+WYvaFPdkiwIMGxYpkpPMjhDXHktBRLWb5BVCYt+CAg SiCXLFG0rw/4vdu4ze/d5vR7V3rFx6xghu4uwTRa9tsYJbpkKAXyzea0/74XPnQ= =NNJ5 -----END PGP SIGNATURE----- --------------enig0C162D78186D9043492F7190-- --===============4307742048366676213== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel --===============4307742048366676213==--