edison-fw / meta-intel-edison

Here is the meta-intel-edison that builds, tries to stay up to date. Master is based on Yocto Poky Gatesgarth LTS 5.10.yy vanilla kernels. It builds a 32bit kernel (Gatesgarth branch 64bit) with ACPI enabled and corresponding rootfs. Telegram group: https://t.me/IntelEdison Web-site:
https://edison-fw.github.io/meta-intel-edison/
MIT License
60 stars 37 forks source link

enabling CONFIG_WATCHDOG_NOWAYOUT=y in kernel does not work #69

Closed razvan-becheriu closed 4 years ago

razvan-becheriu commented 4 years ago

I have enabled CONFIG_WATCHDOG_NOWAYOUT=y in kernel config, but when I start the watchdog service and stop it, I'd expect a reboot after 60 sec. However, the watchdog timer is stopped, just like I would have not enabled CONFIG_WATCHDOG_NOWAYOUT at all.

htot commented 4 years ago

Maybe that is something @andy-shev can answer?

htot commented 4 years ago

Eh, how do you enable it? Did you make a kernel fragment?

razvan-becheriu commented 4 years ago

as described in intel edison configure kernel documentation: https://software.intel.com/en-us/node/593593

razvan-becheriu commented 4 years ago

If I just kill the service process (using kill -9) the board reboots, but stopping the service should not stop the watchdog.

htot commented 4 years ago

as described in intel edison configure kernel documentation: https://software.intel.com/en-us/node/593593

We have made some changes to more closely follow the Yocto way. It is documented here: https://htot.github.io/meta-intel-edison/5.1-Bitbake-tricks#configuring-the-kernel-and-grab-the-kernel-fragment

htot commented 4 years ago

Afaiu the service interacts with the systemd sw watchdog. CONFIG_WATCHDOG_NOWAYOUT is a hw watchdog controlled by the kernel? I don't know how these interact.

razvan-becheriu commented 4 years ago

hm..I am certain that it works the way I build it. I have enabled other flags, like: CONFIG_RFKILL_GPIO=y CONFIG_SENSORS_CORETEMP=y CONFIG_INTEL_MFLD_THERMAL=y CONFIG_PANIC_TIMEOUT=10 CONFIG_IKCONFIG=y CONFIG_IKCONFIG_PROC=y CONFIG_WATCHDOG_NOWAYOUT=y CONFIG_WATCHDOG_SYSFS=y

the only one not working is the CONFIG_WATCHDOG_NOWAYOUT.

htot commented 4 years ago

Ok.

But the intel instructions shouldn't be working afaik. The defconfig from the kernel is used on each build (bitbake linux-yocto -c cleansstate deletes the whole linux directory) if all is well.

So either you need to switch to your own kernel fork and put all your patches on top. Or tell the recipe to apply the fragments (is like a patch for .config) on each checkout of the kernel.

I did notice unpredictable behavior in the past when the checked out kernel is locally modified and gave up on working that way.

razvan-becheriu commented 4 years ago

Ok. But as I have said, I can retrieve the kernel config at runtime doing zcat /proc/config.gz and I can see the flag enabled. I am only curious about the intel watchdog. As you have said, it seems to be implemented in software (kernel doing panic) instead on hw. Either way, the flag should work. Maybe you can also give some insight related to watchdog-sample service, which I think is implemented in hw.

Thanks

htot commented 4 years ago

Ok, so the flag is set.The watchtdog sample code refers to systemd sw watchdog: https://github.com/edison-fw/meta-intel-edison/blob/master/meta-intel-edison-distro/recipes-support/watchdog-sample/watchdog-sample/watchdog-sample.c.

That's all I know, sorry.

andy-shev commented 4 years ago

I see. Driver doesn't support it. I will send soon a patch, please test.

razvan-becheriu commented 4 years ago

Hi, I want to test the patch, but I don't know how.

I have added a file meta-intel-edison-bsp/recipes-kernel/linux/linux-yocto_5.0.0.bbappend

and added the patch in the files directory but the patch can not be applied

I have also modified the already existing file: meta-intel-edison-bsp/recipes-kernel/linux/files/0001-serial-8250_dma-use-linear-buffer-for-transmit.patch

