linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "Edgecombe, Rick P" <rick.p.edgecombe@intel.com>
To: "Liam.Howlett@Oracle.com" <Liam.Howlett@Oracle.com>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>
Cc: "x86@kernel.org" <x86@kernel.org>
Subject: Maple tree MAP_32BIT issue
Date: Sat, 29 Apr 2023 01:48:01 +0000	[thread overview]
Message-ID: <32f156ba80010fd97dbaf0a0cdfc84366608624d.camel@intel.com> (raw)

Hi,

Some of the x86 selftests (ex: sysret_ss_attrs.c) that use MAP_32BIT
break after commit 58c5d0d6d522 (in v6.3). The MAP_32BIT mmap() acts as
if there is no suitable gap when there should be one.

Debugging a little:
MAP_32BIT starts with a bottom up search with a relatively low
high_limit. In unmapped_area(), mas_empty_area() finds a gap within the
limits, then looks for the next VMA with mas_next() to check
vm_start_gap(). In the debugged case, this is outside the limit (up in
the 64 bit address space), but all seems normal so far. Then it calls
mas_prev() trying to check vm_end_gap() on the VMA below the gap found.

This is where it starts to not make sense to me. The VMA returned by
mas_prev() is also above the high_limit. It's as if the earlier
mas_next() skipped over the actual next VMA from the gap, to the second
next one.

In the case debugged, the mas_prev() VMA is also way above the 32 bit
address space. So it finds (vm_end_gap(tmp) > gap) to be true and sets
low_limit to vm_end_gap(tmp) and retries. But then low_limit (up in the
64 bit address space) is above high_limit (in the 32 bit address
space), and unmapped_area() fails with -ENOMEM.

I looked at fixing it, but I'm not sure of the expected behavior of
mas_prev/mas_next(). So instead I'm just reporting it for now, until I
can look at it with a fresh head.

Not every system failed with the same tests. For example,
fsgsbase_restorer.c failed on some systems but not others. So
presumably some other factors are at work. Please let me know if I can
help with any extra testing or debugging.

Rick

                 reply	other threads:[~2023-04-29  1:48 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=32f156ba80010fd97dbaf0a0cdfc84366608624d.camel@intel.com \
    --to=rick.p.edgecombe@intel.com \
    --cc=Liam.Howlett@Oracle.com \
    --cc=linux-mm@kvack.org \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).