Watchdog driver for the 410c?


#1

I’m using the Linaro kernel on my Dragonboard, and it looks like there’s no watchdog driver configured into the kernel, nor any device tree entry for the db410c for a watchdog device. Does anyone have any pointers to patches for watchdog support?


#2

Hi @madisox,

The word watchdog is heavily used for many purpose and I am not sure this will fit your usage.

There is SP805 in ARM SoC.
http://infocenter.arm.com/help/topic/com.arm.doc.ddi0270b/DDI0270.pdf

It requires to have the kernel config.
ARM_SP805_WATCHDOG

This is for other SoC but it should be similar to add device tree entry to DB410C.
https://lkml.org/lkml/2016/2/10/32


#3

Thanks.

I’m looking for a system watchdog - one that will reboot/reset the board if the software hangs. From looking at the HRD, I thought that would be the APCS_KPSS_WDT watchdog… and it looks like that’s the one used in the Android kernel, if I’m reading things right.

I’ve experimented with modifying drivers/watchdog/qcom-wdt.c slightly and putting an entry in the device tree to use that driver; unfortunately, that hasn’t worked.


#4

Its an old thread but answering this might be useful for new users.

For enabling the software watchdog we need to follow the following steps.

  1. download kernel source.
  2. run make menu config or make xconfig after setting up the environment variables ARCH and compiler.
  3. enable software watch dog timer.
  4. flash the kernel to dragonboard.
  5. use application to initialize the timer by opening the device /dev/watchdog.
    6 set the watchdog timer elapse interval.
  6. keep writing to the device to reset the timer. This could be done either through IOCTL or by directly writing to the device file.

#5

I am still facing issue in configuring watchdog in Linux Open-embedded build.

Below are the kernel messages:
root@dragonboard-410c:~# echo V > /dev/watchdog[ 45.261467] watchdog: watchdog0: nowayout prevents watchdog being stopped!

root@dragonboard-410c:~# [ 105.521784] softdog: Initiating system reboot
[ 105.521886] SMP: stopping secondary CPUs

It seems like, "_emergency_restart(); " function in softdog.c is getting called but system does not restart.

Does any one has implemented watchdog support for DB410C ?


#6

SysRq-B will end up calling code similar to emergency_restart(). What happens if you try:
echo b > /proc/sysrq-trigger


#7

Hi danielt,

I have tried “echo b > /proc/sysrq-trigger” command and get response as mentioned below-

root@dragonboard-410c:~# echo b > /proc/sysrq-trigger[ 59.047102] sysrq: SysRq :
[ 59.051205] SMP: stopping secondary CPUs

Looks like after applying this command processor is in reset state, i.e board get shutdown and never restart again.

As per theory it should restart right ?
Please correct me if i am wrong,

Keval


#8

More than should restart… on Debian 17.06.01 is does restart or at least it does for me… I tested before I posted yesterday.

Can you double check the behaviour with latest Debian? It would be good to know if your problem is kernel related or something to do with your board.


#9

Hi daniel,

I have tried on with Debian 17.06.01 release.
i.e i have flashed “boot-linaro-stretch-qcom-snapdragon-arm64-20170628-252.img” and “linaro-stretch-developer-qcom-snapdragon-arm64-20170628-252.img” images.

After boot i applied bellow command:
echo c > /proc/sysrq-trigger

But it does not restart.
Below are the kernel messages after the command:

