All of lore.kernel.org
 help / color / mirror / Atom feed
* [linux-stable-rc:linux-5.4.y 5600/6105] drivers/vfio/vfio_iommu_type1.c:366:22: error: implicit declaration of function 'pte_write'
@ 2021-05-06 15:51 kernel test robot
  2021-05-06 20:12 ` Alex Williamson
  0 siblings, 1 reply; 3+ messages in thread
From: kernel test robot @ 2021-05-06 15:51 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 5407 bytes --]

Hi Jason,

First bad commit (maybe != root cause):

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-5.4.y
head:   73e74400c797af9bc645d41cfd350b15e3e52d2c
commit: 3c57ea09365f4a6b32568b8ba6b98ae7d238cb0d [5600/6105] vfio: IOMMU_API should be selected
config: arm-randconfig-r014-20210506 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 8f5a2a5836cc8e4c1def2bdeb022e7b496623439)
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
        # install arm cross compiling tool for clang build
        # apt-get install binutils-arm-linux-gnueabi
        # https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git/commit/?id=3c57ea09365f4a6b32568b8ba6b98ae7d238cb0d
        git remote add linux-stable-rc https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
        git fetch --no-tags linux-stable-rc linux-5.4.y
        git checkout 3c57ea09365f4a6b32568b8ba6b98ae7d238cb0d
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=arm 

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 >>):

>> drivers/vfio/vfio_iommu_type1.c:366:22: error: implicit declaration of function 'pte_write' [-Werror,-Wimplicit-function-declaration]
           if (write_fault && !pte_write(*ptep))
                               ^
>> drivers/vfio/vfio_iommu_type1.c:369:10: error: implicit declaration of function 'pte_pfn' [-Werror,-Wimplicit-function-declaration]
                   *pfn = pte_pfn(*ptep);
                          ^
   drivers/vfio/vfio_iommu_type1.c:369:10: note: did you mean 'put_pfn'?
   drivers/vfio/vfio_iommu_type1.c:327:12: note: 'put_pfn' declared here
   static int put_pfn(unsigned long pfn, int prot)
              ^
>> drivers/vfio/vfio_iommu_type1.c:371:2: error: implicit declaration of function 'pte_unmap' [-Werror,-Wimplicit-function-declaration]
           pte_unmap_unlock(ptep, ptl);
           ^
   include/linux/mm.h:1988:2: note: expanded from macro 'pte_unmap_unlock'
           pte_unmap(pte);                                 \
           ^
   3 errors generated.


vim +/pte_write +366 drivers/vfio/vfio_iommu_type1.c

73fa0d10d077d9 Alex Williamson 2012-07-31  338  
270c35d0723a2f Ajay Kaher      2020-09-06  339  static int follow_fault_pfn(struct vm_area_struct *vma, struct mm_struct *mm,
270c35d0723a2f Ajay Kaher      2020-09-06  340  			    unsigned long vaddr, unsigned long *pfn,
270c35d0723a2f Ajay Kaher      2020-09-06  341  			    bool write_fault)
270c35d0723a2f Ajay Kaher      2020-09-06  342  {
e41bb745fd0fca Alex Williamson 2021-02-16  343  	pte_t *ptep;
e41bb745fd0fca Alex Williamson 2021-02-16  344  	spinlock_t *ptl;
270c35d0723a2f Ajay Kaher      2020-09-06  345  	int ret;
270c35d0723a2f Ajay Kaher      2020-09-06  346  
e41bb745fd0fca Alex Williamson 2021-02-16  347  	ret = follow_pte(vma->vm_mm, vaddr, &ptep, &ptl);
270c35d0723a2f Ajay Kaher      2020-09-06  348  	if (ret) {
270c35d0723a2f Ajay Kaher      2020-09-06  349  		bool unlocked = false;
270c35d0723a2f Ajay Kaher      2020-09-06  350  
270c35d0723a2f Ajay Kaher      2020-09-06  351  		ret = fixup_user_fault(NULL, mm, vaddr,
270c35d0723a2f Ajay Kaher      2020-09-06  352  				       FAULT_FLAG_REMOTE |
270c35d0723a2f Ajay Kaher      2020-09-06  353  				       (write_fault ?  FAULT_FLAG_WRITE : 0),
270c35d0723a2f Ajay Kaher      2020-09-06  354  				       &unlocked);
270c35d0723a2f Ajay Kaher      2020-09-06  355  		if (unlocked)
270c35d0723a2f Ajay Kaher      2020-09-06  356  			return -EAGAIN;
270c35d0723a2f Ajay Kaher      2020-09-06  357  
270c35d0723a2f Ajay Kaher      2020-09-06  358  		if (ret)
270c35d0723a2f Ajay Kaher      2020-09-06  359  			return ret;
270c35d0723a2f Ajay Kaher      2020-09-06  360  
e41bb745fd0fca Alex Williamson 2021-02-16  361  		ret = follow_pte(vma->vm_mm, vaddr, &ptep, &ptl);
e41bb745fd0fca Alex Williamson 2021-02-16  362  		if (ret)
e41bb745fd0fca Alex Williamson 2021-02-16  363  			return ret;
270c35d0723a2f Ajay Kaher      2020-09-06  364  	}
270c35d0723a2f Ajay Kaher      2020-09-06  365  
e41bb745fd0fca Alex Williamson 2021-02-16 @366  	if (write_fault && !pte_write(*ptep))
e41bb745fd0fca Alex Williamson 2021-02-16  367  		ret = -EFAULT;
e41bb745fd0fca Alex Williamson 2021-02-16  368  	else
e41bb745fd0fca Alex Williamson 2021-02-16 @369  		*pfn = pte_pfn(*ptep);
e41bb745fd0fca Alex Williamson 2021-02-16  370  
e41bb745fd0fca Alex Williamson 2021-02-16 @371  	pte_unmap_unlock(ptep, ptl);
270c35d0723a2f Ajay Kaher      2020-09-06  372  	return ret;
270c35d0723a2f Ajay Kaher      2020-09-06  373  }
270c35d0723a2f Ajay Kaher      2020-09-06  374  

:::::: The code at line 366 was first introduced by commit
:::::: e41bb745fd0fcaa1d37a7bd4da46230822ffe18f vfio/type1: Use follow_pte()

:::::: TO: Alex Williamson <alex.williamson@redhat.com>
:::::: CC: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

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

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 24256 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [linux-stable-rc:linux-5.4.y 5600/6105] drivers/vfio/vfio_iommu_type1.c:366:22: error: implicit declaration of function 'pte_write'
  2021-05-06 15:51 [linux-stable-rc:linux-5.4.y 5600/6105] drivers/vfio/vfio_iommu_type1.c:366:22: error: implicit declaration of function 'pte_write' kernel test robot
@ 2021-05-06 20:12 ` Alex Williamson
  2021-05-06 20:17   ` Alex Williamson
  0 siblings, 1 reply; 3+ messages in thread
From: Alex Williamson @ 2021-05-06 20:12 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 3772 bytes --]

On Thu, 6 May 2021 23:51:51 +0800
kernel test robot <lkp@intel.com> wrote:

> Hi Jason,
> 
> First bad commit (maybe != root cause):
> 
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-5.4.y
> head:   73e74400c797af9bc645d41cfd350b15e3e52d2c
> commit: 3c57ea09365f4a6b32568b8ba6b98ae7d238cb0d [5600/6105] vfio: IOMMU_API should be selected
> config: arm-randconfig-r014-20210506 (attached as .config)
> compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 8f5a2a5836cc8e4c1def2bdeb022e7b496623439)
> 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
>         # install arm cross compiling tool for clang build
>         # apt-get install binutils-arm-linux-gnueabi
>         # https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git/commit/?id=3c57ea09365f4a6b32568b8ba6b98ae7d238cb0d
>         git remote add linux-stable-rc https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
>         git fetch --no-tags linux-stable-rc linux-5.4.y
>         git checkout 3c57ea09365f4a6b32568b8ba6b98ae7d238cb0d
>         # save the attached .config to linux build tree
>         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=arm 
> 
> 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 >>):
> 
> >> drivers/vfio/vfio_iommu_type1.c:366:22: error: implicit declaration of function 'pte_write' [-Werror,-Wimplicit-function-declaration]  
>            if (write_fault && !pte_write(*ptep))
>                                ^
> >> drivers/vfio/vfio_iommu_type1.c:369:10: error: implicit declaration of function 'pte_pfn' [-Werror,-Wimplicit-function-declaration]  
>                    *pfn = pte_pfn(*ptep);
>                           ^
>    drivers/vfio/vfio_iommu_type1.c:369:10: note: did you mean 'put_pfn'?
>    drivers/vfio/vfio_iommu_type1.c:327:12: note: 'put_pfn' declared here
>    static int put_pfn(unsigned long pfn, int prot)
>               ^
> >> drivers/vfio/vfio_iommu_type1.c:371:2: error: implicit declaration of function 'pte_unmap' [-Werror,-Wimplicit-function-declaration]  
>            pte_unmap_unlock(ptep, ptl);
>            ^
>    include/linux/mm.h:1988:2: note: expanded from macro 'pte_unmap_unlock'
>            pte_unmap(pte);                                 \
>            ^
>    3 errors generated.


We need to fit in an MMU dependency for VFIO_IOMMU_TYPE1.  The IOMMU_API
dependency for vfio itself is real.  We could just turn everything off
for MMU (who really cares?) but theoretically VFIO_NOIOMMU support
could be used in some weird way with !MMU.  If VFIO tries to select
something whose dependency isn't met we get Kconfig errors, so I think
the right answer is:

diff --git a/drivers/vfio/Kconfig b/drivers/vfio/Kconfig
index 9dc95024afae..2c3baeabf094 100644
--- a/drivers/vfio/Kconfig
+++ b/drivers/vfio/Kconfig
@@ -1,8 +1,8 @@
 # SPDX-License-Identifier: GPL-2.0-only
 config VFIO_IOMMU_TYPE1
 	tristate
-	depends on VFIO
-	default n
+	depends on VFIO && MMU
+	default VFIO if (X86 || S390 || ARM || ARM64)
 
 config VFIO_IOMMU_SPAPR_TCE
 	tristate
@@ -22,7 +22,6 @@ config VFIO_VIRQFD
 menuconfig VFIO
 	tristate "VFIO Non-Privileged userspace driver framework"
 	select IOMMU_API
-	select VFIO_IOMMU_TYPE1 if (X86 || S390 || ARM || ARM64)
 	help
 	  VFIO provides a framework for secure userspace device drivers.
 	  See Documentation/driver-api/vfio.rst for more details.

Better options?  Thanks,

Alex

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [linux-stable-rc:linux-5.4.y 5600/6105] drivers/vfio/vfio_iommu_type1.c:366:22: error: implicit declaration of function 'pte_write'
  2021-05-06 20:12 ` Alex Williamson
