mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* arch/riscv/net/bpf_jit.h:241:30: sparse: sparse: cast truncates bits from constant value (7ff becomes ff)
@ 2023-07-25 23:34 kernel test robot
  2023-07-26  4:26 ` Randy Dunlap
  0 siblings, 1 reply; 3+ messages in thread
From: kernel test robot @ 2023-07-25 23:34 UTC (permalink / raw)
  To: Randy Dunlap; +Cc: oe-kbuild-all, linux-kernel, Daniel Borkmann

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   af2e19389c2c1d8a299e04c5105b180ef0c5b5b5
commit: 2d311f480b52eeb2e1fd432d64b78d82952c3808 riscv, bpf: Fix patch_text implicit declaration
date:   5 months ago
config: riscv-randconfig-r072-20230725 (https://download.01.org/0day-ci/archive/20230726/202307260704.dUElCrWU-lkp@intel.com/config)
compiler: riscv64-linux-gcc (GCC) 12.3.0
reproduce: (https://download.01.org/0day-ci/archive/20230726/202307260704.dUElCrWU-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202307260704.dUElCrWU-lkp@intel.com/

sparse warnings: (new ones prefixed by >>)
   WARNING: invalid argument to '-march': '_zicbom_zihintpause'
   arch/riscv/net/bpf_jit_comp64.c: note: in included file:
>> arch/riscv/net/bpf_jit.h:241:30: sparse: sparse: cast truncates bits from constant value (7ff becomes ff)

vim +241 arch/riscv/net/bpf_jit.h

ca6cb5447ceca6 Luke Nelson 2020-03-04  238  
ca6cb5447ceca6 Luke Nelson 2020-03-04  239  static inline u32 rv_s_insn(u16 imm11_0, u8 rs2, u8 rs1, u8 funct3, u8 opcode)
ca6cb5447ceca6 Luke Nelson 2020-03-04  240  {
ca6cb5447ceca6 Luke Nelson 2020-03-04 @241  	u8 imm11_5 = imm11_0 >> 5, imm4_0 = imm11_0 & 0x1f;
ca6cb5447ceca6 Luke Nelson 2020-03-04  242  
ca6cb5447ceca6 Luke Nelson 2020-03-04  243  	return (imm11_5 << 25) | (rs2 << 20) | (rs1 << 15) | (funct3 << 12) |
ca6cb5447ceca6 Luke Nelson 2020-03-04  244  		(imm4_0 << 7) | opcode;
ca6cb5447ceca6 Luke Nelson 2020-03-04  245  }
ca6cb5447ceca6 Luke Nelson 2020-03-04  246  

:::::: The code at line 241 was first introduced by commit
:::::: ca6cb5447ceca6a87d6b62c9e5d41042c34f7ffa riscv, bpf: Factor common RISC-V JIT code

:::::: TO: Luke Nelson <lukenels@cs.washington.edu>
:::::: CC: Daniel Borkmann <daniel@iogearbox.net>

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: arch/riscv/net/bpf_jit.h:241:30: sparse: sparse: cast truncates bits from constant value (7ff becomes ff)
  2023-07-25 23:34 arch/riscv/net/bpf_jit.h:241:30: sparse: sparse: cast truncates bits from constant value (7ff becomes ff) kernel test robot
@ 2023-07-26  4:26 ` Randy Dunlap
  2023-07-31  9:38   ` Liu, Yujie
  0 siblings, 1 reply; 3+ messages in thread
From: Randy Dunlap @ 2023-07-26  4:26 UTC (permalink / raw)
  To: kernel test robot, Luke Nelson
  Cc: oe-kbuild-all, linux-kernel, Daniel Borkmann

[add Luke Nelson]

[why on earth was this sent to me?]

On 7/25/23 16:34, kernel test robot wrote:
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head:   af2e19389c2c1d8a299e04c5105b180ef0c5b5b5
> commit: 2d311f480b52eeb2e1fd432d64b78d82952c3808 riscv, bpf: Fix patch_text implicit declaration
> date:   5 months ago
> config: riscv-randconfig-r072-20230725 (https://download.01.org/0day-ci/archive/20230726/202307260704.dUElCrWU-lkp@intel.com/config)
> compiler: riscv64-linux-gcc (GCC) 12.3.0
> reproduce: (https://download.01.org/0day-ci/archive/20230726/202307260704.dUElCrWU-lkp@intel.com/reproduce)
> 
> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <lkp@intel.com>
> | Closes: https://lore.kernel.org/oe-kbuild-all/202307260704.dUElCrWU-lkp@intel.com/
> 
> sparse warnings: (new ones prefixed by >>)
>    WARNING: invalid argument to '-march': '_zicbom_zihintpause'
>    arch/riscv/net/bpf_jit_comp64.c: note: in included file:
>>> arch/riscv/net/bpf_jit.h:241:30: sparse: sparse: cast truncates bits from constant value (7ff becomes ff)
> 
> vim +241 arch/riscv/net/bpf_jit.h
> 
> ca6cb5447ceca6 Luke Nelson 2020-03-04  238  
> ca6cb5447ceca6 Luke Nelson 2020-03-04  239  static inline u32 rv_s_insn(u16 imm11_0, u8 rs2, u8 rs1, u8 funct3, u8 opcode)
> ca6cb5447ceca6 Luke Nelson 2020-03-04  240  {
> ca6cb5447ceca6 Luke Nelson 2020-03-04 @241  	u8 imm11_5 = imm11_0 >> 5, imm4_0 = imm11_0 & 0x1f;
> ca6cb5447ceca6 Luke Nelson 2020-03-04  242  
> ca6cb5447ceca6 Luke Nelson 2020-03-04  243  	return (imm11_5 << 25) | (rs2 << 20) | (rs1 << 15) | (funct3 << 12) |
> ca6cb5447ceca6 Luke Nelson 2020-03-04  244  		(imm4_0 << 7) | opcode;
> ca6cb5447ceca6 Luke Nelson 2020-03-04  245  }
> ca6cb5447ceca6 Luke Nelson 2020-03-04  246  
> 
> :::::: The code at line 241 was first introduced by commit
> :::::: ca6cb5447ceca6a87d6b62c9e5d41042c34f7ffa riscv, bpf: Factor common RISC-V JIT code
> 
> :::::: TO: Luke Nelson <lukenels@cs.washington.edu>
> :::::: CC: Daniel Borkmann <daniel@iogearbox.net>
> 

-- 
~Randy

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: arch/riscv/net/bpf_jit.h:241:30: sparse: sparse: cast truncates bits from constant value (7ff becomes ff)
  2023-07-26  4:26 ` Randy Dunlap
