2017-07-12 17:58:21 -07:00
|
|
|
|
|
|
|
|
|
2018-10-29 15:52:42 -07:00
|
|
|
|
2016-05-18 09:15:08 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-07-24 15:55:42 -07:00
|
|
|
|
2016-05-18 09:15:08 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-04-19 13:39:43 -07:00
|
|
|
|
2017-04-07 15:33:36 -07:00
|
|
|
|
2017-07-12 17:58:21 -07:00
|
|
|
|
2016-05-18 09:15:08 -07:00
|
|
|
|
2026-01-22 16:06:18 +00:00
|
|
|
|
2025-10-20 13:11:19 +01:00
|
|
|
|
|
|
|
|
|
2016-05-14 12:20:44 -07:00
|
|
|
|
2017-01-30 21:43:10 -08:00
|
|
|
|
2016-05-14 12:20:44 -07:00
|
|
|
|
|
|
|
|
|
2017-04-11 09:49:49 -07:00
|
|
|
|
2016-05-14 12:20:44 -07:00
|
|
|
|
|
|
|
|
|
2016-11-16 09:00:38 -08:00
|
|
|
|
mm: rename VMA flag helpers to be more readable
Patch series "mm: vma flag tweaks".
The ongoing work around introducing non-system word VMA flags has
introduced a number of helper functions and macros to make life easier
when working with these flags and to make conversions from the legacy use
of VM_xxx flags more straightforward.
This series improves these to reduce confusion as to what they do and to
improve consistency and readability.
Firstly the series renames vma_flags_test() to vma_flags_test_any() to
make it abundantly clear that this function tests whether any of the flags
are set (as opposed to vma_flags_test_all()).
It then renames vma_desc_test_flags() to vma_desc_test_any() for the same
reason. Note that we drop the 'flags' suffix here, as
vma_desc_test_any_flags() would be cumbersome and 'test' implies a flag
test.
Similarly, we rename vma_test_all_flags() to vma_test_all() for
consistency.
Next, we have a couple of instances (erofs, zonefs) where we are now
testing for vma_desc_test_any(desc, VMA_SHARED_BIT) &&
vma_desc_test_any(desc, VMA_MAYWRITE_BIT).
This is silly, so this series introduces vma_desc_test_all() so these
callers can instead invoke vma_desc_test_all(desc, VMA_SHARED_BIT,
VMA_MAYWRITE_BIT).
We then observe that quite a few instances of vma_flags_test_any() and
vma_desc_test_any() are in fact only testing against a single flag.
Using the _any() variant here is just confusing - 'any' of single item
reads strangely and is liable to cause confusion.
So in these instances the series reintroduces vma_flags_test() and
vma_desc_test() as helpers which test against a single flag.
The fact that vma_flags_t is a struct and that vma_flag_t utilises sparse
to avoid confusion with vm_flags_t makes it impossible for a user to
misuse these helpers without it getting flagged somewhere.
The series also updates __mk_vma_flags() and functions invoked by it to
explicitly mark them always inline to match expectation and to be
consistent with other VMA flag helpers.
It also renames vma_flag_set() to vma_flags_set_flag() (a function only
used by __mk_vma_flags()) to be consistent with other VMA flag helpers.
Finally it updates the VMA tests for each of these changes, and introduces
explicit tests for vma_flags_test() and vma_desc_test() to assert that
they behave as expected.
This patch (of 6):
On reflection, it's confusing to have vma_flags_test() and
vma_desc_test_flags() test whether any comma-separated VMA flag bit is
set, while also having vma_flags_test_all() and vma_test_all_flags()
separately test whether all flags are set.
Firstly, rename vma_flags_test() to vma_flags_test_any() to eliminate this
confusion.
Secondly, since the VMA descriptor flag functions are becoming rather
cumbersome, prefer vma_desc_test*() to vma_desc_test_flags*(), and also
rename vma_desc_test_flags() to vma_desc_test_any().
Finally, rename vma_test_all_flags() to vma_test_all() to keep the
VMA-specific helper consistent with the VMA descriptor naming convention
and to help avoid confusion vs. vma_flags_test_all().
While we're here, also update whitespace to be consistent in helper
functions.
Link: https://lkml.kernel.org/r/cover.1772704455.git.ljs@kernel.org
Link: https://lkml.kernel.org/r/0f9cb3c511c478344fac0b3b3b0300bb95be95e9.1772704455.git.ljs@kernel.org
Signed-off-by: Lorenzo Stoakes (Oracle) <ljs@kernel.org>
Suggested-by: Pedro Falcato <pfalcato@suse.de>
Acked-by: David Hildenbrand (Arm) <david@kernel.org>
Reviewed-by: Pedro Falcato <pfalcato@suse.de>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Babu Moger <babu.moger@amd.com>
Cc: Baolin Wang <baolin.wang@linux.alibaba.com>
Cc: Chao Yu <chao@kernel.org>
Cc: Chatre, Reinette <reinette.chatre@intel.com>
Cc: Chunhai Guo <guochunhai@vivo.com>
Cc: Damien Le Maol <dlemoal@kernel.org>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Dave Jiang <dave.jiang@intel.com>
Cc: Dave Martin <dave.martin@arm.com>
Cc: Gao Xiang <xiang@kernel.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Hongbo Li <lihongbo22@huawei.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: James Morse <james.morse@arm.com>
Cc: Jan Kara <jack@suse.cz>
Cc: Jann Horn <jannh@google.com>
Cc: Jason Gunthorpe <jgg@ziepe.ca>
Cc: Jeffle Xu <jefflexu@linux.alibaba.com>
Cc: Johannes Thumshirn <jth@kernel.org>
Cc: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
Cc: Liam Howlett <liam.howlett@oracle.com>
Cc: "Luck, Tony" <tony.luck@intel.com>
Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Mike Rapoport <rppt@kernel.org>
Cc: Muchun Song <muchun.song@linux.dev>
Cc: Naohiro Aota <naohiro.aota@wdc.com>
Cc: Oscar Salvador <osalvador@suse.de>
Cc: Sandeep Dhavale <dhavale@google.com>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Vishal Verma <vishal.l.verma@intel.com>
Cc: Vlastimil Babka <vbabka@kernel.org>
Cc: Yue Hu <zbestahu@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2026-03-05 10:50:14 +00:00
|
|
|
|
2018-06-27 11:43:58 -04:00
|
|
|
|
|
|
|
|
|
2016-05-14 12:20:44 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-10-13 16:50:50 -07:00
|
|
|
|
2025-10-20 13:11:19 +01:00
|
|
|
|
2018-06-27 11:43:58 -04:00
|
|
|
|
|
|
|
|
|
2025-10-20 13:11:19 +01:00
|
|
|
|
2016-05-14 12:20:44 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-10-20 13:11:19 +01:00
|
|
|
|
2018-06-27 11:43:58 -04:00
|
|
|
|
|
|
|
|
|
2016-05-14 12:20:44 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-10-20 13:11:19 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-01-22 16:06:18 +00:00
|
|
|
|
2025-10-20 13:11:19 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-06-19 18:58:05 +10:00
|
|
|
|
2022-01-14 14:04:36 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-01-14 14:04:47 -08:00
|
|
|
|
2022-01-14 14:04:36 -08:00
|
|
|
|
|
|
|
|
|
2022-01-14 14:04:47 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-01-14 14:04:36 -08:00
|
|
|
|
2024-09-27 15:45:09 +08:00
|
|
|
|
2022-01-14 14:04:36 -08:00
|
|
|
|
|
|
|
|
|
2025-06-19 18:58:05 +10:00
|
|
|
|
2022-01-14 14:04:36 -08:00
|
|
|
|
2024-12-16 15:53:55 +00:00
|
|
|
|
2022-01-14 14:04:36 -08:00
|
|
|
|
|
|
|
|
|
2024-12-16 15:53:55 +00:00
|
|
|
|
|
|
|
|
|
2022-01-14 14:04:36 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-07-13 21:49:34 -07:00
|
|
|
|
2022-01-14 14:04:43 -08:00
|
|
|
|
2016-05-14 12:20:44 -07:00
|
|
|
|
2017-01-30 21:43:10 -08:00
|
|
|
|
2016-05-14 12:20:44 -07:00
|
|
|
|
2025-06-19 18:58:05 +10:00
|
|
|
|
2017-03-10 13:24:22 -07:00
|
|
|
|
2016-05-14 12:20:44 -07:00
|
|
|
|
2017-01-30 21:43:10 -08:00
|
|
|
|
2016-05-14 12:20:44 -07:00
|
|
|
|
|
|
|
|
|
2020-10-13 16:50:50 -07:00
|
|
|
|
2018-03-05 16:40:05 -08:00
|
|
|
|
2020-10-13 16:50:50 -07:00
|
|
|
|
2016-05-14 12:20:44 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-10-13 16:50:50 -07:00
|
|
|
|
2017-03-10 13:24:22 -07:00
|
|
|
|
|
|
|
|
|
2017-05-04 23:38:43 -07:00
|
|
|
|
2016-05-14 12:20:44 -07:00
|
|
|
|
2018-03-05 16:40:05 -08:00
|
|
|
|
2016-05-14 12:20:44 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-06-19 18:58:05 +10:00
|
|
|
|
2016-05-14 12:20:44 -07:00
|
|
|
|
2022-01-14 14:04:43 -08:00
|
|
|
|
2022-01-14 14:04:40 -08:00
|
|
|
|
2025-06-19 18:58:05 +10:00
|
|
|
|
2025-02-28 14:31:15 +11:00
|
|
|
|
2016-05-14 12:20:44 -07:00
|
|
|
|
|
|
|
|
|
2018-07-13 21:49:34 -07:00
|
|
|
|
2022-01-14 14:04:43 -08:00
|
|
|
|
2016-05-14 12:20:44 -07:00
|
|
|
|
2017-02-22 15:40:03 -08:00
|
|
|
|
2017-01-30 21:43:10 -08:00
|
|
|
|
2016-05-14 12:20:44 -07:00
|
|
|
|
|
|
|
|
|
2025-06-19 18:58:05 +10:00
|
|
|
|
2017-03-10 13:24:22 -07:00
|
|
|
|
2016-05-14 12:20:44 -07:00
|
|
|
|
2017-01-30 21:43:10 -08:00
|
|
|
|
2016-05-14 12:20:44 -07:00
|
|
|
|
|
|
|
|
|
2020-10-13 16:50:50 -07:00
|
|
|
|
2018-03-05 16:40:05 -08:00
|
|
|
|
2020-10-13 16:50:50 -07:00
|
|
|
|
2016-05-14 12:20:44 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-10-13 16:50:50 -07:00
|
|
|
|
2017-03-10 13:24:22 -07:00
|
|
|
|
2020-10-13 16:50:50 -07:00
|
|
|
|
2017-03-10 13:24:22 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-02-22 15:40:06 -08:00
|
|
|
|
2017-05-04 23:38:43 -07:00
|
|
|
|
2016-05-14 12:20:44 -07:00
|
|
|
|
2018-03-05 16:40:05 -08:00
|
|
|
|
2016-05-14 12:20:44 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-06-19 18:58:05 +10:00
|
|
|
|
2016-05-14 12:20:44 -07:00
|
|
|
|
2022-01-14 14:04:43 -08:00
|
|
|
|
2022-01-14 14:04:40 -08:00
|
|
|
|
2025-06-19 18:58:05 +10:00
|
|
|
|
2025-02-28 14:31:15 +11:00
|
|
|
|
2016-05-14 12:20:44 -07:00
|
|
|
|
|
|
|
|
|
2017-02-24 14:57:05 -08:00
|
|
|
|
2018-07-13 21:49:34 -07:00
|
|
|
|
2022-01-14 14:04:43 -08:00
|
|
|
|
2017-02-24 14:57:05 -08:00
|
|
|
|
|
|
|
|
|
2017-01-30 21:43:10 -08:00
|
|
|
|
2017-02-24 14:57:05 -08:00
|
|
|
|
|
|
|
|
|
2025-06-19 18:58:05 +10:00
|
|
|
|
2017-03-10 13:24:27 -07:00
|
|
|
|
|
|
|
|
|
2017-02-24 14:57:05 -08:00
|
|
|
|
2017-01-30 21:43:10 -08:00
|
|
|
|
2017-02-24 14:57:05 -08:00
|
|
|
|
|
|
|
|
|
2020-10-13 16:50:50 -07:00
|
|
|
|
2018-03-05 16:40:05 -08:00
|
|
|
|
2020-10-13 16:50:50 -07:00
|
|
|
|
2017-02-24 14:57:05 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-10-13 16:50:50 -07:00
|
|
|
|
2017-03-10 13:24:27 -07:00
|
|
|
|
2020-10-13 16:50:50 -07:00
|
|
|
|
2017-03-10 13:24:27 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-02-24 14:57:05 -08:00
|
|
|
|
2017-05-04 23:38:43 -07:00
|
|
|
|
2017-02-24 14:57:05 -08:00
|
|
|
|
2018-03-05 16:40:05 -08:00
|
|
|
|
2017-02-24 14:57:05 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-06-19 18:58:05 +10:00
|
|
|
|
2017-02-24 14:57:05 -08:00
|
|
|
|
2022-01-14 14:04:43 -08:00
|
|
|
|
2022-01-14 14:04:40 -08:00
|
|
|
|
2025-06-19 18:58:05 +10:00
|
|
|
|
2025-02-28 14:31:15 +11:00
|
|
|
|
2017-02-24 14:57:05 -08:00
|
|
|
|
|
|
|
|
|
2018-07-13 21:49:34 -07:00
|
|
|
|
2022-01-14 14:04:43 -08:00
|
|
|
|
2017-02-24 14:57:05 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-08-18 21:23:35 +01:00
|
|
|
|
2016-05-14 12:20:44 -07:00
|
|
|
|
2017-02-22 15:40:06 -08:00
|
|
|
|
2018-09-04 15:46:26 -07:00
|
|
|
|
|
|
|
|
|
2017-01-30 21:43:10 -08:00
|
|
|
|
2016-05-14 12:20:44 -07:00
|
|
|
|
mm/dax: dump start address in fault handler
Patch series "mm/mprotect: Fix dax puds", v5.
Dax supports pud pages for a while, but mprotect on puds was missing since
the start. This series tries to fix that by providing pud handling in
mprotect(). The goal is to add more types of pud mappings like hugetlb or
pfnmaps. This series paves way for it by fixing known pud entries.
Considering nobody reported this until when I looked at those other types
of pud mappings, I am thinking maybe it doesn't need to be a fix for
stable and this may not need to be backported. I would guess whoever
cares about mprotect() won't care 1G dax puds yet, vice versa. I hope
fixing that in new kernels would be fine, but I'm open to suggestions.
There're a few small things changed to teach mprotect work on PUDs. E.g.
it will need to start with dropping NUMA_HUGE_PTE_UPDATES which may stop
making sense when there can be more than one type of huge pte. OTOH,
we'll also need to push the mmu notifiers from pmd to pud layers, which
might need some attention but so far I think it's safe. For such details,
please refer to each patch's commit message.
The mprotect() pud process should be straightforward, as I kept it as
simple as possible. There's no NUMA handled as dax simply doesn't support
that. There's also no userfault involvements as file memory (even if work
with userfault-wp async mode) will need to split a pud, so pud entry
doesn't need to yet know userfault's existance (but hugetlb entries will;
that's also for later).
This patch (of 7):
Currently the dax fault handler dumps the vma range when dynamic debugging
enabled. That's mostly not useful. Dump the (aligned) address instead
with the order info.
Link: https://lkml.kernel.org/r/20240812181225.1360970-1-peterx@redhat.com
Link: https://lkml.kernel.org/r/20240812181225.1360970-2-peterx@redhat.com
Signed-off-by: Peter Xu <peterx@redhat.com>
Acked-by: David Hildenbrand <david@redhat.com>
Cc: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Dave Jiang <dave.jiang@intel.com>
Cc: David Rientjes <rientjes@google.com>
Cc: "Edgecombe, Rick P" <rick.p.edgecombe@intel.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Kirill A. Shutemov <kirill@shutemov.name>
Cc: Matthew Wilcox <willy@infradead.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Nicholas Piggin <npiggin@gmail.com>
Cc: Oscar Salvador <osalvador@suse.de>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Rik van Riel <riel@surriel.com>
Cc: Sean Christopherson <seanjc@google.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Vlastimil Babka <vbabka@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2024-08-12 14:12:19 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-05-14 12:20:44 -07:00
|
|
|
|
2017-04-11 09:49:49 -07:00
|
|
|
|
2023-08-18 21:23:35 +01:00
|
|
|
|
2022-01-14 14:04:43 -08:00
|
|
|
|
2023-08-18 21:23:35 +01:00
|
|
|
|
2022-01-14 14:04:43 -08:00
|
|
|
|
2023-08-18 21:23:35 +01:00
|
|
|
|
2022-01-14 14:04:43 -08:00
|
|
|
|
2023-08-18 21:23:35 +01:00
|
|
|
|
2017-04-11 09:12:25 -07:00
|
|
|
|
2018-07-13 21:49:40 -07:00
|
|
|
|
2017-04-11 09:49:49 -07:00
|
|
|
|
2016-05-14 12:20:44 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-07-13 21:49:34 -07:00
|
|
|
|
2017-02-24 14:57:08 -08:00
|
|
|
|
2023-08-18 21:23:35 +01:00
|
|
|
|
2017-02-24 14:57:08 -08:00
|
|
|
|
|
|
|
|
|
2020-12-14 19:08:17 -08:00
|
|
|
|
2017-11-29 16:10:32 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-10-13 16:50:50 -07:00
|
|
|
|
2017-11-29 16:10:32 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-04-05 16:24:28 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-10-13 16:50:50 -07:00
|
|
|
|
2018-04-05 16:24:28 -07:00
|
|
|
|
|
|
|
|
|
2017-01-30 21:43:10 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-12-14 19:08:17 -08:00
|
|
|
|
2018-04-05 16:24:28 -07:00
|
|
|
|
2016-05-14 12:20:44 -07:00
|
|
|
|
|
|
|
|
|
2025-10-20 13:11:19 +01:00
|
|
|
|
2016-05-14 12:20:44 -07:00
|
|
|
|
2025-10-20 13:11:19 +01:00
|
|
|
|
2017-01-30 21:43:10 -08:00
|
|
|
|
2017-04-11 09:49:49 -07:00
|
|
|
|
2016-05-14 12:20:44 -07:00
|
|
|
|
2018-03-05 16:40:05 -08:00
|
|
|
|
2016-05-14 12:20:44 -07:00
|
|
|
|
2017-04-11 09:49:49 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-01-22 16:06:18 +00:00
|
|
|
|
2025-10-20 13:11:19 +01:00
|
|
|
|
2017-04-11 09:49:49 -07:00
|
|
|
|
2016-05-14 12:20:44 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-10-20 13:11:19 +01:00
|
|
|
|
2026-01-22 16:06:18 +00:00
|
|
|
|
2016-05-14 12:20:44 -07:00
|
|
|
|
2016-08-07 08:23:56 -07:00
|
|
|
|
2016-05-14 12:20:44 -07:00
|
|
|
|
2016-08-07 08:23:56 -07:00
|
|
|
|
2016-08-11 00:38:03 -07:00
|
|
|
|
2016-08-07 08:23:56 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-01-30 21:43:10 -08:00
|
|
|
|
2016-08-07 08:23:56 -07:00
|
|
|
|
2017-01-30 21:43:10 -08:00
|
|
|
|
2016-08-07 08:23:56 -07:00
|
|
|
|
|
|
|
|
|
2020-10-13 16:50:50 -07:00
|
|
|
|
2016-08-07 08:23:56 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-10-03 16:53:04 +01:00
|
|
|
|
2016-08-07 08:23:56 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-10-03 16:53:04 +01:00
|
|
|
|
2016-08-07 08:23:56 -07:00
|
|
|
|
|
|
|
|
|
2018-09-10 16:18:29 -07:00
|
|
|
|
2022-02-09 20:22:13 +00:00
|
|
|
|
2018-09-10 16:18:29 -07:00
|
|
|
|
|
|
|
|
|
2016-08-11 00:38:03 -07:00
|
|
|
|
2016-08-07 08:23:56 -07:00
|
|
|
|
2017-04-11 09:49:49 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-08-07 08:23:56 -07:00
|
|
|
|
2018-03-05 16:40:05 -08:00
|
|
|
|
2017-04-11 09:49:49 -07:00
|
|
|
|
|
|
|
|
|
2018-09-10 16:18:29 -07:00
|
|
|
|
2016-07-24 21:55:45 -07:00
|
|
|
|
fs: new infrastructure for writeback error handling and reporting
Most filesystems currently use mapping_set_error and
filemap_check_errors for setting and reporting/clearing writeback errors
at the mapping level. filemap_check_errors is indirectly called from
most of the filemap_fdatawait_* functions and from
filemap_write_and_wait*. These functions are called from all sorts of
contexts to wait on writeback to finish -- e.g. mostly in fsync, but
also in truncate calls, getattr, etc.
The non-fsync callers are problematic. We should be reporting writeback
errors during fsync, but many places spread over the tree clear out
errors before they can be properly reported, or report errors at
nonsensical times.
If I get -EIO on a stat() call, there is no reason for me to assume that
it is because some previous writeback failed. The fact that it also
clears out the error such that a subsequent fsync returns 0 is a bug,
and a nasty one since that's potentially silent data corruption.
This patch adds a small bit of new infrastructure for setting and
reporting errors during address_space writeback. While the above was my
original impetus for adding this, I think it's also the case that
current fsync semantics are just problematic for userland. Most
applications that call fsync do so to ensure that the data they wrote
has hit the backing store.
In the case where there are multiple writers to the file at the same
time, this is really hard to determine. The first one to call fsync will
see any stored error, and the rest get back 0. The processes with open
fds may not be associated with one another in any way. They could even
be in different containers, so ensuring coordination between all fsync
callers is not really an option.
One way to remedy this would be to track what file descriptor was used
to dirty the file, but that's rather cumbersome and would likely be
slow. However, there is a simpler way to improve the semantics here
without incurring too much overhead.
This set adds an errseq_t to struct address_space, and a corresponding
one is added to struct file. Writeback errors are recorded in the
mapping's errseq_t, and the one in struct file is used as the "since"
value.
This changes the semantics of the Linux fsync implementation such that
applications can now use it to determine whether there were any
writeback errors since fsync(fd) was last called (or since the file was
opened in the case of fsync having never been called).
Note that those writeback errors may have occurred when writing data
that was dirtied via an entirely different fd, but that's the case now
with the current mapping_set_error/filemap_check_error infrastructure.
This will at least prevent you from getting a false report of success.
The new behavior is still consistent with the POSIX spec, and is more
reliable for application developers. This patch just adds some basic
infrastructure for doing this, and ensures that the f_wb_err "cursor"
is properly set when a file is opened. Later patches will change the
existing code to use this new infrastructure for reporting errors at
fsync time.
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Reviewed-by: Jan Kara <jack@suse.cz>
2017-07-06 07:02:25 -04:00
|
|
|
|
vfs: track per-sb writeback errors and report them to syncfs
Patch series "vfs: have syncfs() return error when there are writeback
errors", v6.
Currently, syncfs does not return errors when one of the inodes fails to
be written back. It will return errors based on the legacy AS_EIO and
AS_ENOSPC flags when syncing out the block device fails, but that's not
particularly helpful for filesystems that aren't backed by a blockdev.
It's also possible for a stray sync to lose those errors.
The basic idea in this set is to track writeback errors at the
superblock level, so that we can quickly and easily check whether
something bad happened without having to fsync each file individually.
syncfs is then changed to reliably report writeback errors after they
occur, much in the same fashion as fsync does now.
This patch (of 2):
Usually we suggest that applications call fsync when they want to ensure
that all data written to the file has made it to the backing store, but
that can be inefficient when there are a lot of open files.
Calling syncfs on the filesystem can be more efficient in some
situations, but the error reporting doesn't currently work the way most
people expect. If a single inode on a filesystem reports a writeback
error, syncfs won't necessarily return an error. syncfs only returns an
error if __sync_blockdev fails, and on some filesystems that's a no-op.
It would be better if syncfs reported an error if there were any
writeback failures. Then applications could call syncfs to see if there
are any errors on any open files, and could then call fsync on all of
the other descriptors to figure out which one failed.
This patch adds a new errseq_t to struct super_block, and has
mapping_set_error also record writeback errors there.
To report those errors, we also need to keep an errseq_t in struct file
to act as a cursor. This patch adds a dedicated field for that purpose,
which slots nicely into 4 bytes of padding at the end of struct file on
x86_64.
An earlier version of this patch used an O_PATH file descriptor to cue
the kernel that the open file should track the superblock error and not
the inode's writeback error.
I think that API is just too weird though. This is simpler and should
make syncfs error reporting "just work" even if someone is multiplexing
fsync and syncfs on the same fds.
Signed-off-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: Jan Kara <jack@suse.cz>
Cc: Andres Freund <andres@anarazel.de>
Cc: Matthew Wilcox <willy@infradead.org>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Christoph Hellwig <hch@infradead.org>
Cc: Dave Chinner <david@fromorbit.com>
Cc: David Howells <dhowells@redhat.com>
Link: http://lkml.kernel.org/r/20200428135155.19223-1-jlayton@kernel.org
Link: http://lkml.kernel.org/r/20200428135155.19223-2-jlayton@kernel.org
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2020-06-01 21:45:36 -07:00
|
|
|
|
2017-01-30 21:43:10 -08:00
|
|
|
|
2016-08-11 00:41:51 -07:00
|
|
|
|
2016-08-07 08:23:56 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-08-11 00:38:03 -07:00
|
|
|
|
2016-08-07 08:23:56 -07:00
|
|
|
|
2017-01-30 21:43:10 -08:00
|
|
|
|
2016-08-07 08:23:56 -07:00
|
|
|
|
2018-03-05 16:40:05 -08:00
|
|
|
|
2016-08-07 08:23:56 -07:00
|
|
|
|
2016-05-14 12:20:44 -07:00
|
|
|
|
|
|
|
|
|
2016-05-18 09:15:08 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-08-11 00:38:03 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-10-20 13:11:19 +01:00
|
|
|
|
2024-03-28 13:27:24 +01:00
|
|
|
|
2016-05-18 09:15:08 -07:00
|
|
|
|
|
|
|
|
|
2017-07-12 17:58:21 -07:00
|
|
|
|
2016-08-07 08:23:56 -07:00
|
|
|
|
2017-07-12 17:58:21 -07:00
|
|
|
|
2016-08-11 00:41:51 -07:00
|
|
|
|
|
|
|
|
|
2017-07-12 17:58:21 -07:00
|
|
|
|
2016-08-07 08:23:56 -07:00
|
|
|
|
2017-07-12 17:58:21 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-05-17 14:55:09 +02:00
|
|
|
|
2017-07-12 17:58:21 -07:00
|
|
|
|
|
|
|
|
|
2020-10-13 16:50:08 -07:00
|
|
|
|
2020-10-13 16:49:43 -07:00
|
|
|
|
2017-04-11 09:49:49 -07:00
|
|
|
|
2016-07-24 15:55:42 -07:00
|
|
|
|
2018-10-29 15:52:42 -07:00
|
|
|
|
2020-10-13 16:50:39 -07:00
|
|
|
|
2018-10-29 15:52:42 -07:00
|
|
|
|
2022-01-14 14:04:33 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-10-13 16:50:39 -07:00
|
|
|
|
2022-01-14 14:04:33 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-10-13 16:50:39 -07:00
|
|
|
|
2022-01-14 14:04:29 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-10-13 16:49:43 -07:00
|
|
|
|
|
|
|
|
|
2022-01-14 14:04:33 -08:00
|
|
|
|
2020-10-13 16:50:39 -07:00
|
|
|
|
2022-01-14 14:04:33 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-10-13 16:49:43 -07:00
|
|
|
|
2020-10-13 16:50:39 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-10-13 16:49:43 -07:00
|
|
|
|
2022-01-14 14:04:47 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-10-13 16:49:43 -07:00
|
|
|
|
2019-06-13 15:56:33 -07:00
|
|
|
|
2018-10-29 15:52:42 -07:00
|
|
|
|
|
|
|
|
|
2017-04-11 09:49:49 -07:00
|
|
|
|
|
|
|
|
|
2016-07-24 15:55:42 -07:00
|
|
|
|
2021-11-15 13:20:57 -08:00
|
|
|
|
2017-07-12 17:58:21 -07:00
|
|
|
|
|
|
|
|
|
2016-07-19 17:51:40 -07:00
|
|
|
|
2017-07-12 17:58:21 -07:00
|
|
|
|
2016-07-19 17:51:40 -07:00
|
|
|
|
2017-07-12 17:58:21 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-08-07 08:23:56 -07:00
|
|
|
|
2017-07-12 17:58:21 -07:00
|
|
|
|
|
|
|
|
|
2016-08-07 08:23:56 -07:00
|
|
|
|
2017-07-12 17:58:21 -07:00
|
|
|
|
2018-11-07 15:31:23 -08:00
|
|
|
|
2020-10-13 16:50:08 -07:00
|
|
|
|
dax: Assign RAM regions to memory-hotplug by default
The default mode for device-dax instances is backwards for RAM-regions
as evidenced by the fact that it tends to catch end users by surprise.
"Where is my memory?". Recall that platforms are increasingly shipping
with performance-differentiated memory pools beyond typical DRAM and
NUMA effects. This includes HBM (high-bandwidth-memory) and CXL (dynamic
interleave, varied media types, and future fabric attached
possibilities).
For this reason the EFI_MEMORY_SP (EFI Special Purpose Memory => Linux
'Soft Reserved') attribute is expected to be applied to all memory-pools
that are not the general purpose pool. This designation gives an
Operating System a chance to defer usage of a memory pool until later in
the boot process where its performance properties can be interrogated
and administrator policy can be applied.
'Soft Reserved' memory can be anything from too limited and precious to
be part of the general purpose pool (HBM), too slow to host hot kernel
data structures (some PMEM media), or anything in between. However, in
the absence of an explicit policy, the memory should at least be made
usable by default. The current device-dax default hides all
non-general-purpose memory behind a device interface.
The expectation is that the distribution of users that want the memory
online by default vs device-dedicated-access by default follows the
Pareto principle. A small number of enlightened users may want to do
userspace memory management through a device, but general users just
want the kernel to make the memory available with an option to get more
advanced later.
Arrange for all device-dax instances not backed by PMEM to default to
attaching to the dax_kmem driver. From there the baseline memory hotplug
policy (CONFIG_MEMORY_HOTPLUG_DEFAULT_ONLINE / memhp_default_state=)
gates whether the memory comes online or stays offline. Where, if it
stays offline, it can be reliably converted back to device-mode where it
can be partitioned, or fronted by a userspace allocator.
So, if someone wants device-dax instances for their 'Soft Reserved'
memory:
1/ Build a kernel with CONFIG_MEMORY_HOTPLUG_DEFAULT_ONLINE=n or boot
with memhp_default_state=offline, or roll the dice and hope that the
kernel has not pinned a page in that memory before step 2.
2/ Write a udev rule to convert the target dax device(s) from
'system-ram' mode to 'devdax' mode:
daxctl reconfigure-device $dax -m devdax -f
Cc: Michal Hocko <mhocko@suse.com>
Cc: David Hildenbrand <david@redhat.com>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Reviewed-by: Gregory Price <gregory.price@memverge.com>
Tested-by: Fan Ni <fan.ni@samsung.com>
Reviewed-by: Dave Jiang <dave.jiang@intel.com>
Link: https://lore.kernel.org/r/167602003336.1924368.6809503401422267885.stgit@dwillia2-xfh.jf.intel.com
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2023-02-10 01:07:13 -08:00
|
|
|
|
2017-07-12 17:58:21 -07:00
|
|
|
|
2016-08-07 08:23:56 -07:00
|
|
|
|
2016-05-18 09:15:08 -07:00
|
|
|
|
|
|
|
|
|
2017-07-12 17:58:21 -07:00
|
|
|
|
2016-05-18 09:15:08 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-11-07 15:31:23 -08:00
|
|
|
|
2016-05-18 09:15:08 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-06-05 10:49:24 -07:00
|
|
|
|
2016-05-18 09:15:08 -07:00
|
|
|
|
2017-07-12 17:58:21 -07:00
|
|
|
|
2016-05-18 09:15:08 -07:00
|
|
|
|
2017-07-12 17:58:21 -07:00
|
|
|
|