From: kernel test robot <lkp@intel.com>
To: Andrea Arcangeli <aarcange@redhat.com>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
Yu Zhao <yuzhao@google.com>, Andy Lutomirski <luto@kernel.org>,
Peter Xu <peterx@redhat.com>, Pavel Emelyanov <xemul@openvz.org>,
Mike Kravetz <mike.kravetz@oracle.com>,
Mike Rapoport <rppt@linux.vnet.ibm.com>,
Minchan Kim <minchan@kernel.org>, Will Deacon <will@kernel.org>
Cc: kbuild-all@lists.01.org
Subject: Re: [PATCH 2/2] mm: soft_dirty: userfaultfd: introduce wrprotect_tlb_flush_pending
Date: Fri, 8 Jan 2021 05:36:42 +0800 [thread overview]
Message-ID: <202101080522.92zFZv3G-lkp@intel.com> (raw)
In-Reply-To: <20210107200402.31095-3-aarcange@redhat.com>
Hi Andrea,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on linux/master]
[also build test WARNING on linus/master hnaz-linux-mm/master v5.11-rc2 next-20210104]
[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]
url: https://github.com/0day-ci/linux/commits/Andrea-Arcangeli/page_count-can-t-be-used-to-decide-when-wp_page_copy/20210108-040616
base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 09162bc32c880a791c6c0668ce0745cf7958f576
compiler: nds32le-linux-gcc (GCC) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
"cppcheck warnings: (new ones prefixed by >>)"
>> fs/proc/task_mmu.c:1248:33: warning: Uninitialized variable: tmp [uninitvar]
for (vma = mm->mmap; vma != tmp;
^
vim +1248 fs/proc/task_mmu.c
1183
1184 static ssize_t clear_refs_write(struct file *file, const char __user *buf,
1185 size_t count, loff_t *ppos)
1186 {
1187 struct task_struct *task;
1188 char buffer[PROC_NUMBUF];
1189 struct mm_struct *mm;
1190 struct vm_area_struct *vma;
1191 enum clear_refs_types type;
1192 int itype;
1193 int rv;
1194
1195 memset(buffer, 0, sizeof(buffer));
1196 if (count > sizeof(buffer) - 1)
1197 count = sizeof(buffer) - 1;
1198 if (copy_from_user(buffer, buf, count))
1199 return -EFAULT;
1200 rv = kstrtoint(strstrip(buffer), 10, &itype);
1201 if (rv < 0)
1202 return rv;
1203 type = (enum clear_refs_types)itype;
1204 if (type < CLEAR_REFS_ALL || type >= CLEAR_REFS_LAST)
1205 return -EINVAL;
1206
1207 task = get_proc_task(file_inode(file));
1208 if (!task)
1209 return -ESRCH;
1210 mm = get_task_mm(task);
1211 if (mm) {
1212 struct mmu_notifier_range range;
1213 struct clear_refs_private cp = {
1214 .type = type,
1215 };
1216
1217 if (type == CLEAR_REFS_MM_HIWATER_RSS) {
1218 if (mmap_write_lock_killable(mm)) {
1219 count = -EINTR;
1220 goto out_mm;
1221 }
1222
1223 /*
1224 * Writing 5 to /proc/pid/clear_refs resets the peak
1225 * resident set size to this mm's current rss value.
1226 */
1227 reset_mm_hiwater_rss(mm);
1228 mmap_write_unlock(mm);
1229 goto out_mm;
1230 }
1231
1232 if (mmap_read_lock_killable(mm)) {
1233 count = -EINTR;
1234 goto out_mm;
1235 }
1236 if (type == CLEAR_REFS_SOFT_DIRTY) {
1237 for (vma = mm->mmap; vma; vma = vma->vm_next) {
1238 struct vm_area_struct *tmp;
1239 if (!(vma->vm_flags & VM_SOFTDIRTY)) {
1240 inc_wrprotect_tlb_flush_pending(vma);
1241 continue;
1242 }
1243
1244 /*
1245 * Rollback wrprotect_tlb_flush_pending before
1246 * releasing the mmap_lock.
1247 */
> 1248 for (vma = mm->mmap; vma != tmp;
1249 vma = vma->vm_next)
1250 dec_wrprotect_tlb_flush_pending(vma);
1251
1252 mmap_read_unlock(mm);
1253 if (mmap_write_lock_killable(mm)) {
1254 count = -EINTR;
1255 goto out_mm;
1256 }
1257 for (vma = mm->mmap; vma; vma = vma->vm_next) {
1258 vma->vm_flags &= ~VM_SOFTDIRTY;
1259 vma_set_page_prot(vma);
1260 inc_wrprotect_tlb_flush_pending(vma);
1261 }
1262 mmap_write_downgrade(mm);
1263 break;
1264 }
1265
1266 inc_tlb_flush_pending(mm);
1267 mmu_notifier_range_init(&range, MMU_NOTIFY_SOFT_DIRTY,
1268 0, NULL, mm, 0, -1UL);
1269 mmu_notifier_invalidate_range_start(&range);
1270 }
1271 walk_page_range(mm, 0, mm->highest_vm_end, &clear_refs_walk_ops,
1272 &cp);
1273 if (type == CLEAR_REFS_SOFT_DIRTY) {
1274 mmu_notifier_invalidate_range_end(&range);
1275 flush_tlb_mm(mm);
1276 for (vma = mm->mmap; vma; vma = vma->vm_next)
1277 dec_wrprotect_tlb_flush_pending(vma);
1278 dec_tlb_flush_pending(mm);
1279 }
1280 mmap_read_unlock(mm);
1281 out_mm:
1282 mmput(mm);
1283 }
1284 put_task_struct(task);
1285
1286 return count;
1287 }
1288
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
next prev parent reply other threads:[~2021-01-07 21:38 UTC|newest]
Thread overview: 96+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-25 9:25 [RFC PATCH v2 0/2] mm: fix races due to deferred TLB flushes Nadav Amit
2020-12-25 9:25 ` [RFC PATCH v2 1/2] mm/userfaultfd: fix memory corruption due to writeprotect Nadav Amit
2021-01-04 12:22 ` Peter Zijlstra
2021-01-04 19:24 ` Andrea Arcangeli
2021-01-04 19:35 ` Nadav Amit
2021-01-04 20:19 ` Andrea Arcangeli
2021-01-04 20:39 ` Nadav Amit
2021-01-04 21:01 ` Andrea Arcangeli
2021-01-04 21:26 ` Nadav Amit
2021-01-05 18:45 ` Andrea Arcangeli
2021-01-05 19:05 ` Nadav Amit
2021-01-05 19:45 ` Andrea Arcangeli
2021-01-05 20:06 ` Nadav Amit
2021-01-05 21:06 ` Andrea Arcangeli
2021-01-05 21:43 ` Peter Xu
2021-01-05 8:13 ` Peter Zijlstra
2021-01-05 8:52 ` Nadav Amit
2021-01-05 14:26 ` Peter Zijlstra
2021-01-05 8:58 ` Peter Zijlstra
2021-01-05 9:22 ` Nadav Amit
2021-01-05 17:58 ` Andrea Arcangeli
2021-01-05 15:08 ` Peter Xu
2021-01-05 18:08 ` Andrea Arcangeli
2021-01-05 18:41 ` Peter Xu
2021-01-05 18:55 ` Andrea Arcangeli
2021-01-05 19:07 ` Nadav Amit
2021-01-05 19:43 ` Peter Xu
2020-12-25 9:25 ` [RFC PATCH v2 2/2] fs/task_mmu: acquire mmap_lock for write on soft-dirty cleanup Nadav Amit
2021-01-05 15:08 ` Will Deacon
2021-01-05 18:20 ` Andrea Arcangeli
2021-01-05 19:26 ` Nadav Amit
2021-01-05 20:39 ` Andrea Arcangeli
2021-01-05 21:20 ` Yu Zhao
2021-01-05 21:22 ` Nadav Amit
2021-01-05 22:16 ` Will Deacon
2021-01-06 0:29 ` Andrea Arcangeli
2021-01-06 0:02 ` Andrea Arcangeli
2021-01-07 20:04 ` [PATCH 0/2] page_count can't be used to decide when wp_page_copy Andrea Arcangeli
2021-01-07 20:04 ` [PATCH 1/2] mm: proc: Invalidate TLB after clearing soft-dirty page state Andrea Arcangeli
2021-01-07 20:04 ` [PATCH 2/2] mm: soft_dirty: userfaultfd: introduce wrprotect_tlb_flush_pending Andrea Arcangeli
2021-01-07 20:17 ` Linus Torvalds
2021-01-07 20:25 ` Linus Torvalds
2021-01-07 20:58 ` Andrea Arcangeli
2021-01-07 21:29 ` Linus Torvalds
2021-01-07 21:53 ` John Hubbard
2021-01-07 22:00 ` Linus Torvalds
2021-01-07 22:14 ` John Hubbard
2021-01-07 22:20 ` Linus Torvalds
2021-01-07 22:24 ` Linus Torvalds
2021-01-07 22:37 ` John Hubbard
2021-01-15 11:27 ` Jan Kara
2021-01-07 22:31 ` Andrea Arcangeli
2021-01-07 22:42 ` Linus Torvalds
2021-01-07 22:51 ` Linus Torvalds
2021-01-07 23:48 ` Andrea Arcangeli
2021-01-08 0:25 ` Linus Torvalds
2021-01-08 12:48 ` Will Deacon
2021-01-08 16:14 ` Andrea Arcangeli
2021-01-08 17:39 ` Linus Torvalds
2021-01-08 17:53 ` Andrea Arcangeli
2021-01-08 19:25 ` Linus Torvalds
2021-01-09 0:12 ` Andrea Arcangeli
2021-01-08 17:30 ` Linus Torvalds
2021-01-07 23:28 ` Andrea Arcangeli
2021-01-07 21:36 ` kernel test robot [this message]
2021-01-07 20:25 ` [PATCH 0/2] page_count can't be used to decide when wp_page_copy Jason Gunthorpe
2021-01-07 20:32 ` Linus Torvalds
2021-01-07 21:05 ` Linus Torvalds
2021-01-07 22:02 ` Andrea Arcangeli
2021-01-07 22:17 ` Linus Torvalds
2021-01-07 22:56 ` Andrea Arcangeli
2021-01-09 19:32 ` Matthew Wilcox
2021-01-09 19:46 ` Linus Torvalds
2021-01-15 14:30 ` Jan Kara
2021-01-07 21:54 ` Andrea Arcangeli
2021-01-07 21:45 ` Andrea Arcangeli
2021-01-08 13:36 ` Jason Gunthorpe
2021-01-08 17:00 ` Andrea Arcangeli
2021-01-08 18:19 ` Jason Gunthorpe
2021-01-08 18:31 ` Andy Lutomirski
2021-01-08 18:38 ` Linus Torvalds
2021-01-08 23:34 ` Andrea Arcangeli
2021-01-09 19:03 ` Andy Lutomirski
2021-01-09 19:15 ` Linus Torvalds
2021-01-08 18:59 ` Linus Torvalds
2021-01-08 22:43 ` Andrea Arcangeli
2021-01-09 0:42 ` Jason Gunthorpe
2021-01-09 2:50 ` Andrea Arcangeli
2021-01-11 14:30 ` Jason Gunthorpe
2021-01-13 21:56 ` Jerome Glisse
2021-01-13 23:39 ` Jason Gunthorpe
2021-01-14 2:35 ` Jerome Glisse
[not found] ` <20210109034958.6928-1-hdanton@sina.com>
2021-01-11 14:39 ` Jason Gunthorpe
2021-01-05 21:55 ` [RFC PATCH v2 2/2] fs/task_mmu: acquire mmap_lock for write on soft-dirty cleanup Peter Xu
2021-03-02 22:13 ` [RFC PATCH v2 0/2] mm: fix races due to deferred TLB flushes Peter Xu
2021-03-02 22:14 ` Nadav Amit
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=202101080522.92zFZv3G-lkp@intel.com \
--to=lkp@intel.com \
--cc=aarcange@redhat.com \
--cc=kbuild-all@lists.01.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=luto@kernel.org \
--cc=mike.kravetz@oracle.com \
--cc=minchan@kernel.org \
--cc=peterx@redhat.com \
--cc=rppt@linux.vnet.ibm.com \
--cc=will@kernel.org \
--cc=xemul@openvz.org \
--cc=yuzhao@google.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).