[tip:WIP.sched/core 144/144] arch/nios2/kernel/process.c:161:21: error: dereferencing pointer to incomplete type 'struct mm_struct'

From: kbuild test robot
Date: Fri Feb 03 2017 - 20:29:31 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git WIP.sched/core
head: f83f0b0647162b099f62e62c203b1cfb90b40239
commit: f83f0b0647162b099f62e62c203b1cfb90b40239 [144/144] sched/headers: Remove the <linux/mm_types.h> dependency from <linux/sched.h>
config: nios2-10m50_defconfig (attached as .config)
compiler: nios2-linux-gcc (GCC) 6.2.0
reproduce:
wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
git checkout f83f0b0647162b099f62e62c203b1cfb90b40239
# save the attached .config to linux build tree
make.cross ARCH=nios2

All errors (new ones prefixed by >>):

In file included from include/linux/kernel.h:13:0,
from include/linux/plist.h:78,
from include/linux/sched.h:8,
from arch/nios2/kernel/process.c:16:
arch/nios2/kernel/process.c: In function 'dump':
>> arch/nios2/kernel/process.c:161:21: error: dereferencing pointer to incomplete type 'struct mm_struct'
(int) current->mm->start_code,
^
include/linux/printk.h:286:35: note: in definition of macro 'pr_emerg'
printk(KERN_EMERG pr_fmt(fmt), ##__VA_ARGS__)
^~~~~~~~~~~

vim +161 arch/nios2/kernel/process.c

71995e4d0 Ley Foon Tan 2014-11-06 10 * This file is subject to the terms and conditions of the GNU General Public
71995e4d0 Ley Foon Tan 2014-11-06 11 * License. See the file "COPYING" in the main directory of this archive
71995e4d0 Ley Foon Tan 2014-11-06 12 * for more details.
71995e4d0 Ley Foon Tan 2014-11-06 13 */
71995e4d0 Ley Foon Tan 2014-11-06 14
71995e4d0 Ley Foon Tan 2014-11-06 15 #include <linux/export.h>
71995e4d0 Ley Foon Tan 2014-11-06 @16 #include <linux/sched.h>
2f830424e Ingo Molnar 2017-02-03 17 #include <linux/sched/debug.h>
7a3c4c423 Ingo Molnar 2017-02-03 18 #include <linux/sched/fork.h>
3ab291518 Ingo Molnar 2017-02-03 19 #include <linux/sched/task_stack.h>
71995e4d0 Ley Foon Tan 2014-11-06 20 #include <linux/tick.h>
71995e4d0 Ley Foon Tan 2014-11-06 21 #include <linux/uaccess.h>
71995e4d0 Ley Foon Tan 2014-11-06 22
71995e4d0 Ley Foon Tan 2014-11-06 23 #include <asm/unistd.h>
71995e4d0 Ley Foon Tan 2014-11-06 24 #include <asm/traps.h>
71995e4d0 Ley Foon Tan 2014-11-06 25 #include <asm/cpuinfo.h>
71995e4d0 Ley Foon Tan 2014-11-06 26
71995e4d0 Ley Foon Tan 2014-11-06 27 asmlinkage void ret_from_fork(void);
71995e4d0 Ley Foon Tan 2014-11-06 28 asmlinkage void ret_from_kernel_thread(void);
71995e4d0 Ley Foon Tan 2014-11-06 29
71995e4d0 Ley Foon Tan 2014-11-06 30 void (*pm_power_off)(void) = NULL;
71995e4d0 Ley Foon Tan 2014-11-06 31 EXPORT_SYMBOL(pm_power_off);
71995e4d0 Ley Foon Tan 2014-11-06 32
71995e4d0 Ley Foon Tan 2014-11-06 33 void arch_cpu_idle(void)
71995e4d0 Ley Foon Tan 2014-11-06 34 {
71995e4d0 Ley Foon Tan 2014-11-06 35 local_irq_enable();
71995e4d0 Ley Foon Tan 2014-11-06 36 }
71995e4d0 Ley Foon Tan 2014-11-06 37
71995e4d0 Ley Foon Tan 2014-11-06 38 /*
71995e4d0 Ley Foon Tan 2014-11-06 39 * The development boards have no way to pull a board reset. Just jump to the
71995e4d0 Ley Foon Tan 2014-11-06 40 * cpu reset address and let the boot loader or the code in head.S take care of
71995e4d0 Ley Foon Tan 2014-11-06 41 * resetting peripherals.
71995e4d0 Ley Foon Tan 2014-11-06 42 */
71995e4d0 Ley Foon Tan 2014-11-06 43 void machine_restart(char *__unused)
71995e4d0 Ley Foon Tan 2014-11-06 44 {
71995e4d0 Ley Foon Tan 2014-11-06 45 pr_notice("Machine restart (%08x)...\n", cpuinfo.reset_addr);
71995e4d0 Ley Foon Tan 2014-11-06 46 local_irq_disable();
71995e4d0 Ley Foon Tan 2014-11-06 47 __asm__ __volatile__ (
71995e4d0 Ley Foon Tan 2014-11-06 48 "jmp %0\n\t"
71995e4d0 Ley Foon Tan 2014-11-06 49 :
71995e4d0 Ley Foon Tan 2014-11-06 50 : "r" (cpuinfo.reset_addr)
71995e4d0 Ley Foon Tan 2014-11-06 51 : "r4");
71995e4d0 Ley Foon Tan 2014-11-06 52 }
71995e4d0 Ley Foon Tan 2014-11-06 53
71995e4d0 Ley Foon Tan 2014-11-06 54 void machine_halt(void)
71995e4d0 Ley Foon Tan 2014-11-06 55 {
71995e4d0 Ley Foon Tan 2014-11-06 56 pr_notice("Machine halt...\n");
71995e4d0 Ley Foon Tan 2014-11-06 57 local_irq_disable();
71995e4d0 Ley Foon Tan 2014-11-06 58 for (;;)
71995e4d0 Ley Foon Tan 2014-11-06 59 ;
71995e4d0 Ley Foon Tan 2014-11-06 60 }
71995e4d0 Ley Foon Tan 2014-11-06 61
71995e4d0 Ley Foon Tan 2014-11-06 62 /*
71995e4d0 Ley Foon Tan 2014-11-06 63 * There is no way to power off the development boards. So just spin for now. If
71995e4d0 Ley Foon Tan 2014-11-06 64 * we ever have a way of resetting a board using a GPIO we should add that here.
71995e4d0 Ley Foon Tan 2014-11-06 65 */
71995e4d0 Ley Foon Tan 2014-11-06 66 void machine_power_off(void)
71995e4d0 Ley Foon Tan 2014-11-06 67 {
71995e4d0 Ley Foon Tan 2014-11-06 68 pr_notice("Machine power off...\n");
71995e4d0 Ley Foon Tan 2014-11-06 69 local_irq_disable();
71995e4d0 Ley Foon Tan 2014-11-06 70 for (;;)
71995e4d0 Ley Foon Tan 2014-11-06 71 ;
71995e4d0 Ley Foon Tan 2014-11-06 72 }
71995e4d0 Ley Foon Tan 2014-11-06 73
71995e4d0 Ley Foon Tan 2014-11-06 74 void show_regs(struct pt_regs *regs)
71995e4d0 Ley Foon Tan 2014-11-06 75 {
71995e4d0 Ley Foon Tan 2014-11-06 76 pr_notice("\n");
71995e4d0 Ley Foon Tan 2014-11-06 77 show_regs_print_info(KERN_DEFAULT);
71995e4d0 Ley Foon Tan 2014-11-06 78
71995e4d0 Ley Foon Tan 2014-11-06 79 pr_notice("r1: %08lx r2: %08lx r3: %08lx r4: %08lx\n",
71995e4d0 Ley Foon Tan 2014-11-06 80 regs->r1, regs->r2, regs->r3, regs->r4);
71995e4d0 Ley Foon Tan 2014-11-06 81
71995e4d0 Ley Foon Tan 2014-11-06 82 pr_notice("r5: %08lx r6: %08lx r7: %08lx r8: %08lx\n",
71995e4d0 Ley Foon Tan 2014-11-06 83 regs->r5, regs->r6, regs->r7, regs->r8);
71995e4d0 Ley Foon Tan 2014-11-06 84
71995e4d0 Ley Foon Tan 2014-11-06 85 pr_notice("r9: %08lx r10: %08lx r11: %08lx r12: %08lx\n",
71995e4d0 Ley Foon Tan 2014-11-06 86 regs->r9, regs->r10, regs->r11, regs->r12);
71995e4d0 Ley Foon Tan 2014-11-06 87
71995e4d0 Ley Foon Tan 2014-11-06 88 pr_notice("r13: %08lx r14: %08lx r15: %08lx\n",
71995e4d0 Ley Foon Tan 2014-11-06 89 regs->r13, regs->r14, regs->r15);
71995e4d0 Ley Foon Tan 2014-11-06 90
71995e4d0 Ley Foon Tan 2014-11-06 91 pr_notice("ra: %08lx fp: %08lx sp: %08lx gp: %08lx\n",
71995e4d0 Ley Foon Tan 2014-11-06 92 regs->ra, regs->fp, regs->sp, regs->gp);
71995e4d0 Ley Foon Tan 2014-11-06 93
71995e4d0 Ley Foon Tan 2014-11-06 94 pr_notice("ea: %08lx estatus: %08lx\n",
71995e4d0 Ley Foon Tan 2014-11-06 95 regs->ea, regs->estatus);
71995e4d0 Ley Foon Tan 2014-11-06 96 }
71995e4d0 Ley Foon Tan 2014-11-06 97
71995e4d0 Ley Foon Tan 2014-11-06 98 void flush_thread(void)
71995e4d0 Ley Foon Tan 2014-11-06 99 {
71995e4d0 Ley Foon Tan 2014-11-06 100 }
71995e4d0 Ley Foon Tan 2014-11-06 101
71995e4d0 Ley Foon Tan 2014-11-06 102 int copy_thread(unsigned long clone_flags,
71995e4d0 Ley Foon Tan 2014-11-06 103 unsigned long usp, unsigned long arg, struct task_struct *p)
71995e4d0 Ley Foon Tan 2014-11-06 104 {
71995e4d0 Ley Foon Tan 2014-11-06 105 struct pt_regs *childregs = task_pt_regs(p);
71995e4d0 Ley Foon Tan 2014-11-06 106 struct pt_regs *regs;
71995e4d0 Ley Foon Tan 2014-11-06 107 struct switch_stack *stack;
71995e4d0 Ley Foon Tan 2014-11-06 108 struct switch_stack *childstack =
71995e4d0 Ley Foon Tan 2014-11-06 109 ((struct switch_stack *)childregs) - 1;
71995e4d0 Ley Foon Tan 2014-11-06 110
71995e4d0 Ley Foon Tan 2014-11-06 111 if (unlikely(p->flags & PF_KTHREAD)) {
71995e4d0 Ley Foon Tan 2014-11-06 112 memset(childstack, 0,
71995e4d0 Ley Foon Tan 2014-11-06 113 sizeof(struct switch_stack) + sizeof(struct pt_regs));
71995e4d0 Ley Foon Tan 2014-11-06 114
71995e4d0 Ley Foon Tan 2014-11-06 115 childstack->r16 = usp; /* fn */
71995e4d0 Ley Foon Tan 2014-11-06 116 childstack->r17 = arg;
71995e4d0 Ley Foon Tan 2014-11-06 117 childstack->ra = (unsigned long) ret_from_kernel_thread;
71995e4d0 Ley Foon Tan 2014-11-06 118 childregs->estatus = STATUS_PIE;
71995e4d0 Ley Foon Tan 2014-11-06 119 childregs->sp = (unsigned long) childstack;
71995e4d0 Ley Foon Tan 2014-11-06 120
71995e4d0 Ley Foon Tan 2014-11-06 121 p->thread.ksp = (unsigned long) childstack;
71995e4d0 Ley Foon Tan 2014-11-06 122 p->thread.kregs = childregs;
71995e4d0 Ley Foon Tan 2014-11-06 123 return 0;
71995e4d0 Ley Foon Tan 2014-11-06 124 }
71995e4d0 Ley Foon Tan 2014-11-06 125
71995e4d0 Ley Foon Tan 2014-11-06 126 regs = current_pt_regs();
71995e4d0 Ley Foon Tan 2014-11-06 127 *childregs = *regs;
71995e4d0 Ley Foon Tan 2014-11-06 128 childregs->r2 = 0; /* Set the return value for the child. */
71995e4d0 Ley Foon Tan 2014-11-06 129 childregs->r7 = 0;
71995e4d0 Ley Foon Tan 2014-11-06 130
71995e4d0 Ley Foon Tan 2014-11-06 131 stack = ((struct switch_stack *) regs) - 1;
71995e4d0 Ley Foon Tan 2014-11-06 132 *childstack = *stack;
71995e4d0 Ley Foon Tan 2014-11-06 133 childstack->ra = (unsigned long)ret_from_fork;
71995e4d0 Ley Foon Tan 2014-11-06 134 p->thread.kregs = childregs;
71995e4d0 Ley Foon Tan 2014-11-06 135 p->thread.ksp = (unsigned long) childstack;
71995e4d0 Ley Foon Tan 2014-11-06 136
71995e4d0 Ley Foon Tan 2014-11-06 137 if (usp)
71995e4d0 Ley Foon Tan 2014-11-06 138 childregs->sp = usp;
71995e4d0 Ley Foon Tan 2014-11-06 139
71995e4d0 Ley Foon Tan 2014-11-06 140 /* Initialize tls register. */
71995e4d0 Ley Foon Tan 2014-11-06 141 if (clone_flags & CLONE_SETTLS)
71995e4d0 Ley Foon Tan 2014-11-06 142 childstack->r23 = regs->r8;
71995e4d0 Ley Foon Tan 2014-11-06 143
71995e4d0 Ley Foon Tan 2014-11-06 144 return 0;
71995e4d0 Ley Foon Tan 2014-11-06 145 }
71995e4d0 Ley Foon Tan 2014-11-06 146
71995e4d0 Ley Foon Tan 2014-11-06 147 /*
71995e4d0 Ley Foon Tan 2014-11-06 148 * Generic dumping code. Used for panic and debug.
71995e4d0 Ley Foon Tan 2014-11-06 149 */
71995e4d0 Ley Foon Tan 2014-11-06 150 void dump(struct pt_regs *fp)
71995e4d0 Ley Foon Tan 2014-11-06 151 {
71995e4d0 Ley Foon Tan 2014-11-06 152 unsigned long *sp;
71995e4d0 Ley Foon Tan 2014-11-06 153 unsigned char *tp;
71995e4d0 Ley Foon Tan 2014-11-06 154 int i;
71995e4d0 Ley Foon Tan 2014-11-06 155
71995e4d0 Ley Foon Tan 2014-11-06 156 pr_emerg("\nCURRENT PROCESS:\n\n");
71995e4d0 Ley Foon Tan 2014-11-06 157 pr_emerg("COMM=%s PID=%d\n", current->comm, current->pid);
71995e4d0 Ley Foon Tan 2014-11-06 158
71995e4d0 Ley Foon Tan 2014-11-06 159 if (current->mm) {
71995e4d0 Ley Foon Tan 2014-11-06 160 pr_emerg("TEXT=%08x-%08x DATA=%08x-%08x BSS=%08x-%08x\n",
71995e4d0 Ley Foon Tan 2014-11-06 @161 (int) current->mm->start_code,
71995e4d0 Ley Foon Tan 2014-11-06 162 (int) current->mm->end_code,
71995e4d0 Ley Foon Tan 2014-11-06 163 (int) current->mm->start_data,
71995e4d0 Ley Foon Tan 2014-11-06 164 (int) current->mm->end_data,

:::::: The code at line 161 was first introduced by commit
:::::: 71995e4d004f6afbc86cc4a80c4a281f6c00b07f nios2: Process management

:::::: TO: Ley Foon Tan <lftan@xxxxxxxxxx>
:::::: CC: Ley Foon Tan <lftan@xxxxxxxxxx>

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

Attachment: .config.gz
Description: application/gzip