public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/3] Cleanup for PAT
@ 2024-01-11 12:09 Wupeng Ma
  2024-01-11 12:09 ` [PATCH v3 1/3] x86/mm/pat: Move follow_phys to pat-related file Wupeng Ma
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Wupeng Ma @ 2024-01-11 12:09 UTC (permalink / raw)
  To: akpm, dave.hansen, luto, tglx, peterz
  Cc: linux-kernel, x86, mawupeng1, bp, mingo

From: Ma Wupeng <mawupeng1@huawei.com>

Patch #1 move follow_phys to memtype.c since only pat use this.
Patch #2 cleanup parameter in follow_phys.
Patch #3 drop the unnecessary WARN_ON_ONCE if follow_phys fails.

Changelog since v2:
- rebase to latest linux

Changelog since v1:
- split patch #1 into two patches based on Boris's advise

Ma Wupeng (3):
  x86/mm/pat: Move follow_phys to pat-related file
  x86/mm/pat: Cleanup unused parameter in follow_phys
  x86/mm/pat: Remove WARN_ON_ONCE if follow_phys fails

 arch/x86/mm/pat/memtype.c | 34 ++++++++++++++++++++++++++++------
 include/linux/mm.h        |  2 --
 mm/memory.c               | 28 ----------------------------
 3 files changed, 28 insertions(+), 36 deletions(-)

-- 
2.25.1


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

* [PATCH v3 1/3] x86/mm/pat: Move follow_phys to pat-related file
  2024-01-11 12:09 [PATCH v3 0/3] Cleanup for PAT Wupeng Ma
@ 2024-01-11 12:09 ` Wupeng Ma
  2024-01-12 14:55   ` kernel test robot
  2024-01-11 12:09 ` [PATCH v3 2/3] x86/mm/pat: Cleanup unused parameter in follow_phys Wupeng Ma
  2024-01-11 12:09 ` [PATCH v3 3/3] x86/mm/pat: Remove WARN_ON_ONCE if follow_phys fails Wupeng Ma
  2 siblings, 1 reply; 7+ messages in thread
From: Wupeng Ma @ 2024-01-11 12:09 UTC (permalink / raw)
  To: akpm, dave.hansen, luto, tglx, peterz
  Cc: linux-kernel, x86, mawupeng1, bp, mingo

From: Ma Wupeng <mawupeng1@huawei.com>

Since only PAT in x86 use follow_phys(), move this to from memory.c to
memtype.c and make it static.

Since config HAVE_IOREMAP_PROT is selected by x86, drop this config macro.

Signed-off-by: Ma Wupeng <mawupeng1@huawei.com>
---
 arch/x86/mm/pat/memtype.c | 28 ++++++++++++++++++++++++++++
 include/linux/mm.h        |  2 --
 mm/memory.c               | 28 ----------------------------
 3 files changed, 28 insertions(+), 30 deletions(-)

diff --git a/arch/x86/mm/pat/memtype.c b/arch/x86/mm/pat/memtype.c
index de10800cd4dd..a6a88679c92e 100644
--- a/arch/x86/mm/pat/memtype.c
+++ b/arch/x86/mm/pat/memtype.c
@@ -950,6 +950,34 @@ static void free_pfn_range(u64 paddr, unsigned long size)
 		memtype_free(paddr, paddr + size);
 }
 
+static int follow_phys(struct vm_area_struct *vma,
+		unsigned long address, unsigned int flags,
+		unsigned long *prot, resource_size_t *phys)
+{
+	int ret = -EINVAL;
+	pte_t *ptep, pte;
+	spinlock_t *ptl;
+
+	if (!(vma->vm_flags & (VM_IO | VM_PFNMAP)))
+		goto out;
+
+	if (follow_pte(vma->vm_mm, address, &ptep, &ptl))
+		goto out;
+	pte = ptep_get(ptep);
+
+	if ((flags & FOLL_WRITE) && !pte_write(pte))
+		goto unlock;
+
+	*prot = pgprot_val(pte_pgprot(pte));
+	*phys = (resource_size_t)pte_pfn(pte) << PAGE_SHIFT;
+
+	ret = 0;
+unlock:
+	pte_unmap_unlock(ptep, ptl);
+out:
+	return ret;
+}
+
 /*
  * track_pfn_copy is called when vma that is covering the pfnmap gets
  * copied through copy_page_range().
diff --git a/include/linux/mm.h b/include/linux/mm.h
index da5219b48d52..8c4fa44e0e4b 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -2364,8 +2364,6 @@ int follow_pte(struct mm_struct *mm, unsigned long address,
 	       pte_t **ptepp, spinlock_t **ptlp);
 int follow_pfn(struct vm_area_struct *vma, unsigned long address,
 	unsigned long *pfn);
-int follow_phys(struct vm_area_struct *vma, unsigned long address,
-		unsigned int flags, unsigned long *prot, resource_size_t *phys);
 int generic_access_phys(struct vm_area_struct *vma, unsigned long addr,
 			void *buf, int len, int write);
 
diff --git a/mm/memory.c b/mm/memory.c
index 6e0712d06cd4..a555f7ebd4ef 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -5697,34 +5697,6 @@ int follow_pfn(struct vm_area_struct *vma, unsigned long address,
 EXPORT_SYMBOL(follow_pfn);
 
 #ifdef CONFIG_HAVE_IOREMAP_PROT
-int follow_phys(struct vm_area_struct *vma,
-		unsigned long address, unsigned int flags,
-		unsigned long *prot, resource_size_t *phys)
-{
-	int ret = -EINVAL;
-	pte_t *ptep, pte;
-	spinlock_t *ptl;
-
-	if (!(vma->vm_flags & (VM_IO | VM_PFNMAP)))
-		goto out;
-
-	if (follow_pte(vma->vm_mm, address, &ptep, &ptl))
-		goto out;
-	pte = ptep_get(ptep);
-
-	if ((flags & FOLL_WRITE) && !pte_write(pte))
-		goto unlock;
-
-	*prot = pgprot_val(pte_pgprot(pte));
-	*phys = (resource_size_t)pte_pfn(pte) << PAGE_SHIFT;
-
-	ret = 0;
-unlock:
-	pte_unmap_unlock(ptep, ptl);
-out:
-	return ret;
-}
-
 /**
  * generic_access_phys - generic implementation for iomem mmap access
  * @vma: the vma to access
-- 
2.25.1


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

* [PATCH v3 2/3] x86/mm/pat: Cleanup unused parameter in follow_phys
  2024-01-11 12:09 [PATCH v3 0/3] Cleanup for PAT Wupeng Ma
  2024-01-11 12:09 ` [PATCH v3 1/3] x86/mm/pat: Move follow_phys to pat-related file Wupeng Ma
@ 2024-01-11 12:09 ` Wupeng Ma
  2024-01-12  6:35   ` kernel test robot
  2024-01-12 10:49   ` kernel test robot
  2024-01-11 12:09 ` [PATCH v3 3/3] x86/mm/pat: Remove WARN_ON_ONCE if follow_phys fails Wupeng Ma
  2 siblings, 2 replies; 7+ messages in thread
From: Wupeng Ma @ 2024-01-11 12:09 UTC (permalink / raw)
  To: akpm, dave.hansen, luto, tglx, peterz
  Cc: linux-kernel, x86, mawupeng1, bp, mingo

From: Ma Wupeng <mawupeng1@huawei.com>

Parameter flags is always zero in caller untrack_pfn() and
track_pfn_copy(). let's drop it.

Signed-off-by: Ma Wupeng <mawupeng1@huawei.com>
---
 arch/x86/mm/pat/memtype.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/arch/x86/mm/pat/memtype.c b/arch/x86/mm/pat/memtype.c
index a6a88679c92e..94bcba399701 100644
--- a/arch/x86/mm/pat/memtype.c
+++ b/arch/x86/mm/pat/memtype.c
@@ -951,8 +951,8 @@ static void free_pfn_range(u64 paddr, unsigned long size)
 }
 
 static int follow_phys(struct vm_area_struct *vma,
-		unsigned long address, unsigned int flags,
-		unsigned long *prot, resource_size_t *phys)
+		unsigned long address,  unsigned long *prot,
+		resource_size_t *phys)
 {
 	int ret = -EINVAL;
 	pte_t *ptep, pte;
@@ -965,9 +965,6 @@ static int follow_phys(struct vm_area_struct *vma,
 		goto out;
 	pte = ptep_get(ptep);
 
-	if ((flags & FOLL_WRITE) && !pte_write(pte))
-		goto unlock;
-
 	*prot = pgprot_val(pte_pgprot(pte));
 	*phys = (resource_size_t)pte_pfn(pte) << PAGE_SHIFT;
 
@@ -997,7 +994,7 @@ int track_pfn_copy(struct vm_area_struct *vma)
 		 * reserve the whole chunk covered by vma. We need the
 		 * starting address and protection from pte.
 		 */
-		if (follow_phys(vma, vma->vm_start, 0, &prot, &paddr)) {
+		if (follow_phys(vma, vma->vm_start, &prot, &paddr)) {
 			WARN_ON_ONCE(1);
 			return -EINVAL;
 		}
@@ -1084,7 +1081,7 @@ void untrack_pfn(struct vm_area_struct *vma, unsigned long pfn,
 	/* free the chunk starting from pfn or the whole chunk */
 	paddr = (resource_size_t)pfn << PAGE_SHIFT;
 	if (!paddr && !size) {
-		if (follow_phys(vma, vma->vm_start, 0, &prot, &paddr)) {
+		if (follow_phys(vma, vma->vm_start, &prot, &paddr)) {
 			WARN_ON_ONCE(1);
 			return;
 		}
-- 
2.25.1


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

* [PATCH v3 3/3] x86/mm/pat: Remove WARN_ON_ONCE if follow_phys fails
  2024-01-11 12:09 [PATCH v3 0/3] Cleanup for PAT Wupeng Ma
  2024-01-11 12:09 ` [PATCH v3 1/3] x86/mm/pat: Move follow_phys to pat-related file Wupeng Ma
  2024-01-11 12:09 ` [PATCH v3 2/3] x86/mm/pat: Cleanup unused parameter in follow_phys Wupeng Ma
@ 2024-01-11 12:09 ` Wupeng Ma
  2 siblings, 0 replies; 7+ messages in thread
From: Wupeng Ma @ 2024-01-11 12:09 UTC (permalink / raw)
  To: akpm, dave.hansen, luto, tglx, peterz
  Cc: linux-kernel, x86, mawupeng1, bp, mingo

From: Ma Wupeng <mawupeng1@huawei.com>

Since there is no obvious reason to keep this WARN_ON_ONCE if follow_phys
fails in track_pfn_copy/untrack_pfn, Drop it.

Signed-off-by: Ma Wupeng <mawupeng1@huawei.com>
---
 arch/x86/mm/pat/memtype.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/arch/x86/mm/pat/memtype.c b/arch/x86/mm/pat/memtype.c
index 94bcba399701..2fd37c2b29d6 100644
--- a/arch/x86/mm/pat/memtype.c
+++ b/arch/x86/mm/pat/memtype.c
@@ -994,10 +994,9 @@ int track_pfn_copy(struct vm_area_struct *vma)
 		 * reserve the whole chunk covered by vma. We need the
 		 * starting address and protection from pte.
 		 */
-		if (follow_phys(vma, vma->vm_start, &prot, &paddr)) {
-			WARN_ON_ONCE(1);
+		if (follow_phys(vma, vma->vm_start, &prot, &paddr))
 			return -EINVAL;
-		}
+
 		pgprot = __pgprot(prot);
 		return reserve_pfn_range(paddr, vma_size, &pgprot, 1);
 	}
@@ -1081,10 +1080,8 @@ void untrack_pfn(struct vm_area_struct *vma, unsigned long pfn,
 	/* free the chunk starting from pfn or the whole chunk */
 	paddr = (resource_size_t)pfn << PAGE_SHIFT;
 	if (!paddr && !size) {
-		if (follow_phys(vma, vma->vm_start, &prot, &paddr)) {
-			WARN_ON_ONCE(1);
+		if (follow_phys(vma, vma->vm_start, &prot, &paddr))
 			return;
-		}
 
 		size = vma->vm_end - vma->vm_start;
 	}
-- 
2.25.1


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

* Re: [PATCH v3 2/3] x86/mm/pat: Cleanup unused parameter in follow_phys
  2024-01-11 12:09 ` [PATCH v3 2/3] x86/mm/pat: Cleanup unused parameter in follow_phys Wupeng Ma
@ 2024-01-12  6:35   ` kernel test robot
  2024-01-12 10:49   ` kernel test robot
  1 sibling, 0 replies; 7+ messages in thread
From: kernel test robot @ 2024-01-12  6:35 UTC (permalink / raw)
  To: Wupeng Ma, akpm, dave.hansen, luto, tglx
  Cc: oe-kbuild-all, linux-kernel, x86, mawupeng1, bp, mingo

Hi Wupeng,

kernel test robot noticed the following build warnings:

[auto build test WARNING on akpm-mm/mm-everything]
[also build test WARNING on tip/x86/mm tip/master linus/master v6.7 next-20240111]
[cannot apply to tip/auto-latest]
[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/Wupeng-Ma/x86-mm-pat-Move-follow_phys-to-pat-related-file/20240111-201305
base:   https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything
patch link:    https://lore.kernel.org/r/20240111120929.2694440-3-mawupeng1%40huawei.com
patch subject: [PATCH v3 2/3] x86/mm/pat: Cleanup unused parameter in follow_phys
config: i386-alldefconfig (https://download.01.org/0day-ci/archive/20240112/202401121454.wuRFNxQE-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240112/202401121454.wuRFNxQE-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202401121454.wuRFNxQE-lkp@intel.com/

All warnings (new ones prefixed by >>):

   arch/x86/mm/pat/memtype.c: In function 'follow_phys':
>> arch/x86/mm/pat/memtype.c:972:1: warning: label 'unlock' defined but not used [-Wunused-label]
     972 | unlock:
         | ^~~~~~


vim +/unlock +972 arch/x86/mm/pat/memtype.c

5899329b19100c arch/x86/mm/pat.c         venkatesh.pallipadi@intel.com 2008-12-18  952  
b4e07d9667b7ae arch/x86/mm/pat/memtype.c Ma Wupeng                     2024-01-11  953  static int follow_phys(struct vm_area_struct *vma,
76b476f1ffb4bf arch/x86/mm/pat/memtype.c Ma Wupeng                     2024-01-11  954  		unsigned long address,  unsigned long *prot,
76b476f1ffb4bf arch/x86/mm/pat/memtype.c Ma Wupeng                     2024-01-11  955  		resource_size_t *phys)
b4e07d9667b7ae arch/x86/mm/pat/memtype.c Ma Wupeng                     2024-01-11  956  {
b4e07d9667b7ae arch/x86/mm/pat/memtype.c Ma Wupeng                     2024-01-11  957  	int ret = -EINVAL;
b4e07d9667b7ae arch/x86/mm/pat/memtype.c Ma Wupeng                     2024-01-11  958  	pte_t *ptep, pte;
b4e07d9667b7ae arch/x86/mm/pat/memtype.c Ma Wupeng                     2024-01-11  959  	spinlock_t *ptl;
b4e07d9667b7ae arch/x86/mm/pat/memtype.c Ma Wupeng                     2024-01-11  960  
b4e07d9667b7ae arch/x86/mm/pat/memtype.c Ma Wupeng                     2024-01-11  961  	if (!(vma->vm_flags & (VM_IO | VM_PFNMAP)))
b4e07d9667b7ae arch/x86/mm/pat/memtype.c Ma Wupeng                     2024-01-11  962  		goto out;
b4e07d9667b7ae arch/x86/mm/pat/memtype.c Ma Wupeng                     2024-01-11  963  
b4e07d9667b7ae arch/x86/mm/pat/memtype.c Ma Wupeng                     2024-01-11  964  	if (follow_pte(vma->vm_mm, address, &ptep, &ptl))
b4e07d9667b7ae arch/x86/mm/pat/memtype.c Ma Wupeng                     2024-01-11  965  		goto out;
b4e07d9667b7ae arch/x86/mm/pat/memtype.c Ma Wupeng                     2024-01-11  966  	pte = ptep_get(ptep);
b4e07d9667b7ae arch/x86/mm/pat/memtype.c Ma Wupeng                     2024-01-11  967  
b4e07d9667b7ae arch/x86/mm/pat/memtype.c Ma Wupeng                     2024-01-11  968  	*prot = pgprot_val(pte_pgprot(pte));
b4e07d9667b7ae arch/x86/mm/pat/memtype.c Ma Wupeng                     2024-01-11  969  	*phys = (resource_size_t)pte_pfn(pte) << PAGE_SHIFT;
b4e07d9667b7ae arch/x86/mm/pat/memtype.c Ma Wupeng                     2024-01-11  970  
b4e07d9667b7ae arch/x86/mm/pat/memtype.c Ma Wupeng                     2024-01-11  971  	ret = 0;
b4e07d9667b7ae arch/x86/mm/pat/memtype.c Ma Wupeng                     2024-01-11 @972  unlock:
b4e07d9667b7ae arch/x86/mm/pat/memtype.c Ma Wupeng                     2024-01-11  973  	pte_unmap_unlock(ptep, ptl);
b4e07d9667b7ae arch/x86/mm/pat/memtype.c Ma Wupeng                     2024-01-11  974  out:
b4e07d9667b7ae arch/x86/mm/pat/memtype.c Ma Wupeng                     2024-01-11  975  	return ret;
b4e07d9667b7ae arch/x86/mm/pat/memtype.c Ma Wupeng                     2024-01-11  976  }
b4e07d9667b7ae arch/x86/mm/pat/memtype.c Ma Wupeng                     2024-01-11  977  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

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

* Re: [PATCH v3 2/3] x86/mm/pat: Cleanup unused parameter in follow_phys
  2024-01-11 12:09 ` [PATCH v3 2/3] x86/mm/pat: Cleanup unused parameter in follow_phys Wupeng Ma
  2024-01-12  6:35   ` kernel test robot
@ 2024-01-12 10:49   ` kernel test robot
  1 sibling, 0 replies; 7+ messages in thread
From: kernel test robot @ 2024-01-12 10:49 UTC (permalink / raw)
  To: Wupeng Ma, akpm, dave.hansen, luto, tglx
  Cc: llvm, oe-kbuild-all, linux-kernel, x86, mawupeng1, bp, mingo

Hi Wupeng,

kernel test robot noticed the following build warnings:

[auto build test WARNING on akpm-mm/mm-everything]
[also build test WARNING on tip/x86/mm tip/master linus/master v6.7 next-20240112]
[cannot apply to tip/auto-latest]
[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/Wupeng-Ma/x86-mm-pat-Move-follow_phys-to-pat-related-file/20240111-201305
base:   https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything
patch link:    https://lore.kernel.org/r/20240111120929.2694440-3-mawupeng1%40huawei.com
patch subject: [PATCH v3 2/3] x86/mm/pat: Cleanup unused parameter in follow_phys
config: i386-buildonly-randconfig-002-20240112 (https://download.01.org/0day-ci/archive/20240112/202401121839.yeX0qcR8-lkp@intel.com/config)
compiler: ClangBuiltLinux clang version 17.0.6 (https://github.com/llvm/llvm-project 6009708b4367171ccdbf4b5905cb6a803753fe18)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240112/202401121839.yeX0qcR8-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202401121839.yeX0qcR8-lkp@intel.com/

All warnings (new ones prefixed by >>):

   arch/x86/mm/pat/memtype.c:973:2: error: call to undeclared function 'kunmap_local'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
     973 |         pte_unmap_unlock(ptep, ptl);
         |         ^
   include/linux/mm.h:2965:2: note: expanded from macro 'pte_unmap_unlock'
    2965 |         pte_unmap(pte);                                 \
         |         ^
   include/linux/pgtable.h:103:2: note: expanded from macro 'pte_unmap'
     103 |         kunmap_local((pte));    \
         |         ^
>> arch/x86/mm/pat/memtype.c:972:1: warning: unused label 'unlock' [-Wunused-label]
     972 | unlock:
         | ^~~~~~~
   1 warning and 1 error generated.


vim +/unlock +972 arch/x86/mm/pat/memtype.c

5899329b19100c0 arch/x86/mm/pat.c         venkatesh.pallipadi@intel.com 2008-12-18  952  
b4e07d9667b7ae8 arch/x86/mm/pat/memtype.c Ma Wupeng                     2024-01-11  953  static int follow_phys(struct vm_area_struct *vma,
76b476f1ffb4bf1 arch/x86/mm/pat/memtype.c Ma Wupeng                     2024-01-11  954  		unsigned long address,  unsigned long *prot,
76b476f1ffb4bf1 arch/x86/mm/pat/memtype.c Ma Wupeng                     2024-01-11  955  		resource_size_t *phys)
b4e07d9667b7ae8 arch/x86/mm/pat/memtype.c Ma Wupeng                     2024-01-11  956  {
b4e07d9667b7ae8 arch/x86/mm/pat/memtype.c Ma Wupeng                     2024-01-11  957  	int ret = -EINVAL;
b4e07d9667b7ae8 arch/x86/mm/pat/memtype.c Ma Wupeng                     2024-01-11  958  	pte_t *ptep, pte;
b4e07d9667b7ae8 arch/x86/mm/pat/memtype.c Ma Wupeng                     2024-01-11  959  	spinlock_t *ptl;
b4e07d9667b7ae8 arch/x86/mm/pat/memtype.c Ma Wupeng                     2024-01-11  960  
b4e07d9667b7ae8 arch/x86/mm/pat/memtype.c Ma Wupeng                     2024-01-11  961  	if (!(vma->vm_flags & (VM_IO | VM_PFNMAP)))
b4e07d9667b7ae8 arch/x86/mm/pat/memtype.c Ma Wupeng                     2024-01-11  962  		goto out;
b4e07d9667b7ae8 arch/x86/mm/pat/memtype.c Ma Wupeng                     2024-01-11  963  
b4e07d9667b7ae8 arch/x86/mm/pat/memtype.c Ma Wupeng                     2024-01-11  964  	if (follow_pte(vma->vm_mm, address, &ptep, &ptl))
b4e07d9667b7ae8 arch/x86/mm/pat/memtype.c Ma Wupeng                     2024-01-11  965  		goto out;
b4e07d9667b7ae8 arch/x86/mm/pat/memtype.c Ma Wupeng                     2024-01-11  966  	pte = ptep_get(ptep);
b4e07d9667b7ae8 arch/x86/mm/pat/memtype.c Ma Wupeng                     2024-01-11  967  
b4e07d9667b7ae8 arch/x86/mm/pat/memtype.c Ma Wupeng                     2024-01-11  968  	*prot = pgprot_val(pte_pgprot(pte));
b4e07d9667b7ae8 arch/x86/mm/pat/memtype.c Ma Wupeng                     2024-01-11  969  	*phys = (resource_size_t)pte_pfn(pte) << PAGE_SHIFT;
b4e07d9667b7ae8 arch/x86/mm/pat/memtype.c Ma Wupeng                     2024-01-11  970  
b4e07d9667b7ae8 arch/x86/mm/pat/memtype.c Ma Wupeng                     2024-01-11  971  	ret = 0;
b4e07d9667b7ae8 arch/x86/mm/pat/memtype.c Ma Wupeng                     2024-01-11 @972  unlock:
b4e07d9667b7ae8 arch/x86/mm/pat/memtype.c Ma Wupeng                     2024-01-11 @973  	pte_unmap_unlock(ptep, ptl);
b4e07d9667b7ae8 arch/x86/mm/pat/memtype.c Ma Wupeng                     2024-01-11  974  out:
b4e07d9667b7ae8 arch/x86/mm/pat/memtype.c Ma Wupeng                     2024-01-11  975  	return ret;
b4e07d9667b7ae8 arch/x86/mm/pat/memtype.c Ma Wupeng                     2024-01-11  976  }
b4e07d9667b7ae8 arch/x86/mm/pat/memtype.c Ma Wupeng                     2024-01-11  977  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

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

* Re: [PATCH v3 1/3] x86/mm/pat: Move follow_phys to pat-related file
  2024-01-11 12:09 ` [PATCH v3 1/3] x86/mm/pat: Move follow_phys to pat-related file Wupeng Ma
@ 2024-01-12 14:55   ` kernel test robot
  0 siblings, 0 replies; 7+ messages in thread
From: kernel test robot @ 2024-01-12 14:55 UTC (permalink / raw)
  To: Wupeng Ma, akpm, dave.hansen, luto, tglx, peterz
  Cc: oe-kbuild-all, linux-kernel, x86, mawupeng1, bp, mingo

Hi Wupeng,

kernel test robot noticed the following build errors:

[auto build test ERROR on akpm-mm/mm-everything]
[also build test ERROR on tip/x86/mm tip/master linus/master v6.7 next-20240112]
[cannot apply to tip/auto-latest]
[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/Wupeng-Ma/x86-mm-pat-Move-follow_phys-to-pat-related-file/20240111-201305
base:   https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything
patch link:    https://lore.kernel.org/r/20240111120929.2694440-2-mawupeng1%40huawei.com
patch subject: [PATCH v3 1/3] x86/mm/pat: Move follow_phys to pat-related file
config: i386-randconfig-012-20240112 (https://download.01.org/0day-ci/archive/20240112/202401122234.MfmlPf9b-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240112/202401122234.MfmlPf9b-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202401122234.MfmlPf9b-lkp@intel.com/

All errors (new ones prefixed by >>):

   In file included from include/linux/mm.h:29,
                    from include/linux/memblock.h:12,
                    from arch/x86/mm/pat/memtype.c:35:
   arch/x86/mm/pat/memtype.c: In function 'follow_phys':
>> include/linux/pgtable.h:103:9: error: implicit declaration of function 'kunmap_local' [-Werror=implicit-function-declaration]
     103 |         kunmap_local((pte));    \
         |         ^~~~~~~~~~~~
   include/linux/mm.h:2965:9: note: in expansion of macro 'pte_unmap'
    2965 |         pte_unmap(pte);                                 \
         |         ^~~~~~~~~
   arch/x86/mm/pat/memtype.c:976:9: note: in expansion of macro 'pte_unmap_unlock'
     976 |         pte_unmap_unlock(ptep, ptl);
         |         ^~~~~~~~~~~~~~~~
   cc1: some warnings being treated as errors


vim +/kunmap_local +103 include/linux/pgtable.h

974b9b2c68f3d3 Mike Rapoport 2020-06-08   98  
0d940a9b270b92 Hugh Dickins  2023-06-08   99  #ifdef CONFIG_HIGHPTE
0d940a9b270b92 Hugh Dickins  2023-06-08  100  #define __pte_map(pmd, address) \
0d940a9b270b92 Hugh Dickins  2023-06-08  101  	((pte_t *)kmap_local_page(pmd_page(*(pmd))) + pte_index((address)))
0d940a9b270b92 Hugh Dickins  2023-06-08  102  #define pte_unmap(pte)	do {	\
0d940a9b270b92 Hugh Dickins  2023-06-08 @103  	kunmap_local((pte));	\
a349d72fd9efc8 Hugh Dickins  2023-07-11  104  	rcu_read_unlock();	\
0d940a9b270b92 Hugh Dickins  2023-06-08  105  } while (0)
974b9b2c68f3d3 Mike Rapoport 2020-06-08  106  #else
0d940a9b270b92 Hugh Dickins  2023-06-08  107  static inline pte_t *__pte_map(pmd_t *pmd, unsigned long address)
0d940a9b270b92 Hugh Dickins  2023-06-08  108  {
0d940a9b270b92 Hugh Dickins  2023-06-08  109  	return pte_offset_kernel(pmd, address);
0d940a9b270b92 Hugh Dickins  2023-06-08  110  }
0d940a9b270b92 Hugh Dickins  2023-06-08  111  static inline void pte_unmap(pte_t *pte)
0d940a9b270b92 Hugh Dickins  2023-06-08  112  {
a349d72fd9efc8 Hugh Dickins  2023-07-11  113  	rcu_read_unlock();
0d940a9b270b92 Hugh Dickins  2023-06-08  114  }
974b9b2c68f3d3 Mike Rapoport 2020-06-08  115  #endif
974b9b2c68f3d3 Mike Rapoport 2020-06-08  116  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

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

end of thread, other threads:[~2024-01-12 14:55 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-11 12:09 [PATCH v3 0/3] Cleanup for PAT Wupeng Ma
2024-01-11 12:09 ` [PATCH v3 1/3] x86/mm/pat: Move follow_phys to pat-related file Wupeng Ma
2024-01-12 14:55   ` kernel test robot
2024-01-11 12:09 ` [PATCH v3 2/3] x86/mm/pat: Cleanup unused parameter in follow_phys Wupeng Ma
2024-01-12  6:35   ` kernel test robot
2024-01-12 10:49   ` kernel test robot
2024-01-11 12:09 ` [PATCH v3 3/3] x86/mm/pat: Remove WARN_ON_ONCE if follow_phys fails Wupeng Ma

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox