From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 140C1199385 for ; Wed, 18 Dec 2024 00:03:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734480191; cv=none; b=tef8uIJnYw69wRfvdea1jFFvHs3dWdN833qfGu4ds/ajTdjOVCS04krVPAxLtllE6uUO/1u4ZUmL8aEieLX+P3g5hqVwoeAGy07yc+15sx1bQEHQ6K5p0lKr6+fT5k2mhVbIpkA0DAIXdvahygyLljX+kFABr2ucApwU12CKZRI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734480191; c=relaxed/simple; bh=+8y0sJt/Y6P33OFP9tjZ5kEt4+lCwIFGiZs3DNl7sXI=; h=Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References: Content-Type:MIME-Version; b=UKG/9SOjDQ6KyuiBb+qySTwvEXDFbTTGP6j66SovkaOloC3eUKTMHX7KOZ8PcGzGs778K15b97c541m/vNkGFDM0Td+neDW7a97z710sGG3U/k5gfg9m5aOCE8jzfZlOX7hSztQ4gBX/YQ5jj07HYB80lGliJMyAjNFB5BLWn7s= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=ehBP3Mwa; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="ehBP3Mwa" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1734480189; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Gx5N9I/1lsHGbnyrfo2lWSxL6bVpVGQji1pXukdz9iQ=; b=ehBP3Mwaf3I81grko5+9/3G6trgw2GwAhj//Gep8rmUp5aLTeehC+ObQN815oA64Axi+hP /zp+LmYuilwiqrsotWSde3Zh1/lmlznxIe7cQn5eoUrQdnIRxxBhDI7CCQ7IEXPZYH1Mhb BlREvyutcMDDg9Rj5pKW7EVjxD1RM+A= Received: from mail-il1-f200.google.com (mail-il1-f200.google.com [209.85.166.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-357-y9eyUY2vM3yyt2RzEjxCSQ-1; Tue, 17 Dec 2024 19:03:04 -0500 X-MC-Unique: y9eyUY2vM3yyt2RzEjxCSQ-1 X-Mimecast-MFC-AGG-ID: y9eyUY2vM3yyt2RzEjxCSQ Received: by mail-il1-f200.google.com with SMTP id e9e14a558f8ab-3a9d4ea9e0cso60540135ab.0 for ; Tue, 17 Dec 2024 16:03:04 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734480184; x=1735084984; h=content-transfer-encoding:mime-version:user-agent:references :in-reply-to:date:cc:to:from:subject:message-id:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=Gx5N9I/1lsHGbnyrfo2lWSxL6bVpVGQji1pXukdz9iQ=; b=cC+nb4O2J9gHwxe1TQkmjzfUDhfg/38XobhVryfsNwkmjmuHjoe9UkNrKYTrgSqlTy RSzKam7oviaXvH8UbHQ3+/lFDYDvOCpbywg6Dx6bHZX5kre8shun+ishKPTCKKLbFVhc uTKyPi1HSkla6VPhlYLMbSqAiy+Cq9QzYvAV0o0UqkITXGppvYDet4PMk2V5z5JnBs2e NaI6n6kmy85qgXoPEVUhOsAJq9X4iP/WW8RAbJlNpFkQGVWo6ZZ6j10ZMRJyT/h5lLG9 0a01XBLTWZ9CYsj4Dw05BwpmoYzlYhHad+P4SAPhwSBCwppQ5etLGyB7g0kiOPd7l1BZ QK6w== X-Forwarded-Encrypted: i=1; AJvYcCXAWJc9gwu3O1zIB07xtUFtCCRH0KmW7lIPfQwH9xlmZE3/Dfx8Lu/MWH20ltT2f3D7IQBdpxdQ4lLZOBE=@vger.kernel.org X-Gm-Message-State: AOJu0Yxo+1ZBLTrCmqydNaQDmynmfwwvoSkewUPivOWIv/82VU4JT5Pa b9co6EK8IzdCXs8s53CKPEgrSn6izTU5JwVaD22E7NabJj3y/7ynkbJll/kLg6ij8NCW7d3eT+z tKJb17V43/GKTKKYkmRLl/HIdWDOLJU6fbIEbI5Kh7h9KY+34aiwcg/YV3yxwgw== X-Gm-Gg: ASbGncud6NDxKG5HSZAbdtR7lRz95joNv8rcxeUh1+kgToj+nWEXiPMpbEsx350Ww/Z WwLjhG9Ax5nkWaDsR2ZdsBnPq2eLkzQk37s3zaG4Lzg3DCCBYcQLuYDkqmqr+0dzLe/pR5n27zX haqaABceLor7GLdUcPj5tVqfhQwMJynywRjDJg0+4qdkX99OTdlvUoud5Qx6mUIwjiDQsghAoTk Q12r1TFfM5e6pRGhTrNm7uFSUP9N+e4kQiTrDZFquCpJnH+KXbAuHPF X-Received: by 2002:a05:6e02:16cf:b0:3a7:e539:c272 with SMTP id e9e14a558f8ab-3bdc4f186a1mr10355525ab.23.1734480183734; Tue, 17 Dec 2024 16:03:03 -0800 (PST) X-Google-Smtp-Source: AGHT+IG2rEHOYhifNGuWs9Bcg4PjuDqaE4nXoeH8qIzkTJ+3G+HZ7blptUJRmJ4YJtTTGYKcF2/lew== X-Received: by 2002:a05:6e02:16cf:b0:3a7:e539:c272 with SMTP id e9e14a558f8ab-3bdc4f186a1mr10355265ab.23.1734480183348; Tue, 17 Dec 2024 16:03:03 -0800 (PST) Received: from starship ([2607:fea8:fc01:8d8d:6adb:55ff:feaa:b156]) by smtp.gmail.com with ESMTPSA id 8926c6da1cb9f-4e5e3d5ea86sm1966419173.142.2024.12.17.16.03.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Dec 2024 16:03:02 -0800 (PST) Message-ID: <948d663c3d5497ff7393305d3efebb7f6198faec.camel@redhat.com> Subject: Re: [PATCH 17/20] KVM: selftests: Tighten checks around prev iter's last dirty page in ring From: Maxim Levitsky To: Sean Christopherson , Paolo Bonzini Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Peter Xu Date: Tue, 17 Dec 2024 19:03:02 -0500 In-Reply-To: <20241214010721.2356923-18-seanjc@google.com> References: <20241214010721.2356923-1-seanjc@google.com> <20241214010721.2356923-18-seanjc@google.com> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.36.5 (3.36.5-2.fc32) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 > --- > 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