Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp648735pxb; Wed, 8 Sep 2021 09:10:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJziIxlsij+IT4x7jBK1uLs7FJEPOakyDbczXwkknrQG6BPrfcTdr0nLIykXazzMOrYi8OW+ X-Received: by 2002:a05:6e02:1d9c:: with SMTP id h28mr470826ila.266.1631117422009; Wed, 08 Sep 2021 09:10:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631117421; cv=none; d=google.com; s=arc-20160816; b=G2eDgA2aBZ7LMdZX2n8OUZQ9YMPQ1FicaYFcRkFciMjPCg45lfeoYfbuGAg/IK7NZR PVzYQAx/eGe4GatmJMrIQ5OsrYAvL9M+bPOiSQt3WFN9o98ZAhDSvOUqPN9V+qHsezCd LU1ZoePRVzX+2q1aRjzUgksletbvnV6fOSvriiGFR/QVuoaZS3nAtFyWoKQUzfFucckH YlyWnunW88m6xjkWNkuIKBInEA7yxmH6q0IJZJaxBYQEuXKTfQBFTdDYOlXbQLt9O5HL hqo5nJPG0XzsFfoDiXuredZJTogc7PDEMVAe9Wzv3KM73GcfaDqiw4kDa7emIMr2SryE TN7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=OlLwloMM1UNziGhSZ73I5whfEToHkI4ZvWhuIcM5G8s=; b=ToQ4LeTY0wYhdDQZeQd0Yu70by0B+Pf2GQw1D0d3VpPgef9lTQ9b2SHYOrC1UCP5jj rNxNTfGB/OCihaD4KX1h05JGmGrCWpFpOx/uZONMSX35NL9JuUmM8oxWbrJRhrBcoCSz TfGbBOHujB9agLxh7icpp9DFB6ui17Bw9KZY5U5Bpv2R4yV5IuBaM6cSyxfpqh6qM5QK XS6JdBpxUlgBmfK4b932RVxYsDibgp7Sr2kA5mENG6PdB7+AXS1hrkxMFrSrec3X3Peh W7c7kqRQGNbTPGokiypKgLjbnR52HjfFdwVPZHVdTBqdH64xfDhCAbM/lfYamFzIy0s/ Mq/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=j5bGc2Ii; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s4si2316528jaa.5.2021.09.08.09.10.08; Wed, 08 Sep 2021 09:10:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=j5bGc2Ii; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1344503AbhIHQIc (ORCPT + 99 others); Wed, 8 Sep 2021 12:08:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54348 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344680AbhIHQI3 (ORCPT ); Wed, 8 Sep 2021 12:08:29 -0400 Received: from mail-yb1-xb2a.google.com (mail-yb1-xb2a.google.com [IPv6:2607:f8b0:4864:20::b2a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 68C63C061757 for ; Wed, 8 Sep 2021 09:07:21 -0700 (PDT) Received: by mail-yb1-xb2a.google.com with SMTP id v10so5322649ybm.5 for ; Wed, 08 Sep 2021 09:07:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=OlLwloMM1UNziGhSZ73I5whfEToHkI4ZvWhuIcM5G8s=; b=j5bGc2IirxaeHkq6J05nylDjOjhI8/WNnNCH218C+ljUcd3BGM6/pCCcKr7PlgQ9rX mqW/bc2JL6DSp2FiVstvuKUqj+sxSdPA6D3jxap2gRz/Av8srgQrIVRHdc/QBVyOAMzT gnjJFbXHDV1N79Vn4zAP+N9TEfUfDMpKdghWSrb3hKHoDqu8urjueLFJAX/2B0xLei0H kKvHUpnCdwec4gbQbL2VsN9H/6tmlUj7M6kQfhy4Cf2xb7nJqKGB0kLL59QoxiBmxHTO OsVNa+PcYwqBB1wJS9AUKqqv4GEtDXYhPdINQVZ6iU3jI863GfKQsA/GQcKcEoCtxCwm AcSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=OlLwloMM1UNziGhSZ73I5whfEToHkI4ZvWhuIcM5G8s=; b=GE2kT3VVlxvIpUf/5exafUDEk9/PImWEy2h5XdbsV29J7GJbLny2+tWCS9dS3RF4yk 5Cm8IGPv72tOwD8XIeMnGiKeI62nubTlJ7DJxLQQQE154K6XsAeIMXuNdR+5PaRKyz8o 4DWl8NrPjSI9IKLyRmEcKOSQ12wU7XIcSr0cLiF6TdKpcULkVkmfE+AMi2B8X5FzbMp9 ZzpvoT4BU+xrl2uk9k6sFct988CS6tZHSAsVNlcBL0y6v484tpEHuts9xIDie5W1mF5t wYyWJ77026gC3Y8VAYWLzJ5tWwsbn3N8os3MN2teXoi3saXECGmJSicbAutFvt9QYEjJ fsnA== X-Gm-Message-State: AOAM5301ZOzvO8Ut9lbkbxKhjeu+4//N72c+7CVh/pnSqK2qXusWQjSJ KjK/UfajOHsSebqzly04SdzaGSyzwqIbPOsoe9Hsqw== X-Received: by 2002:a25:abeb:: with SMTP id v98mr4667226ybi.30.1631117240489; Wed, 08 Sep 2021 09:07:20 -0700 (PDT) MIME-Version: 1.0 References: <20210830044425.2686755-1-mizhang@google.com> <20210830044425.2686755-3-mizhang@google.com> In-Reply-To: From: Mingwei Zhang Date: Wed, 8 Sep 2021 09:07:09 -0700 Message-ID: Subject: Re: [PATCH v3 2/2] selftests: KVM: use dirty logging to check if page stats work correctly To: Sean Christopherson Cc: Ben Gardon , Paolo Bonzini , kvm , LKML , David Matlack , Jing Zhang , Peter Xu Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Sep 6, 2021 at 1:05 PM Mingwei Zhang wrote: > > On Tue, Aug 31, 2021 at 9:58 AM Sean Christopherson wrote: > > > > On Mon, Aug 30, 2021, Ben Gardon wrote: > > > On Sun, Aug 29, 2021 at 9:44 PM Mingwei Zhang wrote: > > > > diff --git a/tools/testing/selftests/kvm/lib/test_util.c b/tools/testing/selftests/kvm/lib/test_util.c > > > > index af1031fed97f..07eb6b5c125e 100644 > > > > --- a/tools/testing/selftests/kvm/lib/test_util.c > > > > +++ b/tools/testing/selftests/kvm/lib/test_util.c > > > > @@ -15,6 +15,13 @@ > > > > #include "linux/kernel.h" > > > > > > > > #include "test_util.h" > > > > +#include "processor.h" > > > > + > > > > +static const char * const pagestat_filepaths[] = { > > > > + "/sys/kernel/debug/kvm/pages_4k", > > > > + "/sys/kernel/debug/kvm/pages_2m", > > > > + "/sys/kernel/debug/kvm/pages_1g", > > > > +}; > > > > > > I think these should only be defined for x86_64 too. Is this the right > > > file for these definitions or is there an arch specific file they > > > should go in? > > > > The stats also need to be pulled from the selftest's VM, not from the overall KVM > > stats, otherwise the test will fail if there are any other active VMs on the host, > > e.g. I like to run to selftests and kvm-unit-tests in parallel. > > That is correct. But since this selftest is not the 'default' selftest > that people normally run, can we make an assumption on running these > tests at this moment? I am planning to submit this test and improve it > in the next series by using Jing's fd based KVM stats interface to > eliminate the assumption of the existence of a single running VM. > Right now, this interface still needs some work, so I am taking a > shortcut that directly uses the whole-system metricfs based interface. > > But I can choose to do that and submit the fd-based API together with > this series. What do you suggest? I will take my point back, since some of the "TEST_ASSERT" in this selftest does assume that there is no other VM running even on 'default' case (ie., run ./dirty_logging_perf_test without arguments). Therefore, this patch will make the test flaky. I will go back to implement the fd based API and submit the code along with this selftest. Thanks. -Mingwei