[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <202507311818.V6HUiudq-lkp@intel.com>
Date: Thu, 31 Jul 2025 19:17:31 +0800
From: kernel test robot <lkp@...el.com>
To: Balbir Singh <balbirs@...dia.com>, linux-mm@...ck.org
Cc: oe-kbuild-all@...ts.linux.dev, linux-kernel@...r.kernel.org,
Balbir Singh <balbirs@...dia.com>,
Karol Herbst <kherbst@...hat.com>, Lyude Paul <lyude@...hat.com>,
Danilo Krummrich <dakr@...nel.org>,
David Airlie <airlied@...il.com>, Simona Vetter <simona@...ll.ch>,
Jérôme Glisse <jglisse@...hat.com>,
Shuah Khan <skhan@...uxfoundation.org>,
David Hildenbrand <david@...hat.com>,
Barry Song <baohua@...nel.org>,
Baolin Wang <baolin.wang@...ux.alibaba.com>,
Ryan Roberts <ryan.roberts@....com>,
Matthew Wilcox <willy@...radead.org>, Peter Xu <peterx@...hat.com>,
Zi Yan <ziy@...dia.com>, Kefeng Wang <wangkefeng.wang@...wei.com>,
Jane Chu <jane.chu@...cle.com>,
Alistair Popple <apopple@...dia.com>,
Donet Tom <donettom@...ux.ibm.com>,
Ralph Campbell <rcampbell@...dia.com>,
Mika Penttilä <mpenttil@...hat.com>,
Matthew Brost <matthew.brost@...el.com>,
Francois Dugast <francois.dugast@...el.com>
Subject: Re: [v2 05/11] lib/test_hmm: test cases and support for zone device
private THP
Hi Balbir,
kernel test robot noticed the following build warnings:
[auto build test WARNING on akpm-mm/mm-everything]
[also build test WARNING on next-20250731]
[cannot apply to akpm-mm/mm-nonmm-unstable shuah-kselftest/next shuah-kselftest/fixes linus/master v6.16]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Balbir-Singh/mm-zone_device-support-large-zone-device-private-folios/20250730-172600
base: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything
patch link: https://lore.kernel.org/r/20250730092139.3890844-6-balbirs%40nvidia.com
patch subject: [v2 05/11] lib/test_hmm: test cases and support for zone device private THP
config: loongarch-allyesconfig (https://download.01.org/0day-ci/archive/20250731/202507311818.V6HUiudq-lkp@intel.com/config)
compiler: clang version 22.0.0git (https://github.com/llvm/llvm-project 8f09b03aebb71c154f3bbe725c29e3f47d37c26e)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250731/202507311818.V6HUiudq-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@...el.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202507311818.V6HUiudq-lkp@intel.com/
All warnings (new ones prefixed by >>):
>> lib/test_hmm.c:1111:6: warning: variable 'dst_pfns' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
1111 | if (!src_pfns)
| ^~~~~~~~~
lib/test_hmm.c:1176:8: note: uninitialized use occurs here
1176 | kfree(dst_pfns);
| ^~~~~~~~
lib/test_hmm.c:1111:2: note: remove the 'if' if its condition is always false
1111 | if (!src_pfns)
| ^~~~~~~~~~~~~~
1112 | goto free_mem;
| ~~~~~~~~~~~~~
lib/test_hmm.c:1097:25: note: initialize the variable 'dst_pfns' to silence this warning
1097 | unsigned long *dst_pfns;
| ^
| = NULL
1 warning generated.
vim +1111 lib/test_hmm.c
1084
1085 static int dmirror_migrate_to_device(struct dmirror *dmirror,
1086 struct hmm_dmirror_cmd *cmd)
1087 {
1088 unsigned long start, end, addr;
1089 unsigned long size = cmd->npages << PAGE_SHIFT;
1090 struct mm_struct *mm = dmirror->notifier.mm;
1091 struct vm_area_struct *vma;
1092 struct dmirror_bounce bounce;
1093 struct migrate_vma args = { 0 };
1094 unsigned long next;
1095 int ret;
1096 unsigned long *src_pfns;
1097 unsigned long *dst_pfns;
1098
1099 start = cmd->addr;
1100 end = start + size;
1101 if (end < start)
1102 return -EINVAL;
1103
1104 /* Since the mm is for the mirrored process, get a reference first. */
1105 if (!mmget_not_zero(mm))
1106 return -EINVAL;
1107
1108 ret = -ENOMEM;
1109 src_pfns = kvcalloc(PTRS_PER_PTE, sizeof(*src_pfns),
1110 GFP_KERNEL | __GFP_NOFAIL);
> 1111 if (!src_pfns)
1112 goto free_mem;
1113
1114 dst_pfns = kvcalloc(PTRS_PER_PTE, sizeof(*dst_pfns),
1115 GFP_KERNEL | __GFP_NOFAIL);
1116 if (!dst_pfns)
1117 goto free_mem;
1118
1119 ret = 0;
1120 mmap_read_lock(mm);
1121 for (addr = start; addr < end; addr = next) {
1122 vma = vma_lookup(mm, addr);
1123 if (!vma || !(vma->vm_flags & VM_READ)) {
1124 ret = -EINVAL;
1125 goto out;
1126 }
1127 next = min(end, addr + (PTRS_PER_PTE << PAGE_SHIFT));
1128 if (next > vma->vm_end)
1129 next = vma->vm_end;
1130
1131 args.vma = vma;
1132 args.src = src_pfns;
1133 args.dst = dst_pfns;
1134 args.start = addr;
1135 args.end = next;
1136 args.pgmap_owner = dmirror->mdevice;
1137 args.flags = MIGRATE_VMA_SELECT_SYSTEM |
1138 MIGRATE_VMA_SELECT_COMPOUND;
1139 ret = migrate_vma_setup(&args);
1140 if (ret)
1141 goto out;
1142
1143 pr_debug("Migrating from sys mem to device mem\n");
1144 dmirror_migrate_alloc_and_copy(&args, dmirror);
1145 migrate_vma_pages(&args);
1146 dmirror_migrate_finalize_and_map(&args, dmirror);
1147 migrate_vma_finalize(&args);
1148 }
1149 mmap_read_unlock(mm);
1150 mmput(mm);
1151
1152 /*
1153 * Return the migrated data for verification.
1154 * Only for pages in device zone
1155 */
1156 ret = dmirror_bounce_init(&bounce, start, size);
1157 if (ret)
1158 goto free_mem;
1159 mutex_lock(&dmirror->mutex);
1160 ret = dmirror_do_read(dmirror, start, end, &bounce);
1161 mutex_unlock(&dmirror->mutex);
1162 if (ret == 0) {
1163 if (copy_to_user(u64_to_user_ptr(cmd->ptr), bounce.ptr,
1164 bounce.size))
1165 ret = -EFAULT;
1166 }
1167 cmd->cpages = bounce.cpages;
1168 dmirror_bounce_fini(&bounce);
1169 goto free_mem;
1170
1171 out:
1172 mmap_read_unlock(mm);
1173 mmput(mm);
1174 free_mem:
1175 kfree(src_pfns);
1176 kfree(dst_pfns);
1177 return ret;
1178 }
1179
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
Powered by blists - more mailing lists