chromiumos/third_party/daisydog.git
18 months agoCHROMIUM: diasydog: count HwWatchdogReboot CRos-events 80/46980/3 factory-4128.B factory-4290.B factory-4455.B factory-pit-4280.B factory-pit-4390.B factory-pit-4471.B factory-spring-4131.B factory-spring-4262.B firmware-falco_peppy-4389.B firmware-leon-4389.26.B firmware-pit-4482.B firmware-wolf-4389.24.B master release-R28-4100.B release-R29-4319.B release-R30-4537.B stabilize-4008.0.B stabilize-4035.0.B stabilize-4068.0.B stabilize-4100.38.B stabilize-4255.B stabilize-4287.B stabilize-4443.B stabilize-4512.B stabilize-spring-4100.53.B toolchainB
Grant Grundler [Fri, 29 Mar 2013 22:40:40 +0000 (15:40 -0700)]
CHROMIUM: diasydog: count HwWatchdogReboot CRos-events

This is part 2/2 where we look for symptoms of HwWatchdogReboot events
and add them to the CrosEvent histogram.

BUG=chromium:221000
TEST=First, trigger watchdog and verify chrome://histograms updated CrosEvents
Second, confirm daisydog is running after reboot in either case.
(initial version was getting errors in pre-start script)

Change-Id: I88f14a14842f1db5b9e0fe8cb134eb3bb3ea9624
Signed-off-by: Grant Grundler <grundler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/46980
Reviewed-by: Luigi Semenzato <semenzato@chromium.org>
20 months agoCHROMIUMOS:daisydog:fix GETBOOTSTATUS return val parsing 47/42747/4 factory-spring-3842.B firmware-spring-3824.4.B firmware-spring-3824.55.B firmware-spring-3824.84.B firmware-spring-3824.B firmware-spring-3833.B release-R26-3701.B release-R27-3912.B stabilize-3701.30.0 stabilize-3701.30.0b stabilize-3701.46.B stabilize-3701.81.B stabilize-3881.0.B stabilize-3912.79.B toolchain-3701.42.B toolchainA
Grant Grundler [Wed, 6 Feb 2013 01:18:57 +0000 (17:18 -0800)]
CHROMIUMOS:daisydog:fix GETBOOTSTATUS return val parsing

bootstatus return value is actually the WDIOF_* bits defined in
watchdog.h. Print a human readable message based on those bits.

BUG=chrome-os-partner:9403
TEST=manual

Change-Id: Idf7dd7664a8c790fb75ced94c5a4e533d2373a82
Signed-off-by: Grant Grundler <grundler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/42747
Reviewed-by: Mike Frysinger <vapier@chromium.org>
22 months agoCHROMIUMOS: daisydog: add SIGTERM to support "stop daisydog" 13/39513/4 factory-3536.B release-R25-3428.B stabilize-3428.110.0 stabilize-3428.149 stabilize-3428.149.B stabilize-3428.193 stabilize-3658.0.0 stabilize-bluetooth-smart toolchain-3428.65.B
Grant Grundler [Fri, 7 Dec 2012 17:24:25 +0000 (09:24 -0800)]
CHROMIUMOS: daisydog: add SIGTERM to support "stop daisydog"

upstart control uses SIGTERM to stop jobs. We need to stop
daisydog cleanly when running /dev/watchdog kernel tests (under
developement now).

BUG=chrome-os-partner:9403
TEST=emerge-daisy daisydog; copy to lucas; kill -SIGTERM and confirm
system does NOT reboot 15 seconds later.

Change-Id: Icb08b799ee85ef92700934bb6999773deb002a95
Signed-off-by: Grant Grundler <grundler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/39513
Reviewed-by: Jorge Lucangeli Obes <jorgelo@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
22 months agoRun 'daisydog' as the 'watchdog' user. 85/39485/2
Jorge Lucangeli Obes [Mon, 10 Dec 2012 18:03:25 +0000 (10:03 -0800)]
Run 'daisydog' as the 'watchdog' user.