root@linaro-developer:~# echo c > /proc/sysrq-trigger
[ 40.114909] sysrq: SysRq : Trigger a crash
[ 40.116738] Unable to handle kernel NULL pointer dereference at virtual address 00000000
[ 40.119253] pgd = ffff80002d991000
[ 40.126822] [00000000] *pgd=00000000b4af0003[ 40.129606] , *pud=00000000b4b39003
, *pmd=0000000000000000[ 40.136953]
[ 40.140142] Internal error: Oops: 96000046 [#1] PREEMPT SMP
[ 40.140882] Modules linked in: btqcomsmd btqca arc4 wcn36xx mac80211 bluetooth cfg80211 venus_enc venus_dec qcom_wcnss_pil msm_rng qcom_cams
[ 40.170450] CPU: 3 PID: 2376 Comm: bash Tainted: G W 4.9.34-linaro-lt-qcom #1
[ 40.170977] Hardware name: Qualcomm Technologies, Inc. APQ 8016 SBC (DT)
[ 40.179052] task: ffff800034a23400 task.stack: ffff80002d96c000
[ 40.185878] PC is at sysrq_handle_crash+0x20/0x30
[ 40.191448] LR is at sysrq_handle_crash+0xc/0x30
[ 40.196300] pc : [] lr : [] pstate: 60000145
[ 40.201136] sp : ffff80002d96fd30
[ 40.208290] x29: ffff80002d96fd30 x28: ffff80002d96c000
[ 40.216448] x27: ffff000008a32000 x26: 0000000000000040
[ 40.221742] x25: 0000000000000123 x24: 0000000000000015
[ 40.227038] x23: 0000000000000000 x22: 0000000000000007
[ 40.232333] x21: ffff00000904b748 x20: 0000000000000063
[ 40.237628] x19: ffff000008fce000 x18: 0000000000000010
[ 40.242923] x17: 0000ffff93cca110 x16: ffff0000081e40b0
[ 40.248217] x15: 0000000000000006 x14: 00000000fffffff0
[ 40.253514] x13: 0000000000000000 x12: 0000000000000007
[ 40.258809] x11: 00000000000001cb x10: 0000000000000006
[ 40.264103] x9 : 00000000000001cb x8 : 0000000000000001
[ 40.269399] x7 : 0000000000000008 x6 : 0000000000000001
[ 40.274694] x5 : 0000000000000000 x4 : 0000000000000000
[ 40.279989] x3 : 0000000000000000 x2 : ffff80002d96c000
[ 40.285284] x1 : 0000000000000000 x0 : 0000000000000001
[ 40.290577]
[ 40.290831] Process bash (pid: 2376, stack limit = 0xffff80002d96c020)
[ 40.292673] Stack: (0xffff80002d96fd30 to 0xffff80002d970000)
[ 40.298969] fd20: ffff80002d96fd40 ffff0000084f8f0c
[ 40.304902] fd40: ffff80002d96fd80 ffff0000084f9370 0000000000000002 fffffffffffffffb
[ 40.312714] fd60: 0000000000000000 ffff80002d96feb8 000000002f92f808 0000000000000015
[ 40.320527] fd80: ffff80002d96fda0 ffff000008248d3c ffff800035abe600 ffff8000366a0f00
[ 40.328338] fda0: ffff80002d96fdc0 ffff0000081e1f04 0000000000000002 ffff8000354ce900
[ 40.336151] fdc0: ffff80002d96fe40 ffff0000081e2d0c 0000000000000002 ffff8000354ce900
[ 40.343963] fde0: ffff800034acca00 000000000000000a ffff80002d96fe20 ffff0000081e2aa4
[ 40.351777] fe00: ffff8000354ce900 0000000000000001 000000002f92f808 ffff80002d96feb8
[ 40.359590] fe20: ffff80002d96fe40 ffff0000081e2dd0 0000000000000002 ffff8000354ce900
[ 40.367402] fe40: ffff80002d96fe80 ffff0000081e40f4 ffff8000354ce900 ffff8000354ce900
[ 40.375214] fe60: 000000002f92f808 0000000000000002 0000000020000000 ffff000008082ef0
[ 40.393455] fe80: 0000000000000000 ffff000008082ef0 0000000000000000 000000002f92f808
[ 40.404339] fea0: ffffffffffffffff 0000ffff93d1ddf8 0000000000000000 0000000000000000
[ 40.415263] fec0: 0000000000000001 000000002f92f808 0000000000000002 0000000000000000
[ 40.426071] fee0: 0000000000000888 5551000454000000 000000002f93d288 0000000000000001
[ 40.436638] ff00: 0000000000000040 0000000000000000 0000000000000000 0000000000000020
[ 40.446993] ff20: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
[ 40.457081] ff40: 0000000000000000 0000ffff93cca110 0000000000000000 0000000000000002
[ 40.466928] ff60: 000000002f92f808 0000ffff93da7480 0000000000000002 0000ffff93da3638
[ 40.476662] ff80: 0000000000000002 0000000000000000 0000000000000000 0000000000000000
[ 40.486079] ffa0: 0000ffffd3a94684 0000ffffd3a94500 0000ffff93ccd2e8 0000ffffd3a94500
[ 40.495168] ffc0: 0000ffff93d1ddf8 0000000020000000 0000000000000001 0000000000000040
[ 40.503924] ffe0: 0000000000000000 0000000000000000 2a8a2a2a8a8aa2aa 8aaaaa8aaaaaaa2a
[ 40.512578] Call trace:
[ 40.519413] Exception stack(0xffff80002d96fb60 to 0xffff80002d96fc90)
[ 40.522262] fb60: ffff000008fce000 0001000000000000 ffff80002d96fd30 ffff0000084f8848
[ 40.527684] fb80: 0000000000000004 ffff000009107000 000000000000000f 000000000000000a
[ 40.535549] fba0: ffff80002d96fbc0 ffff000008106814 ffff000008d2eab8 0000000108fcee80
[ 40.543325] fbc0: ffff80002d96fc60 ffff000008106adc ffff000008fce000 0000000000000063
[ 40.551082] fbe0: ffff00000904b748 0000000000000007 0000000000000000 0000000000000015
[ 40.558910] fc00: 0000000000000001 0000000000000000 ffff80002d96c000 0000000000000000
[ 40.566727] fc20: 0000000000000000 0000000000000000 0000000000000001 0000000000000008
[ 40.574540] fc40: 0000000000000001 00000000000001cb 0000000000000006 00000000000001cb
[ 40.582357] fc60: 0000000000000007 0000000000000000 00000000fffffff0 0000000000000006
[ 40.590173] fc80: ffff0000081e40b0 0000ffff93cca110
[ 40.597997] [] sysrq_handle_crash+0x20/0x30
[ 40.602729] [] __handle_sysrq+0x124/0x198
[ 40.608637] [] write_sysrq_trigger+0x58/0x68
[ 40.614054] [] proc_reg_write+0x64/0x90
[ 40.619989] [] __vfs_write+0x1c/0x100
[ 40.625486] [] vfs_write+0x9c/0x1b0
[ 40.630548] [] SyS_write+0x44/0xa0
[ 40.635769] [] el0_svc_naked+0x24/0x28
[ 40.640832] Code: 52800020 b90cd820 d5033e9f d2800001 (39000020)
[ 40.646302] —[ end trace 07a5d343ff0e1cf2 ]—

Message from syslogd@linaro-developer at Nov 3 17:17:14 …
kernel:[ 40.140142] Internal error: Oops: 96000046 [#1] PREEMPT SMP

Message from syslogd@linaro-developer at Nov 3 17:17:14 …
kernel:[ 40.290831] Process bash (pid: 2376, stack limit = 0xffff80002d96c020)

Message from syslogd@linaro-developer at Nov 3 17:17:14 …
kernel:[ 40.292673] Stack: (0xffff80002d96fd30 to 0xffff80002d970000)

Message from syslogd@linaro-developer at Nov 3 17:17:14 …
kernel:[ 40.298969] fd20: ffff80002d96fd40 ffff0000084f8f0c

Message from syslogd@linaro-developer at Nov 3 17:17:14 …
kernel:[ 40.304902] fd40: ffff80002d96fd80 ffff0000084f9370 0000000000000002 fffffffffffffffb

Message from syslogd@linaro-developer at Nov 3 17:17:14 …
kernel:[ 40.312714] fd60: 0000000000000000 ffff80002d96feb8 000000002f92f808 0000000000000015

Message from syslogd@linaro-developer at Nov 3 17:17:14 …
kernel:[ 40.320527] fd80: ffff80002d96fda0 ffff000008248d3c ffff800035abe600 ffff8000366a0f00

Message from syslogd@linaro-developer at Nov 3 17:17:14 …
kernel:[ 40.328338] fda0: ffff80002d96fdc0 ffff0000081e1f04 0000000000000002 ffff8000354ce900

Message from syslogd@linaro-developer at Nov 3 17:17:14 …
kernel:[ 40.336151] fdc0: ffff80002d96fe40 ffff0000081e2d0c 0000000000000002 ffff8000354ce900

Message from syslogd@linaro-developer at Nov 3 17:17:14 …
kernel:[ 40.343963] fde0: ffff800034acca00 000000000000000a ffff80002d96fe20 ffff0000081e2aa4

Message from syslogd@linaro-developer at Nov 3 17:17:14 …
kernel:[ 40.351777] fe00: ffff8000354ce900 0000000000000001 000000002f92f808 ffff80002d96feb8
[ 40.652219] Kernel panic - not syncing: Fatal exception

Message from syslogd@linaro-developer at Nov 3 17:17:14 …
kernel:[ 40.359590] fe20: ffff80002d96fe40 ffff0000081e2dd0 0000000000000002 ffff8000354ce900

Message from syslogd@linaro-developer at Nov 3 17:17:14 …
kernel:[ 40.367402] fe40: ffff80002d96fe80 ffff0000081e40f4 ffff8000354ce900 ffff8000354ce900

Message from syslogd@linaro-developer at Nov 3 17:17:14 …
kernel:[ 40.375214] fe60: 000000002f92f808 0000000000000002 0000000020000000 ffff000008082ef0

Message from syslogd@linaro-developer at Nov 3 17:17:14 …
kernel:[ 40.393455] fe80: 0000000000000000 ffff000008082ef0 0000000000000000 000000002f92f808

Message from syslogd@linaro-developer at Nov 3 17:17:14 …
kernel:[ 40.404339] fea0: ffffffffffffffff 0000ffff93d1ddf8 0000000000000000 0000000000000000

Message from syslogd@linaro-developer at Nov 3 17:17:14 …
kernel:[ 40.415263] fec0: 0000000000000001 000000002f92f808 0000000000000002 0000000000000000

Message from syslogd@linaro-developer at Nov 3 17:17:14 …
kernel:[ 40.426071] fee0: 0000000000000888 5551000454000000 000000002f93d288 0000000000000001

Message from syslogd@linaro-developer at Nov 3 17:17:14 …
kernel:[ 40.436638] ff00: 0000000000000040 0000000000000000 0000000[ 40.815765] Kernel Offset: disabled

And stuck over there never restart.

Kindly let me know if i missing anything ?

regards.


#10

I think you have mis-remembered the correct SysRq code!
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/admin-guide/sysrq.rst#n83


#11

Hi daniel,

I tried again , i have applied “echo b > /proc/sysrq-trigger” which works for me.
So, as i mentioned earlier i wanted to achieve watchdog functionality in open-embedded release.

Now we are clear that in linaro, this functionality works i.e not an issue of hardware.So, problem is looks like something kernel related.

Do you have any pointer, where should i have to look into code ?

Regards,
Keval


#12

After many months of having this on the back burner, I finally did track down what I was looking for. The watchdog timer in the PM8916 does exactly what I need. I had to write a driver for it myself, but that wasn’t too difficult.


#13

Any chance you could share this driver ?