From: Stefan Roese Date: Tue, 2 Jun 2020 16:53:10 +0200 Subject: [PATCH 0/3] watchdog: honour hw_margin_ms property In-Reply-To: References: <39e2b876-6ba1-59b6-4ddd-068e120f9b4e@denx.de> <20200313160458.19727-1-rasmus.villemoes@prevas.dk> <296630eb-e529-6abf-0e8c-92644827c2ca@denx.de> Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 02.06.20 15:29, Rasmus Villemoes wrote: > On 16/03/2020 16.52, Rasmus Villemoes wrote: >> On 14/03/2020 13.04, Stefan Roese wrote: >>> On 13.03.20 17:04, Rasmus Villemoes wrote: >> >>>> That at least solves half my problems and >>>> might be useful to others as well. Then I'll have to figure out the >>>> time-stands-still problem in some other way. >>> >>> If its too hard to enable interrupts in SPL for you or to provide some >>> other means of a working get_timer() API, then we needto find another >>> solution. You started with this weak function, which of course works. >>> What other options are there? Adding a callback mechanism to register >>> platform specific callback functions? Even though this might get a >>> little bit too complicated. >> >> Now that I dig a bit more into this, I seem to remember that we actually >> also had problems in U-Boot proper when loading a compressed kernel, so >> for now we're using an uncompressed kernel in our FIT images. I will >> have to re-investigate, but it now occurs to me that it might be due to >> the fact that interrupts get disabled during bootm (which makes sense, >> the same reason I stated previously of interrupt vectors about to be >> overwritten), so even in U-Boot proper, time as measured by get_timer() >> ceases to pass after that point, so all the WATCHDOG_RESET() calls from >> the inflate code effectively get ignored. >> >> So it may be necessary to have some wdt_ratelimit_disable() hook that >> can be called from bootm_disable_interrupts() and e.g. some >> board-specific SPL code. I'll do some experiments and figure out if I do >> indeed need such a hook. > > OK, I have now had time to do some more experiments. I have enabled the > timer tick in SPL, so get_timer() now "normally" works. Together with > the .dts based read of the hardware margin, that makes the watchdog > handling mostly work. > > But, as I suspected, I do have a problem when loading a compressed > kernel image - what I write above "so even in U-Boot proper, time as > measured by get_timer() ceases to pass after that point, so all the > WATCHDOG_RESET() calls from the inflate code effectively get ignored." > is indeed the case. > > So, what's the best way to proceed? Should there be a hook disabling the > rate-limiting logic that bootm_disable_interrupts() can call? Or must > get_timer() always return a sensible result even with interrupts disabled? Wouldn't it make sense to move the bootm_disable_interrupts() call to after loading and uncompressing the OS image? To right before jumping to the OS? Thanks, Stefan