[PATCH v3 2/6] dax: fix cache flush on PMD-mapped pages

2022-02-27 Thread Muchun Song
The flush_cache_page() only remove a PAGE_SIZE sized range from the cache. However, it does not cover the full pages in a THP except a head page. Replace it with flush_cache_range() to fix this issue. Fixes: f729c8c9b24f ("dax: wrprotect pmd_t in dax_mapping_entry_mkclean") Signed-off-by: Muchun

[PATCH v3 0/6] Fix some bugs related to ramp and dax

2022-02-27 Thread Muchun Song
This series is based on next-20220225. Patch 1-2 fix a cache flush bug, because subsequent patches depend on those on those changes, there are placed in this series. Patch 3-4 are preparation for fixing a dax bug in patch 5. Patch 6 is code cleanup since the previous patch remove the usage of

[PATCH v3 1/6] mm: rmap: fix cache flush on THP pages

2022-02-27 Thread Muchun Song
The flush_cache_page() only remove a PAGE_SIZE sized range from the cache. However, it does not cover the full pages in a THP except a head page. Replace it with flush_cache_range() to fix this issue. At least, no problems were found due to this. Maybe because the architectures that have virtual

[PATCH v3 5/6] dax: fix missing writeprotect the pte entry

2022-02-27 Thread Muchun Song
Currently dax_mapping_entry_mkclean() fails to clean and write protect the pte entry within a DAX PMD entry during an *sync operation. This can result in data loss in the following sequence: 1) process A mmap write to DAX PMD, dirtying PMD radix tree entry and making the pmd entry dirty

[PATCH v3 6/6] mm: remove range parameter from follow_invalidate_pte()

2022-02-27 Thread Muchun Song
The only user (DAX) of range parameter of follow_invalidate_pte() is gone, it safe to remove the range paramter and make it static to simlify the code. Signed-off-by: Muchun Song --- include/linux/mm.h | 3 --- mm/memory.c| 23 +++ 2 files changed, 3 insertions(+),

[PATCH v3 3/6] mm: rmap: introduce pfn_mkclean_range() to cleans PTEs

2022-02-27 Thread Muchun Song
The page_mkclean_one() is supposed to be used with the pfn that has a associated struct page, but not all the pfns (e.g. DAX) have a struct page. Introduce a new function pfn_mkclean_range() to cleans the PTEs (including PMDs) mapped with range of pfns which has no struct page associated with

[PATCH v3 4/6] mm: pvmw: add support for walking devmap pages

2022-02-27 Thread Muchun Song
The devmap pages can not use page_vma_mapped_walk() to check if a huge devmap page is mapped into a vma. Add support for walking huge devmap pages so that DAX can use it in the next patch. Signed-off-by: Muchun Song --- mm/page_vma_mapped.c | 4 ++-- 1 file changed, 2 insertions(+), 2

[PATCH v11 5/8] mm: move pgoff_address() to vma_pgoff_address()

2022-02-27 Thread Shiyang Ruan
Since it is not a DAX-specific function, move it into mm and rename it to be a generic helper. Signed-off-by: Shiyang Ruan Reviewed-by: Christoph Hellwig Reviewed-by: Dan Williams --- fs/dax.c | 12 +--- include/linux/mm.h | 13 + 2 files changed, 14

[PATCH v11 6/8] mm: Introduce mf_dax_kill_procs() for fsdax case

2022-02-27 Thread Shiyang Ruan
This function is called at the end of RMAP routine, i.e. filesystem recovery function, to collect and kill processes using a shared page of DAX file. The difference with mf_generic_kill_procs() is, it accepts file's (mapping,offset) instead of struct page because different files' mappings and

[PATCH v11 4/8] fsdax: Introduce dax_lock_mapping_entry()

2022-02-27 Thread Shiyang Ruan
The current dax_lock_page() locks dax entry by obtaining mapping and index in page. To support 1-to-N RMAP in NVDIMM, we need a new function to lock a specific dax entry corresponding to this file's mapping,index. And output the page corresponding to the specific dax entry for caller use.

