From: kernel test robot <lkp@intel.com>
To: oe-kbuild@lists.linux.dev
Cc: lkp@intel.com, Dan Carpenter <error27@gmail.com>
Subject: Re: [PATCH RFC v2 4/4] mm/ptshare: Add page fault handling for page table shared regions
Date: Mon, 8 May 2023 06:55:26 +0800 [thread overview]
Message-ID: <202305080652.26E18YDE-lkp@intel.com> (raw)
BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
In-Reply-To: <9edffd2a12a049a42d9a2c216e3f999aae7e65a4.1682453344.git.khalid.aziz@oracle.com>
References: <9edffd2a12a049a42d9a2c216e3f999aae7e65a4.1682453344.git.khalid.aziz@oracle.com>
TO: Khalid Aziz <khalid.aziz@oracle.com>
Hi Khalid,
[This is a private test report for your RFC patch.]
kernel test robot noticed the following build warnings:
[auto build test WARNING on arnd-asm-generic/master]
[also build test WARNING on vfs-idmapping/for-next linus/master v6.4-rc1 next-20230505]
[cannot apply to akpm-mm/mm-everything]
[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/Khalid-Aziz/mm-ptshare-Add-vm-flag-for-shared-PTE/20230427-005143
base: https://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic.git master
patch link: https://lore.kernel.org/r/9edffd2a12a049a42d9a2c216e3f999aae7e65a4.1682453344.git.khalid.aziz%40oracle.com
patch subject: [PATCH RFC v2 4/4] mm/ptshare: Add page fault handling for page table shared regions
:::::: branch date: 11 days ago
:::::: commit date: 11 days ago
config: i386-randconfig-m021 (https://download.01.org/0day-ci/archive/20230508/202305080652.26E18YDE-lkp@intel.com/config)
compiler: gcc-11 (Debian 11.3.0-12) 11.3.0
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <error27@gmail.com>
| Link: https://lore.kernel.org/r/202305080652.26E18YDE-lkp@intel.com/
smatch warnings:
mm/memory.c:5220 handle_mm_fault() warn: variable dereferenced before check 'vma' (see line 5209)
vim +/vma +5220 mm/memory.c
cdc5021cda1941 David Hildenbrand 2022-11-16 5192
9a95f3cf7b33d6 Paul Cassella 2014-08-06 5193 /*
9a95f3cf7b33d6 Paul Cassella 2014-08-06 5194 * By the time we get here, we already hold the mm semaphore
9a95f3cf7b33d6 Paul Cassella 2014-08-06 5195 *
c1e8d7c6a7a682 Michel Lespinasse 2020-06-08 5196 * The mmap_lock may have been released depending on flags and our
9138e47ed42524 Matthew Wilcox (Oracle 2021-03-18 5197) * return value. See filemap_fault() and __folio_lock_or_retry().
9a95f3cf7b33d6 Paul Cassella 2014-08-06 5198 */
2b7403035459c7 Souptick Joarder 2018-08-23 5199 vm_fault_t handle_mm_fault(struct vm_area_struct *vma, unsigned long address,
bce617edecada0 Peter Xu 2020-08-11 5200 unsigned int flags, struct pt_regs *regs)
519e52473ebe9d Johannes Weiner 2013-09-12 5201 {
2b7403035459c7 Souptick Joarder 2018-08-23 5202 vm_fault_t ret;
a2eef9e49f572b Khalid Aziz 2023-04-26 5203 bool shared = false;
a2eef9e49f572b Khalid Aziz 2023-04-26 5204 struct mm_struct *orig_mm;
519e52473ebe9d Johannes Weiner 2013-09-12 5205
519e52473ebe9d Johannes Weiner 2013-09-12 5206 __set_current_state(TASK_RUNNING);
519e52473ebe9d Johannes Weiner 2013-09-12 5207
519e52473ebe9d Johannes Weiner 2013-09-12 5208 count_vm_event(PGFAULT);
2262185c5b287f Roman Gushchin 2017-07-06 @5209 count_memcg_event_mm(vma->vm_mm, PGFAULT);
519e52473ebe9d Johannes Weiner 2013-09-12 5210
cdc5021cda1941 David Hildenbrand 2022-11-16 5211 ret = sanitize_fault_flags(vma, &flags);
cdc5021cda1941 David Hildenbrand 2022-11-16 5212 if (ret)
cdc5021cda1941 David Hildenbrand 2022-11-16 5213 return ret;
cdc5021cda1941 David Hildenbrand 2022-11-16 5214
a2eef9e49f572b Khalid Aziz 2023-04-26 5215 orig_mm = vma->vm_mm;
a2eef9e49f572b Khalid Aziz 2023-04-26 5216 if (unlikely(vma_is_shared(vma))) {
a2eef9e49f572b Khalid Aziz 2023-04-26 5217 ret = find_shared_vma(&vma, &address, flags);
a2eef9e49f572b Khalid Aziz 2023-04-26 5218 if (ret)
a2eef9e49f572b Khalid Aziz 2023-04-26 5219 return ret;
a2eef9e49f572b Khalid Aziz 2023-04-26 @5220 if (!vma)
a2eef9e49f572b Khalid Aziz 2023-04-26 5221 return VM_FAULT_SIGSEGV;
a2eef9e49f572b Khalid Aziz 2023-04-26 5222 shared = true;
a2eef9e49f572b Khalid Aziz 2023-04-26 5223 }
a2eef9e49f572b Khalid Aziz 2023-04-26 5224
de0c799bba2610 Laurent Dufour 2017-09-08 5225 if (!arch_vma_access_permitted(vma, flags & FAULT_FLAG_WRITE,
de0c799bba2610 Laurent Dufour 2017-09-08 5226 flags & FAULT_FLAG_INSTRUCTION,
de0c799bba2610 Laurent Dufour 2017-09-08 5227 flags & FAULT_FLAG_REMOTE))
de0c799bba2610 Laurent Dufour 2017-09-08 5228 return VM_FAULT_SIGSEGV;
de0c799bba2610 Laurent Dufour 2017-09-08 5229
519e52473ebe9d Johannes Weiner 2013-09-12 5230 /*
519e52473ebe9d Johannes Weiner 2013-09-12 5231 * Enable the memcg OOM handling for faults triggered in user
519e52473ebe9d Johannes Weiner 2013-09-12 5232 * space. Kernel faults are handled more gracefully.
519e52473ebe9d Johannes Weiner 2013-09-12 5233 */
519e52473ebe9d Johannes Weiner 2013-09-12 5234 if (flags & FAULT_FLAG_USER)
29ef680ae7c211 Michal Hocko 2018-08-17 5235 mem_cgroup_enter_user_fault();
519e52473ebe9d Johannes Weiner 2013-09-12 5236
ec1c86b25f4bdd Yu Zhao 2022-09-18 5237 lru_gen_enter_fault(vma);
ec1c86b25f4bdd Yu Zhao 2022-09-18 5238
bae473a423f65e Kirill A. Shutemov 2016-07-26 5239 if (unlikely(is_vm_hugetlb_page(vma)))
bae473a423f65e Kirill A. Shutemov 2016-07-26 5240 ret = hugetlb_fault(vma->vm_mm, vma, address, flags);
bae473a423f65e Kirill A. Shutemov 2016-07-26 5241 else
dcddffd41d3f1d Kirill A. Shutemov 2016-07-26 5242 ret = __handle_mm_fault(vma, address, flags);
519e52473ebe9d Johannes Weiner 2013-09-12 5243
ec1c86b25f4bdd Yu Zhao 2022-09-18 5244 lru_gen_exit_fault();
ec1c86b25f4bdd Yu Zhao 2022-09-18 5245
a2eef9e49f572b Khalid Aziz 2023-04-26 5246 /*
a2eef9e49f572b Khalid Aziz 2023-04-26 5247 * Release the read lock on shared VMA's parent mm unless
a2eef9e49f572b Khalid Aziz 2023-04-26 5248 * __handle_mm_fault released the lock already.
a2eef9e49f572b Khalid Aziz 2023-04-26 5249 * __handle_mm_fault sets VM_FAULT_RETRY in return value if
a2eef9e49f572b Khalid Aziz 2023-04-26 5250 * it released mmap lock. If lock was released, that implies
a2eef9e49f572b Khalid Aziz 2023-04-26 5251 * the lock would have been released on task's original mm if
a2eef9e49f572b Khalid Aziz 2023-04-26 5252 * this were not a shared PTE vma. To keep lock state consistent,
a2eef9e49f572b Khalid Aziz 2023-04-26 5253 * make sure to release the lock on task's original mm
a2eef9e49f572b Khalid Aziz 2023-04-26 5254 */
a2eef9e49f572b Khalid Aziz 2023-04-26 5255 if (shared) {
a2eef9e49f572b Khalid Aziz 2023-04-26 5256 int release_mmlock = 1;
a2eef9e49f572b Khalid Aziz 2023-04-26 5257
a2eef9e49f572b Khalid Aziz 2023-04-26 5258 if (!(ret & VM_FAULT_RETRY)) {
a2eef9e49f572b Khalid Aziz 2023-04-26 5259 mmap_read_unlock(vma->vm_mm);
a2eef9e49f572b Khalid Aziz 2023-04-26 5260 release_mmlock = 0;
a2eef9e49f572b Khalid Aziz 2023-04-26 5261 } else if ((flags & FAULT_FLAG_ALLOW_RETRY) &&
a2eef9e49f572b Khalid Aziz 2023-04-26 5262 (flags & FAULT_FLAG_RETRY_NOWAIT)) {
a2eef9e49f572b Khalid Aziz 2023-04-26 5263 mmap_read_unlock(vma->vm_mm);
a2eef9e49f572b Khalid Aziz 2023-04-26 5264 release_mmlock = 0;
a2eef9e49f572b Khalid Aziz 2023-04-26 5265 }
a2eef9e49f572b Khalid Aziz 2023-04-26 5266
a2eef9e49f572b Khalid Aziz 2023-04-26 5267 /*
a2eef9e49f572b Khalid Aziz 2023-04-26 5268 * Reset guest vma pointers that were set up in
a2eef9e49f572b Khalid Aziz 2023-04-26 5269 * find_shared_vma() to process this fault.
a2eef9e49f572b Khalid Aziz 2023-04-26 5270 */
a2eef9e49f572b Khalid Aziz 2023-04-26 5271 vma->vm_mm = orig_mm;
a2eef9e49f572b Khalid Aziz 2023-04-26 5272 if (release_mmlock)
a2eef9e49f572b Khalid Aziz 2023-04-26 5273 mmap_read_unlock(orig_mm);
a2eef9e49f572b Khalid Aziz 2023-04-26 5274 }
a2eef9e49f572b Khalid Aziz 2023-04-26 5275
4942642080ea82 Johannes Weiner 2013-10-16 5276 if (flags & FAULT_FLAG_USER) {
29ef680ae7c211 Michal Hocko 2018-08-17 5277 mem_cgroup_exit_user_fault();
4942642080ea82 Johannes Weiner 2013-10-16 5278 /*
4942642080ea82 Johannes Weiner 2013-10-16 5279 * The task may have entered a memcg OOM situation but
4942642080ea82 Johannes Weiner 2013-10-16 5280 * if the allocation error was handled gracefully (no
4942642080ea82 Johannes Weiner 2013-10-16 5281 * VM_FAULT_OOM), there is no need to kill anything.
4942642080ea82 Johannes Weiner 2013-10-16 5282 * Just clean up the OOM state peacefully.
4942642080ea82 Johannes Weiner 2013-10-16 5283 */
4942642080ea82 Johannes Weiner 2013-10-16 5284 if (task_in_memcg_oom(current) && !(ret & VM_FAULT_OOM))
4942642080ea82 Johannes Weiner 2013-10-16 5285 mem_cgroup_oom_synchronize(false);
4942642080ea82 Johannes Weiner 2013-10-16 5286 }
3812c8c8f39539 Johannes Weiner 2013-09-12 5287
bce617edecada0 Peter Xu 2020-08-11 5288 mm_account_fault(regs, address, flags, ret);
bce617edecada0 Peter Xu 2020-08-11 5289
519e52473ebe9d Johannes Weiner 2013-09-12 5290 return ret;
519e52473ebe9d Johannes Weiner 2013-09-12 5291 }
e1d6d01ab491be Jesse Barnes 2014-12-12 5292 EXPORT_SYMBOL_GPL(handle_mm_fault);
519e52473ebe9d Johannes Weiner 2013-09-12 5293
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests
next reply other threads:[~2023-05-07 22:55 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-07 22:55 kernel test robot [this message]
-- strict thread matches above, loose matches on Subject: below --
2023-04-26 16:49 [PATCH RFC v2 0/4] Add support for sharing page tables across processes (Previously mshare) Khalid Aziz
2023-04-26 16:49 ` [PATCH RFC v2 4/4] mm/ptshare: Add page fault handling for page table shared regions Khalid Aziz
2023-04-27 0:24 ` kernel test robot
2023-04-29 14:07 ` kernel test robot
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=202305080652.26E18YDE-lkp@intel.com \
--to=lkp@intel.com \
--cc=error27@gmail.com \
--cc=oe-kbuild@lists.linux.dev \
/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.