* [PATCH] watchdog: aspeed: replace mdelay with msleep
@ 2024-12-12 11:30 Phil Eichinger
2024-12-12 13:56 ` Guenter Roeck
0 siblings, 1 reply; 4+ messages in thread
From: Phil Eichinger @ 2024-12-12 11:30 UTC (permalink / raw)
To: wim, linux, joel, andrew, linux-watchdog, linux-arm-kernel,
linux-aspeed, linux-kernel
Cc: Phil Eichinger
Since it is not called in an atomic context the mdelay function
can be replaced with msleep to avoid busy wait.
Signed-off-by: Phil Eichinger <phil@zankapfel.net>
---
drivers/watchdog/aspeed_wdt.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/watchdog/aspeed_wdt.c b/drivers/watchdog/aspeed_wdt.c
index b4773a6aaf8c..98ef341408f7 100644
--- a/drivers/watchdog/aspeed_wdt.c
+++ b/drivers/watchdog/aspeed_wdt.c
@@ -208,7 +208,7 @@ static int aspeed_wdt_restart(struct watchdog_device *wdd,
wdt->ctrl &= ~WDT_CTRL_BOOT_SECONDARY;
aspeed_wdt_enable(wdt, 128 * WDT_RATE_1MHZ / 1000);
- mdelay(1000);
+ msleep(1000);
return 0;
}
--
2.39.5
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] watchdog: aspeed: replace mdelay with msleep
2024-12-12 11:30 [PATCH] watchdog: aspeed: replace mdelay with msleep Phil Eichinger
@ 2024-12-12 13:56 ` Guenter Roeck
2024-12-14 21:21 ` David Laight
0 siblings, 1 reply; 4+ messages in thread
From: Guenter Roeck @ 2024-12-12 13:56 UTC (permalink / raw)
To: Phil Eichinger, wim, joel, andrew, linux-watchdog,
linux-arm-kernel, linux-aspeed, linux-kernel
On 12/12/24 03:30, Phil Eichinger wrote:
> Since it is not called in an atomic context the mdelay function
> can be replaced with msleep to avoid busy wait.
>
> Signed-off-by: Phil Eichinger <phil@zankapfel.net>
> ---
> drivers/watchdog/aspeed_wdt.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/watchdog/aspeed_wdt.c b/drivers/watchdog/aspeed_wdt.c
> index b4773a6aaf8c..98ef341408f7 100644
> --- a/drivers/watchdog/aspeed_wdt.c
> +++ b/drivers/watchdog/aspeed_wdt.c
> @@ -208,7 +208,7 @@ static int aspeed_wdt_restart(struct watchdog_device *wdd,
> wdt->ctrl &= ~WDT_CTRL_BOOT_SECONDARY;
> aspeed_wdt_enable(wdt, 128 * WDT_RATE_1MHZ / 1000);
>
> - mdelay(1000);
> + msleep(1000);
>
> return 0;
> }
This is a _restart_ handler. The only purpose of the delay is to wait
for the reset to trigger. It is not supposed to sleep.
NACK.
Guenter
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [PATCH] watchdog: aspeed: replace mdelay with msleep
2024-12-12 13:56 ` Guenter Roeck
@ 2024-12-14 21:21 ` David Laight
2024-12-14 21:46 ` Guenter Roeck
0 siblings, 1 reply; 4+ messages in thread
From: David Laight @ 2024-12-14 21:21 UTC (permalink / raw)
To: 'Guenter Roeck', Phil Eichinger, wim@linux-watchdog.org,
joel@jms.id.au, andrew@codeconstruct.com.au,
linux-watchdog@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-aspeed@lists.ozlabs.org, linux-kernel@vger.kernel.org
From: Guenter Roeck
> Sent: 12 December 2024 13:56
> To: Phil Eichinger <phil@zankapfel.net>; wim@linux-watchdog.org; joel@jms.id.au;
> andrew@codeconstruct.com.au; linux-watchdog@vger.kernel.org; linux-arm-kernel@lists.infradead.org;
> linux-aspeed@lists.ozlabs.org; linux-kernel@vger.kernel.org
> Subject: Re: [PATCH] watchdog: aspeed: replace mdelay with msleep
>
> On 12/12/24 03:30, Phil Eichinger wrote:
> > Since it is not called in an atomic context the mdelay function
> > can be replaced with msleep to avoid busy wait.
> >
> > Signed-off-by: Phil Eichinger <phil@zankapfel.net>
> > ---
> > drivers/watchdog/aspeed_wdt.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/watchdog/aspeed_wdt.c b/drivers/watchdog/aspeed_wdt.c
> > index b4773a6aaf8c..98ef341408f7 100644
> > --- a/drivers/watchdog/aspeed_wdt.c
> > +++ b/drivers/watchdog/aspeed_wdt.c
> > @@ -208,7 +208,7 @@ static int aspeed_wdt_restart(struct watchdog_device *wdd,
> > wdt->ctrl &= ~WDT_CTRL_BOOT_SECONDARY;
> > aspeed_wdt_enable(wdt, 128 * WDT_RATE_1MHZ / 1000);
> >
> > - mdelay(1000);
> > + msleep(1000);
> >
> > return 0;
> > }
> This is a _restart_ handler. The only purpose of the delay is to wait
> for the reset to trigger. It is not supposed to sleep.
With the recent scheduler changes isn't the code likely to get
pre-empted?
Which (effectively) converts is to a sleep?
David
>
> NACK.
>
> Guenter
>
>
>
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] watchdog: aspeed: replace mdelay with msleep
2024-12-14 21:21 ` David Laight
@ 2024-12-14 21:46 ` Guenter Roeck
0 siblings, 0 replies; 4+ messages in thread
From: Guenter Roeck @ 2024-12-14 21:46 UTC (permalink / raw)
To: David Laight, Phil Eichinger, wim@linux-watchdog.org,
joel@jms.id.au, andrew@codeconstruct.com.au,
linux-watchdog@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-aspeed@lists.ozlabs.org, linux-kernel@vger.kernel.org
On 12/14/24 13:21, David Laight wrote:
> From: Guenter Roeck
>> Sent: 12 December 2024 13:56
>> To: Phil Eichinger <phil@zankapfel.net>; wim@linux-watchdog.org; joel@jms.id.au;
>> andrew@codeconstruct.com.au; linux-watchdog@vger.kernel.org; linux-arm-kernel@lists.infradead.org;
>> linux-aspeed@lists.ozlabs.org; linux-kernel@vger.kernel.org
>> Subject: Re: [PATCH] watchdog: aspeed: replace mdelay with msleep
>>
>> On 12/12/24 03:30, Phil Eichinger wrote:
>>> Since it is not called in an atomic context the mdelay function
>>> can be replaced with msleep to avoid busy wait.
>>>
>>> Signed-off-by: Phil Eichinger <phil@zankapfel.net>
>>> ---
>>> drivers/watchdog/aspeed_wdt.c | 2 +-
>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/watchdog/aspeed_wdt.c b/drivers/watchdog/aspeed_wdt.c
>>> index b4773a6aaf8c..98ef341408f7 100644
>>> --- a/drivers/watchdog/aspeed_wdt.c
>>> +++ b/drivers/watchdog/aspeed_wdt.c
>>> @@ -208,7 +208,7 @@ static int aspeed_wdt_restart(struct watchdog_device *wdd,
>>> wdt->ctrl &= ~WDT_CTRL_BOOT_SECONDARY;
>>> aspeed_wdt_enable(wdt, 128 * WDT_RATE_1MHZ / 1000);
>>>
>>> - mdelay(1000);
>>> + msleep(1000);
>>>
>>> return 0;
>>> }
>> This is a _restart_ handler. The only purpose of the delay is to wait
>> for the reset to trigger. It is not supposed to sleep.
>
> With the recent scheduler changes isn't the code likely to get
> pre-empted?
> Which (effectively) converts is to a sleep?
>
This code is called from do_kernel_restart(), which in turn is called from
machine_restart(). I'd think that the kernel has a severe problem if it
decides to preempt that function.
Guenter
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-12-14 21:46 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-12 11:30 [PATCH] watchdog: aspeed: replace mdelay with msleep Phil Eichinger
2024-12-12 13:56 ` Guenter Roeck
2024-12-14 21:21 ` David Laight
2024-12-14 21:46 ` Guenter Roeck
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox