lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210211000322.159437-1-mike.kravetz@oracle.com>
Date:   Wed, 10 Feb 2021 16:03:17 -0800
From:   Mike Kravetz <mike.kravetz@...cle.com>
To:     linux-mm@...ck.org, linux-kernel@...r.kernel.org,
        linux-s390@...r.kernel.org
Cc:     shu wang <malate_wangshu@...mail.com>,
        Axel Rasmussen <axelrasmussen@...gle.com>,
        Peter Xu <peterx@...hat.com>,
        Andrea Arcangeli <aarcange@...hat.com>,
        Heiko Carstens <hca@...ux.ibm.com>,
        Alexey Dobriyan <adobriyan@...il.com>,
        Matthew Wilcox <willy@...radead.org>,
        Michel Lespinasse <walken@...gle.com>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Mike Kravetz <mike.kravetz@...cle.com>
Subject: [RFC PATCH 0/5] Add hugetlb soft dirty support

Shu Wang opened bugzilla 211287 [1] saying,
When a memory region is mapped with huge pages, the softdirty bit is set
only right after the huge pages is mapped. After the memory mapping, if
the softdirty bit is cleared and the memory is written again, the softdirty
bit is not set when reading from the process's pagemap.

Their use case for hugetlb soft dirty is,
We maps both PMEM and hugetlb DRAM to process’s address space to provide
large amount of memory to the application. Periodically, we clear the soft
dirty bit by writing ‘4’ to the clear_refs. Then, we check the page’s soft
dirty bit from pagemap and use this information to track write activity to
memory. We migrate the data between DRAM and PMEM based the write activity
for better performance.

A quick check of the code revealed,
The /proc clear_refs code handles THP pages and 'normal' pages.  There is
no check/processing for hugetlb pages.  All the code will do is clear the
VM_SOFTDIRTY vma flag and vma_set_page_prot.  None of the individual ptes
or page flags are touched.

The only soft dirty checking done by the /proc pagemap code is at the vma
level.  It checks the VM_SOFTDIRTY flag.   It does not look for soft dirty
on the individual ptes.

That explains the behavior described in the bugzilla report.

This series adds soft dirty support for hugetlb.  It has only passed
some very basic testing and likely needs more work.  However, Axel
Rasmussen's "userfaultfd: add minor fault handling" and Peter Xu's
"userfaultfd-wp: Support shmem and hugetlbfs" work touch the same areas
and have similiar issues.  Therefore, code is being sent earlier than
normal so that efforts in common areas can be coordinated.

[1] https://bugzilla.kernel.org/show_bug.cgi?id=211287

Mike Kravetz (5):
  hugetlb: add hugetlb helpers for soft dirty support
  hugetlb: enhance hugetlb fault processing to support soft dirty
  mm proc/task_mmu.c: add soft dirty pte checks for hugetlb
  hugetlb: don't permit pmd sharing if soft dirty in use
  mm proc/task_mmu.c: add hugetlb specific routine for clear_refs

 arch/s390/include/asm/hugetlb.h |  30 +++++++++
 fs/proc/task_mmu.c              | 114 ++++++++++++++++++++++++++++++++
 include/asm-generic/hugetlb.h   |  30 +++++++++
 include/linux/hugetlb.h         |   1 +
 mm/hugetlb.c                    |  40 ++++++-----
 5 files changed, 199 insertions(+), 16 deletions(-)

-- 
2.29.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