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  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAK8P3a2pZEdsAi6YQ5z3YD=zD1iZLu+WPirhwmxeZ33k7sjkeg@mail.gmail.com>
Date:   Thu, 23 Jan 2020 12:39:06 +0100
From:   Arnd Bergmann <arnd@...db.de>
To:     Manivannan Sadhasivam <manivannan.sadhasivam@...aro.org>
Cc:     gregkh <gregkh@...uxfoundation.org>, smohanad@...eaurora.org,
        Jeffrey Hugo <jhugo@...eaurora.org>,
        Kalle Valo <kvalo@...eaurora.org>,
        Bjorn Andersson <bjorn.andersson@...aro.org>,
        hemantk@...eaurora.org,
        linux-arm-msm <linux-arm-msm@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 05/16] bus: mhi: core: Add support for ringing
 channel/event ring doorbells

On Thu, Jan 23, 2020 at 12:19 PM Manivannan Sadhasivam
<manivannan.sadhasivam@...aro.org> wrote:

> +int __must_check mhi_read_reg(struct mhi_controller *mhi_cntrl,
> +                             void __iomem *base, u32 offset, u32 *out)
> +{
> +       u32 tmp = readl_relaxed(base + offset);
....
> +void mhi_write_reg(struct mhi_controller *mhi_cntrl, void __iomem *base,
> +                  u32 offset, u32 val)
> +{
> +       writel_relaxed(val, base + offset);

Please avoid using _relaxed accessors by default, and use the regular
ones instead. There are a number of things that can go wrong with
the relaxed version, so ideally each caller should have a comment
explaining why this instance is safe without the barriers and why it
matters to not have it.

If there are performance critical callers of mhi_read_reg/mhi_write_reg,
you could add mhi_read_reg_relaxed/mhi_write_reg_relaxed for those
and apply the same rules there.

Usually most mmio accesses are only needed for reconfiguration or
other slow paths.

      Arnd

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