From nobody Wed Feb 11 22:55:49 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 423ACC77B72 for ; Wed, 12 Apr 2023 20:10:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229578AbjDLUKQ (ORCPT ); Wed, 12 Apr 2023 16:10:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56206 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230010AbjDLUKG (ORCPT ); Wed, 12 Apr 2023 16:10:06 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ECB38619E for ; Wed, 12 Apr 2023 13:09:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681330159; 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; bh=i5jrl4HyYmJIvlEgkd7txy7LdCkCR9JKfs0t6bJZ/6M=; b=accY5vOLDdlA5MpFBggqhOJs2SS4T7tQrxytifXXSpXPrEXsnHdB0lrRBOc5Z2wX9H+FKM IZwtodUixthVBwZcIHoaopNa4NEr8HA41a/bXc1qvjzXhY07jqPRaW2MqLCiNYyIEkSuFm IZfVcwgvH9uuEB4bCOxDW510RvmLX9o= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-499-W2z4sEnHP32Z8O1eFz0J8g-1; Wed, 12 Apr 2023 16:09:14 -0400 X-MC-Unique: W2z4sEnHP32Z8O1eFz0J8g-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6F1E98996E8; Wed, 12 Apr 2023 20:09:14 +0000 (UTC) Received: from virtlab701.virt.lab.eng.bos.redhat.com (virtlab701.virt.lab.eng.bos.redhat.com [10.19.152.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4745E40CF916; Wed, 12 Apr 2023 20:09:14 +0000 (UTC) From: Paolo Bonzini To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: vipinsh@google.com, bgardon@google.com, seanjc@google.com Subject: [PATCH] selftests/kvm: touch all pages of args on each memstress iteration Date: Wed, 12 Apr 2023 16:09:13 -0400 Message-Id: <20230412200913.1570873-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Access the same memory addresses on each iteration of the memstress guest code. This ensures that the state of KVM's page tables is the same after every iteration, including the pages that host the guest page tables for args and vcpu_args. This difference is visible on the dirty_log_page_splitting_test on AMD machines. Signed-off-by: Paolo Bonzini Reviewed-by: Vipin Sharma --- tools/testing/selftests/kvm/lib/memstress.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/testing/selftests/kvm/lib/memstress.c b/tools/testing/se= lftests/kvm/lib/memstress.c index 3632956c6bcf..df457452d146 100644 --- a/tools/testing/selftests/kvm/lib/memstress.c +++ b/tools/testing/selftests/kvm/lib/memstress.c @@ -65,6 +65,9 @@ void memstress_guest_code(uint32_t vcpu_idx) GUEST_ASSERT(vcpu_args->vcpu_idx =3D=3D vcpu_idx); =20 while (true) { + for (i =3D 0; i < sizeof(memstress_args); i +=3D args->guest_page_size) + (void) *((volatile char *)args + i); + for (i =3D 0; i < pages; i++) { if (args->random_access) page =3D guest_random_u32(&rand_state) % pages; --=20 2.39.1