Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

boot type is always 0 #10

Closed
mpvader opened this issue Dec 14, 2015 · 14 comments
Closed

boot type is always 0 #10

mpvader opened this issue Dec 14, 2015 · 14 comments
Assignees

Comments

@mpvader
Copy link
Contributor

mpvader commented Dec 14, 2015

Seeing watchdog reboots is valuable for quality purposes.

For the CCGX, we have a mechanism to read the boot type, using IOCTL with WDIOC_GETBOOTSTATUS:
https://git.victronenergy.com/ccgx/meta-ccgx/blob/master/recipes-extended/watchdog/files/get_boot_type.c

Output (/tmp/last_boot_type) is then read by vrmlogger.py. Which then overwrittes it with a result code, and sends it to vrmportal.

On bbb the contents of /tmp/last_boot_type is 0, both on normal power up and after a reboot.

Definition of the numbers written to /tmp/last_boot_type are:
0=Old kernel, no boottype support;
1=Normal boot;
17=Watchdog reboot;
-1=Reading watchdog register failed (generated by get_boot_type);
-2=Reading tmp file failed (generated by vrmlogger.py)
-3=Reading tmp file succeeded (generated by vrmlogger.py, and used to make sure that boottype is only sent to the portal once)

@mpvader
Copy link
Contributor Author

mpvader commented Dec 15, 2015

This patch is probably how we fixed / used this on the ccgx:
victronenergy/linux@ca732e7

I would expect there to be a more mainstream solution in sysfs or proc which we should use on the bbb and other future hardware

@luctius
Copy link

luctius commented Aug 24, 2016

Right now I get '-3' on a clean power-up and '0' after a soft reboot.

@mpvader
Copy link
Contributor Author

mpvader commented Aug 24, 2016

Yes, I see I missed that code when making the list above. I hadded -3 now. For background, see:
https://git.victronenergy.com/ccgx/dbus_vrm/blob/master/vrmlogger.py#L96.

So to test this, disable the vrmlogger:

touch /service/vrmlogger/down

@luctius
Copy link

luctius commented Aug 24, 2016

Status at this moment is that the watchdog driver (omap_wdt.c) for this kernel does not implement an ioctl or sysfs interface to retrieve the boot status. Thus the generic wdt ioctl interface is called and that one will always reply '0' to an boot status (WDIOC_GETBOOTSTATUS) ioctl, hence our problem.

@mpvader mpvader changed the title bbb: boot type is always 0 boot type is always 0 Sep 6, 2016
@mpvader
Copy link
Contributor Author

mpvader commented Sep 14, 2016

The CCGX (TI AM3517) boot statuses are detailed in chapter 4.12.2.11.3 of the technical reference manual.

Looking the VRM database, out of thousands of CCGX-es, there are only two reporting status 2. Which is Global software reset occurred.

@mpvader
Copy link
Contributor Author

mpvader commented Oct 16, 2016

@luctius: you posted an email to a mailing list somewhere for this, right? Please post a link to that email in the ML archive here in this issue.

@mpvader
Copy link
Contributor Author

mpvader commented Dec 6, 2016

@luctius fixed it:
https://github.com/victronenergy/linux/commits/omap-wdt-bootstatus

waiting for test and inclusion in master.

@mpvader mpvader added this to the bbb: first release milestone Dec 6, 2016
@mpvader mpvader assigned mansr and unassigned luctius Dec 14, 2016
@mansr
Copy link
Collaborator

mansr commented Jan 11, 2017

With those patches applied on the beaglebone, I get these values:
reset button: 0
cold boot: 1
reboot command: 2
watchdog reset: 16

@mpvader
Copy link
Contributor Author

mpvader commented Jan 11, 2017

@mansr thanks. So unfortunately those values do not entirely match up to CCGX list. Which has become our enum definition, also in the frontend (vrm portal & database).

So I'd like to keep, and extend, our already existing list to keep all values unique. Which means shifting some of the Beaglebone boot-reasons around..

See table below for my proposal. Codes 3, 4 and 5 are the new ones.

