Re: [PATCH V3 01/29] bitops: add parity functions

2016-04-25 Thread Zeng Zhaoxiu
在 2016年04月20日 02:45, George Spelvin 写道: Add generic odd parity functions, adapted from "https://graphics.stanford.edu/~seander/bithacks.html#ParityParallel; Given a PARITY_MAGIC of 0x6996, this is even parity, not odd. (Which it should be; an XOR of all bits is the "natural" form.) From

Re: [PATCH V3 01/29] bitops: add parity functions

2016-04-25 Thread Zeng Zhaoxiu
在 2016年04月20日 02:45, George Spelvin 写道: Add generic odd parity functions, adapted from "https://graphics.stanford.edu/~seander/bithacks.html#ParityParallel; Given a PARITY_MAGIC of 0x6996, this is even parity, not odd. (Which it should be; an XOR of all bits is the "natural" form.) From

Re: [PATCH v2 10/30] Add x86-specific parity functions

2016-04-10 Thread Zeng Zhaoxiu
在 2016年04月06日 18:37, One Thousand Gnomes 写道: Even that would still be wrong for the smaller parity values. The CPU supports 8bit parity directly going back to the 8086 so the implementation for 8bit and I think 16bit is still wrong. Alan I don't know where the errors. X86 is new to me. The

Re: [PATCH v2 10/30] Add x86-specific parity functions

2016-04-10 Thread Zeng Zhaoxiu
在 2016年04月06日 18:37, One Thousand Gnomes 写道: Even that would still be wrong for the smaller parity values. The CPU supports 8bit parity directly going back to the 8086 so the implementation for 8bit and I think 16bit is still wrong. Alan I don't know where the errors. X86 is new to me. The

Re: [PATCH] mtd: nand: s3c2410: fix bug in s3c2410_nand_correct_data()

2016-04-07 Thread Zeng Zhaoxiu
在 2016年04月08日 10:18, Boris Brezillon 写道: On Fri, 8 Apr 2016 09:51:04 +0800 Zeng Zhaoxiu <zhaoxiu.z...@gmail.com> wrote: 在 2016年04月08日 08:18, Boris Brezillon 写道: Hi Zeng, On Fri, 8 Apr 2016 00:48:17 +0800 zengzhao...@163.com wrote: From: Zeng Zhaoxiu <zhaoxiu.z...@

Re: [PATCH] mtd: nand: s3c2410: fix bug in s3c2410_nand_correct_data()

2016-04-07 Thread Zeng Zhaoxiu
在 2016年04月08日 10:18, Boris Brezillon 写道: On Fri, 8 Apr 2016 09:51:04 +0800 Zeng Zhaoxiu wrote: 在 2016年04月08日 08:18, Boris Brezillon 写道: Hi Zeng, On Fri, 8 Apr 2016 00:48:17 +0800 zengzhao...@163.com wrote: From: Zeng Zhaoxiu If there is only one bit difference in the ECC, the function

Re: [PATCH] mtd: nand: s3c2410: fix bug in s3c2410_nand_correct_data()

2016-04-07 Thread Zeng Zhaoxiu
在 2016年04月08日 08:18, Boris Brezillon 写道: Hi Zeng, On Fri, 8 Apr 2016 00:48:17 +0800 zengzhao...@163.com wrote: From: Zeng Zhaoxiu <zhaoxiu.z...@gmail.com> If there is only one bit difference in the ECC, the function should return 1. The result of "diff0 & ~(1<<

Re: [PATCH] mtd: nand: s3c2410: fix bug in s3c2410_nand_correct_data()

2016-04-07 Thread Zeng Zhaoxiu
在 2016年04月08日 08:18, Boris Brezillon 写道: Hi Zeng, On Fri, 8 Apr 2016 00:48:17 +0800 zengzhao...@163.com wrote: From: Zeng Zhaoxiu If there is only one bit difference in the ECC, the function should return 1. The result of "diff0 & ~(1< Missing Signed-off-by here. --- driv

Re: [PATCH v2 10/30] Add x86-specific parity functions

