All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Johan Almbladh <johan.almbladh@anyfinetworks.com>,
	ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org,
	iii@linux.ibm.com
Cc: llvm@lists.linux.dev, kbuild-all@lists.01.org, kafai@fb.com,
	songliubraving@fb.com, yhs@fb.com, john.fastabend@gmail.com,
	kpsingh@kernel.org, netdev@vger.kernel.org
Subject: Re: [PATCH bpf-next 03/13] bpf/tests: Add exhaustive tests of ALU shift values
Date: Fri, 3 Sep 2021 14:39:36 +0800	[thread overview]
Message-ID: <202109031418.y6WiiADT-lkp@intel.com> (raw)
In-Reply-To: <20210902185229.1840281-4-johan.almbladh@anyfinetworks.com>

[-- Attachment #1: Type: text/plain, Size: 4550 bytes --]

Hi Johan,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on bpf-next/master]

url:    https://github.com/0day-ci/linux/commits/Johan-Almbladh/bpf-tests-Extend-JIT-test-suite-coverage/20210903-025430
base:   https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git master
config: riscv-randconfig-r001-20210903 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project c9948e9254fbb6ea00f66c7b4542311d21e060be)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install riscv cross compiling tool for clang build
        # apt-get install binutils-riscv64-linux-gnu
        # https://github.com/0day-ci/linux/commit/ceabc579a2dfd55d025c0e65dcdb4f8fd313990c
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Johan-Almbladh/bpf-tests-Extend-JIT-test-suite-coverage/20210903-025430
        git checkout ceabc579a2dfd55d025c0e65dcdb4f8fd313990c
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=riscv 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

>> lib/test_bpf.c:581:10: warning: unsequenced modification and access to 'i' [-Wunsequenced]
                           insn[i++] = BPF_ALU64_IMM(BPF_MOV, R0, i);
                                 ^                                ~
   1 warning generated.


vim +/i +581 lib/test_bpf.c

   507	
   508	/* Test an ALU shift operation for all valid shift values */
   509	static int __bpf_fill_alu_shift(struct bpf_test *self, u8 op,
   510					u8 mode, bool alu32)
   511	{
   512		static const s64 regs[] = {
   513			0x0123456789abcdefLL, /* dword > 0, word < 0 */
   514			0xfedcba9876543210LL, /* dowrd < 0, word > 0 */
   515			0xfedcba0198765432LL, /* dowrd < 0, word < 0 */
   516			0x0123458967abcdefLL, /* dword > 0, word > 0 */
   517		};
   518		int bits = alu32 ? 32 : 64;
   519		int len = (2 + 8 * bits) * ARRAY_SIZE(regs) + 2;
   520		struct bpf_insn *insn;
   521		int imm, k;
   522		int i = 0;
   523	
   524		insn = kmalloc_array(len, sizeof(*insn), GFP_KERNEL);
   525		if (!insn)
   526			return -ENOMEM;
   527	
   528		for (k = 0; k < ARRAY_SIZE(regs); k++) {
   529			s64 reg = regs[k];
   530	
   531			i += __bpf_ld_imm64(&insn[i], R3, reg);
   532	
   533			for (imm = 0; imm < bits; imm++) {
   534				u64 val;
   535	
   536				/* Perform operation */
   537				insn[i++] = BPF_ALU64_REG(BPF_MOV, R1, R3);
   538				insn[i++] = BPF_ALU64_IMM(BPF_MOV, R2, imm);
   539				if (alu32) {
   540					if (mode == BPF_K)
   541						insn[i++] = BPF_ALU32_IMM(op, R1, imm);
   542					else
   543						insn[i++] = BPF_ALU32_REG(op, R1, R2);
   544					switch (op) {
   545					case BPF_LSH:
   546						val = (u32)reg << imm;
   547						break;
   548					case BPF_RSH:
   549						val = (u32)reg >> imm;
   550						break;
   551					case BPF_ARSH:
   552						val = (u32)reg >> imm;
   553						if (imm > 0 && (reg & 0x80000000))
   554							val |= ~(u32)0 << (32 - imm);
   555						break;
   556					}
   557				} else {
   558					if (mode == BPF_K)
   559						insn[i++] = BPF_ALU64_IMM(op, R1, imm);
   560					else
   561						insn[i++] = BPF_ALU64_REG(op, R1, R2);
   562					switch (op) {
   563					case BPF_LSH:
   564						val = (u64)reg << imm;
   565						break;
   566					case BPF_RSH:
   567						val = (u64)reg >> imm;
   568						break;
   569					case BPF_ARSH:
   570						val = (u64)reg >> imm;
   571						if (imm > 0 && reg < 0)
   572							val |= ~(u64)0 << (64 - imm);
   573						break;
   574					}
   575				}
   576	
   577				/* Load reference */
   578				i += __bpf_ld_imm64(&insn[i], R4, val);
   579	
   580				/* For diagnostic purposes */
 > 581				insn[i++] = BPF_ALU64_IMM(BPF_MOV, R0, i);
   582	
   583				/* Check result */
   584				insn[i++] = BPF_JMP_REG(BPF_JEQ, R1, R4, 1);
   585				insn[i++] = BPF_EXIT_INSN();
   586			}
   587		}
   588	
   589		insn[i++] = BPF_ALU64_IMM(BPF_MOV, R0, 1);
   590		insn[i++] = BPF_EXIT_INSN();
   591	
   592		self->u.ptr.insns = insn;
   593		self->u.ptr.len = len;
   594		BUG_ON(i > len);
   595	
   596		return 0;
   597	}
   598	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 30099 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: kernel test robot <lkp@intel.com>
