From: kernel test robot <lkp@intel.com>
To: Peter Xu <peterx@redhat.com>, linux-kernel@vger.kernel.org
Cc: kbuild-all@lists.01.org, Andrea Arcangeli <aarcange@redhat.com>,
Will Deacon <will@kernel.org>,
Catalin Marinas <catalin.marinas@arm.com>,
peterx@redhat.com, linux-arm-kernel@lists.infradead.org,
Andrew Morton <akpm@linux-foundation.org>,
Linux Memory Management List <linux-mm@kvack.org>,
Gerald Schaefer <gerald.schaefer@de.ibm.com>
Subject: Re: [PATCH 06/25] mm/arm64: Use mm_fault_accounting()
Date: Wed, 17 Jun 2020 04:46:18 +0800 [thread overview]
Message-ID: <202006170418.hRvJaXle%lkp@intel.com> (raw)
In-Reply-To: <20200615221607.7764-7-peterx@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 6978 bytes --]
Hi Peter,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on sparc/master]
[cannot apply to mmotm/master sparc-next/master linus/master linux/master v5.8-rc1 next-20200616]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url: https://github.com/0day-ci/linux/commits/Peter-Xu/mm-Page-fault-accounting-cleanups/20200616-062640
base: https://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc.git master
config: arm64-allyesconfig (attached as .config)
compiler: aarch64-linux-gcc (GCC) 9.3.0
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
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=arm64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All errors (new ones prefixed by >>, old ones prefixed by <<):
arch/arm64/mm/fault.c: In function 'do_page_fault':
>> arch/arm64/mm/fault.c:538:38: error: 'address' undeclared (first use in this function); did you mean 'addr'?
538 | mm_fault_accounting(current, regs, address, major);
| ^~~~~~~
| addr
arch/arm64/mm/fault.c:538:38: note: each undeclared identifier is reported only once for each function it appears in
arch/arm64/mm/fault.c: At top level:
arch/arm64/mm/fault.c:725:6: warning: no previous prototype for 'do_el0_irq_bp_hardening' [-Wmissing-prototypes]
725 | void do_el0_irq_bp_hardening(void)
| ^~~~~~~~~~~~~~~~~~~~~~~
vim +538 arch/arm64/mm/fault.c
441
442 static int __kprobes do_page_fault(unsigned long addr, unsigned int esr,
443 struct pt_regs *regs)
444 {
445 const struct fault_info *inf;
446 struct mm_struct *mm = current->mm;
447 vm_fault_t fault, major = 0;
448 unsigned long vm_flags = VM_ACCESS_FLAGS;
449 unsigned int mm_flags = FAULT_FLAG_DEFAULT;
450
451 if (kprobe_page_fault(regs, esr))
452 return 0;
453
454 /*
455 * If we're in an interrupt or have no user context, we must not take
456 * the fault.
457 */
458 if (faulthandler_disabled() || !mm)
459 goto no_context;
460
461 if (user_mode(regs))
462 mm_flags |= FAULT_FLAG_USER;
463
464 if (is_el0_instruction_abort(esr)) {
465 vm_flags = VM_EXEC;
466 mm_flags |= FAULT_FLAG_INSTRUCTION;
467 } else if (is_write_abort(esr)) {
468 vm_flags = VM_WRITE;
469 mm_flags |= FAULT_FLAG_WRITE;
470 }
471
472 if (is_ttbr0_addr(addr) && is_el1_permission_fault(addr, esr, regs)) {
473 /* regs->orig_addr_limit may be 0 if we entered from EL0 */
474 if (regs->orig_addr_limit == KERNEL_DS)
475 die_kernel_fault("access to user memory with fs=KERNEL_DS",
476 addr, esr, regs);
477
478 if (is_el1_instruction_abort(esr))
479 die_kernel_fault("execution of user memory",
480 addr, esr, regs);
481
482 if (!search_exception_tables(regs->pc))
483 die_kernel_fault("access to user memory outside uaccess routines",
484 addr, esr, regs);
485 }
486
487 /*
488 * As per x86, we may deadlock here. However, since the kernel only
489 * validly references user space from well defined areas of the code,
490 * we can bug out early if this is from code which shouldn't.
491 */
492 if (!down_read_trylock(&mm->mmap_sem)) {
493 if (!user_mode(regs) && !search_exception_tables(regs->pc))
494 goto no_context;
495 retry:
496 down_read(&mm->mmap_sem);
497 } else {
498 /*
499 * The above down_read_trylock() might have succeeded in which
500 * case, we'll have missed the might_sleep() from down_read().
501 */
502 might_sleep();
503 #ifdef CONFIG_DEBUG_VM
504 if (!user_mode(regs) && !search_exception_tables(regs->pc)) {
505 up_read(&mm->mmap_sem);
506 goto no_context;
507 }
508 #endif
509 }
510
511 fault = __do_page_fault(mm, addr, mm_flags, vm_flags);
512 major |= fault & VM_FAULT_MAJOR;
513
514 /* Quick path to respond to signals */
515 if (fault_signal_pending(fault, regs)) {
516 if (!user_mode(regs))
517 goto no_context;
518 return 0;
519 }
520
521 if (fault & VM_FAULT_RETRY) {
522 if (mm_flags & FAULT_FLAG_ALLOW_RETRY) {
523 mm_flags |= FAULT_FLAG_TRIED;
524 goto retry;
525 }
526 }
527 up_read(&mm->mmap_sem);
528
529 /*
530 * Handle the "normal" (no error) case first.
531 */
532 if (likely(!(fault & (VM_FAULT_ERROR | VM_FAULT_BADMAP |
533 VM_FAULT_BADACCESS)))) {
534 /*
535 * Major/minor page fault accounting is only done
536 * once.
537 */
> 538 mm_fault_accounting(current, regs, address, major);
539 return 0;
540 }
541
542 /*
543 * If we are in kernel mode at this point, we have no context to
544 * handle this fault with.
545 */
546 if (!user_mode(regs))
547 goto no_context;
548
549 if (fault & VM_FAULT_OOM) {
550 /*
551 * We ran out of memory, call the OOM killer, and return to
552 * userspace (which will retry the fault, or kill us if we got
553 * oom-killed).
554 */
555 pagefault_out_of_memory();
556 return 0;
557 }
558
559 inf = esr_to_fault_info(esr);
560 set_thread_esr(addr, esr);
561 if (fault & VM_FAULT_SIGBUS) {
562 /*
563 * We had some memory, but were unable to successfully fix up
564 * this page fault.
565 */
566 arm64_force_sig_fault(SIGBUS, BUS_ADRERR, (void __user *)addr,
567 inf->name);
568 } else if (fault & (VM_FAULT_HWPOISON_LARGE | VM_FAULT_HWPOISON)) {
569 unsigned int lsb;
570
571 lsb = PAGE_SHIFT;
572 if (fault & VM_FAULT_HWPOISON_LARGE)
573 lsb = hstate_index_to_shift(VM_FAULT_GET_HINDEX(fault));
574
575 arm64_force_sig_mceerr(BUS_MCEERR_AR, (void __user *)addr, lsb,
576 inf->name);
577 } else {
578 /*
579 * Something tried to access memory that isn't in our memory
580 * map.
581 */
582 arm64_force_sig_fault(SIGSEGV,
583 fault == VM_FAULT_BADACCESS ? SEGV_ACCERR : SEGV_MAPERR,
584 (void __user *)addr,
585 inf->name);
586 }
587
588 return 0;
589
590 no_context:
591 __do_kernel_fault(addr, esr, regs);
592 return 0;
593 }
594
---
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: 71792 bytes --]
parent reply other threads:[~2020-06-16 20:46 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <20200615221607.7764-7-peterx@redhat.com>]
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=202006170418.hRvJaXle%lkp@intel.com \
--to=lkp@intel.com \
--cc=aarcange@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=catalin.marinas@arm.com \
--cc=gerald.schaefer@de.ibm.com \
--cc=kbuild-all@lists.01.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=peterx@redhat.com \
--cc=will@kernel.org \
/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