Skip to contentSkip to conversation

lib/crc32: slice by 4 is more efficient than the default slice by 8 on Powerpc 8xx.

PATCH Superseded Christophe Leroy 3 participants 5 messages Nov 19, 2013 Library code

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 lib/crc32: slice by 4 is more efficient than the default slice by 8 on Powerpc 8xx.

On PPC_8xx, CRC32_SLICEBY4 is more efficient (almost twice) than CRC32_SLICEBY8, as shown below:

With CRC32_SLICEBY8:

[    1.109204] crc32: CRC_LE_BITS = 64, CRC_BE BITS = 64
[    1.114401] crc32: self tests passed, processed 225944 bytes in 15118910 nsec
[    1.130655] crc32c: CRC_LE_BITS = 64
[    1.134235] crc32c: self tests passed, processed 225944 bytes in 4479879 nsec

With CRC32_SLICEBY4:

[    1.097129] crc32: CRC_LE_BITS = 32, CRC_BE BITS = 32
[    1.101878] crc32: self tests passed, processed 225944 bytes in 8616242 nsec
[    1.116298] crc32c: CRC_LE_BITS = 32
[    1.119607] crc32c: self tests passed, processed 225944 bytes in 3289576 nsec
lib/Kconfig +1 -0
Index: a/lib/Kconfig
===================================================================
@@ -102,6 +102,7 @@
 choice
 	prompt "CRC32 implementation"
 	depends on CRC32
+	default CRC32_SLICEBY4 if PPC_8xx
 	default CRC32_SLICEBY8
 	help
 	  This option allows a kernel builder to override the default choice
Acked-by on v1 1/1
#1 lore raw

I found the same on MPC8321 long time ago(when 64 bits change went in), the 32 bits were much faster. I guess the "smaller"
CPUs cannot handle the cache trashing these big tables impose, I didn't look into the details though.
So I think this is a good change for 8xx.

Christophe Leroy <[email protected]> wrote on 2013/11/18 08:04:23:

Quoted 2 lines

From: Christophe Leroy <[email protected]>
To: Vitaly Bordug <[email protected]>, Marcelo Tosatti

<[email protected]>, Joakim Tjernlund <[email protected]>, Bob Pearson <[email protected]>,

Quoted 3 lines

Cc: [email protected], [email protected]
Date: 2013/11/19 13:05
Subject: [PATCH] lib/crc32: slice by 4 is more efficient than the

default slice by 8 on Powerpc 8xx.

Quoted 2 lines

On PPC_8xx, CRC32_SLICEBY4 is more efficient (almost twice) than

CRC32_SLICEBY8,

Quoted 5 lines

as shown below:

With CRC32_SLICEBY8:

[    1.109204] crc32: CRC_LE_BITS = 64, CRC_BE BITS = 64
[    1.114401] crc32: self tests passed, processed 225944 bytes in 

15118910 nsec

Quoted 2 lines
[    1.130655] crc32c: CRC_LE_BITS = 64
[    1.134235] crc32c: self tests passed, processed 225944 bytes in 

4479879 nsec

Quoted 4 lines

With CRC32_SLICEBY4:

[    1.097129] crc32: CRC_LE_BITS = 32, CRC_BE BITS = 32
[    1.101878] crc32: self tests passed, processed 225944 bytes in 

8616242 nsec

Quoted 2 lines
[    1.116298] crc32c: CRC_LE_BITS = 32
[    1.119607] crc32c: self tests passed, processed 225944 bytes in 

3289576 nsec

Quoted 15 lines

Index: a/lib/Kconfig
===================================================================

lib/Kconfig (copie de travail) renamed from lib/Kconfig (révision 5325) +1 -0
@@ -102,6 +102,7 @@
 choice
    prompt "CRC32 implementation"
    depends on CRC32
+   default CRC32_SLICEBY4 if PPC_8xx
    default CRC32_SLICEBY8
    help
      This option allows a kernel builder to override the default choice
#2 lore raw

I don't think we should go littering the Kconfig with defaults for various bits of hardware -- especially since you've already pointed out non-8xx hardware that would also want this. Put it in defconfig instead, unless you can identify very broad classes of machines for which SLICEBY4 is faster.

-Scott

Quoted 60 lines · Joakim Tjernlund

I found the same on MPC8321 long time ago(when 64 bits change went in), the 32 bits were much faster. I guess the "smaller"
CPUs cannot handle the cache trashing these big tables impose, I didn't look into the details though.
So I think this is a good change for 8xx.

Christophe Leroy <[email protected]> wrote on 2013/11/18 08:04:23:

Quoted 2 lines

From: Christophe Leroy <[email protected]>
To: Vitaly Bordug <[email protected]>, Marcelo Tosatti

<[email protected]>, Joakim Tjernlund <[email protected]>, Bob Pearson <[email protected]>,

Quoted 3 lines

Cc: [email protected], [email protected]
Date: 2013/11/19 13:05
Subject: [PATCH] lib/crc32: slice by 4 is more efficient than the

default slice by 8 on Powerpc 8xx.

Quoted 2 lines

On PPC_8xx, CRC32_SLICEBY4 is more efficient (almost twice) than

CRC32_SLICEBY8,

Quoted 5 lines

as shown below:

With CRC32_SLICEBY8:

[    1.109204] crc32: CRC_LE_BITS = 64, CRC_BE BITS = 64
[    1.114401] crc32: self tests passed, processed 225944 bytes in 

15118910 nsec

Quoted 2 lines
[    1.130655] crc32c: CRC_LE_BITS = 64
[    1.134235] crc32c: self tests passed, processed 225944 bytes in 

