Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp2792101rwl; Thu, 13 Apr 2023 10:54:39 -0700 (PDT) X-Google-Smtp-Source: AKy350YhUDvk3K3pBBMLgsej65zss84cC0lc/zPMQSWKDnmXYrfCrRV03bhNve7Gwz4qQzHpT1fv X-Received: by 2002:a17:902:da8a:b0:1a6:7510:3341 with SMTP id j10-20020a170902da8a00b001a675103341mr3481709plx.69.1681408479168; Thu, 13 Apr 2023 10:54:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681408479; cv=none; d=google.com; s=arc-20160816; b=JGlGLpXxUuSojpxi5l/O7Lr6SifLf0I+xI0F8ldjRJXyzHOZ59R2iYtlH/ASgbYDXK EPvRmcK3ZnkpUeL116QmgnoN/oDZlizLAMHjw1aPVgQfMmFiDNjL53yr8mkjuekglzAs 0cxpVWIxDfvoxUfUYRbz9VCzNi9RQb7piuPPxoyRC591eNWBzCwP7uRF+PJ5QWAjmRFB 88uUF+lz5Ck4J2jVF0wm4sxTBgbMkXBqCm8vcaQIwTCUv69omkhOCYaWaof8upL0Hlba j0bfOy3c1swFk8xOJydnBbEP8ISfOM4fBXqg9SGACnF4waWztLFQs91f6Wmjbigxzn2F +Tmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=B1jnZnwN/IOOycxEpyhHeYgSCymd9H+aV9u/LeikvAg=; b=PIt5Ncx+OBr+t1qpjFRSJ37PWt1uy6cDD8NiLS0t4DBbkWcuGeOXqryZWwEU9+xADv DQ4XAn/eIimtZq5JzeDLcV21e1Ed9zRueJU0gu4JSlJ5z5tHC/SVESIicNINI4VHgCKG 0+WFqABdnrNqtkLPn44rd44UmvelIEDp9Tp7suyeMyqGaLfSnAjQssftklAatFKKQIJ5 /Qq1ztvm6o9DCNPIxqHJg5WbZdGUy7EYmYHHz9eXiCXD21yLUEZw16n7Abq+VvUKNpHI a/Y1HfmNGOCfwHpnB8gH8yI2cPlHmPgxrukIDaFxSe0Xzialy+bLShnZULDNSOeAZolF f/Wg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b="xv33HL/S"; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l3-20020a170902f68300b001a1b776489dsi2725956plg.300.2023.04.13.10.54.24; Thu, 13 Apr 2023 10:54:39 -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=@google.com header.s=20221208 header.b="xv33HL/S"; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229786AbjDMRhh (ORCPT + 99 others); Thu, 13 Apr 2023 13:37:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59762 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229479AbjDMRhf (ORCPT ); Thu, 13 Apr 2023 13:37:35 -0400 Received: from mail-yb1-xb30.google.com (mail-yb1-xb30.google.com [IPv6:2607:f8b0:4864:20::b30]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2F3B59029 for ; Thu, 13 Apr 2023 10:37:34 -0700 (PDT) Received: by mail-yb1-xb30.google.com with SMTP id i20so19950485ybg.10 for ; Thu, 13 Apr 2023 10:37:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1681407453; x=1683999453; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=B1jnZnwN/IOOycxEpyhHeYgSCymd9H+aV9u/LeikvAg=; b=xv33HL/Sgz5q7Yb32dgAQIxQHaYsTs1Ftmkoa477GEep3uRJcQJS6PO6P/CD+63CBC 7tTmF9AlscXTRE36iKX5JBKqyiT5bNgSybovp2wpGA+tNaX++49xBa+MDD8Fv+7Y7oDG VpogIGbm1Fe0iyh5T9mbYYWHoQT+IEt3zH+l5qYDn+4Ay3e+zO50JUdZ+vBDwDMvhv99 Hja9X1DItRSGLhqMCtBKsslxiTOpOtxhvcBWiWYtwAhQDsNjdSBVhZWDX5YHYhPV5Vo8 T27BfNsRFq1j5pGTwMDbffM8HaDt+C/rb49bFht9N8O4Z42NEtUEoHwRdivvwGKgGfO/ wqkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681407453; x=1683999453; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=B1jnZnwN/IOOycxEpyhHeYgSCymd9H+aV9u/LeikvAg=; b=faAEYIxqVRFzIXL7zFVbPqFXc9UBPxF3TIxbgkG+xJ5TClawxGmPcRTiZoB5hDUO4Q d5FVK537Xae7IIRZJg0ro1HDBM5Xc2YpAXCWfqKeJMF1nlLOHNi9wM5gE6tRHxMeNJCB +aM4jvR0MbYEOukVsmHRenS3lRWz7IOyjPhwohcONQMIbfPlKSjJ3+mBQU16Gf7BTAAG v9RQ7WqbYsRqHOB3/BFUjR88u5phtFT/iFKrvUkEKMfz37s5rrTtxxHcTGndBI9IisK1 Y8szoHOZflXwFYwsFq1q32Dpb38XQco0FkPFRbriYF6RymP743dTFUv49gVgvpem4iYd Z+QQ== X-Gm-Message-State: AAQBX9dUrjL9OqlQLOXEU16XORvnPl690DxM3HcncO58aMwTu+i5sYT5 MFkSJ7a5CIzOK0q3Ss4Yhxp4ZGcu0MyrR7hcGloRHQ== X-Received: by 2002:a25:df41:0:b0:b8f:3367:d5e0 with SMTP id w62-20020a25df41000000b00b8f3367d5e0mr1949248ybg.13.1681407453095; Thu, 13 Apr 2023 10:37:33 -0700 (PDT) MIME-Version: 1.0 References: <20230412200913.1570873-1-pbonzini@redhat.com> In-Reply-To: <20230412200913.1570873-1-pbonzini@redhat.com> From: Vipin Sharma Date: Thu, 13 Apr 2023 10:36:57 -0700 Message-ID: Subject: Re: [PATCH] selftests/kvm: touch all pages of args on each memstress iteration To: Paolo Bonzini Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, bgardon@google.com, seanjc@google.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL 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 On Wed, Apr 12, 2023 at 1:09=E2=80=AFPM Paolo Bonzini = wrote: > > 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. > AMD and eptad=3D0 reasoning you gave in https://lore.kernel.org/lkml/199f404d-c08e-3895-6ce3-36b21514f487@redhat.co= m should also be included here. "It also reproduces on Intel with pml=3D0 and eptad=3D0; the reason is due to the different semantics of dirty bits for page-table pages on AMD and Intel. Both AMD and eptad=3D0 Intel treat those as writes, therefore more pages are dropped before the repopulation phase when dirty logging is disabled. The "missing" page had been included in the population phase because it hosts the page tables for vcpu_args, but repopulation does not need it." > 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 =3D=3D vcpu_idx); > > while (true) { > + for (i =3D 0; i < sizeof(memstress_args); i +=3D args->gu= est_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; > -- > 2.39.1 > Apart from the commit log. Reviewed-by: Vipin Sharma