linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [linux-next:master 7592/7905] arch/riscv/mm/ptdump.c:57:3: error: 'FIXADDR_START' undeclared here (not in a function); did you mean 'XAS_RESTART'?
@ 2020-05-09 10:46 kbuild test robot
  2020-05-14  1:07 ` Andrew Morton
  0 siblings, 1 reply; 5+ messages in thread
From: kbuild test robot @ 2020-05-09 10:46 UTC (permalink / raw)
  To: Zong Li; +Cc: kbuild-all, Andrew Morton, Linux Memory Management List

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

Hi Zong,

First bad commit (maybe != root cause):

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   30e2206e11ce27ae910cc0dab21472429e400a87
commit: c0eba2d72e70b4208ca6fd82820ba7428090e350 [7592/7905] riscv: support DEBUG_WX
config: riscv-randconfig-r003-20200509 (attached as .config)
compiler: riscv64-linux-gcc (GCC) 9.3.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        git checkout c0eba2d72e70b4208ca6fd82820ba7428090e350
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day GCC_VERSION=9.3.0 make.cross ARCH=riscv 

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

All error/warnings (new ones prefixed by >>):

>> arch/riscv/mm/ptdump.c:57:3: error: 'FIXADDR_START' undeclared here (not in a function); did you mean 'XAS_RESTART'?
      57 |  {FIXADDR_START,  "Fixmap start"},
         |   ^~~~~~~~~~~~~
         |   XAS_RESTART
>> arch/riscv/mm/ptdump.c:58:3: error: 'FIXADDR_TOP' undeclared here (not in a function)
      58 |  {FIXADDR_TOP,  "Fixmap end"},
         |   ^~~~~~~~~~~
>> arch/riscv/mm/ptdump.c:59:3: error: 'PCI_IO_START' undeclared here (not in a function)
      59 |  {PCI_IO_START,  "PCI I/O start"},
         |   ^~~~~~~~~~~~
>> arch/riscv/mm/ptdump.c:60:3: error: 'PCI_IO_END' undeclared here (not in a function)
      60 |  {PCI_IO_END,  "PCI I/O end"},
         |   ^~~~~~~~~~
   In file included from arch/riscv/include/asm/page.h:12,
                    from arch/riscv/include/asm/thread_info.h:11,
                    from include/linux/thread_info.h:38,
                    from include/asm-generic/preempt.h:5,
                    from ./arch/riscv/include/generated/asm/preempt.h:1,
                    from include/linux/preempt.h:78,
                    from include/linux/spinlock.h:51,
                    from include/linux/wait.h:9,
                    from include/linux/wait_bit.h:8,
                    from include/linux/fs.h:6,
                    from include/linux/debugfs.h:15,
                    from arch/riscv/mm/ptdump.c:7:
   arch/riscv/mm/ptdump.c: In function 'note_page':
>> arch/riscv/mm/ptdump.c:210:20: error: implicit declaration of function 'pte_pfn' [-Werror=implicit-function-declaration]
     210 |  u64 pa = PFN_PHYS(pte_pfn(__pte(val)));
         |                    ^~~~~~~
   include/linux/pfn.h:21:36: note: in definition of macro 'PFN_PHYS'
      21 | #define PFN_PHYS(x) ((phys_addr_t)(x) << PAGE_SHIFT)
         |                                    ^
   arch/riscv/mm/ptdump.c: In function 'ptdump_walk':
>> arch/riscv/mm/ptdump.c:257:6: error: 'KERN_VIRT_START' undeclared (first use in this function); did you mean 'KERN_VIRT_SIZE'?
     257 |     {KERN_VIRT_START, ULONG_MAX},
         |      ^~~~~~~~~~~~~~~
         |      KERN_VIRT_SIZE
   arch/riscv/mm/ptdump.c:257:6: note: each undeclared identifier is reported only once for each function it appears in
>> arch/riscv/mm/ptdump.c:257:6: warning: initialization of 'long unsigned int' from 'struct addr_marker *' makes integer from pointer without a cast [-Wint-conversion]
   arch/riscv/mm/ptdump.c:257:6: note: (near initialization for '(anonymous)[0].start')
   arch/riscv/mm/ptdump.c: In function 'ptdump_check_wx':
   arch/riscv/mm/ptdump.c:279:6: error: 'KERN_VIRT_START' undeclared (first use in this function); did you mean 'KERN_VIRT_SIZE'?
     279 |     {KERN_VIRT_START, ULONG_MAX},
         |      ^~~~~~~~~~~~~~~
         |      KERN_VIRT_SIZE
   arch/riscv/mm/ptdump.c:279:6: warning: initialization of 'long unsigned int' from 'struct addr_marker *' makes integer from pointer without a cast [-Wint-conversion]
   arch/riscv/mm/ptdump.c:279:6: note: (near initialization for '(anonymous)[0].start')
   cc1: some warnings being treated as errors

vim +57 arch/riscv/mm/ptdump.c

59c4da8640ccf4 Zong Li 2020-03-12   @7  #include <linux/debugfs.h>
59c4da8640ccf4 Zong Li 2020-03-12    8  #include <linux/seq_file.h>
59c4da8640ccf4 Zong Li 2020-03-12    9  #include <linux/ptdump.h>
59c4da8640ccf4 Zong Li 2020-03-12   10  
59c4da8640ccf4 Zong Li 2020-03-12   11  #include <asm/ptdump.h>
59c4da8640ccf4 Zong Li 2020-03-12   12  #include <asm/pgtable.h>
59c4da8640ccf4 Zong Li 2020-03-12   13  #include <asm/kasan.h>
59c4da8640ccf4 Zong Li 2020-03-12   14  
59c4da8640ccf4 Zong Li 2020-03-12   15  #define pt_dump_seq_printf(m, fmt, args...)	\
59c4da8640ccf4 Zong Li 2020-03-12   16  ({						\
59c4da8640ccf4 Zong Li 2020-03-12   17  	if (m)					\
59c4da8640ccf4 Zong Li 2020-03-12   18  		seq_printf(m, fmt, ##args);	\
59c4da8640ccf4 Zong Li 2020-03-12   19  })
59c4da8640ccf4 Zong Li 2020-03-12   20  
59c4da8640ccf4 Zong Li 2020-03-12   21  #define pt_dump_seq_puts(m, fmt)	\
59c4da8640ccf4 Zong Li 2020-03-12   22  ({					\
59c4da8640ccf4 Zong Li 2020-03-12   23  	if (m)				\
59c4da8640ccf4 Zong Li 2020-03-12   24  		seq_printf(m, fmt);	\
59c4da8640ccf4 Zong Li 2020-03-12   25  })
59c4da8640ccf4 Zong Li 2020-03-12   26  
59c4da8640ccf4 Zong Li 2020-03-12   27  /*
59c4da8640ccf4 Zong Li 2020-03-12   28   * The page dumper groups page table entries of the same type into a single
59c4da8640ccf4 Zong Li 2020-03-12   29   * description. It uses pg_state to track the range information while
59c4da8640ccf4 Zong Li 2020-03-12   30   * iterating over the pte entries. When the continuity is broken it then
59c4da8640ccf4 Zong Li 2020-03-12   31   * dumps out a description of the range.
59c4da8640ccf4 Zong Li 2020-03-12   32   */
59c4da8640ccf4 Zong Li 2020-03-12   33  struct pg_state {
59c4da8640ccf4 Zong Li 2020-03-12   34  	struct ptdump_state ptdump;
59c4da8640ccf4 Zong Li 2020-03-12   35  	struct seq_file *seq;
59c4da8640ccf4 Zong Li 2020-03-12   36  	const struct addr_marker *marker;
59c4da8640ccf4 Zong Li 2020-03-12   37  	unsigned long start_address;
59c4da8640ccf4 Zong Li 2020-03-12   38  	unsigned long start_pa;
59c4da8640ccf4 Zong Li 2020-03-12   39  	unsigned long last_pa;
59c4da8640ccf4 Zong Li 2020-03-12   40  	int level;
59c4da8640ccf4 Zong Li 2020-03-12   41  	u64 current_prot;
59c4da8640ccf4 Zong Li 2020-03-12   42  	bool check_wx;
59c4da8640ccf4 Zong Li 2020-03-12   43  	unsigned long wx_pages;
59c4da8640ccf4 Zong Li 2020-03-12   44  };
59c4da8640ccf4 Zong Li 2020-03-12   45  
59c4da8640ccf4 Zong Li 2020-03-12   46  /* Address marker */
59c4da8640ccf4 Zong Li 2020-03-12   47  struct addr_marker {
59c4da8640ccf4 Zong Li 2020-03-12   48  	unsigned long start_address;
59c4da8640ccf4 Zong Li 2020-03-12   49  	const char *name;
59c4da8640ccf4 Zong Li 2020-03-12   50  };
59c4da8640ccf4 Zong Li 2020-03-12   51  
59c4da8640ccf4 Zong Li 2020-03-12   52  static struct addr_marker address_markers[] = {
59c4da8640ccf4 Zong Li 2020-03-12   53  #ifdef CONFIG_KASAN
59c4da8640ccf4 Zong Li 2020-03-12   54  	{KASAN_SHADOW_START,	"Kasan shadow start"},
59c4da8640ccf4 Zong Li 2020-03-12   55  	{KASAN_SHADOW_END,	"Kasan shadow end"},
59c4da8640ccf4 Zong Li 2020-03-12   56  #endif
59c4da8640ccf4 Zong Li 2020-03-12  @57  	{FIXADDR_START,		"Fixmap start"},
59c4da8640ccf4 Zong Li 2020-03-12  @58  	{FIXADDR_TOP,		"Fixmap end"},
59c4da8640ccf4 Zong Li 2020-03-12  @59  	{PCI_IO_START,		"PCI I/O start"},
59c4da8640ccf4 Zong Li 2020-03-12  @60  	{PCI_IO_END,		"PCI I/O end"},
59c4da8640ccf4 Zong Li 2020-03-12   61  #ifdef CONFIG_SPARSEMEM_VMEMMAP
59c4da8640ccf4 Zong Li 2020-03-12   62  	{VMEMMAP_START,		"vmemmap start"},
59c4da8640ccf4 Zong Li 2020-03-12   63  	{VMEMMAP_END,		"vmemmap end"},
59c4da8640ccf4 Zong Li 2020-03-12   64  #endif
59c4da8640ccf4 Zong Li 2020-03-12   65  	{VMALLOC_START,		"vmalloc() area"},
59c4da8640ccf4 Zong Li 2020-03-12   66  	{VMALLOC_END,		"vmalloc() end"},
59c4da8640ccf4 Zong Li 2020-03-12   67  	{PAGE_OFFSET,		"Linear mapping"},
59c4da8640ccf4 Zong Li 2020-03-12   68  	{-1, NULL},
59c4da8640ccf4 Zong Li 2020-03-12   69  };
59c4da8640ccf4 Zong Li 2020-03-12   70  
59c4da8640ccf4 Zong Li 2020-03-12   71  /* Page Table Entry */
59c4da8640ccf4 Zong Li 2020-03-12   72  struct prot_bits {
59c4da8640ccf4 Zong Li 2020-03-12   73  	u64 mask;
59c4da8640ccf4 Zong Li 2020-03-12   74  	u64 val;
59c4da8640ccf4 Zong Li 2020-03-12   75  	const char *set;
59c4da8640ccf4 Zong Li 2020-03-12   76  	const char *clear;
59c4da8640ccf4 Zong Li 2020-03-12   77  };
59c4da8640ccf4 Zong Li 2020-03-12   78  
59c4da8640ccf4 Zong Li 2020-03-12   79  static const struct prot_bits pte_bits[] = {
59c4da8640ccf4 Zong Li 2020-03-12   80  	{
59c4da8640ccf4 Zong Li 2020-03-12   81  		.mask = _PAGE_SOFT,
59c4da8640ccf4 Zong Li 2020-03-12   82  		.val = _PAGE_SOFT,
59c4da8640ccf4 Zong Li 2020-03-12   83  		.set = "RSW",
59c4da8640ccf4 Zong Li 2020-03-12   84  		.clear = "   ",
59c4da8640ccf4 Zong Li 2020-03-12   85  	}, {
59c4da8640ccf4 Zong Li 2020-03-12   86  		.mask = _PAGE_DIRTY,
59c4da8640ccf4 Zong Li 2020-03-12   87  		.val = _PAGE_DIRTY,
59c4da8640ccf4 Zong Li 2020-03-12   88  		.set = "D",
59c4da8640ccf4 Zong Li 2020-03-12   89  		.clear = ".",
59c4da8640ccf4 Zong Li 2020-03-12   90  	}, {
59c4da8640ccf4 Zong Li 2020-03-12   91  		.mask = _PAGE_ACCESSED,
59c4da8640ccf4 Zong Li 2020-03-12   92  		.val = _PAGE_ACCESSED,
59c4da8640ccf4 Zong Li 2020-03-12   93  		.set = "A",
59c4da8640ccf4 Zong Li 2020-03-12   94  		.clear = ".",
59c4da8640ccf4 Zong Li 2020-03-12   95  	}, {
59c4da8640ccf4 Zong Li 2020-03-12   96  		.mask = _PAGE_GLOBAL,
59c4da8640ccf4 Zong Li 2020-03-12   97  		.val = _PAGE_GLOBAL,
59c4da8640ccf4 Zong Li 2020-03-12   98  		.set = "G",
59c4da8640ccf4 Zong Li 2020-03-12   99  		.clear = ".",
59c4da8640ccf4 Zong Li 2020-03-12  100  	}, {
59c4da8640ccf4 Zong Li 2020-03-12  101  		.mask = _PAGE_USER,
59c4da8640ccf4 Zong Li 2020-03-12  102  		.val = _PAGE_USER,
59c4da8640ccf4 Zong Li 2020-03-12  103  		.set = "U",
59c4da8640ccf4 Zong Li 2020-03-12  104  		.clear = ".",
59c4da8640ccf4 Zong Li 2020-03-12  105  	}, {
59c4da8640ccf4 Zong Li 2020-03-12  106  		.mask = _PAGE_EXEC,
59c4da8640ccf4 Zong Li 2020-03-12  107  		.val = _PAGE_EXEC,
59c4da8640ccf4 Zong Li 2020-03-12  108  		.set = "X",
59c4da8640ccf4 Zong Li 2020-03-12  109  		.clear = ".",
59c4da8640ccf4 Zong Li 2020-03-12  110  	}, {
59c4da8640ccf4 Zong Li 2020-03-12  111  		.mask = _PAGE_WRITE,
59c4da8640ccf4 Zong Li 2020-03-12  112  		.val = _PAGE_WRITE,
59c4da8640ccf4 Zong Li 2020-03-12  113  		.set = "W",
59c4da8640ccf4 Zong Li 2020-03-12  114  		.clear = ".",
59c4da8640ccf4 Zong Li 2020-03-12  115  	}, {
59c4da8640ccf4 Zong Li 2020-03-12  116  		.mask = _PAGE_READ,
59c4da8640ccf4 Zong Li 2020-03-12  117  		.val = _PAGE_READ,
59c4da8640ccf4 Zong Li 2020-03-12  118  		.set = "R",
59c4da8640ccf4 Zong Li 2020-03-12  119  		.clear = ".",
59c4da8640ccf4 Zong Li 2020-03-12  120  	}, {
59c4da8640ccf4 Zong Li 2020-03-12  121  		.mask = _PAGE_PRESENT,
59c4da8640ccf4 Zong Li 2020-03-12  122  		.val = _PAGE_PRESENT,
59c4da8640ccf4 Zong Li 2020-03-12  123  		.set = "V",
59c4da8640ccf4 Zong Li 2020-03-12  124  		.clear = ".",
59c4da8640ccf4 Zong Li 2020-03-12  125  	}
59c4da8640ccf4 Zong Li 2020-03-12  126  };
59c4da8640ccf4 Zong Li 2020-03-12  127  
59c4da8640ccf4 Zong Li 2020-03-12  128  /* Page Level */
59c4da8640ccf4 Zong Li 2020-03-12  129  struct pg_level {
59c4da8640ccf4 Zong Li 2020-03-12  130  	const char *name;
59c4da8640ccf4 Zong Li 2020-03-12  131  	u64 mask;
59c4da8640ccf4 Zong Li 2020-03-12  132  };
59c4da8640ccf4 Zong Li 2020-03-12  133  
59c4da8640ccf4 Zong Li 2020-03-12  134  static struct pg_level pg_level[] = {
59c4da8640ccf4 Zong Li 2020-03-12  135  	{ /* pgd */
59c4da8640ccf4 Zong Li 2020-03-12  136  		.name = "PGD",
59c4da8640ccf4 Zong Li 2020-03-12  137  	}, { /* p4d */
59c4da8640ccf4 Zong Li 2020-03-12  138  		.name = (CONFIG_PGTABLE_LEVELS > 4) ? "P4D" : "PGD",
59c4da8640ccf4 Zong Li 2020-03-12  139  	}, { /* pud */
59c4da8640ccf4 Zong Li 2020-03-12  140  		.name = (CONFIG_PGTABLE_LEVELS > 3) ? "PUD" : "PGD",
59c4da8640ccf4 Zong Li 2020-03-12  141  	}, { /* pmd */
59c4da8640ccf4 Zong Li 2020-03-12  142  		.name = (CONFIG_PGTABLE_LEVELS > 2) ? "PMD" : "PGD",
59c4da8640ccf4 Zong Li 2020-03-12  143  	}, { /* pte */
59c4da8640ccf4 Zong Li 2020-03-12  144  		.name = "PTE",
59c4da8640ccf4 Zong Li 2020-03-12  145  	},
59c4da8640ccf4 Zong Li 2020-03-12  146  };
59c4da8640ccf4 Zong Li 2020-03-12  147  
59c4da8640ccf4 Zong Li 2020-03-12  148  static void dump_prot(struct pg_state *st)
59c4da8640ccf4 Zong Li 2020-03-12  149  {
59c4da8640ccf4 Zong Li 2020-03-12  150  	unsigned int i;
59c4da8640ccf4 Zong Li 2020-03-12  151  
59c4da8640ccf4 Zong Li 2020-03-12  152  	for (i = 0; i < ARRAY_SIZE(pte_bits); i++) {
59c4da8640ccf4 Zong Li 2020-03-12  153  		const char *s;
59c4da8640ccf4 Zong Li 2020-03-12  154  
59c4da8640ccf4 Zong Li 2020-03-12  155  		if ((st->current_prot & pte_bits[i].mask) == pte_bits[i].val)
59c4da8640ccf4 Zong Li 2020-03-12  156  			s = pte_bits[i].set;
59c4da8640ccf4 Zong Li 2020-03-12  157  		else
59c4da8640ccf4 Zong Li 2020-03-12  158  			s = pte_bits[i].clear;
59c4da8640ccf4 Zong Li 2020-03-12  159  
59c4da8640ccf4 Zong Li 2020-03-12  160  		if (s)
59c4da8640ccf4 Zong Li 2020-03-12  161  			pt_dump_seq_printf(st->seq, " %s", s);
59c4da8640ccf4 Zong Li 2020-03-12  162  	}
59c4da8640ccf4 Zong Li 2020-03-12  163  }
59c4da8640ccf4 Zong Li 2020-03-12  164  
59c4da8640ccf4 Zong Li 2020-03-12  165  #ifdef CONFIG_64BIT
59c4da8640ccf4 Zong Li 2020-03-12  166  #define ADDR_FORMAT	"0x%016lx"
59c4da8640ccf4 Zong Li 2020-03-12  167  #else
59c4da8640ccf4 Zong Li 2020-03-12  168  #define ADDR_FORMAT	"0x%08lx"
59c4da8640ccf4 Zong Li 2020-03-12  169  #endif
59c4da8640ccf4 Zong Li 2020-03-12  170  static void dump_addr(struct pg_state *st, unsigned long addr)
59c4da8640ccf4 Zong Li 2020-03-12  171  {
59c4da8640ccf4 Zong Li 2020-03-12  172  	static const char units[] = "KMGTPE";
59c4da8640ccf4 Zong Li 2020-03-12  173  	const char *unit = units;
59c4da8640ccf4 Zong Li 2020-03-12  174  	unsigned long delta;
59c4da8640ccf4 Zong Li 2020-03-12  175  
59c4da8640ccf4 Zong Li 2020-03-12  176  	pt_dump_seq_printf(st->seq, ADDR_FORMAT "-" ADDR_FORMAT "   ",
59c4da8640ccf4 Zong Li 2020-03-12  177  			   st->start_address, addr);
59c4da8640ccf4 Zong Li 2020-03-12  178  
59c4da8640ccf4 Zong Li 2020-03-12  179  	pt_dump_seq_printf(st->seq, " " ADDR_FORMAT " ", st->start_pa);
59c4da8640ccf4 Zong Li 2020-03-12  180  	delta = (addr - st->start_address) >> 10;
59c4da8640ccf4 Zong Li 2020-03-12  181  
59c4da8640ccf4 Zong Li 2020-03-12  182  	while (!(delta & 1023) && unit[1]) {
59c4da8640ccf4 Zong Li 2020-03-12  183  		delta >>= 10;
59c4da8640ccf4 Zong Li 2020-03-12  184  		unit++;
59c4da8640ccf4 Zong Li 2020-03-12  185  	}
59c4da8640ccf4 Zong Li 2020-03-12  186  
59c4da8640ccf4 Zong Li 2020-03-12  187  	pt_dump_seq_printf(st->seq, "%9lu%c %s", delta, *unit,
59c4da8640ccf4 Zong Li 2020-03-12  188  			   pg_level[st->level].name);
59c4da8640ccf4 Zong Li 2020-03-12  189  }
59c4da8640ccf4 Zong Li 2020-03-12  190  
59c4da8640ccf4 Zong Li 2020-03-12  191  static void note_prot_wx(struct pg_state *st, unsigned long addr)
59c4da8640ccf4 Zong Li 2020-03-12  192  {
59c4da8640ccf4 Zong Li 2020-03-12  193  	if (!st->check_wx)
59c4da8640ccf4 Zong Li 2020-03-12  194  		return;
59c4da8640ccf4 Zong Li 2020-03-12  195  
59c4da8640ccf4 Zong Li 2020-03-12  196  	if ((st->current_prot & (_PAGE_WRITE | _PAGE_EXEC)) !=
59c4da8640ccf4 Zong Li 2020-03-12  197  	    (_PAGE_WRITE | _PAGE_EXEC))
59c4da8640ccf4 Zong Li 2020-03-12  198  		return;
59c4da8640ccf4 Zong Li 2020-03-12  199  
59c4da8640ccf4 Zong Li 2020-03-12  200  	WARN_ONCE(1, "riscv/mm: Found insecure W+X mapping at address %p/%pS\n",
59c4da8640ccf4 Zong Li 2020-03-12  201  		  (void *)st->start_address, (void *)st->start_address);
59c4da8640ccf4 Zong Li 2020-03-12  202  
59c4da8640ccf4 Zong Li 2020-03-12  203  	st->wx_pages += (addr - st->start_address) / PAGE_SIZE;
59c4da8640ccf4 Zong Li 2020-03-12  204  }
59c4da8640ccf4 Zong Li 2020-03-12  205  
59c4da8640ccf4 Zong Li 2020-03-12  206  static void note_page(struct ptdump_state *pt_st, unsigned long addr,
59c4da8640ccf4 Zong Li 2020-03-12  207  		      int level, unsigned long val)
59c4da8640ccf4 Zong Li 2020-03-12  208  {
59c4da8640ccf4 Zong Li 2020-03-12  209  	struct pg_state *st = container_of(pt_st, struct pg_state, ptdump);
59c4da8640ccf4 Zong Li 2020-03-12 @210  	u64 pa = PFN_PHYS(pte_pfn(__pte(val)));
59c4da8640ccf4 Zong Li 2020-03-12  211  	u64 prot = 0;
59c4da8640ccf4 Zong Li 2020-03-12  212  
59c4da8640ccf4 Zong Li 2020-03-12  213  	if (level >= 0)
59c4da8640ccf4 Zong Li 2020-03-12  214  		prot = val & pg_level[level].mask;
59c4da8640ccf4 Zong Li 2020-03-12  215  
59c4da8640ccf4 Zong Li 2020-03-12  216  	if (st->level == -1) {
59c4da8640ccf4 Zong Li 2020-03-12  217  		st->level = level;
59c4da8640ccf4 Zong Li 2020-03-12  218  		st->current_prot = prot;
59c4da8640ccf4 Zong Li 2020-03-12  219  		st->start_address = addr;
59c4da8640ccf4 Zong Li 2020-03-12  220  		st->start_pa = pa;
59c4da8640ccf4 Zong Li 2020-03-12  221  		st->last_pa = pa;
59c4da8640ccf4 Zong Li 2020-03-12  222  		pt_dump_seq_printf(st->seq, "---[ %s ]---\n", st->marker->name);
59c4da8640ccf4 Zong Li 2020-03-12  223  	} else if (prot != st->current_prot ||
59c4da8640ccf4 Zong Li 2020-03-12  224  		   level != st->level || addr >= st->marker[1].start_address) {
59c4da8640ccf4 Zong Li 2020-03-12  225  		if (st->current_prot) {
59c4da8640ccf4 Zong Li 2020-03-12  226  			note_prot_wx(st, addr);
59c4da8640ccf4 Zong Li 2020-03-12  227  			dump_addr(st, addr);
59c4da8640ccf4 Zong Li 2020-03-12  228  			dump_prot(st);
59c4da8640ccf4 Zong Li 2020-03-12  229  			pt_dump_seq_puts(st->seq, "\n");
59c4da8640ccf4 Zong Li 2020-03-12  230  		}
59c4da8640ccf4 Zong Li 2020-03-12  231  
59c4da8640ccf4 Zong Li 2020-03-12  232  		while (addr >= st->marker[1].start_address) {
59c4da8640ccf4 Zong Li 2020-03-12  233  			st->marker++;
59c4da8640ccf4 Zong Li 2020-03-12  234  			pt_dump_seq_printf(st->seq, "---[ %s ]---\n",
59c4da8640ccf4 Zong Li 2020-03-12  235  					   st->marker->name);
59c4da8640ccf4 Zong Li 2020-03-12  236  		}
59c4da8640ccf4 Zong Li 2020-03-12  237  
59c4da8640ccf4 Zong Li 2020-03-12  238  		st->start_address = addr;
59c4da8640ccf4 Zong Li 2020-03-12  239  		st->start_pa = pa;
59c4da8640ccf4 Zong Li 2020-03-12  240  		st->last_pa = pa;
59c4da8640ccf4 Zong Li 2020-03-12  241  		st->current_prot = prot;
59c4da8640ccf4 Zong Li 2020-03-12  242  		st->level = level;
59c4da8640ccf4 Zong Li 2020-03-12  243  	} else {
59c4da8640ccf4 Zong Li 2020-03-12  244  		st->last_pa = pa;
59c4da8640ccf4 Zong Li 2020-03-12  245  	}
59c4da8640ccf4 Zong Li 2020-03-12  246  }
59c4da8640ccf4 Zong Li 2020-03-12  247  

:::::: The code at line 57 was first introduced by commit
:::::: 59c4da8640ccf4721d54d36835706f3eefb521a4 riscv: Add support to dump the kernel page tables

:::::: TO: Zong Li <zong.li@sifive.com>
:::::: CC: Palmer Dabbelt <palmerdabbelt@google.com>

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

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

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

* Re: [linux-next:master 7592/7905] arch/riscv/mm/ptdump.c:57:3: error: 'FIXADDR_START' undeclared here (not in a function); did you mean 'XAS_RESTART'?
  2020-05-09 10:46 [linux-next:master 7592/7905] arch/riscv/mm/ptdump.c:57:3: error: 'FIXADDR_START' undeclared here (not in a function); did you mean 'XAS_RESTART'? kbuild test robot
@ 2020-05-14  1:07 ` Andrew Morton
  2020-05-14  3:47   ` Zong Li
  0 siblings, 1 reply; 5+ messages in thread
From: Andrew Morton @ 2020-05-14  1:07 UTC (permalink / raw)
  To: kbuild test robot; +Cc: Zong Li, kbuild-all, Linux Memory Management List

On Sat, 9 May 2020 18:46:50 +0800 kbuild test robot <lkp@intel.com> wrote:

> Hi Zong,
> 
> First bad commit (maybe != root cause):
> 
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
> head:   30e2206e11ce27ae910cc0dab21472429e400a87
> commit: c0eba2d72e70b4208ca6fd82820ba7428090e350 [7592/7905] riscv: support DEBUG_WX
> config: riscv-randconfig-r003-20200509 (attached as .config)
> compiler: riscv64-linux-gcc (GCC) 9.3.0
> reproduce:
>         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
>         chmod +x ~/bin/make.cross
>         git checkout c0eba2d72e70b4208ca6fd82820ba7428090e350
>         # save the attached .config to linux build tree
>         COMPILER_INSTALL_PATH=$HOME/0day GCC_VERSION=9.3.0 make.cross ARCH=riscv 
> 
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kbuild test robot <lkp@intel.com>
> 
> All error/warnings (new ones prefixed by >>):
> 
> >> arch/riscv/mm/ptdump.c:57:3: error: 'FIXADDR_START' undeclared here (not in a function); did you mean 'XAS_RESTART'?
>       57 |  {FIXADDR_START,  "Fixmap start"},
>          |   ^~~~~~~~~~~~~
>          |   XAS_RESTART

argh, I can't figure out how to make riscv compile :(

Are you using the riscv32 toolchain or riscv64?

And arch/riscv/include/asm/perf_event.h does

#ifdef CONFIG_RISCV_BASE_PMU
#define RISCV_MAX_COUNTERS	2
#endif

#ifndef RISCV_MAX_COUNTERS
#error "Please provide a valid RISCV_MAX_COUNTERS for the PMU."
#endif

where is RISCV_MAX_COUNTERS supposed to come from?  Surely this should
be implemented in Kconfig somehow?

Sigh.  Zong, did you take a look at this?


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

* Re: [linux-next:master 7592/7905] arch/riscv/mm/ptdump.c:57:3: error: 'FIXADDR_START' undeclared here (not in a function); did you mean 'XAS_RESTART'?
  2020-05-14  1:07 ` Andrew Morton