@ 2021-05-06 20:17   ` Alex Williamson
  0 siblings, 0 replies; 3+ messages in thread
From: Alex Williamson @ 2021-05-06 20:17 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 4201 bytes --]

On Thu, 6 May 2021 14:12:21 -0600
Alex Williamson <alex.williamson@redhat.com> wrote:

> On Thu, 6 May 2021 23:51:51 +0800
> kernel test robot <lkp@intel.com> wrote:
> 
> > Hi Jason,
> > 
> > First bad commit (maybe != root cause):
> > 
> > tree:   https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-5.4.y
> > head:   73e74400c797af9bc645d41cfd350b15e3e52d2c
> > commit: 3c57ea09365f4a6b32568b8ba6b98ae7d238cb0d [5600/6105] vfio: IOMMU_API should be selected
> > config: arm-randconfig-r014-20210506 (attached as .config)
> > compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 8f5a2a5836cc8e4c1def2bdeb022e7b496623439)
> > 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
> >         # install arm cross compiling tool for clang build
> >         # apt-get install binutils-arm-linux-gnueabi
> >         # https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git/commit/?id=3c57ea09365f4a6b32568b8ba6b98ae7d238cb0d
> >         git remote add linux-stable-rc https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
> >         git fetch --no-tags linux-stable-rc linux-5.4.y
> >         git checkout 3c57ea09365f4a6b32568b8ba6b98ae7d238cb0d
> >         # save the attached .config to linux build tree
> >         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=arm 
> > 
> > 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 >>):
> >   
> > >> drivers/vfio/vfio_iommu_type1.c:366:22: error: implicit declaration of function 'pte_write' [-Werror,-Wimplicit-function-declaration]    
> >            if (write_fault && !pte_write(*ptep))
> >                                ^  
> > >> drivers/vfio/vfio_iommu_type1.c:369:10: error: implicit declaration of function 'pte_pfn' [-Werror,-Wimplicit-function-declaration]    
> >                    *pfn = pte_pfn(*ptep);
> >                           ^
> >    drivers/vfio/vfio_iommu_type1.c:369:10: note: did you mean 'put_pfn'?
> >    drivers/vfio/vfio_iommu_type1.c:327:12: note: 'put_pfn' declared here
> >    static int put_pfn(unsigned long pfn, int prot)
> >               ^  
> > >> drivers/vfio/vfio_iommu_type1.c:371:2: error: implicit declaration of function 'pte_unmap' [-Werror,-Wimplicit-function-declaration]    
> >            pte_unmap_unlock(ptep, ptl);
> >            ^
> >    include/linux/mm.h:1988:2: note: expanded from macro 'pte_unmap_unlock'
> >            pte_unmap(pte);                                 \
> >            ^
> >    3 errors generated.  
> 
> 
> We need to fit in an MMU dependency for VFIO_IOMMU_TYPE1.  The IOMMU_API
> dependency for vfio itself is real.  We could just turn everything off
> for MMU (who really cares?) but theoretically VFIO_NOIOMMU support
> could be used in some weird way with !MMU.  If VFIO tries to select
> something whose dependency isn't met we get Kconfig errors, so I think
> the right answer is:
> 
> diff --git a/drivers/vfio/Kconfig b/drivers/vfio/Kconfig
> index 9dc95024afae..2c3baeabf094 100644
> --- a/drivers/vfio/Kconfig
> +++ b/drivers/vfio/Kconfig
> @@ -1,8 +1,8 @@
>  # SPDX-License-Identifier: GPL-2.0-only
>  config VFIO_IOMMU_TYPE1
>  	tristate
> -	depends on VFIO
> -	default n
> +	depends on VFIO && MMU
> +	default VFIO if (X86 || S390 || ARM || ARM64)
>  
>  config VFIO_IOMMU_SPAPR_TCE
>  	tristate
> @@ -22,7 +22,6 @@ config VFIO_VIRQFD
>  menuconfig VFIO
>  	tristate "VFIO Non-Privileged userspace driver framework"
>  	select IOMMU_API
> -	select VFIO_IOMMU_TYPE1 if (X86 || S390 || ARM || ARM64)
>  	help
>  	  VFIO provides a framework for secure userspace device drivers.
>  	  See Documentation/driver-api/vfio.rst for more details.
> 
> Better options?  Thanks,

D'oh, we already fixed this in b2b12db53507 ("vfio: Depend on MMU").  I
sort of like the above better, but I'll forward the existing commit to
stable.  Thanks,

Alex

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-05-06 20:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-06 15:51 [linux-stable-rc:linux-5.4.y 5600/6105] drivers/vfio/vfio_iommu_type1.c:366:22: error: implicit declaration of function 'pte_write' kernel test robot
2021-05-06 20:12 ` Alex Williamson
2021-05-06 20:17   ` Alex Williamson

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.