* [davidhildenbrand:folded_pgtable 17/28] arch/nios2/mm/fault.c:231:39: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'p4d_k'
@ 2026-07-08 2:37 kernel test robot
0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2026-07-08 2:37 UTC (permalink / raw)
To: Yeoreum Yun; +Cc: oe-kbuild-all, David Hildenbrand (Arm)
tree: https://github.com/davidhildenbrand/linux folded_pgtable
head: 710c0f29eb829f67c4c0d1c2a3f764b286282229
commit: bdd0e7f6c7062ca47a16ca208ab1de07161ec049 [17/28] nios2: mm: use proper set_pXd() for folded patable in vmalloc_fault path
config: nios2-allnoconfig (https://download.01.org/0day-ci/archive/20260708/202607081001.D20Pg1h9-lkp@intel.com/config)
compiler: nios2-linux-gcc (GCC) 11.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260708/202607081001.D20Pg1h9-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202607081001.D20Pg1h9-lkp@intel.com/
All errors (new ones prefixed by >>):
arch/nios2/mm/fault.c: In function 'do_page_fault':
>> arch/nios2/mm/fault.c:231:39: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'p4d_k'
231 | p4d_t *p4dp, *p4dp_k p4d_k;
| ^~~~~
>> arch/nios2/mm/fault.c:245:17: error: 'p4dp_k' undeclared (first use in this function); did you mean 'pmdp_k'?
245 | p4dp_k = p4d_offset(pgdp_k, address);
| ^~~~~~
| pmdp_k
arch/nios2/mm/fault.c:245:17: note: each undeclared identifier is reported only once for each function it appears in
>> arch/nios2/mm/fault.c:246:17: error: 'p4d_k' undeclared (first use in this function); did you mean 'pmd_k'?
246 | p4d_k = p4dp_get(p4dp_k);
| ^~~~~
| pmd_k
>> arch/nios2/mm/fault.c:252:17: error: 'pud' undeclared (first use in this function); did you mean 'pudp'?
252 | pud = pud_offset(p4dp, address);
| ^~~
| pudp
In file included from arch/nios2/include/asm/pgtable.h:25,
from include/linux/pgtable.h:6,
from include/linux/mm.h:31,
from include/linux/pid_namespace.h:7,
from include/linux/ptrace.h:10,
from arch/nios2/mm/fault.c:22:
arch/nios2/mm/fault.c:258:39: error: incompatible types when initializing type 'long unsigned int' using type 'pud_t'
258 | set_p4d(pudp, pud_k);
| ^~~~~
include/asm-generic/pgtable-nopmd.h:45:86: note: in definition of macro 'set_pud'
45 | #define set_pud(pudptr, pudval) set_pmd((pmd_t *)(pudptr), (pmd_t) { pudval })
| ^~~~~~
arch/nios2/mm/fault.c:258:25: note: in expansion of macro 'set_p4d'
258 | set_p4d(pudp, pud_k);
| ^~~~~~~
arch/nios2/mm/fault.c:261:37: error: incompatible type for argument 1 of 'pmd_offset'
261 | pmdp_k = pmd_offset(pud_k, address);
| ^~~~~
| |
| pud_t
In file included from arch/nios2/include/asm/pgtable.h:25,
from include/linux/pgtable.h:6,
from include/linux/mm.h:31,
from include/linux/pid_namespace.h:7,
from include/linux/ptrace.h:10,
from arch/nios2/mm/fault.c:22:
include/asm-generic/pgtable-nopmd.h:47:42: note: expected 'pud_t *' but argument is of type 'pud_t'
47 | static inline pmd_t * pmd_offset(pud_t * pud, unsigned long address)
| ~~~~~~~~^~~
vim +231 arch/nios2/mm/fault.c
37
38 /*
39 * This routine handles page faults. It determines the address,
40 * and the problem, and then passes it off to one of the appropriate
41 * routines.
42 */
43 asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long cause,
44 unsigned long address)
45 {
46 struct vm_area_struct *vma = NULL;
47 struct task_struct *tsk = current;
48 struct mm_struct *mm = tsk->mm;
49 int code = SEGV_MAPERR;
50 vm_fault_t fault;
51 unsigned int flags = FAULT_FLAG_DEFAULT;
52
53 cause >>= 2;
54
55 /* Restart the instruction */
56 regs->ea -= 4;
57
58 /*
59 * We fault-in kernel-space virtual memory on-demand. The
60 * 'reference' page table is init_mm.pgd.
61 *
62 * NOTE! We MUST NOT take any locks for this case. We may
63 * be in an interrupt or a critical region, and should
64 * only copy the information from the master page table,
65 * nothing more.
66 */
67 if (unlikely(address >= VMALLOC_START && address <= VMALLOC_END)) {
68 if (user_mode(regs))
69 goto bad_area_nosemaphore;
70 else
71 goto vmalloc_fault;
72 }
73
74 if (unlikely(address >= TASK_SIZE))
75 goto bad_area_nosemaphore;
76
77 /*
78 * If we're in an interrupt or have no user
79 * context, we must not take the fault..
80 */
81 if (faulthandler_disabled() || !mm)
82 goto bad_area_nosemaphore;
83
84 if (user_mode(regs))
85 flags |= FAULT_FLAG_USER;
86
87 perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, regs, address);
88
89 retry:
90 vma = lock_mm_and_find_vma(mm, address, regs);
91 if (!vma)
92 goto bad_area_nosemaphore;
93 /*
94 * Ok, we have a good vm_area for this memory access, so
95 * we can handle it..
96 */
97 code = SEGV_ACCERR;
98
99 switch (cause) {
100 case EXC_SUPERV_INSN_ACCESS:
101 goto bad_area;
102 case EXC_SUPERV_DATA_ACCESS:
103 goto bad_area;
104 case EXC_X_PROTECTION_FAULT:
105 if (!(vma->vm_flags & VM_EXEC))
106 goto bad_area;
107 break;
108 case EXC_R_PROTECTION_FAULT:
109 if (!(vma->vm_flags & VM_READ))
110 goto bad_area;
111 break;
112 case EXC_W_PROTECTION_FAULT:
113 if (!(vma->vm_flags & VM_WRITE))
114 goto bad_area;
115 flags = FAULT_FLAG_WRITE;
116 break;
117 }
118
119 /*
120 * If for any reason at all we couldn't handle the fault,
121 * make sure we exit gracefully rather than endlessly redo
122 * the fault.
123 */
124 fault = handle_mm_fault(vma, address, flags, regs);
125
126 if (fault_signal_pending(fault, regs)) {
127 if (!user_mode(regs))
128 goto no_context;
129 return;
130 }
131
132 /* The fault is fully completed (including releasing mmap lock) */
133 if (fault & VM_FAULT_COMPLETED)
134 return;
135
136 if (unlikely(fault & VM_FAULT_ERROR)) {
137 if (fault & VM_FAULT_OOM)
138 goto out_of_memory;
139 else if (fault & VM_FAULT_SIGSEGV)
140 goto bad_area;
141 else if (fault & VM_FAULT_SIGBUS)
142 goto do_sigbus;
143 BUG();
144 }
145
146 if (fault & VM_FAULT_RETRY) {
147 flags |= FAULT_FLAG_TRIED;
148
149 /*
150 * No need to mmap_read_unlock(mm) as we would
151 * have already released it in __lock_page_or_retry
152 * in mm/filemap.c.
153 */
154
155 goto retry;
156 }
157
158 mmap_read_unlock(mm);
159 return;
160
161 /*
162 * Something tried to access memory that isn't in our memory map..
163 * Fix it, but check if it's kernel or user first..
164 */
165 bad_area:
166 mmap_read_unlock(mm);
167
168 bad_area_nosemaphore:
169 /* User mode accesses just cause a SIGSEGV */
170 if (user_mode(regs)) {
171 if (unhandled_signal(current, SIGSEGV) && printk_ratelimit()) {
172 pr_info("%s: unhandled page fault (%d) at 0x%08lx, "
173 "cause %ld\n", current->comm, SIGSEGV, address, cause);
174 show_regs(regs);
175 }
176 _exception(SIGSEGV, regs, code, address);
177 return;
178 }
179
180 no_context:
181 /* Are we prepared to handle this kernel fault? */
182 if (fixup_exception(regs))
183 return;
184
185 /*
186 * Oops. The kernel tried to access some bad page. We'll have to
187 * terminate things with extreme prejudice.
188 */
189 bust_spinlocks(1);
190
191 pr_alert("Unable to handle kernel %s at virtual address %08lx",
192 address < PAGE_SIZE ? "NULL pointer dereference" :
193 "paging request", address);
194 pr_alert("ea = %08lx, ra = %08lx, cause = %ld\n", regs->ea, regs->ra,
195 cause);
196 panic("Oops");
197 return;
198
199 /*
200 * We ran out of memory, or some other thing happened to us that made
201 * us unable to handle the page fault gracefully.
202 */
203 out_of_memory:
204 mmap_read_unlock(mm);
205 if (!user_mode(regs))
206 goto no_context;
207 pagefault_out_of_memory();
208 return;
209
210 do_sigbus:
211 mmap_read_unlock(mm);
212
213 /* Kernel mode? Handle exceptions or die */
214 if (!user_mode(regs))
215 goto no_context;
216
217 _exception(SIGBUS, regs, BUS_ADRERR, address);
218 return;
219
220 vmalloc_fault:
221 {
222 /*
223 * Synchronize this task's top level page-table
224 * with the 'reference' page table.
225 *
226 * Do _not_ use "tsk" here. We might be inside
227 * an interrupt in the middle of a task switch..
228 */
229 int offset = pgd_index(address);
230 pgd_t *pgdp, *pgdp_k, pgd_k;
> 231 p4d_t *p4dp, *p4dp_k p4d_k;
232 pud_t *pudp, *pudp_k, pud_k;
233 pmd_t *pmdp, *pmdp_k, pmd_k;
234 pte_t *ptep_k;
235
236 pgdp = pgd_current + offset;
237 pgdp_k = init_mm.pgd + offset;
238 pgd_k = pgdp_get(pgdp_k);
239 if (!pgd_present(pgd_k))
240 goto no_context;
241 if (!pgd_present(pgdp_get(pgdp)))
242 set_pgd(pgdp, pgd_k);
243
244 p4dp = p4d_offset(pgdp, address);
> 245 p4dp_k = p4d_offset(pgdp_k, address);
> 246 p4d_k = p4dp_get(p4dp_k);
247 if (!p4d_present(p4d_k))
248 goto no_context;
249 if (!p4d_present(p4dp_get(p4dp)))
250 set_p4d(p4dp, p4d_k);
251
> 252 pud = pud_offset(p4dp, address);
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-07-08 2:38 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-08 2:37 [davidhildenbrand:folded_pgtable 17/28] arch/nios2/mm/fault.c:231:39: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'p4d_k' kernel test robot
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.