but it seems that it is unable to apply the patch. What is the procedure (the easiest, I don't want to create another recipe or alternative platform).

I only have a fork for meta-intel-edison

thank you.

razvan-becheriu commented 4 years ago

nevermind. I was able to apply the patch by modifying: meta-intel-edison-bsp/recipes-kernel/linux/linux-yocto_5.0.0.bb

adding another line: SRC_URI_append = " file://0001-no_way_out.patch"

testing now

razvan-becheriu commented 4 years ago

it works!

thanks!

razvan-becheriu commented 4 years ago

unrelated question:

does Intel Edison board has a HW watchdog as well?

htot commented 4 years ago

nevermind. I was able to apply the patch by modifying: meta-intel-edison-bsp/recipes-kernel/linux/linux-yocto_5.0.0.bb

adding another line: SRC_URI_append = " file://0001-no_way_out.patch"

testing now

This is exactly how I do it.

htot commented 4 years ago

it works!

thanks!

You mean the patch works as you expect? If so, you might want to add you test-by: tag?

BTW this is also where you would add a kernel fragment (see the other *.cfg files in the files directory) to enable CONFIG_WATCHDOG_NOWAYOUT.

If you send a PR for the linux-yocto recipe I'll take it.

razvan-becheriu commented 4 years ago

What do you mean add my test by tag?

I am not sure if people would like this enabled by default. Usually, on reboot, systemd waits for 1:30/1:35 (90s/95s) for services to exit. This would cause a watchdog reset on some reboots. Also, if this is disabled in the kernel, the watchdog service is just stopped on systemd reboot sequence and the watchdog counter is disabled so a forced reboot caused by the watchdog is never executed. If you want to enable this by default, we should also extend the watchdog timer to at lease 120s to allow a gratuitous shutdown.

On Wed, Sep 25, 2019 at 10:30 PM Ferry Toth notifications@github.com wrote:

it works!

thanks!

You mean the patch works as you expect? If so, you might want to add you test-by: tag?

BTW this is also where you would add a kernel fragment (see the other *.cfg files in the files directory) to enable CONFIG_WATCHDOG_NOWAYOUT.

If you send a PR for the linux-yocto recipe I'll take it.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/edison-fw/meta-intel-edison/issues/69?email_source=notifications&email_token=AEURNW7CVC6YJIMUSFHVS23QLO355A5CNFSM4IZBWNT2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD7TCHRI#issuecomment-535176133, or mute the thread https://github.com/notifications/unsubscribe-auth/AEURNW7MU4SLMZNNSEBBGOLQLO355ANCNFSM4IZBWNTQ .

htot commented 4 years ago

Like this: https://marc.info/?l=linux-kernel&m=156942376014758&w=2

I think Andy's patch should always go in the kernel. But I see what you mean, the systemd watchdog service should be shutdown last, after all others.

andy-shev commented 4 years ago

What do you mean add my test by tag?

To tell maintainers that you have tested it and it works. See about tags in this documentation: https://www.kernel.org/doc/html/latest/process/submitting-patches.html#using-reported-by-tested-by-reviewed-by-suggested-by-and-fixes

Note, it has nothing to do with default settings.

razvan-becheriu commented 4 years ago

How about this:

Tested-by: Razvan Becheriu <razvan.becheriu@gmail.com>
The patch works.
By configuring the CONFIG_WATCHDOG_NOWAYOUT in the kernel and stopping the
watchdog.service, the board reboots.
Previously, the watchdog.service was able to disable the watchdog counter,
and no reboot was performed.

Thank you, Razvan

On Fri, Sep 27, 2019 at 9:46 AM Andy Shevchenko notifications@github.com wrote:

What do you mean add my test by tag?

To tell maintainers that you have tested it and it works. See about tags in this documentation: https://www.kernel.org/doc/html/latest/process/submitting-patches.html#using-reported-by-tested-by-reviewed-by-suggested-by-and-fixes

Note, it has nothing to do with default settings.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/edison-fw/meta-intel-edison/issues/69?email_source=notifications&email_token=AEURNW5PFVNAKRTQZUQOXL3QLWT4ZA5CNFSM4IZBWNT2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD7X5T4A#issuecomment-535812592, or mute the thread https://github.com/notifications/unsubscribe-auth/AEURNW6QAUQGSHBXOQMJ5D3QLWT4ZANCNFSM4IZBWNTQ .

andy-shev commented 4 years ago

Tested-by: Razvan Becheriu <razvan.becheriu@gmail.com> The patch works. By configuring the CONFIG_WATCHDOG_NOWAYOUT in the kernel and stopping the watchdog.service, the board reboots. Previously, the watchdog.service was able to disable the watchdog counter, and no reboot was performed.

I didn't see any email from you. Hope you will send it some time soon. The text above is good, but has to be send as a reply to my patch by email!

razvan-becheriu commented 4 years ago

I have just replied to your patch email.

Hope it is OK now.

Thank you again. Razvan

On Tue, Oct 1, 2019 at 9:22 PM Andy Shevchenko notifications@github.com wrote:

Tested-by: Razvan Becheriu razvan.becheriu@gmail.com The patch works. By configuring the CONFIG_WATCHDOG_NOWAYOUT in the kernel and stopping the watchdog.service, the board reboots. Previously, the watchdog.service was able to disable the watchdog counter, and no reboot was performed.

I didn't see any email from you. Hope you will send it some time soon. The text above is good, but has to be send as a reply to my patch by email!

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/edison-fw/meta-intel-edison/issues/69?email_source=notifications&email_token=AEURNWZESMZ63M5OTGNDDL3QMOIQFA5CNFSM4IZBWNT2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEACH4HQ#issuecomment-537165342, or mute the thread https://github.com/notifications/unsubscribe-auth/AEURNW62F3XHFPGGHNZPVVDQMOIQFANCNFSM4IZBWNTQ .

razvan-becheriu commented 4 years ago

I did send an email, but I get:

Message may contain a virus Your message wasn't delivered to linux-watchdog@vger.kernel.orgbecause it may contain a virus. Learn how to check for and prevent viruses. The response from the remote server was: 550 5.7.1 Content-Policy reject msg: The message contains HTML subpart, therefore we consider it SPAM or Outlook Virus. TEXT/PLAIN is accepted.! BF:<U 0.499989>; S1726642AbfJATJI

Sent from my iPhone

On 1 Oct 2019, at 21:22, Andy Shevchenko notifications@github.com wrote:

 Tested-by: Razvan Becheriu razvan.becheriu@gmail.com The patch works. By configuring the CONFIG_WATCHDOG_NOWAYOUT in the kernel and stopping the watchdog.service, the board reboots. Previously, the watchdog.service was able to disable the watchdog counter, and no reboot was performed.

I didn't see any email from you. Hope you will send it some time soon. The text above is good, but has to be send as a reply to my patch by email!

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

andy-shev commented 4 years ago

I did send an email, but I get: The message contains HTML subpart, therefore we consider it SPAM or Outlook Virus. TEXT/PLAIN is accepted.!

I left summary above. I hope you know how to send in plain text.

htot commented 4 years ago

I took the kernel patch and added it into the linux-yocto recipe. We are now on v5.3 and may expect this patch to go into the kernel with v5.5. CONFIG_WATCHDOG_NOWAYOUT is not enabled by default. To enable it create a kernel fragment like this Configuring the kernel and grab the kernel fragment and add the fragment to the kernel recipe.

@razvan-becheriu I force pushed this into htoth/meta-intel-edison master and warrior. Eventually this will go into edison-fw. It builds but I would appreciate if you test it..

andy-shev commented 4 years ago

Can somebody ping maintainers about it? @razvan-becheriu, we may have even chance to get it into v5.4 if you have a good justification.

razvan-becheriu commented 4 years ago

Hi,

No need to hurry. I was interested in thud version. If this is going into warrior version, then it is the same for me if it is 5.4 or 5.5. I'll use custom 'patch-file' in my thud version.

Regards, Razvan

On Mon, Oct 28, 2019 at 12:22 PM Andy Shevchenko notifications@github.com wrote:

Can somebody ping maintainers about it? @razvan-becheriu https://github.com/razvan-becheriu, we may have even chance to get it into v5.4 if you have a good justification.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/edison-fw/meta-intel-edison/issues/69?email_source=notifications&email_token=AEURNW7MUBFPQHJBJL7MH4TQQ24NLA5CNFSM4IZBWNT2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOECMMJOI#issuecomment-546882745, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEURNWYJGH5ZQAF7BY336X3QQ24NLANCNFSM4IZBWNTQ .

htot commented 4 years ago

You can cherry-pick this patch on top of thud ec3327e294cb6e0012faffb8e73a8a63a885c674

andy-shev commented 4 years ago

JFYI: patch on its way to Torvalds' tree.

htot commented 4 years ago

I believe this is fixed, so closing.