Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp1461407rwl; Wed, 12 Apr 2023 13:15:45 -0700 (PDT) X-Google-Smtp-Source: AKy350ZagIlLti6LSEOsP9hS9lEydQDEmlgLy114NpqAktGDd4cpdkGRKiZXfzCJwR1IHevey8D0 X-Received: by 2002:a17:906:2295:b0:8aa:a9fe:a3fc with SMTP id p21-20020a170906229500b008aaa9fea3fcmr121091eja.8.1681330545441; Wed, 12 Apr 2023 13:15:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681330545; cv=none; d=google.com; s=arc-20160816; b=ngFeBZ7t4ZBDHMhTpNEr3pGvqbKhhjII6WXb/nQOOh7HvA8KdIJuP8Rh4kjclKGffB XXXuQlFR+PIw4F++Zl2MnbIVXc7zPzu02AgWQLv3Qe4F08L7MkkbfBHzLSqFAMjyueoq xVBkzHq6xThTiiTnZy68VZbH1OkSl/gwzDj7TfTVBDskLHzMWqIBG1IK4+tV59qAfYbp Icim0jcWU6l9pW68V9ohw5BoOSGU26Uq3S0H0mCrUzbSm29ZmGT279psAI8uaW6hKOCm iezqaldMEdxmrI6QNMuSpvDd6HJgUTqvIoA4MRx/7JLKPIVmBv7ARP8nUf/A2vAzW+Yb yrEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=i5jrl4HyYmJIvlEgkd7txy7LdCkCR9JKfs0t6bJZ/6M=; b=uusKr2/vZJ+EpnFSTQy5uZAdO10TpAQiPXGVe7fdU8Gb6YD825DVlurWyksfYUlsiP 4iO+WG6MCLNhanxIwIG97yKwdTac157sUTMLjcwAGdsUvxDq1ln69haRFq/eiHE25wYp f23O1qHXQ95tqyQ9ASDnvb2D0lpXyzglbY8MByoIl4VqdmK1t/a/Bac/xsREhPi7BlvR Y0VW71Qq46zSgU+reFOz++vNVUk67OFQBVfEdUCuIWaUaVmo9zEKL8GZCGpt8oMwNtIM dWdyTgbt7/zdLjT5F2iEQfSQ7CNs57BWN/l+q4FB/mPuE+iO8D7/jymjpSqVdDysIYcO U82g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=accY5vOL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i25-20020aa7dd19000000b00504bba95e20si1675863edv.64.2023.04.12.13.15.20; Wed, 12 Apr 2023 13:15:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=accY5vOL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230155AbjDLUKP (ORCPT + 99 others); Wed, 12 Apr 2023 16:10:15 -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-Type: text/plain Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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/selftests/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 == vcpu_idx); while (true) { + for (i = 0; i < sizeof(memstress_args); i += args->guest_page_size) + (void) *((volatile char *)args + i); + for (i = 0; i < pages; i++) { if (args->random_access) page = guest_random_u32(&rand_state) % pages; -- 2.39.1