Re: [PATCH V12] mm/debug: Add tests validating architecture page table helpers

From: Gerald Schaefer
Date: Wed Jan 29 2020 - 17:21:03 EST


On Mon, 27 Jan 2020 22:33:08 -0500
Qian Cai <cai@xxxxxx> wrote:

> >
> >> Did those tests ever find any regression or this is almost only useful for new
> >
> > The test has already found problems with s390 page table helpers.
>
> Hmm, that is pretty weak where s390 is not even official supported with this version.
>

I first had to get the three patches upstream, each fixing non-conform
behavior on s390, and each issue was found by this extremely useful test:

2416cefc504b s390/mm: add mm_pxd_folded() checks to pxd_free()
2d1fc1eb9b54 s390/mm: simplify page table helpers for large entries
1c27a4bc817b s390/mm: make pmd/pud_bad() report large entries as bad

I did not see any direct effect of this misbehavior yet, but I am
very happy that this could be found and fixed in order to prevent
future issues. And this is exactly the value of this test, to make
sure that all architectures have a common understanding of how
the various page table helpers are supposed to work.

For example, who would have thought that pXd_bad() is supposed to
report large entries as bad? It's not really documented anywhere,
so we just checked them for sanity like normal entries, which
apparently worked fine so far, but for how long?