To: kbuild-all@lists.01.org
Subject: Re: [PATCH bpf-next 03/13] bpf/tests: Add exhaustive tests of ALU shift values
Date: Fri, 03 Sep 2021 14:39:36 +0800	[thread overview]
Message-ID: <202109031418.y6WiiADT-lkp@intel.com> (raw)
In-Reply-To: <20210902185229.1840281-4-johan.almbladh@anyfinetworks.com>

[-- Attachment #1: Type: text/plain, Size: 4683 bytes --]

Hi Johan,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on bpf-next/master]

url:    https://github.com/0day-ci/linux/commits/Johan-Almbladh/bpf-tests-Extend-JIT-test-suite-coverage/20210903-025430
base:   https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git master
config: riscv-randconfig-r001-20210903 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project c9948e9254fbb6ea00f66c7b4542311d21e060be)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install riscv cross compiling tool for clang build
        # apt-get install binutils-riscv64-linux-gnu
        # https://github.com/0day-ci/linux/commit/ceabc579a2dfd55d025c0e65dcdb4f8fd313990c
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Johan-Almbladh/bpf-tests-Extend-JIT-test-suite-coverage/20210903-025430
        git checkout ceabc579a2dfd55d025c0e65dcdb4f8fd313990c
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=riscv 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

>> lib/test_bpf.c:581:10: warning: unsequenced modification and access to 'i' [-Wunsequenced]
                           insn[i++] = BPF_ALU64_IMM(BPF_MOV, R0, i);
                                 ^                                ~
   1 warning generated.