@ 2020-05-14  3:47   ` Zong Li
  2020-05-14  8:37     ` Kefeng Wang
  0 siblings, 1 reply; 5+ messages in thread
From: Zong Li @ 2020-05-14  3:47 UTC (permalink / raw)
  To: Andrew Morton; +Cc: kbuild test robot, kbuild-all, Linux Memory Management List

On Thu, May 14, 2020 at 9:07 AM Andrew Morton <akpm@linux-foundation.org> wrote:
>
> On Sat, 9 May 2020 18:46:50 +0800 kbuild test robot <lkp@intel.com> wrote:
>
> > Hi Zong,
> >
> > First bad commit (maybe != root cause):
> >
> > tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
> > head:   30e2206e11ce27ae910cc0dab21472429e400a87
> > commit: c0eba2d72e70b4208ca6fd82820ba7428090e350 [7592/7905] riscv: support DEBUG_WX
> > config: riscv-randconfig-r003-20200509 (attached as .config)
> > compiler: riscv64-linux-gcc (GCC) 9.3.0
> > reproduce:
> >         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> >         chmod +x ~/bin/make.cross
> >         git checkout c0eba2d72e70b4208ca6fd82820ba7428090e350
> >         # save the attached .config to linux build tree
> >         COMPILER_INSTALL_PATH=$HOME/0day GCC_VERSION=9.3.0 make.cross ARCH=riscv
> >
> > If you fix the issue, kindly add following tag as appropriate
> > Reported-by: kbuild test robot <lkp@intel.com>
> >
> > All error/warnings (new ones prefixed by >>):
> >
> > >> arch/riscv/mm/ptdump.c:57:3: error: 'FIXADDR_START' undeclared here (not in a function); did you mean 'XAS_RESTART'?
> >       57 |  {FIXADDR_START,  "Fixmap start"},
> >          |   ^~~~~~~~~~~~~
> >          |   XAS_RESTART
>
> argh, I can't figure out how to make riscv compile :(
>
> Are you using the riscv32 toolchain or riscv64?
>
> And arch/riscv/include/asm/perf_event.h does
>
> #ifdef CONFIG_RISCV_BASE_PMU
> #define RISCV_MAX_COUNTERS      2
> #endif
>
> #ifndef RISCV_MAX_COUNTERS
> #error "Please provide a valid RISCV_MAX_COUNTERS for the PMU."
> #endif
>
> where is RISCV_MAX_COUNTERS supposed to come from?  Surely this should
> be implemented in Kconfig somehow?
>
> Sigh.  Zong, did you take a look at this?

