Re: WARNING: at mm/mremap.c:211 move_page_tables in i386

Linus Torvalds
2020-07-09T19:12:41Z

[-- Attachment #1: Type: text/plain, Size: 447 bytes --]

On Wed, Jul 8, 2020 at 10:28 PM Naresh Kamboju
<naresh.kamboju@linaro.org> wrote:
>
> While running LTP mm test suite on i386 or qemu_i386 this kernel warning
> has been noticed from stable 5.4 to stable 5.7 branches and mainline 5.8.0-rc4
> and linux next.

Hmm

If this is repeatable, would you mind making the warning also print
out the old range and new addresses and pmd value?

Something like the attached (UNTESTED!) patch.

Linus

[-- Attachment #2: patch --]
[-- Type: application/octet-stream, Size: 651 bytes --]

mm/mremap.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/mm/mremap.c b/mm/mremap.c
index 5dd572d57ca9..b3f073cf2806 100644
--- a/mm/mremap.c
+++ b/mm/mremap.c
@@ -208,8 +208,10 @@ static bool move_normal_pmd(struct vm_area_struct *vma, unsigned long old_addr,
* The destination pmd shouldn't be established, free_pgtables()
* should have release it.
*/
- if (WARN_ON(!pmd_none(*new_pmd)))
+ if (WARN_ON(!pmd_none(*new_pmd))) {
+ printk(" old: %lx-%lx new: %lx (val: %lx)\n", old_addr, old_end, new_addr, pmd_val(*new_pmd));
return false;
+ }

/*
* We don't have to worry about the ordering of src and dst