[PATCH v5 3/9] powerpc/vas: Add paste address mmap fault handler

kernel test robot lkp at intel.com
Tue Mar 1 04:35:06 AEDT 2022


Hi Haren,

I love your patch! Perhaps something to improve:

[auto build test WARNING on powerpc/next]
[also build test WARNING on v5.17-rc6 next-20220225]
[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/Haren-Myneni/powerpc-pseries-vas-NXGZIP-support-with-DLPAR/20220228-154814
base:   https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next
config: powerpc64-randconfig-s031-20220227 (https://download.01.org/0day-ci/archive/20220228/202202281913.4N2Af10e-lkp@intel.com/config)
compiler: powerpc64-linux-gcc (GCC) 11.2.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # apt-get install sparse
        # sparse version: v0.6.4-dirty
        # https://github.com/0day-ci/linux/commit/336150efb288e945786ca6d54b0eb7d9c956aad8
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Haren-Myneni/powerpc-pseries-vas-NXGZIP-support-with-DLPAR/20220228-154814
        git checkout 336150efb288e945786ca6d54b0eb7d9c956aad8
        # save the config file to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=powerpc SHELL=/bin/bash arch/powerpc/platforms/book3s/ arch/powerpc/platforms/pseries/

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


sparse warnings: (new ones prefixed by >>)
>> arch/powerpc/platforms/book3s/vas-api.c:403:29: sparse: sparse: incorrect type in assignment (different base types) @@     expected int ret @@     got restricted vm_fault_t @@
   arch/powerpc/platforms/book3s/vas-api.c:403:29: sparse:     expected int ret
   arch/powerpc/platforms/book3s/vas-api.c:403:29: sparse:     got restricted vm_fault_t
>> arch/powerpc/platforms/book3s/vas-api.c:406:32: sparse: sparse: incorrect type in return expression (different base types) @@     expected restricted vm_fault_t @@     got int ret @@
   arch/powerpc/platforms/book3s/vas-api.c:406:32: sparse:     expected restricted vm_fault_t
   arch/powerpc/platforms/book3s/vas-api.c:406:32: sparse:     got int ret

vim +403 arch/powerpc/platforms/book3s/vas-api.c

   353	
   354	/*
   355	 * This fault handler is invoked when the core generates page fault on
   356	 * the paste address. Happens if the kernel closes window in hypervisor
   357	 * (on pseries) due to lost credit or the paste address is not mapped.
   358	 */
   359	static vm_fault_t vas_mmap_fault(struct vm_fault *vmf)
   360	{
   361		struct vm_area_struct *vma = vmf->vma;
   362		struct file *fp = vma->vm_file;
   363		struct coproc_instance *cp_inst = fp->private_data;
   364		struct vas_window *txwin;
   365		u64 paste_addr;
   366		int ret;
   367	
   368		/*
   369		 * window is not opened. Shouldn't expect this error.
   370		 */
   371		if (!cp_inst || !cp_inst->txwin) {
   372			pr_err("%s(): Unexpected fault on paste address with TX window closed\n",
   373					__func__);
   374			return VM_FAULT_SIGBUS;
   375		}
   376	
   377		txwin = cp_inst->txwin;
   378		/*
   379		 * When the LPAR lost credits due to core removal or during
   380		 * migration, invalidate the existing mapping for the current
   381		 * paste addresses and set windows in-active (zap_page_range in
   382		 * reconfig_close_windows()).
   383		 * New mapping will be done later after migration or new credits
   384		 * available. So continue to receive faults if the user space
   385		 * issue NX request.
   386		 */
   387		if (txwin->task_ref.vma != vmf->vma) {
   388			pr_err("%s(): No previous mapping with paste address\n",
   389				__func__);
   390			return VM_FAULT_SIGBUS;
   391		}
   392	
   393		mutex_lock(&txwin->task_ref.mmap_mutex);
   394		/*
   395		 * The window may be inactive due to lost credit (Ex: core
   396		 * removal with DLPAR). If the window is active again when
   397		 * the credit is available, map the new paste address at the
   398		 * the window virtual address.
   399		 */
   400		if (txwin->status == VAS_WIN_ACTIVE) {
   401			paste_addr = cp_inst->coproc->vops->paste_addr(txwin);
   402			if (paste_addr) {
 > 403				ret = vmf_insert_pfn(vma, vma->vm_start,
   404						(paste_addr >> PAGE_SHIFT));
   405				mutex_unlock(&txwin->task_ref.mmap_mutex);
 > 406				return ret;
   407			}
   408		}
   409		mutex_unlock(&txwin->task_ref.mmap_mutex);
   410	
   411		return VM_FAULT_SIGBUS;
   412	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org


More information about the Linuxppc-dev mailing list