From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id B4A74C38145 for ; Wed, 7 Sep 2022 13:46:22 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 09BB76B0072; Wed, 7 Sep 2022 09:46:22 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 04ACA8D0003; Wed, 7 Sep 2022 09:46:22 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E55408D0002; Wed, 7 Sep 2022 09:46:21 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id D4FBD6B0072 for ; Wed, 7 Sep 2022 09:46:21 -0400 (EDT) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id B06B01210A4 for ; Wed, 7 Sep 2022 13:46:21 +0000 (UTC) X-FDA: 79885413762.10.C128C05 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by imf20.hostedemail.com (Postfix) with ESMTP id 2787C1C009D for ; Wed, 7 Sep 2022 13:46:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1662558380; x=1694094380; h=date:from:to:cc:subject:message-id:mime-version; bh=UflLZnVGOAMOJFmrZYqSPnD/SdgLmy9AlEbobAL2be0=; b=M+awDY+WK/bqai2O4s7rinXNKtjLLX5xy0Om8wfMhqpd667ZUxb0RWSz LrjHTFl3+E7lz8MEaqX+riK+OatBgbClyoT7J+iYwA3USwr84BT3MYNY7 WRUGS66ZIayh96E0wxw79O+tFHgTEIY/NGqklifHLjGoP8RKCk6mV5kRH rXox7Ikr5xiM5BwfdX9aZ04BKjhtSqEnSFYuaOgSbpVVxNQbniYzmDCQY tnqt6vqnhTZVMh6G41sC6EAOEZDVq1ytiquWKyE+VBzH2w8r9q+ImPp0q mwkbjguDbK/qsYzAGV9ab5UuOZcOFpzcO6WFAkCNx9cC92E9wvs2E3GP6 g==; X-IronPort-AV: E=McAfee;i="6500,9779,10462"; a="277266811" X-IronPort-AV: E=Sophos;i="5.93,296,1654585200"; d="scan'208";a="277266811" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Sep 2022 06:46:18 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,296,1654585200"; d="scan'208";a="644618742" Received: from lkp-server02.sh.intel.com (HELO 95dfd251caa2) ([10.239.97.151]) by orsmga008.jf.intel.com with ESMTP; 07 Sep 2022 06:46:17 -0700 Received: from kbuild by 95dfd251caa2 with local (Exim 4.96) (envelope-from ) id 1oVvNg-0006cD-2B; Wed, 07 Sep 2022 13:46:16 +0000 Date: Wed, 7 Sep 2022 21:45:34 +0800 From: kernel test robot To: Alexei Starovoitov Cc: kbuild-all@lists.01.org, Linux Memory Management List , Daniel Borkmann Subject: [linux-next:master 4810/5850] kernel/bpf/hashtab.c:1059:30: sparse: sparse: incorrect type in assignment (different address spaces) Message-ID: <202209072120.mpA19MLJ-lkp@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1662558380; a=rsa-sha256; cv=none; b=OGa6tXIeyzM+0Rr7Mgu1wUiJgUeYnHrLba7VzJQv/wKlYu9qPlecOp62hicjyZPQ3vlPua nPBcQwt8aT2stgIH9yCWWq+3qplvmDUviYnzywshI0ZdIGJJBA/nonP/WvvO0jhfQSjHW0 cjhasAuy7gnYwxyH8sCBjFNRGLbqvJQ= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=none ("invalid DKIM record") header.d=intel.com header.s=Intel header.b=M+awDY+W; spf=pass (imf20.hostedemail.com: domain of lkp@intel.com designates 192.55.52.151 as permitted sender) smtp.mailfrom=lkp@intel.com; dmarc=pass (policy=none) header.from=intel.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1662558380; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding:in-reply-to: references:dkim-signature; bh=aqwsuyJifywEGd7ke59PlBsS+GsAW4K6Maor+Y+GFyU=; b=wu0JeBpKBf5wUVK6eM6dd94mldmhpX969wdiXIQrKzXOnNu0mQr4XBs9PVsR83hqCnJ6U/ tPDAyC3WpzPyfVoVeZoInnpKrI36I8+Bez7B+0z3nQDyuhB6+WKIkbE5eyzvYc1nwq2/iN INy+aP8Ef0XmskNcE38wrp7hMF5OaqY= X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 2787C1C009D X-Rspam-User: Authentication-Results: imf20.hostedemail.com; dkim=none ("invalid DKIM record") header.d=intel.com header.s=Intel header.b=M+awDY+W; spf=pass (imf20.hostedemail.com: domain of lkp@intel.com designates 192.55.52.151 as permitted sender) smtp.mailfrom=lkp@intel.com; dmarc=pass (policy=none) header.from=intel.com X-Stat-Signature: dpx3h5g1zs74smw4g89a1f8nhbku8ar4 X-HE-Tag: 1662558379-106716 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master head: 5957ac6635a1a12d4aa2661bbf04d3085a73372a commit: ee4ed53c5eb62f49f23560cc2642353547e46c32 [4810/5850] bpf: Convert percpu hash map to per-cpu bpf_mem_alloc. config: nios2-randconfig-s052-20220906 (https://download.01.org/0day-ci/archive/20220907/202209072120.mpA19MLJ-lkp@intel.com/config) compiler: nios2-linux-gcc (GCC) 12.1.0 reproduce: wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # apt-get install sparse # sparse version: v0.6.4-39-gce1a6720-dirty # https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=ee4ed53c5eb62f49f23560cc2642353547e46c32 git remote add linux-next https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git git fetch --no-tags linux-next master git checkout ee4ed53c5eb62f49f23560cc2642353547e46c32 # save the config file mkdir build_dir && cp config build_dir/.config COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=nios2 SHELL=/bin/bash kernel/bpf/ If you fix the issue, kindly add following tag where applicable Reported-by: kernel test robot sparse warnings: (new ones prefixed by >>) >> kernel/bpf/hashtab.c:1059:30: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected void [noderef] __percpu *[assigned] pptr @@ got void * @@ kernel/bpf/hashtab.c:1059:30: sparse: expected void [noderef] __percpu *[assigned] pptr kernel/bpf/hashtab.c:1059:30: sparse: got void * >> kernel/bpf/hashtab.c:1065:44: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected void *ptr_to_pptr @@ got void [noderef] __percpu *[assigned] pptr @@ kernel/bpf/hashtab.c:1065:44: sparse: expected void *ptr_to_pptr kernel/bpf/hashtab.c:1065:44: sparse: got void [noderef] __percpu *[assigned] pptr >> kernel/bpf/hashtab.c:1066:34: sparse: sparse: cast removes address space '__percpu' of expression kernel/bpf/hashtab.c:1066:30: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected void [noderef] __percpu *[assigned] pptr @@ got void * @@ kernel/bpf/hashtab.c:1066:30: sparse: expected void [noderef] __percpu *[assigned] pptr kernel/bpf/hashtab.c:1066:30: sparse: got void * kernel/bpf/hashtab.c:208:17: sparse: sparse: context imbalance in 'htab_map_delete_elem' - unexpected unlock kernel/bpf/hashtab.c:208:17: sparse: sparse: context imbalance in 'htab_lru_map_delete_elem' - unexpected unlock kernel/bpf/hashtab.c:208:17: sparse: sparse: context imbalance in '__htab_map_lookup_and_delete_elem' - unexpected unlock kernel/bpf/hashtab.c: note: in included file (through include/linux/workqueue.h, include/linux/bpf.h): include/linux/rcupdate.h:737:9: sparse: sparse: context imbalance in '__htab_map_lookup_and_delete_batch' - unexpected unlock kernel/bpf/hashtab.c:2019:17: sparse: sparse: context imbalance in 'bpf_hash_map_seq_find_next' - unexpected unlock include/linux/rcupdate.h:737:9: sparse: sparse: context imbalance in 'bpf_hash_map_seq_stop' - unexpected unlock vim +1059 kernel/bpf/hashtab.c 1006 1007 static struct htab_elem *alloc_htab_elem(struct bpf_htab *htab, void *key, 1008 void *value, u32 key_size, u32 hash, 1009 bool percpu, bool onallcpus, 1010 struct htab_elem *old_elem) 1011 { 1012 u32 size = htab->map.value_size; 1013 bool prealloc = htab_is_prealloc(htab); 1014 struct htab_elem *l_new, **pl_new; 1015 void __percpu *pptr; 1016 1017 if (prealloc) { 1018 if (old_elem) { 1019 /* if we're updating the existing element, 1020 * use per-cpu extra elems to avoid freelist_pop/push 1021 */ 1022 pl_new = this_cpu_ptr(htab->extra_elems); 1023 l_new = *pl_new; 1024 htab_put_fd_value(htab, old_elem); 1025 *pl_new = old_elem; 1026 } else { 1027 struct pcpu_freelist_node *l; 1028 1029 l = __pcpu_freelist_pop(&htab->freelist); 1030 if (!l) 1031 return ERR_PTR(-E2BIG); 1032 l_new = container_of(l, struct htab_elem, fnode); 1033 } 1034 } else { 1035 if (is_map_full(htab)) 1036 if (!old_elem) 1037 /* when map is full and update() is replacing 1038 * old element, it's ok to allocate, since 1039 * old element will be freed immediately. 1040 * Otherwise return an error 1041 */ 1042 return ERR_PTR(-E2BIG); 1043 inc_elem_count(htab); 1044 l_new = bpf_mem_cache_alloc(&htab->ma); 1045 if (!l_new) { 1046 l_new = ERR_PTR(-ENOMEM); 1047 goto dec_count; 1048 } 1049 check_and_init_map_value(&htab->map, 1050 l_new->key + round_up(key_size, 8)); 1051 } 1052 1053 memcpy(l_new->key, key, key_size); 1054 if (percpu) { 1055 if (prealloc) { 1056 pptr = htab_elem_get_ptr(l_new, key_size); 1057 } else { 1058 /* alloc_percpu zero-fills */ > 1059 pptr = bpf_mem_cache_alloc(&htab->pcpu_ma); 1060 if (!pptr) { 1061 bpf_mem_cache_free(&htab->ma, l_new); 1062 l_new = ERR_PTR(-ENOMEM); 1063 goto dec_count; 1064 } > 1065 l_new->ptr_to_pptr = pptr; > 1066 pptr = *(void **)pptr; 1067 } 1068 1069 pcpu_init_value(htab, pptr, value, onallcpus); 1070 1071 if (!prealloc) 1072 htab_elem_set_ptr(l_new, key_size, pptr); 1073 } else if (fd_htab_map_needs_adjust(htab)) { 1074 size = round_up(size, 8); 1075 memcpy(l_new->key + round_up(key_size, 8), value, size); 1076 } else { 1077 copy_map_value(&htab->map, 1078 l_new->key + round_up(key_size, 8), 1079 value); 1080 } 1081 1082 l_new->hash = hash; 1083 return l_new; 1084 dec_count: 1085 dec_elem_count(htab); 1086 return l_new; 1087 } 1088 -- 0-DAY CI Kernel Test Service https://01.org/lkp