From: Alexandru Elisei <alexandru.elisei@arm.com>
To: Punit Agrawal <punit1.agrawal@toshiba.co.jp>
Cc: suzuki.poulose@arm.com, maz@kernel.org, james.morse@arm.com,
linux-arm-kernel@lists.infradead.org,
kvmarm@lists.cs.columbia.edu, julien.thierry.kdev@gmail.com
Subject: Re: [PATCH v2] KVM: arm64: Try PMD block mappings if PUD mappings are not supported
Date: Fri, 11 Sep 2020 17:26:11 +0100 [thread overview]
Message-ID: <2850b4d3-4399-c44c-0e5e-b01906c80ec7@arm.com> (raw)
In-Reply-To: <87363oogp2.fsf@kokedama.swc.toshiba.co.jp>
Hi Punit,
Thank you for having a look!
On 9/11/20 9:34 AM, Punit Agrawal wrote:
> Hi Alexandru,
>
> Alexandru Elisei <alexandru.elisei@arm.com> writes:
>
>> When userspace uses hugetlbfs for the VM memory, user_mem_abort() tries to
>> use the same block size to map the faulting IPA in stage 2. If stage 2
>> cannot the same block mapping because the block size doesn't fit in the
>> memslot or the memslot is not properly aligned, user_mem_abort() will fall
>> back to a page mapping, regardless of the block size. We can do better for
>> PUD backed hugetlbfs by checking if a PMD block mapping is supported before
>> deciding to use a page.
> I think this was discussed in the past.
>
> I have a vague recollection of there being a problem if the user and
> stage 2 mappings go out of sync - can't recall the exact details.
I'm not sure what you mean by the two tables going out of sync. I'm looking at
Documentation/vm/unevictable-lru.rst and this is what it says regarding hugetlbfs:
"VMAs mapping hugetlbfs page are already effectively pinned into memory. We
neither need nor want to mlock() these pages. However, to preserve the prior
behavior of mlock() - before the unevictable/mlock changes - mlock_fixup() will
call make_pages_present() in the hugetlbfs VMA range to allocate the huge pages
and populate the ptes."
Please correct me if I'm wrong, but my interpretation is that once a hugetlbfs
page has been mapped in a process' address space, the only way to unmap it is via
munmap. If that's the case, the KVM mmu notifier should take care of unmapping
from stage 2 the entire memory range addressed by the hugetlbfs pages, right?
>
> Putting it out there in case anybody else on the thread can recall the
> details of the previous discussion (offlist).
>
> Though things may have changed and if it passes testing - then maybe I
> am mis-remembering. I'll take a closer look at the patch and shout out
> if I notice anything.
The test I ran was to boot a VM and run ltp (with printk's sprinkled in the host
kernel to see what page size and where it gets mapped/unmapped at stage 2). Do you
mind recommending other tests that I might run?
Thanks,
Alex
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2020-09-11 16:26 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-10 13:33 [PATCH v2] KVM: arm64: Try PMD block mappings if PUD mappings are not supported Alexandru Elisei
2020-09-11 8:34 ` Punit Agrawal
2020-09-11 16:26 ` Alexandru Elisei [this message]
2020-09-15 8:23 ` Punit Agrawal
2020-09-18 15:56 ` Marc Zyngier
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=2850b4d3-4399-c44c-0e5e-b01906c80ec7@arm.com \
--to=alexandru.elisei@arm.com \
--cc=james.morse@arm.com \
--cc=julien.thierry.kdev@gmail.com \
--cc=kvmarm@lists.cs.columbia.edu \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=maz@kernel.org \
--cc=punit1.agrawal@toshiba.co.jp \
--cc=suzuki.poulose@arm.com \
/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).