4479879 nsec

Quoted 4 lines

With CRC32_SLICEBY4:

[    1.097129] crc32: CRC_LE_BITS = 32, CRC_BE BITS = 32
[    1.101878] crc32: self tests passed, processed 225944 bytes in 

8616242 nsec

Quoted 2 lines
[    1.116298] crc32c: CRC_LE_BITS = 32
[    1.119607] crc32c: self tests passed, processed 225944 bytes in 

3289576 nsec

Quoted 8 lines

Index: a/lib/Kconfig
===================================================================

lib/Kconfig (copie de travail) line 108

Quoted 7 lines
lib/Kconfig (copie de travail) renamed from lib/Kconfig (révision 5325) +1 -0
@@ -102,6 +102,7 @@
 choice
    prompt "CRC32 implementation"
    depends on CRC32
+   default CRC32_SLICEBY4 if PPC_8xx
    default CRC32_SLICEBY8
    help
      This option allows a kernel builder to override the default choice

_______________________________________________
Linuxppc-dev mailing list
[email protected]
https://lists.ozlabs.org/listinfo/linuxppc-dev

#3 lore raw

Scott Wood <[email protected]> wrote on 2013/11/19 19:29:26:

Quoted 6 lines

I don't think we should go littering the Kconfig with defaults for various bits of hardware -- especially since you've already pointed out non-8xx hardware that would also want this. Put it in defconfig instead, unless you can identify very broad classes of machines for which SLICEBY4 is faster.

hmm, when 64bits went in there was not much proof that it was faster for a wide range of CPU, just 2 or 3 if I recall correctly. I suspect there are quite a few CPUs where 32 bits a equal or faster.

Jocke

Quoted 5 lines

-Scott

Quoted 1 line · Joakim Tjernlund

I found the same on MPC8321 long time ago(when 64 bits change went

in),

Quoted 2 lines
Quoted 2 lines

the 32 bits were much faster. I guess the "smaller" CPUs cannot handle the cache trashing these big tables impose, I

didn't

Quoted 6 lines
Quoted 6 lines

look into the details though.
So I think this is a good change for 8xx.

Christophe Leroy <[email protected]> wrote on 2013/11/18

08:04:23:

Quoted 4 lines
Quoted 4 lines
Quoted 3 lines

From: Christophe Leroy <[email protected]>
To: Vitaly Bordug <[email protected]>, Marcelo Tosatti

<[email protected]>, Joakim Tjernlund <[email protected]>,

Bob

Quoted 28 lines
Quoted 28 lines

Pearson <[email protected]>,

Quoted 3 lines

Cc: [email protected], [email protected]
Date: 2013/11/19 13:05
Subject: [PATCH] lib/crc32: slice by 4 is more efficient than the

default slice by 8 on Powerpc 8xx.

Quoted 2 lines

On PPC_8xx, CRC32_SLICEBY4 is more efficient (almost twice) than

CRC32_SLICEBY8,

Quoted 5 lines

as shown below:

With CRC32_SLICEBY8:

[    1.109204] crc32: CRC_LE_BITS = 64, CRC_BE BITS = 64
[    1.114401] crc32: self tests passed, processed 225944 bytes in 

15118910 nsec

Quoted 2 lines
[    1.130655] crc32c: CRC_LE_BITS = 64
[    1.134235] crc32c: self tests passed, processed 225944 bytes in 

4479879 nsec

Quoted 4 lines

With CRC32_SLICEBY4:

[    1.097129] crc32: CRC_LE_BITS = 32, CRC_BE BITS = 32
[    1.101878] crc32: self tests passed, processed 225944 bytes in 

8616242 nsec

Quoted 2 lines
[    1.116298] crc32c: CRC_LE_BITS = 32
[    1.119607] crc32c: self tests passed, processed 225944 bytes in 

3289576 nsec

Quoted 3 lines
Quoted 12 lines
Quoted 4 lines
Quoted 4 lines

Index: a/lib/Kconfig
===================================================================

lib/Kconfig (copie de travail) renamed from lib/Kconfig (révision 5325) +0 -0
Quoted 8 lines

lib/Kconfig (copie de travail) line 108

Quoted 8 lines
lib/Kconfig (copie de travail) renamed from lib/Kconfig (révision 5325) +1 -0
@@ -102,6 +102,7 @@
 choice
    prompt "CRC32 implementation"
    depends on CRC32
+   default CRC32_SLICEBY4 if PPC_8xx
    default CRC32_SLICEBY8
    help
      This option allows a kernel builder to override the default 

choice

Quoted 10 lines
Quoted 7 lines

_______________________________________________
Linuxppc-dev mailing list
[email protected]
https://lists.ozlabs.org/listinfo/linuxppc-dev

#4 lore raw
Quoted 11 lines · Joakim Tjernlund

Scott Wood <[email protected]> wrote on 2013/11/19 19:29:26:

Quoted 6 lines

I don't think we should go littering the Kconfig with defaults for various bits of hardware -- especially since you've already pointed out non-8xx hardware that would also want this. Put it in defconfig instead, unless you can identify very broad classes of machines for which SLICEBY4 is faster.

hmm, when 64bits went in there was not much proof that it was faster for a wide range of CPU, just 2 or 3 if I recall correctly. I suspect there are quite a few CPUs where 32 bits a equal or faster.

That may be the case, but I don't think we want a big list of them in lib/Kconfig. Whether the default should change (for all targets that don't override it in defconfig, or at least for some broader category such as "all 32-bit chips") is a different discussion.

-Scott