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: <d9f088d1d548c8735b393a15d5a16dbd914ddeca.camel@collabora.com>
Date:   Mon, 19 Jun 2023 14:29:38 -0400
From:   Nicolas Dufresne <nicolas.dufresne@...labora.com>
To:     Arnd Bergmann <arnd@...db.de>, Arnd Bergmann <arnd@...nel.org>,
        Ezequiel Garcia <ezequiel@...guardiasur.com.ar>,
        Philipp Zabel <p.zabel@...gutronix.de>,
        Mauro Carvalho Chehab <mchehab@...nel.org>
Cc:     Hans Verkuil <hverkuil-cisco@...all.nl>,
        Benjamin Gaignard <benjamin.gaignard@...labora.com>,
        Jernej Skrabec <jernej.skrabec@...il.com>,
        linux-media@...r.kernel.org, linux-rockchip@...ts.infradead.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/2] media: verisilicon: change confusingly named
 relaxed register access

Le lundi 19 juin 2023 à 16:49 +0200, Arnd Bergmann a écrit :
> On Mon, Jun 19, 2023, at 16:41, Nicolas Dufresne wrote:
> > Le vendredi 16 juin 2023 à 16:48 +0200, Arnd Bergmann a écrit :
> > > From: Arnd Bergmann <arnd@...db.de>
> > > 
> > > The register abstraction has wrappers around both the normal writel()
> > > and its writel_relaxed() counterpart, but this has led to a lot of users
> > > ending up with the relaxed version.
> > > 
> > > There is sometimes a need to intentionally pick the relaxed accessor for
> > > performance critical functions, but I noticed that each hantro_reg_write()
> > > call also contains a non-relaxed readl(), which is typically much more
> > > expensive than a writel, so there is little benefit here but an added
> > > risk of missing a serialization against DMA.
> > > 
> > > To make this behave like other interfaces, use the normal accessor by
> > > default and only provide the relaxed version as an alternative for
> > > performance critical code. hantro_postproc.c is the only place that
> > > used both the relaxed and normal writel, but this does not seem
> > > cricital either, so change it all to the normal ones.
> > 
> > In this text you spoke about potential performance side effects of existing code
> > and your changes, but its left all very vague and theoretical. Have you done any
> > measurement ? Do you need help with the manner ?
> 
> I don't have this hardware and have not done any measurements.
> Obviously the only point of using relaxed accessors is to
> improve performance in critical code paths, but from the way they
> are used here it seems that this was instead just an accident
> and nobody else did any comparisons either.
> 
> My guess would be that if one wanted to speed up the register
> access, a better way would be to use a regmap cache to avoid
> reading registers when the contents are already known.

All I know is that for the majority of registers when programming stateless
codecs, each 32bit word of registers are fully written too, the read value is
not always meaningful (its a value from last time the HW has been triggered) and
should be ignored, so better to not do that. As for regmap, there is folks that
have reported regmap to be completely overkill for this type of hardware.

That discussion highlight my concern, which is that this specific patch should
require a Tested-by before being merged. A clearer note to say that this patch
is not tested could have helped.

regards,
Nicolas

> 
>      Arnd

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