Skip to content

Commit 44d9304

Browse files
hcahcaVasily Gorbik
authored andcommitted
s390/cmma: fix detection of DAT pages
If the cmma no-dat feature is available the kernel page tables are walked to identify and mark all pages which are used for address translation (all region, segment, and page tables). In a subsequent loop all other pages are marked as "no-dat" pages with the ESSA instruction. This information is visible to the hypervisor, so that the hypervisor can optimize purging of guest TLB entries. The initial loop however is incorrect: only the first three of the four pages which belong to segment and region tables will be marked as being used for DAT. The last page is incorrectly marked as no-dat. This can result in incorrect guest TLB flushes. Fix this by simply marking all four pages. Cc: <[email protected]> Reviewed-by: Claudio Imbrenda <[email protected]> Signed-off-by: Heiko Carstens <[email protected]> Signed-off-by: Vasily Gorbik <[email protected]>
1 parent e3f4170 commit 44d9304

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

arch/s390/mm/page-states.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ static void mark_kernel_pud(p4d_t *p4d, unsigned long addr, unsigned long end)
121121
continue;
122122
if (!pud_folded(*pud)) {
123123
page = phys_to_page(pud_val(*pud));
124-
for (i = 0; i < 3; i++)
124+
for (i = 0; i < 4; i++)
125125
set_bit(PG_arch_1, &page[i].flags);
126126
}
127127
mark_kernel_pmd(pud, addr, next);
@@ -142,7 +142,7 @@ static void mark_kernel_p4d(pgd_t *pgd, unsigned long addr, unsigned long end)
142142
continue;
143143
if (!p4d_folded(*p4d)) {
144144
page = phys_to_page(p4d_val(*p4d));
145-
for (i = 0; i < 3; i++)
145+
for (i = 0; i < 4; i++)
146146
set_bit(PG_arch_1, &page[i].flags);
147147
}
148148
mark_kernel_pud(p4d, addr, next);
@@ -171,7 +171,7 @@ static void mark_kernel_pgd(void)
171171
continue;
172172
if (!pgd_folded(*pgd)) {
173173
page = phys_to_page(pgd_val(*pgd));
174-
for (i = 0; i < 3; i++)
174+
for (i = 0; i < 4; i++)
175175
set_bit(PG_arch_1, &page[i].flags);
176176
}
177177
mark_kernel_p4d(pgd, addr, next);

0 commit comments

Comments
 (0)