vim +/i +581 lib/test_bpf.c

   507	
   508	/* Test an ALU shift operation for all valid shift values */
   509	static int __bpf_fill_alu_shift(struct bpf_test *self, u8 op,
   510					u8 mode, bool alu32)
   511	{
   512		static const s64 regs[] = {
   513			0x0123456789abcdefLL, /* dword > 0, word < 0 */
   514			0xfedcba9876543210LL, /* dowrd < 0, word > 0 */
   515			0xfedcba0198765432LL, /* dowrd < 0, word < 0 */
   516			0x0123458967abcdefLL, /* dword > 0, word > 0 */
   517		};
   518		int bits = alu32 ? 32 : 64;
   519		int len = (2 + 8 * bits) * ARRAY_SIZE(regs) + 2;
   520		struct bpf_insn *insn;
   521		int imm, k;
   522		int i = 0;
   523	
   524		insn = kmalloc_array(len, sizeof(*insn), GFP_KERNEL);
   525		if (!insn)
   526			return -ENOMEM;
   527	
   528		for (k = 0; k < ARRAY_SIZE(regs); k++) {
   529			s64 reg = regs[k];
   530	
   531			i += __bpf_ld_imm64(&insn[i], R3, reg);
   532	
   533			for (imm = 0; imm < bits; imm++) {
   534				u64 val;
   535	
   536				/* Perform operation */
   537				insn[i++] = BPF_ALU64_REG(BPF_MOV, R1, R3);
   538				insn[i++] = BPF_ALU64_IMM(BPF_MOV, R2, imm);
   539				if (alu32) {
   540					if (mode == BPF_K)
   541						insn[i++] = BPF_ALU32_IMM(op, R1, imm);
   542					else
   543						insn[i++] = BPF_ALU32_REG(op, R1, R2);
   544					switch (op) {
   545					case BPF_LSH:
   546						val = (u32)reg << imm;
   547						break;
   548					case BPF_RSH:
   549						val = (u32)reg >> imm;
   550						break;
   551					case BPF_ARSH:
   552						val = (u32)reg >> imm;
   553						if (imm > 0 && (reg & 0x80000000))
   554							val |= ~(u32)0 << (32 - imm);
   555						break;
   556					}
   557				} else {
   558					if (mode == BPF_K)
   559						insn[i++] = BPF_ALU64_IMM(op, R1, imm);
   560					else
   561						insn[i++] = BPF_ALU64_REG(op, R1, R2);
   562					switch (op) {
   563					case BPF_LSH:
   564						val = (u64)reg << imm;
   565						break;
   566					case BPF_RSH:
   567						val = (u64)reg >> imm;
   568						break;
   569					case BPF_ARSH:
   570						val = (u64)reg >> imm;
   571						if (imm > 0 && reg < 0)
   572							val |= ~(u64)0 << (64 - imm);
   573						break;
   574					}
   575				}
   576	
   577				/* Load reference */
   578				i += __bpf_ld_imm64(&insn[i], R4, val);
   579	
   580				/* For diagnostic purposes */
 > 581				insn[i++] = BPF_ALU64_IMM(BPF_MOV, R0, i);
   582	
   583				/* Check result */
   584				insn[i++] = BPF_JMP_REG(BPF_JEQ, R1, R4, 1);
   585				insn[i++] = BPF_EXIT_INSN();
   586			}
   587		}
   588	
   589		insn[i++] = BPF_ALU64_IMM(BPF_MOV, R0, 1);
   590		insn[i++] = BPF_EXIT_INSN();
   591	
   592		self->u.ptr.insns = insn;
   593		self->u.ptr.len = len;
   594		BUG_ON(i > len);
   595	
   596		return 0;
   597	}
   598	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 30099 bytes --]

  reply	other threads:[~2021-09-03  6:40 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-02 18:52 [PATCH bpf-next 00/13] bpf/tests: Extend JIT test suite coverage Johan Almbladh
2021-09-02 18:52 ` [PATCH bpf-next 01/13] bpf/tests: Allow different number of runs per test case Johan Almbladh
2021-09-02 18:52 ` [PATCH bpf-next 02/13] bpf/tests: Reduce memory footprint of test suite Johan Almbladh
2021-09-02 18:52 ` [PATCH bpf-next 03/13] bpf/tests: Add exhaustive tests of ALU shift values Johan Almbladh
2021-09-03  6:39   ` kernel test robot [this message]
2021-09-03  6:39     ` kernel test robot
2021-09-02 18:52 ` [PATCH bpf-next 04/13] bpf/tests: Add exhaustive tests of ALU operand magnitudes Johan Almbladh
2021-09-02 18:52 ` [PATCH bpf-next 05/13] bpf/tests: Add exhaustive tests of JMP " Johan Almbladh
2021-09-02 18:52 ` [PATCH bpf-next 06/13] bpf/tests: Add staggered JMP and JMP32 tests Johan Almbladh
2021-09-03  8:22   ` Johan Almbladh
2021-09-02 18:52 ` [PATCH bpf-next 07/13] bpf/tests: Add exhaustive test of LD_IMM64 immediate magnitudes Johan Almbladh
2021-09-02 18:52 ` [PATCH bpf-next 08/13] bpf/tests: Add test case flag for verifier zero-extension Johan Almbladh
2021-09-02 18:52 ` [PATCH bpf-next 09/13] bpf/tests: Add JMP tests with small offsets Johan Almbladh
2021-09-02 18:52 ` [PATCH bpf-next 10/13] bpf/tests: Add JMP tests with degenerate conditional Johan Almbladh
2021-09-02 18:52 ` [PATCH bpf-next 11/13] bpf/tests: Expand branch conversion JIT test Johan Almbladh
2021-09-02 18:52 ` [PATCH bpf-next 12/13] bpf/tests: Add more BPF_END byte order conversion tests Johan Almbladh
2021-09-02 18:52 ` [PATCH bpf-next 13/13] bpf/tests: Add tail call limit test with external function call Johan Almbladh

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=202109031418.y6WiiADT-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=iii@linux.ibm.com \
    --cc=johan.almbladh@anyfinetworks.com \
    --cc=john.fastabend@gmail.com \
    --cc=kafai@fb.com \
    --cc=kbuild-all@lists.01.org \
    --cc=kpsingh@kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=netdev@vger.kernel.org \
    --cc=songliubraving@fb.com \
    --cc=yhs@fb.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.