[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ZldZkm_bqDSZ1oS5@J2N7QTR9R3.cambridge.arm.com>
Date: Wed, 29 May 2024 17:36:34 +0100
From: Mark Rutland <mark.rutland@....com>
To: Arnd Bergmann <arnd@...db.de>
Cc: Arnd Bergmann <arnd@...nel.org>,
Catalin Marinas <catalin.marinas@....com>,
Will Deacon <will@...nel.org>, Jason Gunthorpe <jgg@...pe.ca>,
Valentin Schneider <vschneid@...hat.com>,
Baoquan He <bhe@...hat.com>, Peter Zijlstra <peterz@...radead.org>,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] arm64/io: add constant-argument check
On Wed, May 29, 2024 at 06:15:57PM +0200, Arnd Bergmann wrote:
> On Wed, May 29, 2024, at 17:08, Mark Rutland wrote:
> > On Wed, May 29, 2024 at 02:29:37PM +0200, Arnd Bergmann wrote:
> >> On Wed, May 29, 2024, at 13:14, Mark Rutland wrote:
>
> >>
> >> Yes, your version addresses both failures I ran into, and
> >> I think all other theoretical cases.
> >>
> >> I would prefer to combine both though, using __always_inline
> >> to force the compiler to pick the inline version over
> >> __iowrite32_copy_full() even when it is optimizing for size
> >> and it decides the inline version is larger, but removing
> >> the extra complexity from the macro.
> >
> > Sorry, I'm not sure what you mean here. I don't see anything handling
> > optimizing for size today so I'm not sure what change your suggesting to
> > force the use of the inline version; AFAICT that'd always be forced for
> > a suitable constant size.
> >
> > What change are you suggesting?
>
> What I meant is that reason gcc chooses to not inline
> the macro is when we build with CONFIG_CC_OPTIMIZE_FOR_SIZE.
>
> Since it doesn't know that __const_memcpy_toio_aligned64()
> is intended to be small after inlining, it sometimes
> decides against it, which (with just my patch) would
> fall back to the out-of-line __iowrite32_copy_full()
> while trying to generate smaller code.
>
> The __always_inline annotation just overrides the
> calculation.
Ah, ok.
I think what you're suggesting is:
* Add the __always_inline annotations, as in my patch.
* Move the __builtin_constant_p check into __const_iowrite32_copy(), as in your
patch.
* Remove the __iowrite32_copy() macro and rename __const_iowrite32_copy() to
__iowrite32_copy(), removing the redundant logic.
Assuming so, that makes total sense to me.
Mark.
Powered by blists - more mailing lists