[PATCH 01/18] powerpc/64s: move the last of the page fault handling logic to C

kernel test robot lkp at intel.com
Fri Nov 6 08:54:40 AEDT 2020


Hi Nicholas,

I love your patch! Perhaps something to improve:

[auto build test WARNING on powerpc/next]
[also build test WARNING on v5.10-rc2 next-20201105]
[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/Nicholas-Piggin/powerpc-interrupt-wrappers/20201105-231909
base:   https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next
config: powerpc-allyesconfig (attached as .config)
compiler: powerpc64-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
        # https://github.com/0day-ci/linux/commit/7c4e3c4d325c8c43a43b8031b5327cb91b56db19
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Nicholas-Piggin/powerpc-interrupt-wrappers/20201105-231909
        git checkout 7c4e3c4d325c8c43a43b8031b5327cb91b56db19
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=powerpc 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp at intel.com>

All warnings (new ones prefixed by >>):

>> arch/powerpc/mm/book3s64/hash_utils.c:1513:5: warning: no previous prototype for 'do_hash_fault' [-Wmissing-prototypes]
    1513 | int do_hash_fault(struct pt_regs *regs, unsigned long ea, unsigned long dsisr)
         |     ^~~~~~~~~~~~~
   arch/powerpc/mm/book3s64/hash_utils.c:1886:6: warning: no previous prototype for 'hpte_insert_repeating' [-Wmissing-prototypes]
    1886 | long hpte_insert_repeating(unsigned long hash, unsigned long vpn,
         |      ^~~~~~~~~~~~~~~~~~~~~

vim +/do_hash_fault +1513 arch/powerpc/mm/book3s64/hash_utils.c

  1512	
> 1513	int do_hash_fault(struct pt_regs *regs, unsigned long ea, unsigned long dsisr)
  1514	{
  1515		unsigned long access = _PAGE_PRESENT | _PAGE_READ;
  1516		unsigned long flags = 0;
  1517		struct mm_struct *mm;
  1518		unsigned int region_id;
  1519		int err;
  1520	
  1521		if (unlikely(dsisr & (DSISR_BAD_FAULT_64S | DSISR_DABRMATCH | DSISR_KEYFAULT)))
  1522			goto _do_page_fault;
  1523	
  1524		/*
  1525		 * If we are in an "NMI" (e.g., an interrupt when soft-disabled), then
  1526		 * don't call hash_page, just fail the fault. This is required to
  1527		 * prevent re-entrancy problems in the hash code, namely perf
  1528		 * interrupts hitting while something holds H_PAGE_BUSY, and taking a
  1529		 * hash fault. See the comment in hash_preload().
  1530		 *
  1531		 * We come here as a result of a DSI at a point where we don't want
  1532		 * to call hash_page, such as when we are accessing memory (possibly
  1533		 * user memory) inside a PMU interrupt that occurred while interrupts
  1534		 * were soft-disabled.  We want to invoke the exception handler for
  1535		 * the access, or panic if there isn't a handler.
  1536		 */
  1537		if (unlikely(in_nmi())) {
  1538			bad_page_fault(regs, ea, SIGSEGV);
  1539			return 0;
  1540		}
  1541	
  1542		region_id = get_region_id(ea);
  1543		if ((region_id == VMALLOC_REGION_ID) || (region_id == IO_REGION_ID))
  1544			mm = &init_mm;
  1545		else
  1546			mm = current->mm;
  1547	
  1548		if (dsisr & DSISR_NOHPTE)
  1549			flags |= HPTE_NOHPTE_UPDATE;
  1550	
  1551		if (dsisr & DSISR_ISSTORE)
  1552			access |= _PAGE_WRITE;
  1553		/*
  1554		 * We set _PAGE_PRIVILEGED only when
  1555		 * kernel mode access kernel space.
  1556		 *
  1557		 * _PAGE_PRIVILEGED is NOT set
  1558		 * 1) when kernel mode access user space
  1559		 * 2) user space access kernel space.
  1560		 */
  1561		access |= _PAGE_PRIVILEGED;
  1562		if (user_mode(regs) || (region_id == USER_REGION_ID))
  1563			access &= ~_PAGE_PRIVILEGED;
  1564	
  1565		if (regs->trap == 0x400)
  1566			access |= _PAGE_EXEC;
  1567	
  1568		err = hash_page_mm(mm, ea, access, regs->trap, flags);
  1569		if (unlikely(err < 0)) {
  1570			// failed to instert a hash PTE due to an hypervisor error
  1571			if (user_mode(regs)) {
  1572				if (IS_ENABLED(CONFIG_PPC_SUBPAGE_PROT) && err == -2)
  1573					_exception(SIGSEGV, regs, SEGV_ACCERR, ea);
  1574				else
  1575					_exception(SIGBUS, regs, BUS_ADRERR, ea);
  1576			} else {
  1577				bad_page_fault(regs, ea, SIGBUS);
  1578			}
  1579			err = 0;
  1580	
  1581		} else if (err) {
  1582	_do_page_fault:
  1583			err = hash__do_page_fault(regs, ea, dsisr);
  1584		}
  1585	
  1586		return err;
  1587	}
  1588	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 71468 bytes
Desc: not available
URL: <http://lists.ozlabs.org/pipermail/linuxppc-dev/attachments/20201106/913ddaa7/attachment-0001.gz>


More information about the Linuxppc-dev mailing list