linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Charlie Jenkins <charlie@rivosinc.com>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Guenter Roeck <linux@roeck-us.net>,
	David Laight <David.Laight@aculab.com>,
	Palmer Dabbelt <palmer@dabbelt.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Helge Deller <deller@gmx.de>,
	"James E.J. Bottomley" <James.Bottomley@hansenpartnership.com>,
	Parisc List <linux-parisc@vger.kernel.org>,
	Christophe Leroy <christophe.leroy@csgroup.eu>,
	Arnd Bergmann <arnd@arndb.de>,
	linux-kernel@vger.kernel.org,
	Palmer Dabbelt <palmer@rivosinc.com>
Subject: Re: [PATCH v10] lib: checksum: Use aligned accesses for ip_fast_csum and csum_ipv6_magic tests
Date: Tue, 27 Feb 2024 09:55:59 -0800	[thread overview]
Message-ID: <Zd4iL3VbUpot0Zmw@ghost> (raw)
In-Reply-To: <CAMuHMdW16fs2rtHkwyGK_+Fhgi5LOFVYb6vPN4mTw3Fhjv1sqg@mail.gmail.com>

On Tue, Feb 27, 2024 at 12:17:58PM +0100, Geert Uytterhoeven wrote:
> Hi Charlie,
> 
> Thanks for your patch!
> 
> On Fri, Feb 23, 2024 at 11:12 PM Charlie Jenkins <charlie@rivosinc.com> wrote:
> > The test cases for ip_fast_csum and csum_ipv6_magic were not properly
> > aligning the IP header, which were causing failures on architectures
> > that do not support misaligned accesses like some ARM platforms. To
> > solve this, align the data along (14 + NET_IP_ALIGN) bytes which is the
> > standard alignment of an IP header and must be supported by the
> > architecture.
> >
> > Furthermore, all architectures except the m68k pad "struct
> > csum_ipv6_magic_data" to 44 bits. To make compatible with the m68k,
> > manually pad this structure to 44 bits.
> 
> s/bits/bytes/ everywhere

Whoops, thanks!

> 
> >
> > Fixes: 6f4c45cbcb00 ("kunit: Add tests for csum_ipv6_magic and ip_fast_csum")
> > Signed-off-by: Charlie Jenkins <charlie@rivosinc.com>
> > Reviewed-by: Guenter Roeck <linux@roeck-us.net>
> > Acked-by: Palmer Dabbelt <palmer@rivosinc.com>
> > ---
> > The ip_fast_csum and csum_ipv6_magic tests did not work on all
> > architectures due to differences in misaligned access support.
> > Fix those issues by changing endianness of data and aligning the data.
> >
> > This patch relies upon a patch from Christophe:
> >
> > [PATCH net] kunit: Fix again checksum tests on big endian CPUs
> >
> > https://lore.kernel.org/lkml/73df3a9e95c2179119398ad1b4c84cdacbd8dfb6.1708684443.git.christophe.leroy@csgroup.eu/t/
> > ---
> > Changes in v10:
> > - Christophe Leroy graciously decided to re-write my patch to fit his
> >   style so I have dropped my endianness+sparse changes and have based by
> >   alignment fixes on his patch. The link to his patch can be seen above.
> > - I dropped Guenter's tested-by but kept his reviewed-by since only the base
> >   was changed.
> > - Link to v9: https://lore.kernel.org/r/20240221-fix_sparse_errors_checksum_tests-v9-0-bff4d73ab9d1@rivosinc.com
> 
> > --- a/lib/checksum_kunit.c
> > +++ b/lib/checksum_kunit.c
> 
> > @@ -595,28 +473,31 @@ static void test_ip_fast_csum(struct kunit *test)
> >  static void test_csum_ipv6_magic(struct kunit *test)
> >  {
> >  #if defined(CONFIG_NET)
> > -       const struct in6_addr *saddr;
> > -       const struct in6_addr *daddr;
> > +       struct csum_ipv6_magic_data {
> > +               const struct in6_addr saddr;
> > +               const struct in6_addr daddr;
> > +               __le32 len;
> > +               __wsum csum;
> > +               unsigned char proto;
> > +               unsigned char pad[3];
> > +       } *data;
> 
> If having a size of 44 bytes is critical, you really want to add a
> BUILD_BUG_ON() check for that.

Good idea, I will add that.

- Charlie

> 
> Gr{oetje,eeting}s,
> 
>                         Geert
> 
> -- 
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
> 
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like that.
>                                 -- Linus Torvalds

      reply	other threads:[~2024-02-27 17:56 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-23 22:11 [PATCH v10] lib: checksum: Use aligned accesses for ip_fast_csum and csum_ipv6_magic tests Charlie Jenkins
2024-02-25 15:58 ` Guenter Roeck
2024-02-26 11:34 ` Christophe Leroy
2024-02-26 11:47   ` Russell King (Oracle)
2024-02-26 11:57     ` Christophe Leroy
2024-02-26 12:03       ` Russell King (Oracle)
2024-02-26 16:44   ` Guenter Roeck
2024-02-26 17:50     ` Russell King (Oracle)
2024-02-26 18:35       ` Charlie Jenkins
2024-02-26 19:06         ` Russell King (Oracle)
2024-02-26 19:19           ` Charlie Jenkins
2024-02-26 22:33           ` David Laight
2024-02-26 23:17             ` Charlie Jenkins
2024-02-26 23:48               ` Guenter Roeck
2024-02-27  6:47                 ` Christophe Leroy
2024-02-27 10:28                   ` Russell King (Oracle)
2024-02-27 11:32                     ` Christophe Leroy
2024-02-27 17:54                       ` Charlie Jenkins
2024-02-27 18:11                         ` Christophe Leroy
2024-02-27 18:21                           ` Charlie Jenkins
2024-02-27 18:35                             ` Christophe Leroy
2024-02-27 19:04                               ` Charlie Jenkins
2024-02-27 19:31                         ` Guenter Roeck
2024-02-27 22:44                           ` David Laight
2024-02-28  5:19                             ` Guenter Roeck
2024-02-28  0:24                           ` Charlie Jenkins
2024-02-28  0:21                     ` Charlie Jenkins
2024-02-28  7:25                       ` Christophe Leroy
2024-02-28  7:59                         ` Guenter Roeck
2024-02-28 10:15                           ` Geert Uytterhoeven
2024-02-28 15:40                             ` Guenter Roeck
2024-02-29  8:07                               ` David Gow
2024-02-29 19:38                               ` Charlie Jenkins
2024-02-29 20:22                                 ` Guenter Roeck
2024-03-01  7:00                           ` Christophe Leroy
2024-03-01  6:46     ` Christophe Leroy
2024-03-01 16:24       ` Guenter Roeck
2024-03-01 20:47         ` Guenter Roeck
2024-02-27 11:17 ` Geert Uytterhoeven
2024-02-27 17:55   ` Charlie Jenkins [this message]

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=Zd4iL3VbUpot0Zmw@ghost \
    --to=charlie@rivosinc.com \
    --cc=David.Laight@aculab.com \
    --cc=James.Bottomley@hansenpartnership.com \
    --cc=akpm@linux-foundation.org \
    --cc=arnd@arndb.de \
    --cc=christophe.leroy@csgroup.eu \
    --cc=deller@gmx.de \
    --cc=geert@linux-m68k.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-parisc@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=palmer@dabbelt.com \
    --cc=palmer@rivosinc.com \
    /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).