2016-04-06 Thread Zeng Zhaoxiu
在 2016年04月06日 18:53, Borislav Petkov 写道: On Wed, Apr 06, 2016 at 11:37:37AM +0100, One Thousand Gnomes wrote: Even that would still be wrong for the smaller parity values. The CPU supports 8bit parity directly going back to the 8086 so the implementation for 8bit and I think 16bit is still

Re: [PATCH v2 10/30] Add x86-specific parity functions

2016-04-06 Thread Zeng Zhaoxiu
在 2016年04月07日 03:45, Andi Kleen 写道: zengzhao...@163.com writes: From: Zhaoxiu Zeng Use alternatives, lifted from arch_hweight Is there actually anything performance critical in the kernel that uses parity? FWIW the arch hweight custom calling convention is a problem

Re: [PATCH v2 10/30] Add x86-specific parity functions

2016-04-06 Thread Zeng Zhaoxiu
在 2016年04月06日 18:53, Borislav Petkov 写道: On Wed, Apr 06, 2016 at 11:37:37AM +0100, One Thousand Gnomes wrote: Even that would still be wrong for the smaller parity values. The CPU supports 8bit parity directly going back to the 8086 so the implementation for 8bit and I think 16bit is still

Re: [PATCH v2 10/30] Add x86-specific parity functions

2016-04-06 Thread Zeng Zhaoxiu
在 2016年04月07日 03:45, Andi Kleen 写道: zengzhao...@163.com writes: From: Zhaoxiu Zeng Use alternatives, lifted from arch_hweight Is there actually anything performance critical in the kernel that uses parity? FWIW the arch hweight custom calling convention is a problem for LTO because it

Re: [PATCH v2 08/30] Add sparc-specific parity functions

2016-04-06 Thread Zeng Zhaoxiu
在 2016年04月07日 02:44, Sam Ravnborg 写道: Hi Zeng. Use runtime patching for sparc64, lifted from hweight No errors found in patch - but a few comments. In general patch looks good. Thanks. Sparc, powerpc, and x86 are all new to me. +++ b/arch/sparc/include/asm/bitops_64.h @@ -47,6 +47,24 @@

Re: [PATCH v2 09/30] Add tile-specific parity functions

2016-04-06 Thread Zeng Zhaoxiu
在 2016年04月06日 21:27, Chris Metcalf 写道: On 4/6/2016 5:08 AM, zengzhao...@163.com wrote: From: Zhaoxiu Zeng Signed-off-by: Zhaoxiu Zeng --- arch/tile/include/asm/bitops.h | 26 ++ 1 file changed, 26 insertions(+) Since

Re: [PATCH v2 08/30] Add sparc-specific parity functions

2016-04-06 Thread Zeng Zhaoxiu
在 2016年04月07日 02:44, Sam Ravnborg 写道: Hi Zeng. Use runtime patching for sparc64, lifted from hweight No errors found in patch - but a few comments. In general patch looks good. Thanks. Sparc, powerpc, and x86 are all new to me. +++ b/arch/sparc/include/asm/bitops_64.h @@ -47,6 +47,24 @@

Re: [PATCH v2 09/30] Add tile-specific parity functions

2016-04-06 Thread Zeng Zhaoxiu
在 2016年04月06日 21:27, Chris Metcalf 写道: On 4/6/2016 5:08 AM, zengzhao...@163.com wrote: From: Zhaoxiu Zeng Signed-off-by: Zhaoxiu Zeng --- arch/tile/include/asm/bitops.h | 26 ++ 1 file changed, 26 insertions(+) Since all the code you are adding here is

Re: [PATCH v2 10/30] Add x86-specific parity functions

2016-04-06 Thread Zeng Zhaoxiu
在 2016年04月06日 18:13, Borislav Petkov 写道: On Wed, Apr 06, 2016 at 05:14:45PM +0800, zengzhao...@163.com wrote: From: Zhaoxiu Zeng Use alternatives, lifted from arch_hweight Signed-off-by: Zhaoxiu Zeng --- arch/x86/include/asm/arch_hweight.h |

Re: [PATCH v2 10/30] Add x86-specific parity functions

