diff mbox series

[3/5] mm/vma: Replace all remaining open encodings with is_vm_hugetlb_page()

Message ID 1581915833-21984-4-git-send-email-anshuman.khandual@arm.com (mailing list archive)
State New, archived
Headers show
Series mm/vma: Use available wrappers when possible | expand

Commit Message

Anshuman Khandual Feb. 17, 2020, 5:03 a.m. UTC
This replaces all remaining open encodings with is_vm_hugetlb_page().

Cc: Paul Mackerras <paulus@ozlabs.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: Will Deacon <will@kernel.org>
Cc: "Aneesh Kumar K.V" <aneesh.kumar@linux.ibm.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Nick Piggin <npiggin@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: kvm-ppc@vger.kernel.org
Cc: linuxppc-dev@lists.ozlabs.org
Cc: linux-kernel@vger.kernel.org
Cc: linux-fsdevel@vger.kernel.org
Cc: linux-arch@vger.kernel.org
Cc: linux-mm@kvack.org
Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
---
 arch/powerpc/kvm/e500_mmu_host.c | 2 +-
 fs/binfmt_elf.c                  | 2 +-
 include/asm-generic/tlb.h        | 2 +-
 kernel/events/core.c             | 3 ++-
 4 files changed, 5 insertions(+), 4 deletions(-)

Comments