Re: [PATCH v11 7/8] xfs: Implement ->notify_failure() for XFS

2022-02-27 Thread kernel test robot
. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch] url: https://github.com/0day-ci/linux/commits/Shiyang-Ruan/fsdax-introduce-fs-query-to-support-reflink/20220227-200849 base: https://git.kernel.org/pub/scm/fs/xfs/xfs-linux.git

Re: [PATCH v11 8/8] fsdax: set a CoW flag when associate reflink mappings

2022-02-27 Thread kernel test robot
a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch] url: https://github.com/0day-ci/linux/commits/Shiyang-Ruan/fsdax-introduce-fs-query-to-support-reflink/20220227-200849 base: https://git.kernel.org/pub/scm/fs/xfs/xfs-linux.git

[PATCH v11 2/8] mm: factor helpers for memory_failure_dev_pagemap

2022-02-27 Thread Shiyang Ruan
memory_failure_dev_pagemap code is a bit complex before introduce RMAP feature for fsdax. So it is needed to factor some helper functions to simplify these code. Signed-off-by: Shiyang Ruan Reviewed-by: Darrick J. Wong Reviewed-by: Christoph Hellwig Reviewed-by: Dan Williams ---

[PATCH v11 3/8] pagemap,pmem: Introduce ->memory_failure()

2022-02-27 Thread Shiyang Ruan
When memory-failure occurs, we call this function which is implemented by each kind of devices. For the fsdax case, pmem device driver implements it. Pmem device driver will find out the filesystem in which the corrupted page located in. With dax_holder notify support, we are able to notify the

[PATCH v11 0/8] fsdax: introduce fs query to support reflink

2022-02-27 Thread Shiyang Ruan
This patchset is aimed to support shared pages tracking for fsdax. Changes since V10: - Use cmpxchg() to prevent concurrent registration/unregistration - Use phys_addr_t for ->memory_failure() - Add dax_entry_lock() for dax_lock_mapping_entry() - Fix offset and length calculation at the

[PATCH v11 7/8] xfs: Implement ->notify_failure() for XFS

2022-02-27 Thread Shiyang Ruan
Introduce xfs_notify_failure.c to handle failure related works, such as implement ->notify_failure(), register/unregister dax holder in xfs, and so on. If the rmap feature of XFS enabled, we can query it to find files and metadata which are associated with the corrupt data. For now all we do is

[PATCH v11 1/8] dax: Introduce holder for dax_device

2022-02-27 Thread Shiyang Ruan
To easily track filesystem from a pmem device, we introduce a holder for dax_device structure, and also its operation. This holder is used to remember who is using this dax_device: - When it is the backend of a filesystem, the holder will be the instance of this filesystem. - When this pmem

[PATCH v11 8/8] fsdax: set a CoW flag when associate reflink mappings

2022-02-27 Thread Shiyang Ruan
Introduce a PAGE_MAPPING_DAX_COW flag to support association with CoW file mappings. In this case, since the dax-rmap has already took the responsibility to look up for shared files by given dax page, the page->mapping is no longer to used for rmap but for marking that this dax page is shared.

Re: [PATCH v11 7/8] xfs: Implement ->notify_failure() for XFS

2022-02-27 Thread kernel test robot
. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch] url: https://github.com/0day-ci/linux/commits/Shiyang-Ruan/fsdax-introduce-fs-query-to-support-reflink/20220227-200849 base: https://git.kernel.org/pub/scm/fs/xfs/xfs-linux.git

Re: [PATCH v11 7/8] xfs: Implement ->notify_failure() for XFS

2022-02-27 Thread kernel test robot
. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch] url: https://github.com/0day-ci/linux/commits/Shiyang-Ruan/fsdax-introduce-fs-query-to-support-reflink/20220227-200849 base: https://git.kernel.org/pub/scm/fs/xfs/xfs-linux.git