All of lore.kernel.org
 help / color / mirror / Atom feed
From: Noah Goldstein <goldstein.w.n@gmail.com>
To: Eric Dumazet <edumazet@google.com>
Cc: Johannes Berg <johannes@sipsolutions.net>,
	alexanderduyck@fb.com, kbuild-all@lists.01.org,
	open list <linux-kernel@vger.kernel.org>,
	linux-um@lists.infradead.org, lkp@intel.com,
	peterz@infradead.org, X86 ML <x86@kernel.org>
Subject: Re: [tip:x86/core 1/1] arch/x86/um/../lib/csum-partial_64.c:98:12: error: implicit declaration of function 'load_unaligned_zeropad'
Date: Wed, 24 Nov 2021 21:41:19 -0600	[thread overview]
Message-ID: <CAFUsyf+5zp+p_0TPFLr-fMNry0M_CnNAFDG30PKDuy2jA5MhNw@mail.gmail.com> (raw)
In-Reply-To: <CANn89iJdQ1VTLYUKu1hYNm4wF__ZzrwNYr28v_vGM0MCybJpxg@mail.gmail.com>

On Wed, Nov 24, 2021 at 8:56 PM Eric Dumazet <edumazet@google.com> wrote:
>
> On Wed, Nov 24, 2021 at 5:59 PM Noah Goldstein <goldstein.w.n@gmail.com> wrote:
> >
>
> >
> > Hi, I'm not sure if this is intentional or not, but I noticed that the output
> > of 'csum_partial' is different after this patch. I figured that the checksum
> > algorithm is fixed so just wanted mention it incase its a bug. If not sorry
> > for the spam.
> >
> > Example on x86_64:
> >
> > Buff: [ 87, b3, 92, b7, 8b, 53, 96, db, cd, 0f, 7e, 7e ]
> > len : 11
> > sum : 0
> >
> > csum_partial new : 2480936615
> > csum_partial HEAD: 2472089390
>
> No worries.
>
> skb->csum is 32bit, but really what matters is the 16bit folded value.
>
> So make sure to apply csum_fold() before comparing the results.
>
> A minimal C and generic version of csum_fold() would be something like
>
> static unsigned short csum_fold(u32 csum)
> {
>   u32 sum = csum;
>   sum = (sum & 0xffff) + (sum >> 16);
>   sum = (sum & 0xffff) + (sum >> 16);
>   return ~sum;
> }
>
> I bet that csum_fold(2480936615) == csum_fold(2472089390)
>

Correct :)

The outputs seem to match if `buff` is aligned to 64-bit. Still see
difference with `csum_fold(csum_partial())` if `buff` is not 64-bit aligned.

The comment at the top says it's "best" to have `buff` 64-bit aligned but
the code logic seems meant to support the misaligned case so not
sure if it's an issue.

Example:

csum_fold(csum_partial) new : 0x3764
csum_fold(csum_partial) HEAD: 0x3a61

buff        : [ 11, ea, 75, 76, e9, ab, 86, 48 ]
buff addr   : ffff88eaf5fb0001
len         : 8
sum_in      : 25

> It would be nice if we had a csum test suite, hint, hint ;)

Where in the kernel would that belong?

>
> Thanks !

WARNING: multiple messages have this Message-ID (diff)
From: Noah Goldstein <goldstein.w.n@gmail.com>
To: kbuild-all@lists.01.org
Subject: Re: [tip:x86/core 1/1] arch/x86/um/../lib/csum-partial_64.c:98:12: error: implicit declaration of function 'load_unaligned_zeropad'
Date: Wed, 24 Nov 2021 21:41:19 -0600	[thread overview]
Message-ID: <CAFUsyf+5zp+p_0TPFLr-fMNry0M_CnNAFDG30PKDuy2jA5MhNw@mail.gmail.com> (raw)
In-Reply-To: <CANn89iJdQ1VTLYUKu1hYNm4wF__ZzrwNYr28v_vGM0MCybJpxg@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1786 bytes --]

On Wed, Nov 24, 2021 at 8:56 PM Eric Dumazet <edumazet@google.com> wrote:
>
> On Wed, Nov 24, 2021 at 5:59 PM Noah Goldstein <goldstein.w.n@gmail.com> wrote:
> >
>
> >
> > Hi, I'm not sure if this is intentional or not, but I noticed that the output
> > of 'csum_partial' is different after this patch. I figured that the checksum
> > algorithm is fixed so just wanted mention it incase its a bug. If not sorry
> > for the spam.
> >
> > Example on x86_64:
> >
> > Buff: [ 87, b3, 92, b7, 8b, 53, 96, db, cd, 0f, 7e, 7e ]
> > len : 11
> > sum : 0
> >
> > csum_partial new : 2480936615
> > csum_partial HEAD: 2472089390
>
> No worries.
>
> skb->csum is 32bit, but really what matters is the 16bit folded value.
>
> So make sure to apply csum_fold() before comparing the results.
>
> A minimal C and generic version of csum_fold() would be something like
>
> static unsigned short csum_fold(u32 csum)
> {
>   u32 sum = csum;
>   sum = (sum & 0xffff) + (sum >> 16);
>   sum = (sum & 0xffff) + (sum >> 16);
>   return ~sum;
> }
>
> I bet that csum_fold(2480936615) == csum_fold(2472089390)
>