Yes, I had taken a look at that, the problem is that the .config
selects CONFIG_PERF_EVENTS, but doesn't select CONFIG_RISCV_BASE_PMU
together. It seems to me that it is a bug of perf porting on RISC-V,
CONFIG_RISCV_BASE_PMU could be selected or unselected, but in fact,
CONFIG_RISCV_BASE_PMU must be always selected when selecting
CONFIG_PERF_EVENTS on RISC-V perf implementation. Maybe let me send a
patch to fix it.


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

* Re: [linux-next:master 7592/7905] arch/riscv/mm/ptdump.c:57:3: error: 'FIXADDR_START' undeclared here (not in a function); did you mean 'XAS_RESTART'?
  2020-05-14  3:47   ` Zong Li
@ 2020-05-14  8:37     ` Kefeng Wang
  2020-05-14  9:19       ` Zong Li
  0 siblings, 1 reply; 5+ messages in thread
From: Kefeng Wang @ 2020-05-14  8:37 UTC (permalink / raw)
  To: Zong Li, Andrew Morton
  Cc: kbuild test robot, kbuild-all, Linux Memory Management List


On 2020/5/14 11:47, Zong Li wrote:
> On Thu, May 14, 2020 at 9:07 AM Andrew Morton <akpm@linux-foundation.org> wrote:
>> On Sat, 9 May 2020 18:46:50 +0800 kbuild test robot <lkp@intel.com> wrote:
>>
>>> Hi Zong,
>>>
>>> First bad commit (maybe != root cause):
>>>
>>> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
>>> head:   30e2206e11ce27ae910cc0dab21472429e400a87
>>> commit: c0eba2d72e70b4208ca6fd82820ba7428090e350 [7592/7905] riscv: support DEBUG_WX
>>> config: riscv-randconfig-r003-20200509 (attached as .config)
>>> compiler: riscv64-linux-gcc (GCC) 9.3.0
>>> reproduce:
>>>          wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
>>>          chmod +x ~/bin/make.cross
>>>          git checkout c0eba2d72e70b4208ca6fd82820ba7428090e350
>>>          # save the attached .config to linux build tree
>>>          COMPILER_INSTALL_PATH=$HOME/0day GCC_VERSION=9.3.0 make.cross ARCH=riscv
>>>
>>> If you fix the issue, kindly add following tag as appropriate
>>> Reported-by: kbuild test robot <lkp@intel.com>
>>>
>>> All error/warnings (new ones prefixed by >>):
>>>
>>>>> arch/riscv/mm/ptdump.c:57:3: error: 'FIXADDR_START' undeclared here (not in a function); did you mean 'XAS_RESTART'?
>>>        57 |  {FIXADDR_START,  "Fixmap start"},
>>>           |   ^~~~~~~~~~~~~
>>>           |   XAS_RESTART
>> argh, I can't figure out how to make riscv compile :(
>>
>> Are you using the riscv32 toolchain or riscv64?
>>
>> And arch/riscv/include/asm/perf_event.h does
>>
>> #ifdef CONFIG_RISCV_BASE_PMU
>> #define RISCV_MAX_COUNTERS      2
>> #endif
>>
>> #ifndef RISCV_MAX_COUNTERS
>> #error "Please provide a valid RISCV_MAX_COUNTERS for the PMU."
>> #endif
>>
>> where is RISCV_MAX_COUNTERS supposed to come from?  Surely this should
>> be implemented in Kconfig somehow?
>>
>> Sigh.  Zong, did you take a look at this?
> Yes, I had taken a look at that, the problem is that the .config
> selects CONFIG_PERF_EVENTS, but doesn't select CONFIG_RISCV_BASE_PMU
> together. It seems to me that it is a bug of perf porting on RISC-V,
> CONFIG_RISCV_BASE_PMU could be selected or unselected, but in fact,
> CONFIG_RISCV_BASE_PMU must be always selected when selecting
> CONFIG_PERF_EVENTS on RISC-V perf implementation. Maybe let me send a
> patch to fix it.

Hi Andrew and Zong, I have sent some fix patches, and Palmer accept

them.

https://lore.kernel.org/linux-riscv/mhng-d7e9b8e8-2c97-490b-9eac-fd88c7a5a34d@palmerdabbelt-glaptop1/T/#t

>
>
>



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

* Re: [linux-next:master 7592/7905] arch/riscv/mm/ptdump.c:57:3: error: 'FIXADDR_START' undeclared here (not in a function); did you mean 'XAS_RESTART'?
  2020-05-14  8:37     ` Kefeng Wang
