lkml.org 
[lkml]   [2023]   [Sep]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC PATCH v2 0/6] KVM: gmem: Implement test cases for error_remove_page
On 9/22/23 22:32, Sean Christopherson wrote:
> Unless we can't extend fadvise() for some reason, I think we should pursue
> FADV_HWPOISION. The enabling should be downright trivial, e.g. just implement
> file_operations.fadvise() for guest_memfd, have it handle FADV_HWPOISON, and pass
> everything else to generic_fadvise().
>
> It'll basically be your ioctl() just without a dedicated ioctl().
>
> At the very least, we should run the idea past the fs maintainers.

fadvise() is different from madvise() though and not necessarily a great
match. Looking at the list of flags in advise(), something like
FADV_POPULATE_READ, FADV_PAGEOUT or FADV_COLD would make sense, but I
can't really think of any other flag that would be useful in a general
case for fadvise. Everything else would have to be very spcific to
memfd or guest_memfd.

In particular FADV_HWPOISON would not make sense for anything that is
not backend by memory. There are some flags that could be useful on
gmem file descriptors, such as hypothetically {WIPE,KEEP}ONFORK or
SOFT_OFFLINE, but again they're not something that can be applied to
fadvise().

So a ioctl implementation does have some advantages after all. I
suggest that we reuse MADV_* flags in the ioctl arguments, to leave the
door open for future extensions and avoid ioctl proliferation. The
ioctl could be implemented by memfd, too, and perhaps even by /dev/zero.

Paolo

\
 
 \ /
  Last update: 2023-09-28 19:15    [W:0.323 / U:0.044 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site