[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <948d663c3d5497ff7393305d3efebb7f6198faec.camel@redhat.com>
Date: Tue, 17 Dec 2024 19:03:02 -0500
From: Maxim Levitsky <mlevitsk@...hat.com>
To: Sean Christopherson <seanjc@...gle.com>, Paolo Bonzini
<pbonzini@...hat.com>
Cc: kvm@...r.kernel.org, linux-kernel@...r.kernel.org, Peter Xu
<peterx@...hat.com>
Subject: Re: [PATCH 17/20] KVM: selftests: Tighten checks around prev iter's
last dirty page in ring
On Fri, 2024-12-13 at 17:07 -0800, Sean Christopherson wrote:
> Now that each iteration collects all dirty entries and ensures the guest
> *completes* at least one write, tighten the exemptions for the last dirty
> page of the previous iteration. Specifically, the only legal value (other
> than the current iteration) is N-1.
>
> Unlike the last page for the current iteration, the in-progress write from
> the previous iteration is guaranteed to have completed, otherwise the test
> would have hung.
>
> Signed-off-by: Sean Christopherson <seanjc@...gle.com>
> ---
> tools/testing/selftests/kvm/dirty_log_test.c | 22 +++++++++++++-------
> 1 file changed, 15 insertions(+), 7 deletions(-)
>
> diff --git a/tools/testing/selftests/kvm/dirty_log_test.c b/tools/testing/selftests/kvm/dirty_log_test.c
> index 8eb51597f762..18d41537e737 100644
> --- a/tools/testing/selftests/kvm/dirty_log_test.c
> +++ b/tools/testing/selftests/kvm/dirty_log_test.c
> @@ -517,14 +517,22 @@ static void vm_dirty_log_verify(enum vm_guest_mode mode, unsigned long **bmap)
>
> if (host_log_mode == LOG_MODE_DIRTY_RING) {
> /*
> - * The last page in the ring from this iteration
> - * or the previous can be written with the value
> - * from the previous iteration (relative to the
> - * last page's iteration), as the value to be
> - * written may be cached in a CPU register.
> + * The last page in the ring from previous
> + * iteration can be written with the value
> + * from the previous iteration, as the value to
> + * be written may be cached in a CPU register.
> */
> - if ((page == dirty_ring_last_page ||
> - page == dirty_ring_prev_iteration_last_page) &&
> + if (page == dirty_ring_prev_iteration_last_page &&
> + val == iteration - 1)
> + continue;
> +
> + /*
> + * Any value from a previous iteration is legal
> + * for the last entry, as the write may not yet
> + * have retired, i.e. the page may hold whatever
> + * it had before this iteration started.
> + */
> + if (page == dirty_ring_last_page &&
> val < iteration)
> continue;
> } else if (!val && iteration == 1 && bmap0_dirty) {
Reviewed-by: Maxim Levitsky <mlevitsk@...hat.com>
Powered by blists - more mailing lists