Correct :)

The outputs seem to match if `buff` is aligned to 64-bit. Still see
difference with `csum_fold(csum_partial())` if `buff` is not 64-bit aligned.

The comment at the top says it's "best" to have `buff` 64-bit aligned but
the code logic seems meant to support the misaligned case so not
sure if it's an issue.

Example:

csum_fold(csum_partial) new : 0x3764
csum_fold(csum_partial) HEAD: 0x3a61

buff        : [ 11, ea, 75, 76, e9, ab, 86, 48 ]
buff addr   : ffff88eaf5fb0001
len         : 8
sum_in      : 25

> It would be nice if we had a csum test suite, hint, hint ;)

Where in the kernel would that belong?

>
> Thanks !

WARNING: multiple messages have this Message-ID (diff)
From: Noah Goldstein <goldstein.w.n@gmail.com>
To: Eric Dumazet <edumazet@google.com>
Cc: Johannes Berg <johannes@sipsolutions.net>,
	alexanderduyck@fb.com, kbuild-all@lists.01.org,
	open list <linux-kernel@vger.kernel.org>,
	linux-um@lists.infradead.org, lkp@intel.com,
	peterz@infradead.org, X86 ML <x86@kernel.org>
Subject: Re: [tip:x86/core 1/1] arch/x86/um/../lib/csum-partial_64.c:98:12: error: implicit declaration of function 'load_unaligned_zeropad'
Date: Wed, 24 Nov 2021 21:41:19 -0600	[thread overview]
Message-ID: <CAFUsyf+5zp+p_0TPFLr-fMNry0M_CnNAFDG30PKDuy2jA5MhNw@mail.gmail.com> (raw)
In-Reply-To: <CANn89iJdQ1VTLYUKu1hYNm4wF__ZzrwNYr28v_vGM0MCybJpxg@mail.gmail.com>

On Wed, Nov 24, 2021 at 8:56 PM Eric Dumazet <edumazet@google.com> wrote:
>
> On Wed, Nov 24, 2021 at 5:59 PM Noah Goldstein <goldstein.w.n@gmail.com> wrote:
> >
>
> >
> > Hi, I'm not sure if this is intentional or not, but I noticed that the output
> > of 'csum_partial' is different after this patch. I figured that the checksum
> > algorithm is fixed so just wanted mention it incase its a bug. If not sorry
> > for the spam.
> >
> > Example on x86_64:
> >
> > Buff: [ 87, b3, 92, b7, 8b, 53, 96, db, cd, 0f, 7e, 7e ]
> > len : 11
> > sum : 0
> >
> > csum_partial new : 2480936615
> > csum_partial HEAD: 2472089390
>
> No worries.
>
> skb->csum is 32bit, but really what matters is the 16bit folded value.
>
> So make sure to apply csum_fold() before comparing the results.
>
> A minimal C and generic version of csum_fold() would be something like
>
> static unsigned short csum_fold(u32 csum)
> {
>   u32 sum = csum;
>   sum = (sum & 0xffff) + (sum >> 16);
>   sum = (sum & 0xffff) + (sum >> 16);
>   return ~sum;
> }
>
> I bet that csum_fold(2480936615) == csum_fold(2472089390)
>

Correct :)

The outputs seem to match if `buff` is aligned to 64-bit. Still see
difference with `csum_fold(csum_partial())` if `buff` is not 64-bit aligned.

The comment at the top says it's "best" to have `buff` 64-bit aligned but
the code logic seems meant to support the misaligned case so not
sure if it's an issue.

Example:

csum_fold(csum_partial) new : 0x3764
csum_fold(csum_partial) HEAD: 0x3a61

buff        : [ 11, ea, 75, 76, e9, ab, 86, 48 ]
buff addr   : ffff88eaf5fb0001
len         : 8
sum_in      : 25

> It would be nice if we had a csum test suite, hint, hint ;)

Where in the kernel would that belong?

>
> Thanks !

_______________________________________________
linux-um mailing list
linux-um@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-um


  reply	other threads:[~2021-11-25  3:43 UTC|newest]

