lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Sat, 8 Aug 2020 19:13:05 +0200
From:   Tomasz Figa <tomasz.figa@...il.com>
To:     Sylwester Nawrocki <s.nawrocki@...sung.com>
Cc:     "open list:COMMON CLK FRAMEWORK" <linux-clk@...r.kernel.org>,
        Chanwoo Choi <cw00.choi@...sung.com>,
        Stephen Boyd <sboyd@...nel.org>,
        Mike Turquette <mturquette@...libre.com>,
        "moderated list:SAMSUNG SOC CLOCK DRIVERS" 
        <linux-samsung-soc@...r.kernel.org>,
        linux-kernel <linux-kernel@...r.kernel.org>,
        Bartlomiej Zolnierkiewicz <b.zolnierkie@...sung.com>,
        Marek Szyprowski <m.szyprowski@...sung.com>
Subject: Re: [PATCH] clk: samsung: Prevent potential endless loop in the PLL
 set_rate ops

2020年8月7日(金) 19:06 Sylwester Nawrocki <s.nawrocki@...sung.com>:
>
> Hi Tomasz,
>
> On 8/6/20 18:11, Tomasz Figa wrote:
> >> --- a/drivers/clk/samsung/clk-pll.c
> >> +++ b/drivers/clk/samsung/clk-pll.c
> >> @@ -63,6 +63,27 @@ static long samsung_pll_round_rate(struct clk_hw *hw,
> >>         return rate_table[i - 1].rate;
> >>  }
> >>
> >> +static int samsung_pll_lock_wait(struct samsung_clk_pll *pll,
> >> +                                unsigned int reg_mask)
> >> +{
> >> +       ktime_t timeout;
> >> +
> >> +       /* Wait until the PLL is in steady locked state */
> >> +       timeout = ktime_add_ms(ktime_get(), PLL_TIMEOUT_MS);
> >> +
> >> +       while (!(readl_relaxed(pll->con_reg) & reg_mask)) {
> >> +               if (ktime_after(ktime_get(), timeout)) {
> >> +                       pr_err("%s: Could not lock PLL %s\n",
> >> +                               __func__, clk_hw_get_name(&pll->hw));
> >> +                       return -EFAULT;
> >> +               }
> >> +
> >> +               cpu_relax();
> >> +       }
>
> > Thanks for the patch! Good to have this consolidated. How about going
> > one step further and using the generic
> > readl_relaxed_poll_timeout_atomic() helper?
>
> Might be a good suggestion, I was considering those helpers but ended
> up not using them in the patch. The cpu_relax() call might also not be
> really needed now, when there is the ktime code within the loop.
> Having multiple occurrences of readl_relaxed_poll_timeout_atomic() could
> increase the code size due to inlining. How about keeping the
> samsung_pll_lock_wait() function and just changing its implementation?

Sounds good to me, thanks!

Best regards,
Tomasz

Powered by blists - more mailing lists