BUG=chromium-os:37045
TEST=gmerge daisydog, stop daisydog, start daisydog, system does not restart.
TEST=nice -n -20 minijail -u watchdog -g watchdog -- /usr/bin/nice shows -20.

Change-Id: I9ddfa6c3be9a7298fa3587abbf158fda2dae9bdd
Reviewed-on: https://gerrit.chromium.org/gerrit/39485
Tested-by: Jorge Lucangeli Obes <jorgelo@chromium.org>
Reviewed-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Grant Grundler <grundler@chromium.org>
Commit-Ready: Jorge Lucangeli Obes <jorgelo@chromium.org>

22 months agoAdd udev rules to daisydog. 31/39431/2
Jorge Lucangeli Obes [Sat, 8 Dec 2012 01:31:31 +0000 (17:31 -0800)]
Add udev rules to daisydog.

By making the watchdog device owned by group 'watchdog',
we can run daisydog as a regular user.

BUG=chromium-os:37045
TEST=emerge-daisy daisydog, check /build/daisy/lib/udev/rules.d
TEST=stop daisydog, minijail0 -u watchdog -g watchdog -- /usr/sbin/daisydog

Change-Id: I73f95f43f0ce7e9cc1f4b1cb628ea8db7f529b9d
Reviewed-on: https://gerrit.chromium.org/gerrit/39431
Tested-by: Jorge Lucangeli Obes <jorgelo@chromium.org>
Reviewed-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Grant Grundler <grundler@chromium.org>
Reviewed-by: Olof Johansson <olofj@chromium.org>
Commit-Ready: Jorge Lucangeli Obes <jorgelo@chromium.org>

22 months agoCHROMIUMOS: daisydog: fix warning (ignoring write() return value) 17/39117/3 stabilize2
Grant Grundler [Mon, 3 Dec 2012 21:28:40 +0000 (13:28 -0800)]
CHROMIUMOS: daisydog: fix warning (ignoring write() return value)

After apply changes to daisydog ebuild (not committed yet) to use the
default "src_compile()", compiler warned about ignoring the
return value of "write()" on line 170.  The kernel will warn
the watchdog was not closed correctly and still running (and will
probably expire, resetting the system).

BUG=chrome-os-partner:9403
TEST=emerge-daisy daisydog

Change-Id: I996ef988fb51471f02dd6cf1df0b0016f37db714
Signed-of-by: Grant Grundler <grundler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/39117
Reviewed-by: Grant Grundler <grundler@chromium.org>
Tested-by: Grant Grundler <grundler@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Commit-Ready: Grant Grundler <grundler@chromium.org>

22 months agoCHROMIUMOS: daisydog: replace $INSTALL with install 16/39116/2
Grant Grundler [Mon, 3 Dec 2012 21:26:09 +0000 (13:26 -0800)]
CHROMIUMOS: daisydog: replace $INSTALL with install

Default src_install() function in ebuild doesn't provide INSTALL.
Just call "install".

BUG=chrome-os-partner:9403
TEST=emerge-daisy daisydog with the modified ebuild that doesn't provide
a "src_install" function.

Change-Id: I4135a970fbcf6fdc46430936f5be86b0dbd77988
Signed-off-by: Grant Grundler <grundler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/39116
Reviewed-by: Mike Frysinger <vapier@chromium.org>
22 months agoclean up source a little 38/39038/2
Mike Frysinger [Sat, 1 Dec 2012 06:57:57 +0000 (01:57 -0500)]
clean up source a little

The file uses a few funcs but doesn't include their headers leading to
implicit decl warnings.

Simplify the short_options so that it isn't a pointer to a const string,
but the address of the const string itself.

Further, write does not reset errno if things work correctly.  So relying
on it being zeroed first (or for write to zero it out) is incorrect. So
check the return value of write itself to see when an error happens.

