netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Dumazet <edumazet@google.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Alexander Duyck <alexander.duyck@gmail.com>,
	Eric Dumazet <eric.dumazet@gmail.com>,
	"David S . Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>, netdev <netdev@vger.kernel.org>,
	"the arch/x86 maintainers" <x86@kernel.org>
Subject: Re: [PATCH v1] x86/csum: rewrite csum_partial()
Date: Fri, 12 Nov 2021 07:37:48 -0800	[thread overview]
Message-ID: <CANn89iLpjDsSzLCMz6w8TO5zu1N6HoWM3sgzQevv=zpMYaOt8g@mail.gmail.com> (raw)
In-Reply-To: <YY6HXBK7UN4YqBJm@hirez.programming.kicks-ass.net>

On Fri, Nov 12, 2021 at 7:25 AM Peter Zijlstra <peterz@infradead.org> wrote:
>
> 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@infradead.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

Ah right you are, thanks a lot !

  reply	other threads:[~2021-11-12 15:38 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-11 18:10 [PATCH v1] x86/csum: rewrite csum_partial() Eric Dumazet
2021-11-11 21:56 ` Alexander Duyck
2021-11-11 22:30   ` Eric Dumazet
2021-11-12  9:13     ` Peter Zijlstra
2021-11-12 14:21       ` Eric Dumazet
2021-11-12 15:25         ` Peter Zijlstra
2021-11-12 15:37           ` Eric Dumazet [this message]
2021-11-14 14:44     ` David Laight
2021-11-14 15:03       ` Eric Dumazet
2021-11-14 19:09         ` David Laight
2021-11-14 19:23           ` Eric Dumazet
2021-11-14 14:21   ` David Laight

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CANn89iLpjDsSzLCMz6w8TO5zu1N6HoWM3sgzQevv=zpMYaOt8g@mail.gmail.com' \
    --to=edumazet@google.com \
    --cc=alexander.duyck@gmail.com \
    --cc=davem@davemloft.net \
    --cc=eric.dumazet@gmail.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).