linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V2 0/2] mm/migration: Add trace events
@ 2022-01-25  3:08 Anshuman Khandual
  2022-01-25  3:08 ` [PATCH V2 1/2] mm/migration: Add trace events for THP migrations Anshuman Khandual
  2022-01-25  3:08 ` [PATCH V2 2/2] mm/migration: Add trace events for base page and HugeTLB migrations Anshuman Khandual
  0 siblings, 2 replies; 12+ messages in thread
From: Anshuman Khandual @ 2022-01-25  3:08 UTC (permalink / raw)
  To: linux-mm; +Cc: akpm, naoya.horiguchi, rostedt, Anshuman Khandual

This adds trace events for all migration scenarios including base page, THP
and HugeTLB. This series is applies on v5.17-rc1. 

Changes in V2:

- Used DECLARE_EVENT_CLASS()/DEFINE_EVENT() construct reducing code footprint
- Added trace events for base page and HugeTLB

Changes in V1:

https://lore.kernel.org/all/1641531575-28524-1-git-send-email-anshuman.khandual@arm.com/

- Dropped mm, pmdp, page arguments from trace
- Updated trace argument names and output format

Changes in RFC:

https://lore.kernel.org/all/1640328398-20698-1-git-send-email-anshuman.khandual@arm.com/

Anshuman Khandual (2):
  mm/migration: Add trace events for THP migrations
  mm/migration: Add trace events for base page and HugeTLB migrations

 include/trace/events/migrate.h | 31 +++++++++++++++++++++++++++++++
 include/trace/events/thp.h     | 27 +++++++++++++++++++++++++++
 mm/huge_memory.c               |  5 +++++
 mm/migrate.c                   |  3 +++
 mm/rmap.c                      |  5 +++++
 5 files changed, 71 insertions(+)

-- 
2.20.1



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

* [PATCH V2 1/2] mm/migration: Add trace events for THP migrations
  2022-01-25  3:08 [PATCH V2 0/2] mm/migration: Add trace events Anshuman Khandual
@ 2022-01-25  3:08 ` Anshuman Khandual
  2022-01-25  3:08 ` [PATCH V2 2/2] mm/migration: Add trace events for base page and HugeTLB migrations Anshuman Khandual
  1 sibling, 0 replies; 12+ messages in thread
From: Anshuman Khandual @ 2022-01-25  3:08 UTC (permalink / raw)
  To: linux-mm
  Cc: akpm, naoya.horiguchi, rostedt, Anshuman Khandual, Ingo Molnar,
	Zi Yan, Naoya Horiguchi, John Hubbard, Matthew Wilcox,
	linux-kernel

This adds two trace events for PMD based THP migration without split. These
events closely follow the implementation details like setting and removing
of PMD migration entries, which are essential operations for THP migration.

Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Zi Yan <ziy@nvidia.com>
Cc: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Cc: John Hubbard <jhubbard@nvidia.com>
Cc: Matthew Wilcox <willy@infradead.org>
Cc: linux-mm@kvack.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
---
 include/trace/events/thp.h | 27 +++++++++++++++++++++++++++
 mm/huge_memory.c           |  5 +++++
 2 files changed, 32 insertions(+)

diff --git a/include/trace/events/thp.h b/include/trace/events/thp.h
index ca3f2767828a..202b3e3e67ff 100644
--- a/include/trace/events/thp.h
+++ b/include/trace/events/thp.h
@@ -48,6 +48,33 @@ TRACE_EVENT(hugepage_update,
 	    TP_printk("hugepage update at addr 0x%lx and pte = 0x%lx clr = 0x%lx, set = 0x%lx", __entry->addr, __entry->pte, __entry->clr, __entry->set)
 );
 
+DECLARE_EVENT_CLASS(migration_pmd,
+
+		TP_PROTO(unsigned long addr, unsigned long pmd),
+
+		TP_ARGS(addr, pmd),
+
+		TP_STRUCT__entry(
+			__field(unsigned long, addr)
+			__field(unsigned long, pmd)
+		),
+
+		TP_fast_assign(
+			__entry->addr = addr;
+			__entry->pmd = pmd;
+		),
+		TP_printk("addr=%lx, pmd=%lx", __entry->addr, __entry->pmd)
+);
+
+DEFINE_EVENT(migration_pmd, set_migration_pmd,
+	TP_PROTO(unsigned long addr, unsigned long pmd),
+	TP_ARGS(addr, pmd)
+);
+
+DEFINE_EVENT(migration_pmd, remove_migration_pmd,
+	TP_PROTO(unsigned long addr, unsigned long pmd),
+	TP_ARGS(addr, pmd)
+);
 #endif /* _TRACE_THP_H */
 
 /* This part must be outside protection */
diff --git a/mm/huge_memory.c b/mm/huge_memory.c
index 406a3c28c026..ab49f9a3e420 100644
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@ -39,6 +39,9 @@
 #include <asm/pgalloc.h>
 #include "internal.h"
 
