[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CA+CK2bDPjLSECOeduZY7hVPreYYCTpgNMd4aTGSy=35E86W72Q@mail.gmail.com>
Date: Wed, 4 Dec 2019 15:50:15 -0500
From: Pavel Tatashin <pasha.tatashin@...een.com>
To: Mark Rutland <mark.rutland@....com>
Cc: James Morris <jmorris@...ei.org>, Sasha Levin <sashal@...nel.org>,
LKML <linux-kernel@...r.kernel.org>,
Catalin Marinas <catalin.marinas@....com>,
Will Deacon <will@...nel.org>, steve.capper@....com,
Linux ARM <linux-arm-kernel@...ts.infradead.org>,
Marc Zyngier <marc.zyngier@....com>,
James Morse <james.morse@....com>,
Vladimir Murzin <vladimir.murzin@....com>,
Thomas Gleixner <tglx@...utronix.de>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
allison@...utok.net, info@...ux.net, alexios.zavras@...el.com,
Stefano Stabellini <sstabellini@...nel.org>,
boris.ostrovsky@...cle.com, jgross@...e.com,
Stefan Agner <stefan@...er.ch>,
Masahiro Yamada <yamada.masahiro@...ionext.com>,
xen-devel@...ts.xenproject.org,
Russell King - ARM Linux admin <linux@...linux.org.uk>
Subject: Re: [PATCH 2/3] arm64: remove uaccess_ttbr0 asm macros from cache functions
On Thu, Nov 28, 2019 at 9:51 AM Mark Rutland <mark.rutland@....com> wrote:
>
> On Wed, Nov 27, 2019 at 01:44:52PM -0500, Pavel Tatashin wrote:
> > We currently duplicate the logic to enable/disable uaccess via TTBR0,
> > with C functions and assembly macros. This is a maintenenace burden
> > and is liable to lead to subtle bugs, so let's get rid of the assembly
> > macros, and always use the C functions. This requires refactoring
> > some assembly functions to have a C wrapper.
>
> [...]
>
> > +static inline int invalidate_icache_range(unsigned long start,
> > + unsigned long end)
> > +{
> > + int rv;
>
> Please make this 'ret', for consistency with other arm64 code. We only
> use 'rv' in one place where it's short for "Revision and Variant", and
> 'ret' is our usual name for a temporary variable used to hold a return
> value.
OK
>
> > +
> > + if (cpus_have_const_cap(ARM64_HAS_CACHE_DIC)) {
> > + isb();
> > + return 0;
> > + }
> > + uaccess_ttbr0_enable();
>
> Please place a newline between these two, for consistency with other
> arm64 code.
OK
>
> > + rv = asm_invalidate_icache_range(start, end);
> > + uaccess_ttbr0_disable();
> > +
> > + return rv;
> > +}
> > +
> > static inline void flush_icache_range(unsigned long start, unsigned long end)
> > {
> > __flush_icache_range(start, end);
> > diff --git a/arch/arm64/mm/cache.S b/arch/arm64/mm/cache.S
> > index db767b072601..a48b6dba304e 100644
> > --- a/arch/arm64/mm/cache.S
> > +++ b/arch/arm64/mm/cache.S
> > @@ -15,7 +15,7 @@
> > #include <asm/asm-uaccess.h>
> >
> > /*
> > - * flush_icache_range(start,end)
> > + * __asm_flush_icache_range(start,end)
> > *
> > * Ensure that the I and D caches are coherent within specified region.
> > * This is typically used when code has been written to a memory region,
> > @@ -24,11 +24,11 @@
> > * - start - virtual start address of region
> > * - end - virtual end address of region
> > */
> > -ENTRY(__flush_icache_range)
> > +ENTRY(__asm_flush_icache_range)
> > /* FALLTHROUGH */
> >
> > /*
> > - * __flush_cache_user_range(start,end)
> > + * __asm_flush_cache_user_range(start,end)
> > *
> > * Ensure that the I and D caches are coherent within specified region.
> > * This is typically used when code has been written to a memory region,
> > @@ -37,8 +37,7 @@ ENTRY(__flush_icache_range)
> > * - start - virtual start address of region
> > * - end - virtual end address of region
> > */
> > -ENTRY(__flush_cache_user_range)
> > - uaccess_ttbr0_enable x2, x3, x4
> > +ENTRY(__asm_flush_cache_user_range)
> > alternative_if ARM64_HAS_CACHE_IDC
>
> It's unfortunate that we pulled the IDC alternative out for
> invalidate_icache_range(), but not here.
Good point. I will fix that in a separate patch.
Thank you,
Pasha
Powered by blists - more mailing lists