BUG=chrome-os-partner:9403
TEST=`make` still works and is less warningful

Change-Id: I68b5cad2f92de26c869b9dfe7022550bbef24a5a
Reviewed-on: https://gerrit.chromium.org/gerrit/39038
Reviewed-by: Doug Anderson <dianders@chromium.org>
Commit-Ready: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
22 months agorespect proper build flags 37/39037/2
Mike Frysinger [Sat, 1 Dec 2012 06:57:12 +0000 (01:57 -0500)]
respect proper build flags

BUG=chrome-os-partner:9403
TEST=`make` worked and respected all flags

Change-Id: Ib9c73fa9ad55cd58f479023711f4a9c04caea1bc
Reviewed-on: https://gerrit.chromium.org/gerrit/39037
Reviewed-by: Doug Anderson <dianders@chromium.org>
Commit-Ready: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
22 months agoCHROMIUMOS: daisydog: set daisydog daemon to highest scheduling prio 91/38491/6
Grant Grundler [Tue, 20 Nov 2012 00:45:36 +0000 (16:45 -0800)]
CHROMIUMOS: daisydog: set daisydog daemon to highest scheduling prio

Make sure daisydog gets to run when it needs to. Won't catch "live lock"
scenarios in user space - so might want to reduce that value in the
future.

BUG=chrome-os-partner:9403
TEST=manual (install and observe behavior)

Change-Id: I7ec4c935a0e5aa882af24e774d8c3b343e7c61b4
Signed-off-by: Grant Grundler <grundler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/38491
Reviewed-by: Doug Anderson <dianders@chromium.org>
22 months agoCHROMIUMOS: daisydog: get gcc src/dst correct in Makefile 90/38490/6
Grant Grundler [Tue, 20 Nov 2012 00:42:39 +0000 (16:42 -0800)]
CHROMIUMOS: daisydog: get gcc src/dst correct in Makefile

Source and destination were reverse in the Makefile

BUG=chrome-os-partner:9403
TEST=emerge-daisy daisydog

Change-Id: I10243f282d71f10c3ef591d86869502fef4cec53
Signed-off-by: Grant Grundler <grundler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/38490
Reviewed-by: Doug Anderson <dianders@chromium.org>
22 months agoCHROMIUMOS: daisydog: convert test/demo code to a daemon 89/38489/4
Grant Grundler [Tue, 20 Nov 2012 00:12:26 +0000 (16:12 -0800)]
CHROMIUMOS: daisydog: convert test/demo code to a daemon

Chromium.org copyright was missing.
Setup main loop so we would determine HW watchdog reset interval and pet
more often than that. :)

BUG=chrome-os-partner:9403
TEST=manual

Change-Id: I399e010b6ebefdd164572952a056a28b6a726371
Signed-off-by: Grant Grundler <grundler@chromium.org>
23 months agoCHROMIUMOS: diasydog: set repo upload test preferences 88/38488/1
Grant Grundler [Wed, 21 Nov 2012 23:09:07 +0000 (15:09 -0800)]
CHROMIUMOS: diasydog: set repo upload test preferences

Stop repo from whining about GPL license and use of tabs.

BUG=chrome-os-partner:9403
TEST=manual (upload)

Change-Id: I5cd7c2f48669b7316b905406a8a19bd5b711e603
Signed-off-by: Grant Grundler <grundler@chromium.org>
23 months agoCHROMIUMOS: add daisydog - "simple" watchdog 21/38221/1
Grant Grundler [Thu, 15 Nov 2012 01:28:10 +0000 (17:28 -0800)]
CHROMIUMOS: add daisydog - "simple" watchdog

daisydog.c GPL code is from:
   http://embeddedfreak.wordpress.com/2010/08/23/howto-use-linux-watchdog/

Will modify to turn this into a daemon instead of demo/test program.

BUG=chrome-os-partner:9403
TEST=initial version - not used anywhere yet

Signed-off-by: Grant Grundler <grundler@chromium.org>