2016-04-06 Thread Zeng Zhaoxiu
在 2016年04月06日 18:13, Borislav Petkov 写道: On Wed, Apr 06, 2016 at 05:14:45PM +0800, zengzhao...@163.com wrote: From: Zhaoxiu Zeng Use alternatives, lifted from arch_hweight Signed-off-by: Zhaoxiu Zeng --- arch/x86/include/asm/arch_hweight.h | 5 ++ arch/x86/include/asm/arch_parity.h |

Re: [PATCH V2 01/30] bitops: add parity functions

2016-04-05 Thread Zeng Zhaoxiu
在 2016年04月06日 03:04, Sam Ravnborg 写道: On Tue, Apr 05, 2016 at 10:06:21AM +0800, Zeng Zhaoxiu wrote: From: Zhaoxiu Zeng <zhaoxiu.z...@gmail.com> These patches provide generic and architecture-specific odd parity calculations. Hi Zeng. Can you please fix your mail script. I see only 1/30

Re: [PATCH V2 01/30] bitops: add parity functions

2016-04-05 Thread Zeng Zhaoxiu
在 2016年04月06日 03:04, Sam Ravnborg 写道: On Tue, Apr 05, 2016 at 10:06:21AM +0800, Zeng Zhaoxiu wrote: From: Zhaoxiu Zeng These patches provide generic and architecture-specific odd parity calculations. Hi Zeng. Can you please fix your mail script. I see only 1/30 (sent to linux-arch

[PATCH V2 02/30] Include generic parity.h in some architectures' bitops.h

2016-04-04 Thread Zeng Zhaoxiu
From: Zhaoxiu Zeng Use the generic version --- arch/arc/include/asm/bitops.h | 1 + arch/arm/include/asm/bitops.h | 1 + arch/arm64/include/asm/bitops.h| 1 + arch/avr32/include/asm/bitops.h| 1 + arch/c6x/include/asm/bitops.h | 1 +

[PATCH V2 02/30] Include generic parity.h in some architectures' bitops.h

2016-04-04 Thread Zeng Zhaoxiu
From: Zhaoxiu Zeng Use the generic version --- arch/arc/include/asm/bitops.h | 1 + arch/arm/include/asm/bitops.h | 1 + arch/arm64/include/asm/bitops.h| 1 + arch/avr32/include/asm/bitops.h| 1 + arch/c6x/include/asm/bitops.h | 1 + arch/cris/include/asm/bitops.h |

[PATCH V2 01/30] bitops: add parity functions

2016-04-04 Thread Zeng Zhaoxiu
From: Zhaoxiu Zeng These patches provide generic and architecture-specific odd parity calculations. I did not use GCC's __builtin_parity* functions, based on the following reasons: 1. I don't know where to identify which version of GCC from the beginning

[PATCH V2 01/30] bitops: add parity functions

2016-04-04 Thread Zeng Zhaoxiu
From: Zhaoxiu Zeng These patches provide generic and architecture-specific odd parity calculations. I did not use GCC's __builtin_parity* functions, based on the following reasons: 1. I don't know where to identify which version of GCC from the beginning supported __builtin_parity

Re: [PATCH 01/31] bitops: add parity functions

2016-03-28 Thread Zeng Zhaoxiu
在 2016年03月28日 14:51, Sam Ravnborg 写道: diff --git a/include/asm-generic/bitops/arch_parity.h b/include/asm-generic/bitops/arch_parity.h new file mode 100644 index 000..cddc555 --- /dev/null +++ b/include/asm-generic/bitops/arch_parity.h @@ -0,0 +1,39 @@ +#ifndef

Re: [PATCH 01/31] bitops: add parity functions

2016-03-28 Thread Zeng Zhaoxiu
在 2016年03月28日 14:51, Sam Ravnborg 写道: diff --git a/include/asm-generic/bitops/arch_parity.h b/include/asm-generic/bitops/arch_parity.h new file mode 100644 index 000..cddc555 --- /dev/null +++ b/include/asm-generic/bitops/arch_parity.h @@ -0,0 +1,39 @@ +#ifndef

Re: [PATCH 07/31] Add mips-specific parity functions

2016-03-28 Thread Zeng Zhaoxiu
在 2016年03月29日 01:25, David Daney 写道: On 03/26/2016 11:06 PM, zhaoxiu.zeng wrote: From: Zeng Zhaoxiu <zhaoxiu.z...@gmail.com> There is nothing MIPS specific here. Why not put it in asm-generic or some similar place where it can be shared by all architectures? Also, are yo

Re: [PATCH 07/31] Add mips-specific parity functions

2016-03-28 Thread Zeng Zhaoxiu
在 2016年03月29日 01:25, David Daney 写道: On 03/26/2016 11:06 PM, zhaoxiu.zeng wrote: From: Zeng Zhaoxiu There is nothing MIPS specific here. Why not put it in asm-generic or some similar place where it can be shared by all architectures? Also, are you sure __builtin_popcount

Re: [PATCH 10/31] Add sparc-specific parity functions

2016-03-27 Thread Zeng Zhaoxiu
在 2016年03月28日 10:43, David Miller 写道: From: "zhaoxiu.zeng" Date: Sun, 27 Mar 2016 14:43:10 +0800 + +/* + * parityN: returns the parity of a N-bit word, + * i.e. the number of 1-bits in x modulo 2. + */ + +#define __arch_parity4(w) (__arch_hweight8((w) & 0xf) & 1)

Re: [PATCH 10/31] Add sparc-specific parity functions

2016-03-27 Thread Zeng Zhaoxiu
在 2016年03月28日 10:43, David Miller 写道: From: "zhaoxiu.zeng" Date: Sun, 27 Mar 2016 14:43:10 +0800 + +/* + * parityN: returns the parity of a N-bit word, + * i.e. the number of 1-bits in x modulo 2. + */ + +#define __arch_parity4(w) (__arch_hweight8((w) & 0xf) & 1) +#define

Re: [PATCH 01/31] bitops: add parity functions

2016-03-27 Thread Zeng Zhaoxiu
OK, I will do the V2 patches soon. In addition, the best is to provide asm version parity functions for powerpc, sparc, and x86. 在 2016年03月28日 01:56, Sam Ravnborg 写道: Any particular reason that you select one approach over the other in the different cases? No particular reason, just like the

Re: [PATCH 01/31] bitops: add parity functions

2016-03-27 Thread Zeng Zhaoxiu
OK, I will do the V2 patches soon. In addition, the best is to provide asm version parity functions for powerpc, sparc, and x86. 在 2016年03月28日 01:56, Sam Ravnborg 写道: Any particular reason that you select one approach over the other in the different cases? No particular reason, just like the

Re: [PATCH 01/31] bitops: add parity functions

2016-03-27 Thread Zeng Zhaoxiu
On 2016年03月27日 21:38, zhaoxiu.zeng wrote: On 2016/3/27 20:44, Sam Ravnborg wrote: Hi Zeng. Looking through the arch specific implementations of __arch_parity(). Some architectures uses #defines, other uses inline static functions. Any particular reason that you select one approach over the

Re: [PATCH 01/31] bitops: add parity functions

2016-03-27 Thread Zeng Zhaoxiu
On 2016年03月27日 21:38, zhaoxiu.zeng wrote: On 2016/3/27 20:44, Sam Ravnborg wrote: Hi Zeng. Looking through the arch specific implementations of __arch_parity(). Some architectures uses #defines, other uses inline static functions. Any particular reason that you select one approach over the

[PATCH 1/1] mac80211: improve the contiguous mask checking

2015-12-17 Thread Zeng Zhaoxiu
If the result of adding the first set bit to the mask is power of 2, the mask must be contiguous. "mask & -mask" can get the first set bit of mask gracefully. Signed-off-by: Zeng Zhaoxiu --- net/mac80211/iface.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) di

[PATCH 1/1] mac80211: improve the contiguous mask checking

2015-12-17 Thread Zeng Zhaoxiu
If the result of adding the first set bit to the mask is power of 2, the mask must be contiguous. "mask & -mask" can get the first set bit of mask gracefully. Signed-off-by: Zeng Zhaoxiu <zhaoxiu.z...@gmail.com> --- net/mac80211/iface.c | 5 +++-- 1 file changed, 3 insert