+#define CREATE_TRACE_POINTS
+#include <trace/events/thp.h>
+
 /*
  * By default, transparent hugepage support is disabled in order to avoid
  * risking an increased memory footprint for applications that are not
@@ -3173,6 +3176,7 @@ void set_pmd_migration_entry(struct page_vma_mapped_walk *pvmw,
 	set_pmd_at(mm, address, pvmw->pmd, pmdswp);
 	page_remove_rmap(page, true);
 	put_page(page);
+	trace_set_migration_pmd(address, pmd_val(pmdswp));
 }
 
 void remove_migration_pmd(struct page_vma_mapped_walk *pvmw, struct page *new)
@@ -3206,5 +3210,6 @@ void remove_migration_pmd(struct page_vma_mapped_walk *pvmw, struct page *new)
 	if ((vma->vm_flags & VM_LOCKED) && !PageDoubleMap(new))
 		mlock_vma_page(new);
 	update_mmu_cache_pmd(vma, address, pvmw->pmd);
+	trace_remove_migration_pmd(address, pmd_val(pmde));
 }
 #endif
-- 
2.20.1



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

* [PATCH V2 2/2] mm/migration: Add trace events for base page and HugeTLB migrations
  2022-01-25  3:08 [PATCH V2 0/2] mm/migration: Add trace events Anshuman Khandual
  2022-01-25  3:08 ` [PATCH V2 1/2] mm/migration: Add trace events for THP migrations Anshuman Khandual
@ 2022-01-25  3:08 ` Anshuman Khandual
  2022-01-25  9:41   ` kernel test robot
                     ` (3 more replies)
  1 sibling, 4 replies; 12+ messages in thread
From: Anshuman Khandual @ 2022-01-25  3:08 UTC (permalink / raw)
  To: linux-mm
  Cc: akpm, naoya.horiguchi, rostedt, Anshuman Khandual, Ingo Molnar,
	Zi Yan, Naoya Horiguchi, John Hubbard, Matthew Wilcox,
	linux-kernel

This adds two trace events for base page and HugeTLB page migrations. These
events, closely follow the implementation details like setting and removing
of PTE migration entries, which are essential operations for migration.

Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Zi Yan <ziy@nvidia.com>
Cc: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Cc: John Hubbard <jhubbard@nvidia.com>
Cc: Matthew Wilcox <willy@infradead.org>
Cc: linux-mm@kvack.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
---
 include/trace/events/migrate.h | 31 +++++++++++++++++++++++++++++++
 mm/migrate.c                   |  3 +++
 mm/rmap.c                      |  5 +++++
 3 files changed, 39 insertions(+)

diff --git a/include/trace/events/migrate.h b/include/trace/events/migrate.h
index 779f3fad9ecd..061b5128f335 100644
--- a/include/trace/events/migrate.h
+++ b/include/trace/events/migrate.h
@@ -105,6 +105,37 @@ TRACE_EVENT(mm_migrate_pages_start,
 		  __print_symbolic(__entry->reason, MIGRATE_REASON))
 );
 
+DECLARE_EVENT_CLASS(migration_pte,
+
+		TP_PROTO(unsigned long addr, unsigned long pte, int order),
+
+		TP_ARGS(addr, pte, order),
+
+		TP_STRUCT__entry(
+			__field(unsigned long, addr)
+			__field(unsigned long, pte)
+			__field(int, order)
+		),
+
+		TP_fast_assign(
+			__entry->addr = addr;
+			__entry->pte = pte;
+			__entry->order = order;
+		),
+
+		TP_printk("addr=%lx, pte=%lx order=%d", __entry->addr, __entry->pte, __entry->order)
+);
+
+DEFINE_EVENT(migration_pte, set_migration_pte,
+	TP_PROTO(unsigned long addr, unsigned long pte, int order),
+	TP_ARGS(addr, pte, order)
+);
+
+DEFINE_EVENT(migration_pte, remove_migration_pte,
+	TP_PROTO(unsigned long addr, unsigned long pte, int order),
+	TP_ARGS(addr, pte, order)
+);
+
 #endif /* _TRACE_MIGRATE_H */
 
 /* This part must be outside protection */
diff --git a/mm/migrate.c b/mm/migrate.c
index c7da064b4781..253dc5812949 100644
--- a/mm/migrate.c
+++ b/mm/migrate.c
@@ -257,6 +257,9 @@ static bool remove_migration_pte(struct page *page, struct vm_area_struct *vma,
 		if (PageTransHuge(page) && PageMlocked(page))
 			clear_page_mlock(page);
 
+		trace_remove_migration_pte(pvmw.address, pte_val(pte),
+					   compound_order(new));
+
 		/* No need to invalidate - it was non-present before */
 		update_mmu_cache(vma, pvmw.address, pvmw.pte);
 	}
diff --git a/mm/rmap.c b/mm/rmap.c
index 6a1e8c7f6213..cce5dbae07f2 100644
--- a/mm/rmap.c
+++ b/mm/rmap.c
@@ -77,6 +77,7 @@
 #include <asm/tlbflush.h>
 
 #include <trace/events/tlb.h>
+#include <trace/events/migrate.h>
 
 #include "internal.h"
 