Anshuman Khandual Feb. 17, 2020, 9:21 a.m. UTC | #1
On 02/17/2020 10:33 AM, Anshuman Khandual wrote:
> This replaces all remaining open encodings with is_vm_hugetlb_page().
> 
> Cc: Paul Mackerras <paulus@ozlabs.org>
> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> Cc: Michael Ellerman <mpe@ellerman.id.au>
> Cc: Alexander Viro <viro@zeniv.linux.org.uk>
> Cc: Will Deacon <will@kernel.org>
> Cc: "Aneesh Kumar K.V" <aneesh.kumar@linux.ibm.com>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Nick Piggin <npiggin@gmail.com>
> Cc: Peter Zijlstra <peterz@infradead.org>
> Cc: Arnd Bergmann <arnd@arndb.de>
> Cc: Ingo Molnar <mingo@redhat.com>
> Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
> Cc: kvm-ppc@vger.kernel.org
> Cc: linuxppc-dev@lists.ozlabs.org
> Cc: linux-kernel@vger.kernel.org
> Cc: linux-fsdevel@vger.kernel.org
> Cc: linux-arch@vger.kernel.org
> Cc: linux-mm@kvack.org
> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
> ---
>  arch/powerpc/kvm/e500_mmu_host.c | 2 +-
>  fs/binfmt_elf.c                  | 2 +-
>  include/asm-generic/tlb.h        | 2 +-
>  kernel/events/core.c             | 3 ++-
>  4 files changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/powerpc/kvm/e500_mmu_host.c b/arch/powerpc/kvm/e500_mmu_host.c
> index 425d13806645..3922575a1c31 100644
> --- a/arch/powerpc/kvm/e500_mmu_host.c
> +++ b/arch/powerpc/kvm/e500_mmu_host.c
> @@ -422,7 +422,7 @@ static inline int kvmppc_e500_shadow_map(struct kvmppc_vcpu_e500 *vcpu_e500,
>  				break;
>  			}
>  		} else if (vma && hva >= vma->vm_start &&
> -			   (vma->vm_flags & VM_HUGETLB)) {
> +			   (is_vm_hugetlb_page(vma))) {

Additional braces around is_vm_hugetlb_page() can be dropped here.
kernel test robot Feb. 19, 2020, 1:14 a.m. UTC | #2
Hi Anshuman,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on mmotm/master]
[also build test ERROR on tip/perf/core m68k/for-next powerpc/next tip/sched/core char-misc/char-misc-testing linux/master linus/master tip/x86/mm asm-generic/master v5.6-rc2 next-20200218]
[cannot apply to kvm-ppc/kvm-ppc-next]
[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/Anshuman-Khandual/mm-vma-Use-available-wrappers-when-possible/20200219-065223
base:   git://git.cmpxchg.org/linux-mmotm.git master
config: nds32-allnoconfig (attached as .config)
compiler: nds32le-linux-gcc (GCC) 9.2.0
reproduce:
        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
        GCC_VERSION=9.2.0 make.cross ARCH=nds32 

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   In file included from arch/nds32/include/asm/tlb.h:7,
                    from arch/nds32/mm/init.c:18:
   include/asm-generic/tlb.h: In function 'tlb_update_vma_flags':
>> include/asm-generic/tlb.h:382:18: error: implicit declaration of function 'is_vm_hugetlb_page' [-Werror=implicit-function-declaration]
     382 |  tlb->vma_huge = is_vm_hugetlb_page(vma);
         |                  ^~~~~~~~~~~~~~~~~~
   cc1: some warnings being treated as errors

vim +/is_vm_hugetlb_page +382 include/asm-generic/tlb.h

   367	
   368	static inline void
   369	tlb_update_vma_flags(struct mmu_gather *tlb, struct vm_area_struct *vma)
   370	{
   371		/*
   372		 * flush_tlb_range() implementations that look at VM_HUGETLB (tile,
   373		 * mips-4k) flush only large pages.
   374		 *
   375		 * flush_tlb_range() implementations that flush I-TLB also flush D-TLB
   376		 * (tile, xtensa, arm), so it's ok to just add VM_EXEC to an existing
   377		 * range.
   378		 *
   379		 * We rely on tlb_end_vma() to issue a flush, such that when we reset
   380		 * these values the batch is empty.
   381		 */
 > 382		tlb->vma_huge = is_vm_hugetlb_page(vma);
   383		tlb->vma_exec = !!(vma->vm_flags & VM_EXEC);
   384	}
   385	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Anshuman Khandual Feb. 24, 2020, 2:21 a.m. UTC | #3
On 02/19/2020 06:44 AM, kbuild test robot wrote:
> Hi Anshuman,
> 
> Thank you for the patch! Yet something to improve:
> 
> [auto build test ERROR on mmotm/master]
> [also build test ERROR on tip/perf/core m68k/for-next powerpc/next tip/sched/core char-misc/char-misc-testing linux/master linus/master tip/x86/mm asm-generic/master v5.6-rc2 next-20200218]
> [cannot apply to kvm-ppc/kvm-ppc-next]
> [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/Anshuman-Khandual/mm-vma-Use-available-wrappers-when-possible/20200219-065223
> base:   git://git.cmpxchg.org/linux-mmotm.git master
> config: nds32-allnoconfig (attached as .config)
> compiler: nds32le-linux-gcc (GCC) 9.2.0
> reproduce:
>         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
>         GCC_VERSION=9.2.0 make.cross ARCH=nds32 
> 
> If you fix the issue, kindly add following tag
> Reported-by: kbuild test robot <lkp@intel.com>
> 
> All errors (new ones prefixed by >>):
> 
>    In file included from arch/nds32/include/asm/tlb.h:7,
>                     from arch/nds32/mm/init.c:18:
>    include/asm-generic/tlb.h: In function 'tlb_update_vma_flags':
>>> include/asm-generic/tlb.h:382:18: error: implicit declaration of function 'is_vm_hugetlb_page' [-Werror=implicit-function-declaration]
>      382 |  tlb->vma_huge = is_vm_hugetlb_page(vma);
>          |                  ^~~~~~~~~~~~~~~~~~
>    cc1: some warnings being treated as errors

Though I am unable to reproduce this build failure [1], it seems like
explicitly adding <linux/hugetlb.h> or <linux/hugetlb_inline.h> header
will be sufficient.

[1] nds32 build failure (error while loading shared libraries)

/usr/lib/x86_64-linux-gnu/libfl.so.2: invalid ELF header
diff mbox series

Patch

diff --git a/arch/powerpc/kvm/e500_mmu_host.c b/arch/powerpc/kvm/e500_mmu_host.c
index 425d13806645..3922575a1c31 100644
--- a/arch/powerpc/kvm/e500_mmu_host.c
+++ b/arch/powerpc/kvm/e500_mmu_host.c
@@ -422,7 +422,7 @@  static inline int kvmppc_e500_shadow_map(struct kvmppc_vcpu_e500 *vcpu_e500,
 				break;
 			}
 		} else if (vma && hva >= vma->vm_start &&
-			   (vma->vm_flags & VM_HUGETLB)) {
+			   (is_vm_hugetlb_page(vma))) {
 			unsigned long psize = vma_kernel_pagesize(vma);
 
 			tsize = (gtlbe->mas1 & MAS1_TSIZE_MASK) >>
diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
index f4713ea76e82..6bc97ede10ba 100644
--- a/fs/binfmt_elf.c
+++ b/fs/binfmt_elf.c
@@ -1317,7 +1317,7 @@  static unsigned long vma_dump_size(struct vm_area_struct *vma,
 	}
 
 	/* Hugetlb memory check */
-	if (vma->vm_flags & VM_HUGETLB) {
+	if (is_vm_hugetlb_page(vma)) {
 		if ((vma->vm_flags & VM_SHARED) && FILTER(HUGETLB_SHARED))
 			goto whole;
 		if (!(vma->vm_flags & VM_SHARED) && FILTER(HUGETLB_PRIVATE))
diff --git a/include/asm-generic/tlb.h b/include/asm-generic/tlb.h
index f391f6b500b4..d42c236d4965 100644
--- a/include/asm-generic/tlb.h
+++ b/include/asm-generic/tlb.h
@@ -398,7 +398,7 @@  tlb_update_vma_flags(struct mmu_gather *tlb, struct vm_area_struct *vma)
 	 * We rely on tlb_end_vma() to issue a flush, such that when we reset
 	 * these values the batch is empty.
 	 */
-	tlb->vma_huge = !!(vma->vm_flags & VM_HUGETLB);
+	tlb->vma_huge = is_vm_hugetlb_page(vma);
 	tlb->vma_exec = !!(vma->vm_flags & VM_EXEC);
 }
 
diff --git a/kernel/events/core.c b/kernel/events/core.c
index e453589da97c..eb0ee3c5f322 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -28,6 +28,7 @@ 
 #include <linux/export.h>
 #include <linux/vmalloc.h>
 #include <linux/hardirq.h>
+#include <linux/hugetlb_inline.h>
 #include <linux/rculist.h>
 #include <linux/uaccess.h>
 #include <linux/syscalls.h>
@@ -7693,7 +7694,7 @@  static void perf_event_mmap_event(struct perf_mmap_event *mmap_event)
 		flags |= MAP_EXECUTABLE;
 	if (vma->vm_flags & VM_LOCKED)
 		flags |= MAP_LOCKED;
-	if (vma->vm_flags & VM_HUGETLB)
+	if (is_vm_hugetlb_page(vma))
 		flags |= MAP_HUGETLB;
 
 	if (file) {