Re: [PATCH v1 1/4] softmmu/physmem: Warn with ram_block_discard_range() on MAP_PRIVATE file mapping

2023-06-22 Thread Peter Xu
On Thu, Jun 22, 2023 at 03:10:47PM +0200, David Hildenbrand wrote: > Maybe ... depends also on the uffd semantics as in 3). UFFDIO_COPY|ZEROPAGE bypasses page cache for private file mappings, afaict. We'll still got a limit on the inode size (so we can't COPY|ZEROPAGE over that offset of vma) but

Re: [PATCH v1 1/4] softmmu/physmem: Warn with ram_block_discard_range() on MAP_PRIVATE file mapping

2023-06-22 Thread David Hildenbrand
On 21.06.23 18:55, Peter Xu wrote: On Wed, Jun 21, 2023 at 06:17:37PM +0200, David Hildenbrand wrote: As documented, ram_block_discard_range() guarantees two things a) Read 0 after discarding succeeded b) Make postcopy work by triggering a fault on next access And if we'd simply want to drop t

Re: [PATCH v1 1/4] softmmu/physmem: Warn with ram_block_discard_range() on MAP_PRIVATE file mapping

2023-06-21 Thread Peter Xu
On Wed, Jun 21, 2023 at 06:17:37PM +0200, David Hildenbrand wrote: > As documented, ram_block_discard_range() guarantees two things > > a) Read 0 after discarding succeeded > b) Make postcopy work by triggering a fault on next access > > And if we'd simply want to drop the FALLOC_FL_PUNCH_HOLE: >

Re: [PATCH v1 1/4] softmmu/physmem: Warn with ram_block_discard_range() on MAP_PRIVATE file mapping

2023-06-21 Thread David Hildenbrand
On 21.06.23 17:55, Peter Xu wrote: On Tue, Jun 20, 2023 at 03:03:51PM +0200, David Hildenbrand wrote: ram_block_discard_range() cannot possibly do the right thing in MAP_PRIVATE file mappings in the general case. To achieve the documented semantics, we also have to punch a hole into the file, p

Re: [PATCH v1 1/4] softmmu/physmem: Warn with ram_block_discard_range() on MAP_PRIVATE file mapping

2023-06-21 Thread Peter Xu
On Tue, Jun 20, 2023 at 03:03:51PM +0200, David Hildenbrand wrote: > ram_block_discard_range() cannot possibly do the right thing in > MAP_PRIVATE file mappings in the general case. > > To achieve the documented semantics, we also have to punch a hole into > the file, possibly messing with other M

[PATCH v1 1/4] softmmu/physmem: Warn with ram_block_discard_range() on MAP_PRIVATE file mapping

2023-06-20 Thread David Hildenbrand
ram_block_discard_range() cannot possibly do the right thing in MAP_PRIVATE file mappings in the general case. To achieve the documented semantics, we also have to punch a hole into the file, possibly messing with other MAP_PRIVATE/MAP_SHARED mappings of such a file. For example, using VM templat