@@ -1861,6 +1862,8 @@ static bool try_to_migrate_one(struct page *page, struct vm_area_struct *vma,
 			if (pte_swp_uffd_wp(pteval))
 				swp_pte = pte_swp_mkuffd_wp(swp_pte);
 			set_pte_at(mm, pvmw.address, pvmw.pte, swp_pte);
+			trace_set_migration_pte(pvmw.address, pte_val(swp_pte),
+						compound_order(page));
 			/*
 			 * No need to invalidate here it will synchronize on
 			 * against the special swap migration pte.
@@ -1929,6 +1932,8 @@ static bool try_to_migrate_one(struct page *page, struct vm_area_struct *vma,
 			if (pte_uffd_wp(pteval))
 				swp_pte = pte_swp_mkuffd_wp(swp_pte);
 			set_pte_at(mm, address, pvmw.pte, swp_pte);
+			trace_set_migration_pte(address, pte_val(swp_pte),
+						compound_order(page));
 			/*
 			 * No need to invalidate here it will synchronize on
 			 * against the special swap migration pte.
-- 
2.20.1



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

* Re: [PATCH V2 2/2] mm/migration: Add trace events for base page and HugeTLB migrations
  2022-01-25  3:08 ` [PATCH V2 2/2] mm/migration: Add trace events for base page and HugeTLB migrations Anshuman Khandual
@ 2022-01-25  9:41   ` kernel test robot
  2022-01-25  9:41   ` kernel test robot
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 12+ messages in thread
From: kernel test robot @ 2022-01-25  9:41 UTC (permalink / raw)
  To: Anshuman Khandual, linux-mm
  Cc: llvm, kbuild-all, akpm, naoya.horiguchi, rostedt,
	Anshuman Khandual, Ingo Molnar, Zi Yan, Naoya Horiguchi,
	John Hubbard, Matthew Wilcox

Hi Anshuman,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on v5.17-rc1]
[also build test ERROR on next-20220124]
[cannot apply to hnaz-mm/master rostedt-trace/for-next]
[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/Anshuman-Khandual/mm-migration-Add-trace-events/20220125-110944
base:    e783362eb54cd99b2cac8b3a9aeac942e6f6ac07
config: hexagon-randconfig-r041-20220124 (https://download.01.org/0day-ci/archive/20220125/202201251747.ZSFwDZvC-lkp@intel.com/config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 997e128e2a78f5a5434fc75997441ae1ee76f8a4)
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/f1100840c009fceb20d26ac4564c9d4c9c23c729
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Anshuman-Khandual/mm-migration-Add-trace-events/20220125-110944
        git checkout f1100840c009fceb20d26ac4564c9d4c9c23c729
        # save the config file to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon SHELL=/bin/bash

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

>> ld.lld: error: undefined symbol: __traceiter_set_migration_pte
   >>> referenced by rmap.c
   >>> rmap.o:(try_to_migrate_one) in archive mm/built-in.a
   >>> referenced by rmap.c
   >>> rmap.o:(try_to_migrate_one) in archive mm/built-in.a

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


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

* Re: [PATCH V2 2/2] mm/migration: Add trace events for base page and HugeTLB migrations
  2022-01-25  3:08 ` [PATCH V2 2/2] mm/migration: Add trace events for base page and HugeTLB migrations Anshuman Khandual
  2022-01-25  9:41   ` kernel test robot
@ 2022-01-25  9:41   ` kernel test robot
  2022-01-25 10:28     ` Anshuman Khandual
  2022-01-25 11:13   ` kernel test robot
  2022-01-25 13:28   ` Matthew Wilcox
  3 siblings, 1 reply; 12+ messages in thread
From: kernel test robot @ 2022-01-25  9:41 UTC (permalink / raw)
  To: Anshuman Khandual, linux-mm
  Cc: kbuild-all, akpm, naoya.horiguchi, rostedt, Anshuman Khandual,
	Ingo Molnar, Zi Yan, Naoya Horiguchi, John Hubbard,
	Matthew Wilcox

Hi Anshuman,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on v5.17-rc1]
[also build test ERROR on next-20220124]
[cannot apply to hnaz-mm/master rostedt-trace/for-next]
[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/Anshuman-Khandual/mm-migration-Add-trace-events/20220125-110944
base:    e783362eb54cd99b2cac8b3a9aeac942e6f6ac07
config: xtensa-randconfig-r031-20220124 (https://download.01.org/0day-ci/archive/20220125/202201251716.ncCstDar-lkp@intel.com/config)
compiler: xtensa-linux-gcc (GCC) 11.2.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/f1100840c009fceb20d26ac4564c9d4c9c23c729
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Anshuman-Khandual/mm-migration-Add-trace-events/20220125-110944
        git checkout f1100840c009fceb20d26ac4564c9d4c9c23c729
        # save the config file to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=xtensa SHELL=/bin/bash

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

   arch/xtensa/kernel/entry.o: in function `fast_syscall_spill_registers':
   (.exception.text+0x253): dangerous relocation: windowed longcall crosses 1GB boundary; return may fail: make_task_dead
   xtensa-linux-ld: mm/rmap.o: in function `page_remove_rmap':
>> rmap.c:(.text+0x11b0): undefined reference to `__tracepoint_set_migration_pte'
>> xtensa-linux-ld: rmap.c:(.text+0x11b4): undefined reference to `__tracepoint_set_migration_pte'
>> xtensa-linux-ld: rmap.c:(.text+0x11c4): undefined reference to `__traceiter_set_migration_pte'
   xtensa-linux-ld: mm/rmap.o: in function `try_to_unmap_one':
>> rmap.c:(.text+0x135d): undefined reference to `__traceiter_set_migration_pte'
>> xtensa-linux-ld: mm/rmap.o:(__jump_table+0x8): undefined reference to `__tracepoint_set_migration_pte'

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


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

* Re: [PATCH V2 2/2] mm/migration: Add trace events for base page and HugeTLB migrations
  2022-01-25  9:41   ` kernel test robot
@ 2022-01-25 10:28     ` Anshuman Khandual
  2022-01-27  4:07       ` Andrew Morton
  0 siblings, 1 reply; 12+ messages in thread
From: Anshuman Khandual @ 2022-01-25 10:28 UTC (permalink / raw)
  To: kernel test robot, linux-mm
  Cc: kbuild-all, akpm, naoya.horiguchi, rostedt, Ingo Molnar, Zi Yan,
	Naoya Horiguchi, John Hubbard, Matthew Wilcox



On 1/25/22 3:11 PM, kernel test robot wrote:
> Hi Anshuman,
> 
> Thank you for the patch! Yet something to improve:
> 
> [auto build test ERROR on v5.17-rc1]
> [also build test ERROR on next-20220124]
> [cannot apply to hnaz-mm/master rostedt-trace/for-next]
> [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/Anshuman-Khandual/mm-migration-Add-trace-events/20220125-110944
> base:    e783362eb54cd99b2cac8b3a9aeac942e6f6ac07
> config: xtensa-randconfig-r031-20220124 (https://download.01.org/0day-ci/archive/20220125/202201251716.ncCstDar-lkp@intel.com/config)
> compiler: xtensa-linux-gcc (GCC) 11.2.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/f1100840c009fceb20d26ac4564c9d4c9c23c729
>         git remote add linux-review https://github.com/0day-ci/linux
>         git fetch --no-tags linux-review Anshuman-Khandual/mm-migration-Add-trace-events/20220125-110944
>         git checkout f1100840c009fceb20d26ac4564c9d4c9c23c729
>         # save the config file to linux build tree
>         mkdir build_dir
>         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=xtensa SHELL=/bin/bash
> 
> 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 >>):
> 
>    arch/xtensa/kernel/entry.o: in function `fast_syscall_spill_registers':
>    (.exception.text+0x253): dangerous relocation: windowed longcall crosses 1GB boundary; return may fail: make_task_dead
>    xtensa-linux-ld: mm/rmap.o: in function `page_remove_rmap':
>>> rmap.c:(.text+0x11b0): undefined reference to `__tracepoint_set_migration_pte'
>>> xtensa-linux-ld: rmap.c:(.text+0x11b4): undefined reference to `__tracepoint_set_migration_pte'
>>> xtensa-linux-ld: rmap.c:(.text+0x11c4): undefined reference to `__traceiter_set_migration_pte'
>    xtensa-linux-ld: mm/rmap.o: in function `try_to_unmap_one':
>>> rmap.c:(.text+0x135d): undefined reference to `__traceiter_set_migration_pte'
>>> xtensa-linux-ld: mm/rmap.o:(__jump_table+0x8): undefined reference to `__tracepoint_set_migration_pte'
> 
> ---
> 0-DAY CI Kernel Test Service, Intel Corporation
> https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
> 

The following change should fix both the reported build problems.

diff --git a/mm/rmap.c b/mm/rmap.c
index cce5dbae07f2..cae1c46440d6 100644
--- a/mm/rmap.c
+++ b/mm/rmap.c
@@ -76,6 +76,7 @@
 
 #include <asm/tlbflush.h>
 
+#define CREATE_TRACE_POINTS
 #include <trace/events/tlb.h>
 #include <trace/events/migrate.h>


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

* Re: [PATCH V2 2/2] mm/migration: Add trace events for base page and HugeTLB migrations
  2022-01-25  3:08 ` [PATCH V2 2/2] mm/migration: Add trace events for base page and HugeTLB migrations Anshuman Khandual
  2022-01-25  9:41   ` kernel test robot
  2022-01-25  9:41   ` kernel test robot
@ 2022-01-25 11:13   ` kernel test robot
  2022-01-25 13:28   ` Matthew Wilcox
  3 siblings, 0 replies; 12+ messages in thread
From: kernel test robot @ 2022-01-25 11:13 UTC (permalink / raw)
  To: Anshuman Khandual, linux-mm
  Cc: kbuild-all, akpm, naoya.horiguchi, rostedt, Anshuman Khandual,
	Ingo Molnar, Zi Yan, Naoya Horiguchi, John Hubbard,
	Matthew Wilcox

Hi Anshuman,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on v5.17-rc1]
[also build test ERROR on next-20220124]
[cannot apply to hnaz-mm/master rostedt-trace/for-next]
[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/Anshuman-Khandual/mm-migration-Add-trace-events/20220125-110944
base:    e783362eb54cd99b2cac8b3a9aeac942e6f6ac07
config: i386-randconfig-a012-20211214 (https://download.01.org/0day-ci/archive/20220125/202201251948.RMGoyUiL-lkp@intel.com/config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce (this is a W=1 build):
        # https://github.com/0day-ci/linux/commit/f1100840c009fceb20d26ac4564c9d4c9c23c729
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Anshuman-Khandual/mm-migration-Add-trace-events/20220125-110944
        git checkout f1100840c009fceb20d26ac4564c9d4c9c23c729
        # save the config file to linux build tree
        mkdir build_dir
        make W=1 O=build_dir ARCH=i386 SHELL=/bin/bash

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

   ld: mm/rmap.o: in function `arch_atomic_read':
>> arch/x86/include/asm/atomic.h:29: undefined reference to `__tracepoint_set_migration_pte'
   ld: mm/rmap.o: in function `trace_set_migration_pte':
   include/trace/events/migrate.h:129: undefined reference to `__tracepoint_set_migration_pte'
   ld: include/trace/events/migrate.h:129: undefined reference to `__tracepoint_set_migration_pte'
   ld: include/trace/events/migrate.h:129: undefined reference to `__SCT__tp_func_set_migration_pte'


vim +29 arch/x86/include/asm/atomic.h

5abbbbf0b0cd4a Brian Gerst    2010-01-07  11  
5abbbbf0b0cd4a Brian Gerst    2010-01-07  12  /*
5abbbbf0b0cd4a Brian Gerst    2010-01-07  13   * Atomic operations that C can't guarantee us.  Useful for
5abbbbf0b0cd4a Brian Gerst    2010-01-07  14   * resource counting etc..
5abbbbf0b0cd4a Brian Gerst    2010-01-07  15   */
5abbbbf0b0cd4a Brian Gerst    2010-01-07  16  
5abbbbf0b0cd4a Brian Gerst    2010-01-07  17  /**
8bf705d130396e Dmitry Vyukov  2018-01-29  18   * arch_atomic_read - read atomic variable
5abbbbf0b0cd4a Brian Gerst    2010-01-07  19   * @v: pointer of type atomic_t
5abbbbf0b0cd4a Brian Gerst    2010-01-07  20   *
5abbbbf0b0cd4a Brian Gerst    2010-01-07  21   * Atomically reads the value of @v.
5abbbbf0b0cd4a Brian Gerst    2010-01-07  22   */
8bf705d130396e Dmitry Vyukov  2018-01-29  23  static __always_inline int arch_atomic_read(const atomic_t *v)
5abbbbf0b0cd4a Brian Gerst    2010-01-07  24  {
ac605bee0bfab4 Dmitry Vyukov  2018-01-29  25  	/*
ac605bee0bfab4 Dmitry Vyukov  2018-01-29  26  	 * Note for KASAN: we deliberately don't use READ_ONCE_NOCHECK() here,
ac605bee0bfab4 Dmitry Vyukov  2018-01-29  27  	 * it's non-inlined function that increases binary size and stack usage.
ac605bee0bfab4 Dmitry Vyukov  2018-01-29  28  	 */
37f8173dd84936 Peter Zijlstra 2020-01-24 @29  	return __READ_ONCE((v)->counter);
5abbbbf0b0cd4a Brian Gerst    2010-01-07  30  }
5abbbbf0b0cd4a Brian Gerst    2010-01-07  31  

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


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

* Re: [PATCH V2 2/2] mm/migration: Add trace events for base page and HugeTLB migrations
  2022-01-25  3:08 ` [PATCH V2 2/2] mm/migration: Add trace events for base page and HugeTLB migrations Anshuman Khandual
                     ` (2 preceding siblings ...)
  2022-01-25 11:13   ` kernel test robot
@ 2022-01-25 13:28   ` Matthew Wilcox
  2022-01-25 15:16     ` Steven Rostedt
  3 siblings, 1 reply; 12+ messages in thread
From: Matthew Wilcox @ 2022-01-25 13:28 UTC (permalink / raw)
  To: Anshuman Khandual
  Cc: linux-mm, akpm, naoya.horiguchi, rostedt, Ingo Molnar, Zi Yan,
	Naoya Horiguchi, John Hubbard, linux-kernel

On Tue, Jan 25, 2022 at 08:38:25AM +0530, Anshuman Khandual wrote:
> +		TP_printk("addr=%lx, pte=%lx order=%d", __entry->addr, __entry->pte, __entry->order)

In these days of increasingly advanced Rowhammer attacks, is it wise
to let userspace know exactly which physical addresses are being
used for virtual addresses?


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

* Re: [PATCH V2 2/2] mm/migration: Add trace events for base page and HugeTLB migrations
  2022-01-25 13:28   ` Matthew Wilcox
@ 2022-01-25 15:16     ` Steven Rostedt
  0 siblings, 0 replies; 12+ messages in thread
From: Steven Rostedt @ 2022-01-25 15:16 UTC (permalink / raw)
  To: Matthew Wilcox
  Cc: Anshuman Khandual, linux-mm, akpm, naoya.horiguchi, Ingo Molnar,
	Zi Yan, Naoya Horiguchi, John Hubbard, linux-kernel

On Tue, 25 Jan 2022 13:28:49 +0000
Matthew Wilcox <willy@infradead.org> wrote:

> On Tue, Jan 25, 2022 at 08:38:25AM +0530, Anshuman Khandual wrote:
> > +		TP_printk("addr=%lx, pte=%lx order=%d", __entry->addr, __entry->pte, __entry->order)  
> 
> In these days of increasingly advanced Rowhammer attacks, is it wise
> to let userspace know exactly which physical addresses are being
> used for virtual addresses?

Is it an issue if this is only available for privileged users?

With tracing, you can just create a kprobe to get the same information for
you as well, so this isn't giving a user anything they do not already have.

-- Steve


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

* Re: [PATCH V2 2/2] mm/migration: Add trace events for base page and HugeTLB migrations
  2022-01-25 10:28     ` Anshuman Khandual
@ 2022-01-27  4:07       ` Andrew Morton
  2022-01-27  4:52         ` Anshuman Khandual
  0 siblings, 1 reply; 12+ messages in thread
From: Andrew Morton @ 2022-01-27  4:07 UTC (permalink / raw)
  To: Anshuman Khandual
  Cc: kernel test robot, linux-mm, kbuild-all, naoya.horiguchi,
	rostedt, Ingo Molnar, Zi Yan, Naoya Horiguchi, John Hubbard,
	Matthew Wilcox

On Tue, 25 Jan 2022 15:58:34 +0530 Anshuman Khandual <anshuman.khandual@arm.com> wrote:

> 
> 
> 
> The following change should fix both the reported build problems.
> 
> diff --git a/mm/rmap.c b/mm/rmap.c
> index cce5dbae07f2..cae1c46440d6 100644
> --- a/mm/rmap.c
> +++ b/mm/rmap.c
> @@ -76,6 +76,7 @@
>  
>  #include <asm/tlbflush.h>
>  
> +#define CREATE_TRACE_POINTS
>  #include <trace/events/tlb.h>
>  #include <trace/events/migrate.h>

My x86_64 allmodconfig is unhappy.

lib/strncpy_from_user.o: warning: objtool: strncpy_from_user()+0x129: call to do_strncpy_from_user() with UACCESS enabled
lib/strnlen_user.o: warning: objtool: strnlen_user()+0xc9: call to do_strnlen_user() with UACCESS enabled
/opt/crosstool/gcc-10.3.0-nolibc/x86_64-linux/bin/x86_64-linux-ld: mm/rmap.o:(.data+0x13e0): multiple definition of `__SCK__tp_func_tlb_flush'; arch/x86/mm/init.o:(.data+0x980): first defined here
/opt/crosstool/gcc-10.3.0-nolibc/x86_64-linux/bin/x86_64-linux-ld: mm/rmap.o: in function `__traceiter_tlb_flush':
(.text+0x0): multiple definition of `__traceiter_tlb_flush'; arch/x86/mm/init.o:(.text+0x0): first defined here
/opt/crosstool/gcc-10.3.0-nolibc/x86_64-linux/bin/x86_64-linux-ld: mm/rmap.o:(__tracepoints+0x180): multiple definition of `__tracepoint_tlb_flush'; arch/x86/mm/init.o:(__tracepoints+0x0): first defined here
/opt/crosstool/gcc-10.3.0-nolibc/x86_64-linux/bin/x86_64-linux-ld: mm/rmap.o: in function `__SCT__tp_func_tlb_flush':
(.static_call.text+0x0): multiple definition of `__SCT__tp_func_tlb_flush'; arch/x86/mm/init.o:(.static_call.text+0x0): first defined here
/opt/crosstool/gcc-10.3.0-nolibc/x86_64-linux/bin/x86_64-linux-ld: mm/migrate.o: in function `__SCT__tp_func_mm_migrate_pages':
(.static_call.text+0x0): multiple definition of `__SCT__tp_func_mm_migrate_pages'; mm/rmap.o:(.static_call.text+0x8): first defined here
/opt/crosstool/gcc-10.3.0-nolibc/x86_64-linux/bin/x86_64-linux-ld: mm/migrate.o:(.data+0x13a0): multiple definition of `__SCK__tp_func_remove_migration_pte'; mm/rmap.o:(.data+0xfe0): first defined here
/opt/crosstool/gcc-10.3.0-nolibc/x86_64-linux/bin/x86_64-linux-ld: mm/migrate.o: in function `__traceiter_set_migration_pte':
(.text+0x140): multiple definition of `__traceiter_set_migration_pte'; mm/rmap.o:(.text+0x1c0): first defined here
/opt/crosstool/gcc-10.3.0-nolibc/x86_64-linux/bin/x86_64-linux-ld: mm/migrate.o:(__tracepoints+0x120): multiple definition of `__tracepoint_mm_migrate_pages'; mm/rmap.o:(__tracepoints+0x120): first defined here
/opt/crosstool/gcc-10.3.0-nolibc/x86_64-linux/bin/x86_64-linux-ld: mm/migrate.o: in function `__traceiter_mm_migrate_pages':
(.text+0x0): multiple definition of `__traceiter_mm_migrate_pages'; mm/rmap.o:(.text+0x80): first defined here
/opt/crosstool/gcc-10.3.0-nolibc/x86_64-linux/bin/x86_64-linux-ld: mm/migrate.o: in function `__SCT__tp_func_mm_migrate_pages_start':
(.static_call.text+0x8): multiple definition of `__SCT__tp_func_mm_migrate_pages_start'; mm/rmap.o:(.static_call.text+0x10): first defined here
/opt/crosstool/gcc-10.3.0-nolibc/x86_64-linux/bin/x86_64-linux-ld: mm/migrate.o:(.data+0x1420): multiple definition of `__SCK__tp_func_mm_migrate_pages_start'; mm/rmap.o:(.data+0x1060): first defined here
/opt/crosstool/gcc-10.3.0-nolibc/x86_64-linux/bin/x86_64-linux-ld: mm/migrate.o:(.data+0x1460): multiple definition of `__SCK__tp_func_mm_migrate_pages'; mm/rmap.o:(.data+0x10a0): first defined here
/opt/crosstool/gcc-10.3.0-nolibc/x86_64-linux/bin/x86_64-linux-ld: mm/migrate.o: in function `__traceiter_mm_migrate_pages_start':
(.text+0xc0): multiple definition of `__traceiter_mm_migrate_pages_start'; mm/rmap.o:(.text+0x140): first defined here
/opt/crosstool/gcc-10.3.0-nolibc/x86_64-linux/bin/x86_64-linux-ld: mm/migrate.o: in function `__SCT__tp_func_remove_migration_pte':
(.static_call.text+0x18): multiple definition of `__SCT__tp_func_remove_migration_pte'; mm/rmap.o:(.static_call.text+0x20): first defined here
/opt/crosstool/gcc-10.3.0-nolibc/x86_64-linux/bin/x86_64-linux-ld: mm/migrate.o:(__tracepoints+0x60): multiple definition of `__tracepoint_set_migration_pte'; mm/rmap.o:(__tracepoints+0x60): first defined here
/opt/crosstool/gcc-10.3.0-nolibc/x86_64-linux/bin/x86_64-linux-ld: mm/migrate.o:(__tracepoints+0x0): multiple definition of `__tracepoint_remove_migration_pte'; mm/rmap.o:(__tracepoints+0x0): first defined here
/opt/crosstool/gcc-10.3.0-nolibc/x86_64-linux/bin/x86_64-linux-ld: mm/migrate.o: in function `__traceiter_remove_migration_pte':
(.text+0x1c0): multiple definition of `__traceiter_remove_migration_pte'; mm/rmap.o:(.text+0x240): first defined here
/opt/crosstool/gcc-10.3.0-nolibc/x86_64-linux/bin/x86_64-linux-ld: mm/migrate.o: in function `__SCT__tp_func_set_migration_pte':
(.static_call.text+0x10): multiple definition of `__SCT__tp_func_set_migration_pte'; mm/rmap.o:(.static_call.text+0x18): first defined here
/opt/crosstool/gcc-10.3.0-nolibc/x86_64-linux/bin/x86_64-linux-ld: mm/migrate.o:(.data+0x13e0): multiple definition of `__SCK__tp_func_set_migration_pte'; mm/rmap.o:(.data+0x1020): first defined here
/opt/crosstool/gcc-10.3.0-nolibc/x86_64-linux/bin/x86_64-linux-ld: mm/migrate.o:(__tracepoints+0xc0): multiple definition of `__tracepoint_mm_migrate_pages_start'; mm/rmap.o:(__tracepoints+0xc0): first defined here
make: *** [vmlinux] Error 1



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

* Re: [PATCH V2 2/2] mm/migration: Add trace events for base page and HugeTLB migrations
  2022-01-27  4:07       ` Andrew Morton
@ 2022-01-27  4:52         ` Anshuman Khandual
  2022-01-27  6:55           ` Anshuman Khandual
  0 siblings, 1 reply; 12+ messages in thread
From: Anshuman Khandual @ 2022-01-27  4:52 UTC (permalink / raw)
  To: Andrew Morton
  Cc: kernel test robot, linux-mm, kbuild-all, naoya.horiguchi,
	rostedt, Ingo Molnar, Zi Yan, Naoya Horiguchi, John Hubbard,
	Matthew Wilcox



On 1/27/22 9:37 AM, Andrew Morton wrote:
> On Tue, 25 Jan 2022 15:58:34 +0530 Anshuman Khandual <anshuman.khandual@arm.com> wrote:
> 
>>
>>
>>
>> The following change should fix both the reported build problems.
>>
>> diff --git a/mm/rmap.c b/mm/rmap.c
>> index cce5dbae07f2..cae1c46440d6 100644
>> --- a/mm/rmap.c
>> +++ b/mm/rmap.c
>> @@ -76,6 +76,7 @@
>>  
>>  #include <asm/tlbflush.h>
>>  
>> +#define CREATE_TRACE_POINTS
>>  #include <trace/events/tlb.h>
>>  #include <trace/events/migrate.h>
> 
> My x86_64 allmodconfig is unhappy.
> 
> lib/strncpy_from_user.o: warning: objtool: strncpy_from_user()+0x129: call to do_strncpy_from_user() with UACCESS enabled
> lib/strnlen_user.o: warning: objtool: strnlen_user()+0xc9: call to do_strnlen_user() with UACCESS enabled
> /opt/crosstool/gcc-10.3.0-nolibc/x86_64-linux/bin/x86_64-linux-ld: mm/rmap.o:(.data+0x13e0): multiple definition of `__SCK__tp_func_tlb_flush'; arch/x86/mm/init.o:(.data+0x980): first defined here
> /opt/crosstool/gcc-10.3.0-nolibc/x86_64-linux/bin/x86_64-linux-ld: mm/rmap.o: in function `__traceiter_tlb_flush':
> (.text+0x0): multiple definition of `__traceiter_tlb_flush'; arch/x86/mm/init.o:(.text+0x0): first defined here
> /opt/crosstool/gcc-10.3.0-nolibc/x86_64-linux/bin/x86_64-linux-ld: mm/rmap.o:(__tracepoints+0x180): multiple definition of `__tracepoint_tlb_flush'; arch/x86/mm/init.o:(__tracepoints+0x0): first defined here
> /opt/crosstool/gcc-10.3.0-nolibc/x86_64-linux/bin/x86_64-linux-ld: mm/rmap.o: in function `__SCT__tp_func_tlb_flush':
> (.static_call.text+0x0): multiple definition of `__SCT__tp_func_tlb_flush'; arch/x86/mm/init.o:(.static_call.text+0x0): first defined here
> /opt/crosstool/gcc-10.3.0-nolibc/x86_64-linux/bin/x86_64-linux-ld: mm/migrate.o: in function `__SCT__tp_func_mm_migrate_pages':
> (.static_call.text+0x0): multiple definition of `__SCT__tp_func_mm_migrate_pages'; mm/rmap.o:(.static_call.text+0x8): first defined here
> /opt/crosstool/gcc-10.3.0-nolibc/x86_64-linux/bin/x86_64-linux-ld: mm/migrate.o:(.data+0x13a0): multiple definition of `__SCK__tp_func_remove_migration_pte'; mm/rmap.o:(.data+0xfe0): first defined here
> /opt/crosstool/gcc-10.3.0-nolibc/x86_64-linux/bin/x86_64-linux-ld: mm/migrate.o: in function `__traceiter_set_migration_pte':
> (.text+0x140): multiple definition of `__traceiter_set_migration_pte'; mm/rmap.o:(.text+0x1c0): first defined here
> /opt/crosstool/gcc-10.3.0-nolibc/x86_64-linux/bin/x86_64-linux-ld: mm/migrate.o:(__tracepoints+0x120): multiple definition of `__tracepoint_mm_migrate_pages'; mm/rmap.o:(__tracepoints+0x120): first defined here
> /opt/crosstool/gcc-10.3.0-nolibc/x86_64-linux/bin/x86_64-linux-ld: mm/migrate.o: in function `__traceiter_mm_migrate_pages':
> (.text+0x0): multiple definition of `__traceiter_mm_migrate_pages'; mm/rmap.o:(.text+0x80): first defined here
> /opt/crosstool/gcc-10.3.0-nolibc/x86_64-linux/bin/x86_64-linux-ld: mm/migrate.o: in function `__SCT__tp_func_mm_migrate_pages_start':
> (.static_call.text+0x8): multiple definition of `__SCT__tp_func_mm_migrate_pages_start'; mm/rmap.o:(.static_call.text+0x10): first defined here
> /opt/crosstool/gcc-10.3.0-nolibc/x86_64-linux/bin/x86_64-linux-ld: mm/migrate.o:(.data+0x1420): multiple definition of `__SCK__tp_func_mm_migrate_pages_start'; mm/rmap.o:(.data+0x1060): first defined here
> /opt/crosstool/gcc-10.3.0-nolibc/x86_64-linux/bin/x86_64-linux-ld: mm/migrate.o:(.data+0x1460): multiple definition of `__SCK__tp_func_mm_migrate_pages'; mm/rmap.o:(.data+0x10a0): first defined here
> /opt/crosstool/gcc-10.3.0-nolibc/x86_64-linux/bin/x86_64-linux-ld: mm/migrate.o: in function `__traceiter_mm_migrate_pages_start':
> (.text+0xc0): multiple definition of `__traceiter_mm_migrate_pages_start'; mm/rmap.o:(.text+0x140): first defined here
> /opt/crosstool/gcc-10.3.0-nolibc/x86_64-linux/bin/x86_64-linux-ld: mm/migrate.o: in function `__SCT__tp_func_remove_migration_pte':
> (.static_call.text+0x18): multiple definition of `__SCT__tp_func_remove_migration_pte'; mm/rmap.o:(.static_call.text+0x20): first defined here
> /opt/crosstool/gcc-10.3.0-nolibc/x86_64-linux/bin/x86_64-linux-ld: mm/migrate.o:(__tracepoints+0x60): multiple definition of `__tracepoint_set_migration_pte'; mm/rmap.o:(__tracepoints+0x60): first defined here
> /opt/crosstool/gcc-10.3.0-nolibc/x86_64-linux/bin/x86_64-linux-ld: mm/migrate.o:(__tracepoints+0x0): multiple definition of `__tracepoint_remove_migration_pte'; mm/rmap.o:(__tracepoints+0x0): first defined here
> /opt/crosstool/gcc-10.3.0-nolibc/x86_64-linux/bin/x86_64-linux-ld: mm/migrate.o: in function `__traceiter_remove_migration_pte':
> (.text+0x1c0): multiple definition of `__traceiter_remove_migration_pte'; mm/rmap.o:(.text+0x240): first defined here
> /opt/crosstool/gcc-10.3.0-nolibc/x86_64-linux/bin/x86_64-linux-ld: mm/migrate.o: in function `__SCT__tp_func_set_migration_pte':
> (.static_call.text+0x10): multiple definition of `__SCT__tp_func_set_migration_pte'; mm/rmap.o:(.static_call.text+0x18): first defined here
> /opt/crosstool/gcc-10.3.0-nolibc/x86_64-linux/bin/x86_64-linux-ld: mm/migrate.o:(.data+0x13e0): multiple definition of `__SCK__tp_func_set_migration_pte'; mm/rmap.o:(.data+0x1020): first defined here
> /opt/crosstool/gcc-10.3.0-nolibc/x86_64-linux/bin/x86_64-linux-ld: mm/migrate.o:(__tracepoints+0xc0): multiple definition of `__tracepoint_mm_migrate_pages_start'; mm/rmap.o:(__tracepoints+0xc0): first defined here
> make: *** [vmlinux] Error 1
> 

This also seems to be a problem for existing trace points as well like tlb_flush
<events/tlb.h>, mm_migrate_pages_start and mm_migrate_pages <events/migrate.h>.
Is there some cyclic dependency ? Regardless, I can recreate the build problem.
Will look into it.

- Anshuman


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

* Re: [PATCH V2 2/2] mm/migration: Add trace events for base page and HugeTLB migrations
  2022-01-27  4:52         ` Anshuman Khandual
@ 2022-01-27  6:55           ` Anshuman Khandual
  0 siblings, 0 replies; 12+ messages in thread
From: Anshuman Khandual @ 2022-01-27  6:55 UTC (permalink / raw)
  To: Andrew Morton
  Cc: kernel test robot, linux-mm, kbuild-all, naoya.horiguchi,
	rostedt, Ingo Molnar, Zi Yan, Naoya Horiguchi, John Hubbard,
	Matthew Wilcox



On 1/27/22 10:22 AM, Anshuman Khandual wrote:
> 
> 
> On 1/27/22 9:37 AM, Andrew Morton wrote:
>> On Tue, 25 Jan 2022 15:58:34 +0530 Anshuman Khandual <anshuman.khandual@arm.com> wrote:
>>
>>>
>>>
>>>
>>> The following change should fix both the reported build problems.
>>>
>>> diff --git a/mm/rmap.c b/mm/rmap.c
>>> index cce5dbae07f2..cae1c46440d6 100644
>>> --- a/mm/rmap.c
>>> +++ b/mm/rmap.c
>>> @@ -76,6 +76,7 @@
>>>  
>>>  #include <asm/tlbflush.h>
>>>  
>>> +#define CREATE_TRACE_POINTS
>>>  #include <trace/events/tlb.h>
>>>  #include <trace/events/migrate.h>
>>
>> My x86_64 allmodconfig is unhappy.
>>
>> lib/strncpy_from_user.o: warning: objtool: strncpy_from_user()+0x129: call to do_strncpy_from_user() with UACCESS enabled
>> lib/strnlen_user.o: warning: objtool: strnlen_user()+0xc9: call to do_strnlen_user() with UACCESS enabled
>> /opt/crosstool/gcc-10.3.0-nolibc/x86_64-linux/bin/x86_64-linux-ld: mm/rmap.o:(.data+0x13e0): multiple definition of `__SCK__tp_func_tlb_flush'; arch/x86/mm/init.o:(.data+0x980): first defined here
>> /opt/crosstool/gcc-10.3.0-nolibc/x86_64-linux/bin/x86_64-linux-ld: mm/rmap.o: in function `__traceiter_tlb_flush':
>> (.text+0x0): multiple definition of `__traceiter_tlb_flush'; arch/x86/mm/init.o:(.text+0x0): first defined here
>> /opt/crosstool/gcc-10.3.0-nolibc/x86_64-linux/bin/x86_64-linux-ld: mm/rmap.o:(__tracepoints+0x180): multiple definition of `__tracepoint_tlb_flush'; arch/x86/mm/init.o:(__tracepoints+0x0): first defined here
>> /opt/crosstool/gcc-10.3.0-nolibc/x86_64-linux/bin/x86_64-linux-ld: mm/rmap.o: in function `__SCT__tp_func_tlb_flush':
>> (.static_call.text+0x0): multiple definition of `__SCT__tp_func_tlb_flush'; arch/x86/mm/init.o:(.static_call.text+0x0): first defined here
>> /opt/crosstool/gcc-10.3.0-nolibc/x86_64-linux/bin/x86_64-linux-ld: mm/migrate.o: in function `__SCT__tp_func_mm_migrate_pages':
>> (.static_call.text+0x0): multiple definition of `__SCT__tp_func_mm_migrate_pages'; mm/rmap.o:(.static_call.text+0x8): first defined here
>> /opt/crosstool/gcc-10.3.0-nolibc/x86_64-linux/bin/x86_64-linux-ld: mm/migrate.o:(.data+0x13a0): multiple definition of `__SCK__tp_func_remove_migration_pte'; mm/rmap.o:(.data+0xfe0): first defined here
>> /opt/crosstool/gcc-10.3.0-nolibc/x86_64-linux/bin/x86_64-linux-ld: mm/migrate.o: in function `__traceiter_set_migration_pte':
>> (.text+0x140): multiple definition of `__traceiter_set_migration_pte'; mm/rmap.o:(.text+0x1c0): first defined here
>> /opt/crosstool/gcc-10.3.0-nolibc/x86_64-linux/bin/x86_64-linux-ld: mm/migrate.o:(__tracepoints+0x120): multiple definition of `__tracepoint_mm_migrate_pages'; mm/rmap.o:(__tracepoints+0x120): first defined here
>> /opt/crosstool/gcc-10.3.0-nolibc/x86_64-linux/bin/x86_64-linux-ld: mm/migrate.o: in function `__traceiter_mm_migrate_pages':
>> (.text+0x0): multiple definition of `__traceiter_mm_migrate_pages'; mm/rmap.o:(.text+0x80): first defined here
>> /opt/crosstool/gcc-10.3.0-nolibc/x86_64-linux/bin/x86_64-linux-ld: mm/migrate.o: in function `__SCT__tp_func_mm_migrate_pages_start':
>> (.static_call.text+0x8): multiple definition of `__SCT__tp_func_mm_migrate_pages_start'; mm/rmap.o:(.static_call.text+0x10): first defined here
>> /opt/crosstool/gcc-10.3.0-nolibc/x86_64-linux/bin/x86_64-linux-ld: mm/migrate.o:(.data+0x1420): multiple definition of `__SCK__tp_func_mm_migrate_pages_start'; mm/rmap.o:(.data+0x1060): first defined here
>> /opt/crosstool/gcc-10.3.0-nolibc/x86_64-linux/bin/x86_64-linux-ld: mm/migrate.o:(.data+0x1460): multiple definition of `__SCK__tp_func_mm_migrate_pages'; mm/rmap.o:(.data+0x10a0): first defined here
>> /opt/crosstool/gcc-10.3.0-nolibc/x86_64-linux/bin/x86_64-linux-ld: mm/migrate.o: in function `__traceiter_mm_migrate_pages_start':
>> (.text+0xc0): multiple definition of `__traceiter_mm_migrate_pages_start'; mm/rmap.o:(.text+0x140): first defined here
>> /opt/crosstool/gcc-10.3.0-nolibc/x86_64-linux/bin/x86_64-linux-ld: mm/migrate.o: in function `__SCT__tp_func_remove_migration_pte':
>> (.static_call.text+0x18): multiple definition of `__SCT__tp_func_remove_migration_pte'; mm/rmap.o:(.static_call.text+0x20): first defined here
>> /opt/crosstool/gcc-10.3.0-nolibc/x86_64-linux/bin/x86_64-linux-ld: mm/migrate.o:(__tracepoints+0x60): multiple definition of `__tracepoint_set_migration_pte'; mm/rmap.o:(__tracepoints+0x60): first defined here
>> /opt/crosstool/gcc-10.3.0-nolibc/x86_64-linux/bin/x86_64-linux-ld: mm/migrate.o:(__tracepoints+0x0): multiple definition of `__tracepoint_remove_migration_pte'; mm/rmap.o:(__tracepoints+0x0): first defined here
>> /opt/crosstool/gcc-10.3.0-nolibc/x86_64-linux/bin/x86_64-linux-ld: mm/migrate.o: in function `__traceiter_remove_migration_pte':
>> (.text+0x1c0): multiple definition of `__traceiter_remove_migration_pte'; mm/rmap.o:(.text+0x240): first defined here
>> /opt/crosstool/gcc-10.3.0-nolibc/x86_64-linux/bin/x86_64-linux-ld: mm/migrate.o: in function `__SCT__tp_func_set_migration_pte':
>> (.static_call.text+0x10): multiple definition of `__SCT__tp_func_set_migration_pte'; mm/rmap.o:(.static_call.text+0x18): first defined here
>> /opt/crosstool/gcc-10.3.0-nolibc/x86_64-linux/bin/x86_64-linux-ld: mm/migrate.o:(.data+0x13e0): multiple definition of `__SCK__tp_func_set_migration_pte'; mm/rmap.o:(.data+0x1020): first defined here
>> /opt/crosstool/gcc-10.3.0-nolibc/x86_64-linux/bin/x86_64-linux-ld: mm/migrate.o:(__tracepoints+0xc0): multiple definition of `__tracepoint_mm_migrate_pages_start'; mm/rmap.o:(__tracepoints+0xc0): first defined here
>> make: *** [vmlinux] Error 1
>>
> 
> This also seems to be a problem for existing trace points as well like tlb_flush
> <events/tlb.h>, mm_migrate_pages_start and mm_migrate_pages <events/migrate.h>.
> Is there some cyclic dependency ? Regardless, I can recreate the build problem.
> Will look into it.

CREATE_TRACE_POINTS should be defined just once, even if the corresponding trace
header file is included in multiple C files. mm/rmap.c is a better place to have
CREATE_TRACE_POINTS defined as it gets built always with CONFIG_MMU. Because the
file mm/rmap.c now includes both <trace/events/migrate.h> and <trace/events/tlb.h>
, all existing CREATE_TRACE_POINTS (including inside platforms) for them need to
be dropped. A similar problem got created for <trace/events/thp.h> on powerpc as
well, after the first patch.

The following patch here fixes this problem. But I will do some more testing and
respin the series.

diff --git a/arch/powerpc/mm/book3s64/trace.c b/arch/powerpc/mm/book3s64/trace.c
index b86e7b906257..ccd64b5e6cac 100644
--- a/arch/powerpc/mm/book3s64/trace.c
+++ b/arch/powerpc/mm/book3s64/trace.c
@@ -3,6 +3,5 @@
  * This file is for defining trace points and trace related helpers.
  */
 #ifdef CONFIG_TRANSPARENT_HUGEPAGE
-#define CREATE_TRACE_POINTS
 #include <trace/events/thp.h>
 #endif
diff --git a/arch/x86/mm/init.c b/arch/x86/mm/init.c
index 4ba024d5b63a..d8cfce221275 100644
--- a/arch/x86/mm/init.c
+++ b/arch/x86/mm/init.c
@@ -31,7 +31,6 @@
  * We need to define the tracepoints somewhere, and tlb.c
  * is only compiled when SMP=y.
  */
-#define CREATE_TRACE_POINTS
 #include <trace/events/tlb.h>
 
 #include "mm_internal.h"
diff --git a/mm/migrate.c b/mm/migrate.c
index 253dc5812949..79e3a553923a 100644
--- a/mm/migrate.c
+++ b/mm/migrate.c
@@ -54,7 +54,6 @@
 
 #include <asm/tlbflush.h>
 
-#define CREATE_TRACE_POINTS
 #include <trace/events/migrate.h>
 
 #include "internal.h"



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

end of thread, other threads:[~2022-01-27  6:55 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-25  3:08 [PATCH V2 0/2] mm/migration: Add trace events Anshuman Khandual
2022-01-25  3:08 ` [PATCH V2 1/2] mm/migration: Add trace events for THP migrations Anshuman Khandual
2022-01-25  3:08 ` [PATCH V2 2/2] mm/migration: Add trace events for base page and HugeTLB migrations Anshuman Khandual
2022-01-25  9:41   ` kernel test robot
2022-01-25  9:41   ` kernel test robot
2022-01-25 10:28     ` Anshuman Khandual
2022-01-27  4:07       ` Andrew Morton
2022-01-27  4:52         ` Anshuman Khandual
2022-01-27  6:55           ` Anshuman Khandual
2022-01-25 11:13   ` kernel test robot
2022-01-25 13:28   ` Matthew Wilcox
2022-01-25 15:16     ` Steven Rostedt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).