Thread overview: 75+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-17 18:45 [tip:x86/core 1/1] arch/x86/um/../lib/csum-partial_64.c:98:12: error: implicit declaration of function 'load_unaligned_zeropad' kernel test robot
2021-11-17 18:45 ` kernel test robot
2021-11-17 18:55 ` Eric Dumazet
2021-11-17 18:55   ` Eric Dumazet
2021-11-17 19:40   ` Eric Dumazet
2021-11-17 19:40     ` Eric Dumazet
2021-11-18 16:00     ` Peter Zijlstra
2021-11-18 16:00       ` Peter Zijlstra
2021-11-18 16:00       ` Peter Zijlstra
2021-11-18 16:26       ` Johannes Berg
2021-11-18 16:26         ` Johannes Berg
2021-11-18 16:26         ` Johannes Berg
2021-11-18 16:57         ` Eric Dumazet
2021-11-18 16:57           ` Eric Dumazet
2021-11-18 16:57           ` Eric Dumazet
2021-11-18 17:02           ` Eric Dumazet
2021-11-18 17:02             ` Eric Dumazet
2021-11-18 17:02             ` Eric Dumazet
2021-11-25  1:58           ` Noah Goldstein
2021-11-25  1:58             ` Noah Goldstein
2021-11-25  1:58             ` Noah Goldstein
2021-11-25  2:56             ` Eric Dumazet
2021-11-25  2:56               ` Eric Dumazet
2021-11-25  2:56               ` Eric Dumazet
2021-11-25  3:41               ` Noah Goldstein [this message]
2021-11-25  3:41                 ` Noah Goldstein
2021-11-25  3:41                 ` Noah Goldstein
2021-11-25  4:00                 ` Eric Dumazet
2021-11-25  4:00                   ` Eric Dumazet
2021-11-25  4:00                   ` Eric Dumazet
2021-11-25  4:08                   ` Eric Dumazet
2021-11-25  4:08                     ` Eric Dumazet
2021-11-25  4:08                     ` Eric Dumazet
2021-11-25  4:20                     ` Eric Dumazet
2021-11-25  4:20                       ` Eric Dumazet
2021-11-25  4:20                       ` Eric Dumazet
2021-11-25  4:56                       ` Noah Goldstein
2021-11-25  4:56                         ` Noah Goldstein
2021-11-25  4:56                         ` Noah Goldstein
2021-11-25  5:09                         ` Noah Goldstein
2021-11-25  5:09                           ` Noah Goldstein
2021-11-25  5:09                           ` Noah Goldstein
2021-11-25  6:32                           ` Eric Dumazet
2021-11-25  6:32                             ` Eric Dumazet
2021-11-25  6:32                             ` Eric Dumazet
2021-11-25  6:45                             ` Eric Dumazet
2021-11-25  6:45                               ` Eric Dumazet
2021-11-25  6:45                               ` Eric Dumazet
2021-11-25  6:49                               ` Noah Goldstein
2021-11-25  6:49                                 ` Noah Goldstein
2021-11-25  6:49                                 ` Noah Goldstein
2021-11-25  6:47                             ` Noah Goldstein
2021-11-25  6:47                               ` Noah Goldstein
2021-11-25  6:47                               ` Noah Goldstein
2021-11-26 17:18                   ` David Laight
2021-11-26 17:18                     ` David Laight
2021-11-26 17:18                     ` David Laight
2021-11-26 18:09                     ` Eric Dumazet
2021-11-26 18:09                       ` Eric Dumazet
2021-11-26 18:09                       ` Eric Dumazet
2021-11-26 22:41                       ` David Laight
2021-11-26 22:41                         ` David Laight
2021-11-26 22:41                         ` David Laight
2021-11-26 23:04                         ` Noah Goldstein
2021-11-26 23:04                           ` Noah Goldstein
2021-11-26 23:04                           ` Noah Goldstein
2021-11-28 18:30                           ` David Laight
2021-11-28 18:30                             ` David Laight
2021-11-28 18:30                             ` David Laight
2021-12-29  6:00       ` Al Viro
2021-12-29  6:00         ` Al Viro
2021-12-29  6:00         ` Al Viro
2022-01-31  2:29         ` Al Viro
2022-01-31  2:29           ` Al Viro
2022-01-31  2:29           ` Al Viro

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=CAFUsyf+5zp+p_0TPFLr-fMNry0M_CnNAFDG30PKDuy2jA5MhNw@mail.gmail.com \
    --to=goldstein.w.n@gmail.com \
    --cc=alexanderduyck@fb.com \
    --cc=edumazet@google.com \
    --cc=johannes@sipsolutions.net \
    --cc=kbuild-all@lists.01.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-um@lists.infradead.org \
    --cc=lkp@intel.com \
    --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.