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 8230BC05027 for ; Thu, 26 Jan 2023 23:12:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233401AbjAZXMK (ORCPT ); Thu, 26 Jan 2023 18:12:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34954 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232386AbjAZXMI (ORCPT ); Thu, 26 Jan 2023 18:12:08 -0500 Received: from mail-ed1-x52e.google.com (mail-ed1-x52e.google.com [IPv6:2a00:1450:4864:20::52e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E3E0D6A302 for ; Thu, 26 Jan 2023 15:12:05 -0800 (PST) Received: by mail-ed1-x52e.google.com with SMTP id v10so3287068edi.8 for ; Thu, 26 Jan 2023 15:12:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=9LFXa2PlUiluAxw9v2Lp9fRg0TKwZi7Il2FLTW8iHNY=; b=bqBGg/V9is3o8VI/lM7jiQZsvPDUZNgj8CG353W3FKYyzqRbrFs175+aajvWs8inWC 0K/VFzZLF0s6EHM3hjIbyxo3DRkRQPv36i95WY5XpppLMz1D2NVqs06LQR2gZfaD5790 Li3kwy7UN7ZYyP6OTud65d6P62cPtVmYwi7JiH1SPYeq5TBRs+oohoF8T8xs/2ipRRPL oIbEhzt/N9FuqWhOnwevrAM9vapJqxhCy12DEfoUWwndVXJ3G0D4E/vsHBWC5Ongenaf hYt3jSu0O8Hj4JtQ7Xu6qew2EEykrDLLa7E+aMJ+sihGxHoFue1ungnopflAT37GV3Wv egOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=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=9LFXa2PlUiluAxw9v2Lp9fRg0TKwZi7Il2FLTW8iHNY=; b=bdETYHE+fErcEiv+6NniFBQl8H+7Ut8N7SDfGiXBBzOBwybMAhgdmQChfCs0K8xpb+ sqP/uoIPv6WPl4/87M0xWvsSKu0GPANQ6YjpEmUNMwhio2LaSmx+g/xW2GIvssGCPzHx 6C8FE8iJGjP2YcdtqCNJOWNU0v4fl8f7z+SrR4ADcDoyji8BmAKO9i1dE1h3rBPQvzfO U9MGrd8p3mowuojYq43E19ZmfcIGXFJIfvwjsF8e71VHoCxB9s4zftEPjMjp/XssIUK0 oVftRKfROU/WEfgINUff1gXOAlkrcuMHeuzIJN0ELBzEA4AZBob1efesgcszeiZ9cf+y KeEA== X-Gm-Message-State: AFqh2koT6u+5Rw4JGKZf9QT2Q0V9U7RIj4nK/NZvgGOjh+c0I6UT5nLO I5JeCPvoMGPK9jbS0NSP/Gdr0vilkrgnb5gyHjJMnGyQ+yk8JVf2 X-Google-Smtp-Source: AMrXdXt9wDKEURlwnuwvbCVx62WUzh8aAanaLY9EhCKHZi+AdtcSZreR4BRKbFPvanvwgfKYopac3JVqdz2AqW4ZOmk= X-Received: by 2002:a05:6402:2946:b0:49e:45a8:4a4b with SMTP id ed6-20020a056402294600b0049e45a84a4bmr5680900edb.37.1674774723963; Thu, 26 Jan 2023 15:12:03 -0800 (PST) MIME-Version: 1.0 References: <20230125182311.2022303-1-bgardon@google.com> <20230125182311.2022303-3-bgardon@google.com> In-Reply-To: From: Ben Gardon Date: Thu, 26 Jan 2023 15:11:52 -0800 Message-ID: Subject: Re: [PATCH v4 2/2] selftests: KVM: Add dirty logging page splitting test To: Vipin Sharma Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, Paolo Bonzini , Peter Xu , Sean Christopherson , David Matlack , Ricardo Koller Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jan 26, 2023 at 3:04 PM Vipin Sharma wrote: > > On Thu, Jan 26, 2023 at 2:52 PM Ben Gardon wrote: > > > > On Thu, Jan 26, 2023 at 12:06 PM Vipin Sharma wrote: > > > > > > On Wed, Jan 25, 2023 at 10:23 AM Ben Gardon wrote: > > > > > > > +static void run_vcpus_get_page_stats(struct kvm_vm *vm, struct kvm_page_stats *stats, const char *stage) > > > > +{ > > > > + int i; > > > > + > > > > + iteration++; > > > > + for (i = 0; i < VCPUS; i++) { > > > > + while (READ_ONCE(vcpu_last_completed_iteration[i]) != > > > > + iteration) > > > > + ; > > > > + } > > > > + > > > > + get_page_stats(vm, stats, stage); > > > > > > get_page_stats() is already called in run_test() explicitly for other > > > stats. I think it's better to split this function and make the flow > > > like: > > > > > > run_vcpus_till_iteration(iteration++); > > > get_page_stats(vm, &stats_populated, "populating memory"); > > > > > > This makes it easy to follow run_test_till_iteration() and easy to see > > > where stats are collected. run_test_till_iteration() can also be a > > > library function used by other tests like dirty_log_perf_test > > > > Yeah, either way works. We can do it all in the run_tests function as > > I originally had or we can have the run vcpus and get stats in a > > helper as David suggested or we can separate run_vcpus and get_stats > > helpers as you're suggesting. I don't think it makes much of a > > difference. > > If you feel strongly I can send out another iteration of this test. > > > > I should have read David's comment and responded in that version. > No strong feelings. It is up to you. No worries, it probably would have been easier to track down if I had links in the cover letter. :) > > > > > > > > > > > + dirty_log_manual_caps = 0; > > > > + for_each_guest_mode(run_test, NULL); > > > > + > > > > + dirty_log_manual_caps = > > > > + kvm_check_cap(KVM_CAP_MANUAL_DIRTY_LOG_PROTECT2); > > > > + > > > > + if (dirty_log_manual_caps) { > > > > + dirty_log_manual_caps &= (KVM_DIRTY_LOG_MANUAL_PROTECT_ENABLE | > > > > + KVM_DIRTY_LOG_INITIALLY_SET); > > > > + for_each_guest_mode(run_test, NULL); > > > > + } > > > > > > Should there be a message to show that this capability is not tested > > > as it is not available? > > > Or, there can be a command line option to explicitly provide intent of > > > testing combined, split modes, or both? Then test can error out > > > accordingly. > > > > Sure, that would work too. If I send another version of this series I > > can add a skip message, but I don't want to re-add an option to > > specify whether to run with MANUAL_PROTECT, because that's what I had > > originally and then David suggested I remove it and just always run > > both. > > Sounds good. > > Reviewed-By: Vipin Sharma Thanks!