@ 2023-07-31  9:38   ` Liu, Yujie
  0 siblings, 0 replies; 3+ messages in thread
From: Liu, Yujie @ 2023-07-31  9:38 UTC (permalink / raw)
  To: rdunlap; +Cc: daniel, linux-kernel, oe-kbuild-all, lkp, lukenels

Hi Randy,

On Tue, 2023-07-25 at 21:26 -0700, Randy Dunlap wrote:
> [add Luke Nelson]
> 
> [why on earth was this sent to me?]

We investigated this case and found that it was a false positive and
not caused by your commit. Sorry for that.

This report was generated when running sparse. We used to catch a build
error as below:

  CC      arch/riscv/net/bpf_jit_comp64.o
arch/riscv/net/bpf_jit_comp64.c: In function 'bpf_arch_text_poke':
arch/riscv/net/bpf_jit_comp64.c:691:23: error: implicit declaration of
function 'patch_text'; did you mean 'path_get'? [-Werror=implicit-
function-declaration]
  691 |                 ret = patch_text(ip, new_insns, ninsns);
      |                       ^~~~~~~~~~
      |                       path_get

This is exactly what commit 2d311f480b52 wants to fix. Then the build
error is gone and a sparse warning jumps out as below:

  CC      arch/riscv/net/bpf_jit_comp64.o  <-- compiling stage
  CHECK   arch/riscv/net/bpf_jit_comp64.c  <-- sparse check stage
WARNING: invalid argument to '-march': '_zicbom_zihintpause'
arch/riscv/net/bpf_jit_comp64.c: note: in included file:
arch/riscv/net/bpf_jit.h:241:30: sparse: sparse: cast truncates bits
from constant value (7ff becomes ff)

Our bisection logic wrongly assumed that a new issue was introduced on
this commit, but actually it wasn't. It should be an already-there
problem in existing code.

Sorry again for any inconvenience. We will filter out this false
positive and optimize the bot.

Best Regards,
Yujie

> On 7/25/23 16:34, kernel test robot wrote:
> > tree:  
> > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
> > master
> > head:   af2e19389c2c1d8a299e04c5105b180ef0c5b5b5
> > commit: 2d311f480b52eeb2e1fd432d64b78d82952c3808 riscv, bpf: Fix
> > patch_text implicit declaration
> > date:   5 months ago
> > config: riscv-randconfig-r072-20230725
> > (https://download.01.org/0day-ci/archive/20230726/202307260704.dUEl
> > CrWU-lkp@intel.com/config)
> > compiler: riscv64-linux-gcc (GCC) 12.3.0
> > reproduce:
> > (https://download.01.org/0day-ci/archive/20230726/202307260704.dUEl
> > CrWU-lkp@intel.com/reproduce)
> > 
> > If you fix the issue in a separate patch/commit (i.e. not just a
> > new version of
> > the same patch/commit), kindly add following tags
> > > Reported-by: kernel test robot <lkp@intel.com>
> > > Closes:
> > > https://lore.kernel.org/oe-kbuild-all/202307260704.dUElCrWU-lkp@intel.com/
> > 
> > sparse warnings: (new ones prefixed by >>)
> >    WARNING: invalid argument to '-march': '_zicbom_zihintpause'
> >    arch/riscv/net/bpf_jit_comp64.c: note: in included file:
> > > > arch/riscv/net/bpf_jit.h:241:30: sparse: sparse: cast truncates
> > > > bits from constant value (7ff becomes ff)
> > 
> > vim +241 arch/riscv/net/bpf_jit.h
> > 
> > ca6cb5447ceca6 Luke Nelson 2020-03-04  238  
> > ca6cb5447ceca6 Luke Nelson 2020-03-04  239  static inline u32
> > rv_s_insn(u16 imm11_0, u8 rs2, u8 rs1, u8 funct3, u8 opcode)
> > ca6cb5447ceca6 Luke Nelson 2020-03-04  240  {
> > ca6cb5447ceca6 Luke Nelson 2020-03-04 @241      u8 imm11_5 =
> > imm11_0 >> 5, imm4_0 = imm11_0 & 0x1f;
> > ca6cb5447ceca6 Luke Nelson 2020-03-04  242  
> > ca6cb5447ceca6 Luke Nelson 2020-03-04  243      return (imm11_5 <<
> > 25) | (rs2 << 20) | (rs1 << 15) | (funct3 << 12) |
> > ca6cb5447ceca6 Luke Nelson 2020-03-04  244              (imm4_0 <<
> > 7) | opcode;
> > ca6cb5447ceca6 Luke Nelson 2020-03-04  245  }
> > ca6cb5447ceca6 Luke Nelson 2020-03-04  246  
> > 
> > :::::: The code at line 241 was first introduced by commit
> > :::::: ca6cb5447ceca6a87d6b62c9e5d41042c34f7ffa riscv, bpf: Factor
> > common RISC-V JIT code
> > 
> > :::::: TO: Luke Nelson <lukenels@cs.washington.edu>
> > :::::: CC: Daniel Borkmann <daniel@iogearbox.net>
> > 
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-07-31  9:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-25 23:34 arch/riscv/net/bpf_jit.h:241:30: sparse: sparse: cast truncates bits from constant value (7ff becomes ff) kernel test robot
2023-07-26  4:26 ` Randy Dunlap
2023-07-31  9:38   ` Liu, Yujie

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®