@ 2020-05-14  9:19       ` Zong Li
  0 siblings, 0 replies; 5+ messages in thread
From: Zong Li @ 2020-05-14  9:19 UTC (permalink / raw)
  To: Kefeng Wang
  Cc: Andrew Morton, kbuild test robot, kbuild-all,
	Linux Memory Management List

On Thu, May 14, 2020 at 4:37 PM Kefeng Wang <wangkefeng.wang@huawei.com> wrote:
>
>
> On 2020/5/14 11:47, Zong Li wrote:
> > On Thu, May 14, 2020 at 9:07 AM Andrew Morton <akpm@linux-foundation.org> wrote:
> >> On Sat, 9 May 2020 18:46:50 +0800 kbuild test robot <lkp@intel.com> wrote:
> >>
> >>> Hi Zong,
> >>>
> >>> First bad commit (maybe != root cause):
> >>>
> >>> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
> >>> head:   30e2206e11ce27ae910cc0dab21472429e400a87
> >>> commit: c0eba2d72e70b4208ca6fd82820ba7428090e350 [7592/7905] riscv: support DEBUG_WX
> >>> config: riscv-randconfig-r003-20200509 (attached as .config)
> >>> compiler: riscv64-linux-gcc (GCC) 9.3.0
> >>> reproduce:
> >>>          wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> >>>          chmod +x ~/bin/make.cross
> >>>          git checkout c0eba2d72e70b4208ca6fd82820ba7428090e350
> >>>          # save the attached .config to linux build tree
> >>>          COMPILER_INSTALL_PATH=$HOME/0day GCC_VERSION=9.3.0 make.cross ARCH=riscv
> >>>
> >>> If you fix the issue, kindly add following tag as appropriate
> >>> Reported-by: kbuild test robot <lkp@intel.com>
> >>>
> >>> All error/warnings (new ones prefixed by >>):
> >>>
> >>>>> arch/riscv/mm/ptdump.c:57:3: error: 'FIXADDR_START' undeclared here (not in a function); did you mean 'XAS_RESTART'?
> >>>        57 |  {FIXADDR_START,  "Fixmap start"},
> >>>           |   ^~~~~~~~~~~~~
> >>>           |   XAS_RESTART
> >> argh, I can't figure out how to make riscv compile :(
> >>
> >> Are you using the riscv32 toolchain or riscv64?
> >>
> >> And arch/riscv/include/asm/perf_event.h does
> >>
> >> #ifdef CONFIG_RISCV_BASE_PMU
> >> #define RISCV_MAX_COUNTERS      2
> >> #endif
> >>
> >> #ifndef RISCV_MAX_COUNTERS
> >> #error "Please provide a valid RISCV_MAX_COUNTERS for the PMU."
> >> #endif
> >>
> >> where is RISCV_MAX_COUNTERS supposed to come from?  Surely this should
> >> be implemented in Kconfig somehow?
> >>
> >> Sigh.  Zong, did you take a look at this?
> > Yes, I had taken a look at that, the problem is that the .config
> > selects CONFIG_PERF_EVENTS, but doesn't select CONFIG_RISCV_BASE_PMU
> > together. It seems to me that it is a bug of perf porting on RISC-V,
> > CONFIG_RISCV_BASE_PMU could be selected or unselected, but in fact,
> > CONFIG_RISCV_BASE_PMU must be always selected when selecting
> > CONFIG_PERF_EVENTS on RISC-V perf implementation. Maybe let me send a
> > patch to fix it.
>
> Hi Andrew and Zong, I have sent some fix patches, and Palmer accept
>
> them.
>
> https://lore.kernel.org/linux-riscv/mhng-d7e9b8e8-2c97-490b-9eac-fd88c7a5a34d@palmerdabbelt-glaptop1/T/#t
>

Hi Kefeng,

I saw that, thanks. Regarding RISCV_BASE_PMU, I didn't notice that you
had a patch to fix it already, so I also posted a patch to fix the
dependency of RISCV_BASE_PMU. Let's switch to discuss it on that
thread.

> >
> >
> >
>


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

end of thread, other threads:[~2020-05-14  9:20 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-09 10:46 [linux-next:master 7592/7905] arch/riscv/mm/ptdump.c:57:3: error: 'FIXADDR_START' undeclared here (not in a function); did you mean 'XAS_RESTART'? kbuild test robot
2020-05-14  1:07 ` Andrew Morton
2020-05-14  3:47   ` Zong Li
2020-05-14  8:37     ` Kefeng Wang
2020-05-14  9:19       ` Zong Li

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