All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Dumazet <edumazet@google.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Eric Dumazet <eric.dumazet@gmail.com>,
	"David S . Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>, netdev <netdev@vger.kernel.org>,
	x86@kernel.org, Alexander Duyck <alexander.duyck@gmail.com>
Subject: Re: [RFC] x86/csum: rewrite csum_partial()
Date: Thu, 11 Nov 2021 08:52:51 -0800	[thread overview]
Message-ID: <CANn89i+Y6OXdKccgM6+gC-2giJFcOrMfraG7ofCfKXmjsfMPJQ@mail.gmail.com> (raw)
In-Reply-To: <CANn89i+qjOpL9eYj=F2Mg-rLduQob4tOZcEUZeB5v0Zz3p6Qqw@mail.gmail.com>

On Thu, Nov 11, 2021 at 8:02 AM Eric Dumazet <edumazet@google.com> wrote:
>

> Thanks Peter !
>
> This is more or less the first version I wrote. (I was doing tests for
> (len & 32), (len & 16) .. to not have to update len in these blocks.
>
> Then, I tried to add an inline version, a la ip_fast_csum() but for IPv6.
>
> Then I came up with the version I sent, for some reason my .config had
> temporarily disabled CONFIG_RETPOLINE,
> thanks for reminding me this !
>
> I also missed this warning anyway :
> arch/x86/lib/csum-partial_64.o: warning: objtool: csum_partial()+0x2f:
> unannotated intra-function call
>
> I will spend a bit more time on this before sending a V2, thanks again !

BTW, I could not understand why :

               result = add32_with_carry(result, *(u32 *)buff);

generates this code :

 123: 41 8b 09              mov    (%r9),%ecx
 126: 89 4d f8              mov    %ecx,-0x8(%rbp)
 129: 03 45 f8              add    -0x8(%rbp),%eax
 12c: 83 d0 00              adc    $0x0,%eax

Apparently add32_with_carry() forces the use of use of a temporary in memory

While
               asm("   addl 0*4(%[src]),%[res]\n"
                   "   adcl $0,%[res]\n"
                       : [res] "=r" (result)
                       : [src] "r" (buff), "[res]" (result)
                        : "memory");

gives

 120: 41 03 01              add    (%r9),%eax
 123: 83 d0 00              adc    $0x0,%eax

  reply	other threads:[~2021-11-11 16:53 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-11  6:53 [RFC] x86/csum: rewrite csum_partial() Eric Dumazet
2021-11-11  9:10 ` Peter Zijlstra
2021-11-11  9:44   ` Peter Zijlstra
2021-11-11 16:02     ` Eric Dumazet
2021-11-11 16:52       ` Eric Dumazet [this message]
2021-11-11 18:17         ` Andrew Cooper
2021-11-11 19:02           ` Eric Dumazet
2021-11-11 16:51 ` Alexander Duyck
2021-11-14 13:07 ` David Laight
2021-11-14 14:12   ` David Laight
2021-11-15 10:23     ` 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=CANn89i+Y6OXdKccgM6+gC-2giJFcOrMfraG7ofCfKXmjsfMPJQ@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.