code description generic ccgx beaglebone
-3 tmp file already read, vrmlogger restarted!? x
-2 Reading tmp file failed x
-1 Reading watchdog register failed x
0 Old kernel, no boottype support x
1 Cold boot or reboot x
2 Unreproducable reset on CCGX x
3 Reset button x
4 Cold boot x
5 Reboot command x
17 Watchdog reboot x x
29997 Max load avg exceeded x
30012 watchdog-ENOMEM x

Can you arrange this? For example by making a beaglebone specific implementation of get_boot_type.c; or another way you think is best.

In case you are wondering where 29997 and 30012 are coming from, see the init script in that same recipe.

Make sure to add a link to this issue in the commit.

And can you also add the necessary kernel changes to the linux branch we are currently at? While at that, pls see if you can review & add the commits made for #105 while at it.

mansr pushed a commit to victronenergy/linux that referenced this issue Jan 20, 2017
mansr pushed a commit to victronenergy/linux that referenced this issue Jan 20, 2017
@jhofstee
Copy link
Contributor

linux now reports the reboot in 2.01~10. We still need to translate the values though..

mansr added a commit to victronenergy/meta-victronenergy that referenced this issue Jan 24, 2017
mansr added a commit to victronenergy/meta-victronenergy that referenced this issue Jan 25, 2017
@mansr
Copy link
Collaborator

mansr commented Jan 25, 2017

Translation added to get_boot_type.

@mpvader
Copy link
Contributor Author

mpvader commented Jan 29, 2017

@mpvader mpvader assigned jhofstee and unassigned mansr Jan 29, 2017
mansr pushed a commit to victronenergy/linux that referenced this issue Jan 31, 2020
mansr pushed a commit to victronenergy/linux that referenced this issue Jan 31, 2020
mansr pushed a commit to victronenergy/linux that referenced this issue Feb 16, 2020
mansr pushed a commit to victronenergy/linux that referenced this issue Feb 16, 2020
mansr pushed a commit to victronenergy/linux that referenced this issue Mar 3, 2021
mansr pushed a commit to victronenergy/linux that referenced this issue Mar 3, 2021
mansr pushed a commit to victronenergy/linux that referenced this issue Mar 3, 2021
mansr pushed a commit to victronenergy/linux that referenced this issue Mar 3, 2021
mansr pushed a commit to victronenergy/linux that referenced this issue Mar 7, 2021
mansr pushed a commit to victronenergy/linux that referenced this issue Mar 7, 2021
mansr pushed a commit to victronenergy/linux that referenced this issue Mar 8, 2021
mansr pushed a commit to victronenergy/linux that referenced this issue Mar 8, 2021
mansr pushed a commit to victronenergy/linux that referenced this issue Mar 25, 2021
mansr pushed a commit to victronenergy/linux that referenced this issue Mar 25, 2021
mansr pushed a commit to victronenergy/linux that referenced this issue Apr 30, 2021
mansr pushed a commit to victronenergy/linux that referenced this issue Apr 30, 2021
mansr pushed a commit to victronenergy/linux that referenced this issue Jun 3, 2021
mansr pushed a commit to victronenergy/linux that referenced this issue Jun 3, 2021
mansr pushed a commit to victronenergy/linux that referenced this issue Mar 9, 2022
mansr pushed a commit to victronenergy/linux that referenced this issue Mar 9, 2022
mansr pushed a commit to victronenergy/linux that referenced this issue Mar 11, 2022
mansr pushed a commit to victronenergy/linux that referenced this issue Mar 11, 2022
jhofstee pushed a commit to victronenergy/linux that referenced this issue Apr 4, 2022
jhofstee pushed a commit to victronenergy/linux that referenced this issue Apr 4, 2022
mansr pushed a commit to victronenergy/linux that referenced this issue Apr 4, 2022
mansr pushed a commit to victronenergy/linux that referenced this issue Apr 4, 2022
jhofstee pushed a commit to jhofstee/linux that referenced this issue Sep 9, 2022
mansr pushed a commit to victronenergy/linux that referenced this issue Jul 13, 2023
mansr pushed a commit to victronenergy/linux that referenced this issue Jul 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants