Re: [PATCH] be2net: fix adapter->big_page_size miscaculation

2019-07-22 Thread Qian Cai
The original issue, https://lore.kernel.org/netdev/1562959401-19815-1-git-send-email-...@lca.pw/ The debugging so far seems point to that the compilers get confused by the module sections. During module_param(), it stores “__param_rx_frag_size" as a “struct kernel_param” into the __param section.

Re: [PATCH] be2net: fix adapter->big_page_size miscaculation

2019-07-22 Thread James Y Knight
On Mon, Jul 22, 2019 at 5:13 PM Qian Cai wrote: > > On Fri, 2019-07-19 at 17:47 -0400, Qian Cai wrote: > > On Thu, 2019-07-18 at 16:29 -0700, David Miller wrote: > > > From: Qian Cai > > > Date: Thu, 18 Jul 2019 19:26:47 -0400 > > > > > > > > > > > > > > > > On Jul 18, 2019, at 5:21 PM, Bill Wend

Re: [PATCH] be2net: fix adapter->big_page_size miscaculation

2019-07-22 Thread Qian Cai
On Fri, 2019-07-19 at 17:47 -0400, Qian Cai wrote: > On Thu, 2019-07-18 at 16:29 -0700, David Miller wrote: > > From: Qian Cai > > Date: Thu, 18 Jul 2019 19:26:47 -0400 > > > > >   > > >   > > > > On Jul 18, 2019, at 5:21 PM, Bill Wendling wrote: > > > >   > > > > [My previous response was marke

Re: [PATCH] be2net: fix adapter->big_page_size miscaculation

2019-07-19 Thread Qian Cai
On Thu, 2019-07-18 at 16:29 -0700, David Miller wrote: > From: Qian Cai > Date: Thu, 18 Jul 2019 19:26:47 -0400 > > >  > >  > >> On Jul 18, 2019, at 5:21 PM, Bill Wendling wrote: > >>  > >> [My previous response was marked as spam...] > >>  > >> Top-of-tree clang says that it's const: > >>  > >>

Re: [PATCH] be2net: fix adapter->big_page_size miscaculation

2019-07-19 Thread kbuild test robot
Hi Qian, Thank you for the patch! Yet something to improve: [auto build test ERROR on linus/master] [also build test ERROR on v5.2 next-20190719] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url: https://github.com/0day-ci/linux/commits/

Re: [PATCH] be2net: fix adapter->big_page_size miscaculation

2019-07-18 Thread David Miller
From: Qian Cai Date: Thu, 18 Jul 2019 19:26:47 -0400 > > >> On Jul 18, 2019, at 5:21 PM, Bill Wendling wrote: >> >> [My previous response was marked as spam...] >> >> Top-of-tree clang says that it's const: >> >> $ gcc a.c -O2 && ./a.out >> a is a const. >> >> $ clang a.c -O2 && ./a.out >>

Re: [PATCH] be2net: fix adapter->big_page_size miscaculation

2019-07-18 Thread Qian Cai
> On Jul 18, 2019, at 5:21 PM, Bill Wendling wrote: > > [My previous response was marked as spam...] > > Top-of-tree clang says that it's const: > > $ gcc a.c -O2 && ./a.out > a is a const. > > $ clang a.c -O2 && ./a.out > a is a const. I used clang-7.0.1. So, this is getting worse where

Re: [PATCH] be2net: fix adapter->big_page_size miscaculation

2019-07-18 Thread Bill Wendling
Possibly. I'd need to ask him. :-) On Thu, Jul 18, 2019 at 2:22 PM Nick Desaulniers wrote: > > On Thu, Jul 18, 2019 at 2:18 PM Bill Wendling wrote: > > > > Top-of-tree clang says that it's const: > > > > $ gcc a.c -O2 && ./a.out > > a is a const. > > > > $ clang a.c -O2 && ./a.out > > a is a con

Re: [PATCH] be2net: fix adapter->big_page_size miscaculation

2019-07-18 Thread Nick Desaulniers
On Thu, Jul 18, 2019 at 2:18 PM Bill Wendling wrote: > > Top-of-tree clang says that it's const: > > $ gcc a.c -O2 && ./a.out > a is a const. > > $ clang a.c -O2 && ./a.out > a is a const. Right, so I know you (Bill) did a lot of work to refactor __builtin_constant_p handling in Clang and LLVM in

Re: [PATCH] be2net: fix adapter->big_page_size miscaculation

2019-07-18 Thread Bill Wendling
[My previous response was marked as spam...] Top-of-tree clang says that it's const: $ gcc a.c -O2 && ./a.out a is a const. $ clang a.c -O2 && ./a.out a is a const. On Thu, Jul 18, 2019 at 2:10 PM Nick Desaulniers wrote: > > On Thu, Jul 18, 2019 at 2:01 PM Qian Cai wrote: > > > > > > > > > O

Re: [PATCH] be2net: fix adapter->big_page_size miscaculation

2019-07-18 Thread Nick Desaulniers
On Thu, Jul 18, 2019 at 2:01 PM Qian Cai wrote: > > > > > On Jul 12, 2019, at 8:50 PM, David Miller wrote: > > > > From: Qian Cai > > Date: Fri, 12 Jul 2019 20:27:09 -0400 > > > >> Actually, GCC would consider it a const with -O2 optimized level because > >> it found that it was never modified

Re: [PATCH] be2net: fix adapter->big_page_size miscaculation

2019-07-18 Thread Qian Cai
> On Jul 12, 2019, at 8:50 PM, David Miller wrote: > > From: Qian Cai > Date: Fri, 12 Jul 2019 20:27:09 -0400 > >> Actually, GCC would consider it a const with -O2 optimized level because it >> found that it was never modified and it does not understand it is a module >> parameter. Conside

Re: [PATCH] be2net: fix adapter->big_page_size miscaculation

2019-07-12 Thread David Miller
From: Qian Cai Date: Fri, 12 Jul 2019 20:27:09 -0400 > Actually, GCC would consider it a const with -O2 optimized level because it > found that it was never modified and it does not understand it is a module > parameter. Considering the following code. > > # cat const.c > #include > > stati

Re: [PATCH] be2net: fix adapter->big_page_size miscaculation

2019-07-12 Thread Qian Cai
> On Jul 12, 2019, at 6:46 PM, David Miller wrote: > > From: Qian Cai > Date: Fri, 12 Jul 2019 15:23:21 -0400 > >> The commit d66acc39c7ce ("bitops: Optimise get_order()") introduced a >> problem for the be2net driver as "rx_frag_size" could be a module >> parameter that can be changed while

Re: [PATCH] be2net: fix adapter->big_page_size miscaculation

2019-07-12 Thread David Miller
From: Qian Cai Date: Fri, 12 Jul 2019 15:23:21 -0400 > The commit d66acc39c7ce ("bitops: Optimise get_order()") introduced a > problem for the be2net driver as "rx_frag_size" could be a module > parameter that can be changed while loading the module. Why is this a problem? > That commit checks

[PATCH] be2net: fix adapter->big_page_size miscaculation

2019-07-12 Thread Qian Cai
The commit d66acc39c7ce ("bitops: Optimise get_order()") introduced a problem for the be2net driver as "rx_frag_size" could be a module parameter that can be changed while loading the module. That commit checks __builtin_constant_p() first in get_order() which cause "adapter->big_page_size" to be a