[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YY6HXBK7UN4YqBJm@hirez.programming.kicks-ass.net>
Date: Fri, 12 Nov 2021 16:25:16 +0100
From: Peter Zijlstra <peterz@...radead.org>
To: Eric Dumazet <edumazet@...gle.com>
Cc: Alexander Duyck <alexander.duyck@...il.com>,
Eric Dumazet <eric.dumazet@...il.com>,
"David S . Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
netdev <netdev@...r.kernel.org>,
the arch/x86 maintainers <x86@...nel.org>
Subject: Re: [PATCH v1] x86/csum: rewrite csum_partial()
On Fri, Nov 12, 2021 at 06:21:38AM -0800, Eric Dumazet wrote:
> On Fri, Nov 12, 2021 at 1:13 AM Peter Zijlstra <peterz@...radead.org> wrote:
> >
> > On Thu, Nov 11, 2021 at 02:30:50PM -0800, Eric Dumazet wrote:
> > > > For values 7 through 1 I wonder if you wouldn't be better served by
> > > > just doing a single QWORD read and a pair of shifts. Something along
> > > > the lines of:
> > > > if (len) {
> > > > shift = (8 - len) * 8;
> > > > temp64 = (*(unsigned long)buff << shift) >> shift;
> > > > result += temp64;
> > > > result += result < temp64;
> > > > }
> > >
> > > Again, KASAN will not be happy.
> >
> > If you do it in asm, kasan will not know, so who cares :-) as long as
> > the load is aligned, loading beyond @len shouldn't be a problem,
> > otherwise there's load_unaligned_zeropad().
>
> OK, but then in this case we have to align buff on qword boundary,
> or risk crossing page boundary.
Read the above, use load_unaligned_zeropad(), it's made for exactly that
case.
Slightly related, see:
https://lkml.kernel.org/r/20211110101326.141775772@infradead.org
Powered by blists - more mailing lists