On Thu, Apr 27, 2023 at 8:48 AM James Houghton <jthoughton@xxxxxxxxxx> wrote: > > This comment sounds a little bit strange because we're always passing > MODE_DONTWAKE to UFFDIO_COPY/CONTINUE. > > You *could* update the comment to reflect what this test is really > doing, but I think you actually probably want the test to do what the > comment suggests. That is, I think the code you should write should: > 1. DONTWAKE if is_vcpu > 2. UFFDIO_WAKE if !is_vcpu && UFFDIO_COPY/CONTINUE failed (with > EEXIST, but we would have already crashed if it weren't). > > This way, we can save a syscall with almost no added complexity, and > the existing userfaultfd tests remain basically untouched (i.e., no > longer always need an explicit UFFDIO_WAKE). > > Thanks! Good points, and taken: though in practice I suspect that every fault read from the uffd will EEXIST and necessitate the wake anyways.