[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <9afcde72-6720-494e-9a02-b0089253c121@roeck-us.net>
Date: Mon, 26 Aug 2024 08:41:23 -0700
From: Guenter Roeck <linux@...ck-us.net>
To: Mika Westerberg <mika.westerberg@...ux.intel.com>,
Oleksandr Ocheretnyi <oocheret@...co.com>
Cc: Wim Van Sebroeck <wim@...ux-watchdog.org>, Jean Delvare
<jdelvare@...e.de>, Wolfram Sang <wsa@...nel.org>,
linux-watchdog@...r.kernel.org, linux-kernel@...r.kernel.org,
xe-linux-external@...co.com
Subject: Re: [PATCH v1] iTCO_wdt: ignore NMI_NOW bit on register comparison
On 8/26/24 08:15, Guenter Roeck wrote:
> On 8/26/24 08:12, Guenter Roeck wrote:
>> On 8/26/24 04:18, Mika Westerberg wrote:
>>> Hi,
>>>
>>> On Mon, Aug 26, 2024 at 12:53:01AM -0700, Oleksandr Ocheretnyi wrote:
>>>> Commit da23b6faa8bf ("watchdog: iTCO: Add support for Cannon Lake
>>>> PCH iTCO") does not ignore NMI_NOW bit on write operation to TCO1_CNT
>>>> register what causes unexpected NMIs due to NMI_NOW bit inversion
>>>> during regular crashkernel's workflow with following logs:
>>>>
>>>> iTCO_vendor_support: vendor-support=0
>>>> iTCO_wdt iTCO_wdt: unable to reset NO_REBOOT flag, device
>>>> disabled by hardware/BIOS
>>>>
>>>> This change clears NMI_NOW bit in the TCO1_CNT register to have no
>>>> effect on NMI_NOW bit inversion what can cause NMI immediately.
>>>>
>>>> Fixes: da23b6faa8bf ("watchdog: iTCO: Add support for Cannon Lake PCH iTCO")
>>>> Signed-off-by: Oleksandr Ocheretnyi <oocheret@...co.com>
>>>> ---
>>>> drivers/watchdog/iTCO_wdt.c | 2 +-
>>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>>>
>>>> diff --git a/drivers/watchdog/iTCO_wdt.c b/drivers/watchdog/iTCO_wdt.c
>>>> index 264857d314da..679c115ef7d3 100644
>>>> --- a/drivers/watchdog/iTCO_wdt.c
>>>> +++ b/drivers/watchdog/iTCO_wdt.c
>>>> @@ -224,7 +224,7 @@ static int update_no_reboot_bit_cnt(void *priv, bool set)
>>>> val |= BIT(0);
>>>> else
>>>> val &= ~BIT(0);
>>>> - outw(val, TCO1_CNT(p));
>>>> + outw(val & ~BIT(8), TCO1_CNT(p));
>>>
>>> I suggest adding some #define for the magical number 8 so that it is
>>> easier for anyone looking at this driver to figure out what it is doing.
>>>
>>> Otherwise looks good to me, thanks!
>>>
>>
>> Not really; it appears to be hiding a change in code which is supposed to do
>> something different (it is supposed to set or clear the no_reboot bit),
>> with no explanation whatsoever. That warrants a comment in the code.
>> Also, I would prefer
>> val = inw(TCO1_CNT(p)) & ~BIT(8);
>>
>
> On top of that, I fail to understand "on register comparison" in the subject.
> What register comparison ?
>
Sorry, one more: The comment will need to explain why clearing bit 8 is needed
here but not for any other writes to TCO1_CNT. Obviously this isn't just "ignore
bit on write" but something more.
Guenter
Powered by blists - more mailing lists