Skip to content

Commit fb6d5c1

Browse files
zhangqingmychenhuacai
authored andcommitted
kasan: Add (pmd|pud)_init for LoongArch zero_(pud|p4d)_populate process
LoongArch populates pmd/pud with invalid_pmd_table/invalid_pud_table in pagetable_init, So pmd_init/pud_init(p) is required, define them as __weak in mm/kasan/init.c, like mm/sparse-vmemmap.c. Reviewed-by: Andrey Konovalov <andreyknvl@gmail.com> Signed-off-by: Qing Zhang <zhangqing@loongson.cn> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
1 parent 9b04c76 commit fb6d5c1

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

mm/kasan/init.c

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,10 @@ static int __ref zero_pmd_populate(pud_t *pud, unsigned long addr,
139139
return 0;
140140
}
141141

142+
void __weak __meminit pmd_init(void *addr)
143+
{
144+
}
145+
142146
static int __ref zero_pud_populate(p4d_t *p4d, unsigned long addr,
143147
unsigned long end)
144148
{
@@ -166,8 +170,9 @@ static int __ref zero_pud_populate(p4d_t *p4d, unsigned long addr,
166170
if (!p)
167171
return -ENOMEM;
168172
} else {
169-
pud_populate(&init_mm, pud,
170-
early_alloc(PAGE_SIZE, NUMA_NO_NODE));
173+
p = early_alloc(PAGE_SIZE, NUMA_NO_NODE);
174+
pmd_init(p);
175+
pud_populate(&init_mm, pud, p);
171176
}
172177
}
173178
zero_pmd_populate(pud, addr, next);
@@ -176,6 +181,10 @@ static int __ref zero_pud_populate(p4d_t *p4d, unsigned long addr,
176181
return 0;
177182
}
178183

184+
void __weak __meminit pud_init(void *addr)
185+
{
186+
}
187+
179188
static int __ref zero_p4d_populate(pgd_t *pgd, unsigned long addr,
180189
unsigned long end)
181190
{
@@ -207,8 +216,9 @@ static int __ref zero_p4d_populate(pgd_t *pgd, unsigned long addr,
207216
if (!p)
208217
return -ENOMEM;
209218
} else {
210-
p4d_populate(&init_mm, p4d,
211-
early_alloc(PAGE_SIZE, NUMA_NO_NODE));
219+
p = early_alloc(PAGE_SIZE, NUMA_NO_NODE);
220+
pud_init(p);
221+
p4d_populate(&init_mm, p4d, p);
212222
}
213223
}
214224
zero_pud_populate(p4d, addr, next);

0 commit comments

Comments
 (0)