Re: [PATCH] sbsa_gwdt: Calculate timeout with 64-bit math

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Oct 29, 2023 at 10:00:54AM -0700, Guenter Roeck wrote:
> On 10/29/23 09:10, Wim Van Sebroeck wrote:
> > Hi Guenter,
> > 
> > > On 10/14/23 02:12, Darren Hart wrote:
> > > > On Tue, Sep 26, 2023 at 05:45:13AM -0700, Guenter Roeck wrote:
> > > > > On Thu, Sep 21, 2023 at 02:02:36AM -0700, Darren Hart wrote:
> > > > > > Commit abd3ac7902fb ("watchdog: sbsa: Support architecture version 1")
> > > > > > introduced new timer math for watchdog revision 1 with the 48 bit offset
> > > > > > register.
> > > > > > 
> > > > > > The gwdt->clk and timeout are u32, but the argument being calculated is
> > > > > > u64. Without a cast, the compiler performs u32 operations, truncating
> > > > > > intermediate steps, resulting in incorrect values.
> > > > > > 
> > > > > > A watchdog revision 1 implementation with a gwdt->clk of 1GHz and a
> > > > > > timeout of 600s writes 3647256576 to the one shot watchdog instead of
> > > > > > 300000000000, resulting in the watchdog firing in 3.6s instead of 600s.
> > > > > > 
> > > > > > Force u64 math by casting the first argument (gwdt->clk) as a u64. Make
> > > > > > the order of operations explicit with parenthesis.
> > > > > > 
> > > > > > Fixes: abd3ac7902fb ("watchdog: sbsa: Support architecture version 1")
> > > > > > Reported-by: Vanshidhar Konda <vanshikonda@xxxxxxxxxxxxxxxxxxxxxx>
> > > > > > Signed-off-by: Darren Hart <darren@xxxxxxxxxxxxxxxxxxxxxx>
> > > > > > Cc: Wim Van Sebroeck <wim@xxxxxxxxxxxxxxxxxx>
> > > > > > Cc: Guenter Roeck <linux@xxxxxxxxxxxx>
> > > > > > Cc: linux-watchdog@xxxxxxxxxxxxxxx
> > > > > > Cc: linux-kernel@xxxxxxxxxxxxxxx
> > > > > > Cc: linux-arm-kernel@xxxxxxxxxxxxxxxxxxx
> > > > > > Cc: <stable@xxxxxxxxxxxxxxx> # 5.14.x
> > > > > 
> > > > > Reviewed-by: Guenter Roeck <linux@xxxxxxxxxxxx>
> > > > 
> > > > Guenter or Wim, I haven't seen this land in the RCs or in next yet. Have
> > > > you already picked it up? Anything more needed from me?
> > > > 
> > > > Thanks,
> > > > 
> > > 
> > > Sorry, I am suffering from what I can only describe as a severe case of
> > > maintainer/reviewer PTSD, and I have yet to find a way of dealing with that.
> > 
> > I can imagine what it is like. And I do know that if you wouldn't have been there,
> > that I would have allready stopped being a maintainer. So I hope you can find the
> > right cooping mechanisms. I also had to work non-stop the last 4 to 5 weeks and it was hell.
> > So I wish you all the best.
> > 
> > PS: picking up all patches that have your review-by tag on it as we speack.
> > 
> 
> Thanks,
> Guenter

Thanks for the support Wim and Guenter. Appreciate the work you do and the
pressures of maintainership.

-- 
Darren Hart
Ampere Computing / Linux Enabling



[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux