Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1784609pxb; Wed, 10 Feb 2021 17:25:54 -0800 (PST) X-Google-Smtp-Source: ABdhPJzfcr7kTGcA0TLKZWLWKzSrCw7D/u5BbUE7Jzqms801xJVzJfpr3VsgkOtVhgmTaBhs+pa4 X-Received: by 2002:a17:906:8612:: with SMTP id o18mr5669271ejx.435.1613006753837; Wed, 10 Feb 2021 17:25:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613006753; cv=none; d=google.com; s=arc-20160816; b=oRq5P0oPjZygCCBGcXu8msIUs67xPcj0l57iSbM7EWW//suXpxSPvV9Z9DZyRPVGqt ndgCbSLWoYKHPhVkQW7S1adqXVUtV0nG7xvxSYTeFxypm3/4v36fzm1U04fS7i6Hnn24 izEU6T6H6AxmGL52Lmli/11eOr0/OhJuiUKJpR8wYW9USxaulk0GGbOFbLMhwsLzffMq DCpU6D5j8b8qGhFpUazv5N3L2b5pJuUexKLe3g5r7f0v9NXQ83d0l6pj+DtmVcSlQAaK pgit7hdnmcZPPCwNiBB5DcQ+wHVUmUq25RPgrLBKjTcU5sdBST3q3kggUcVK7ydxcgkr URjg== 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=pY8l/20On2UFTPjuvwZ65am2VYSsb4OULocEQ2YqOYM=; b=q6gfdIUOGt9do52WOWzDKjAByzLcsr1E+OIyai08ZryxHxStJTTblfs7WqaYFDel70 2q21nfHAzjJkei3zORWYxhVHzDal4U21RJtMDpDbeRmvKf37HE/LZJM8B1IwjdntWXZ6 UNZhDRqIO77LhSexRny/WdE/OokzVnPFBF/Ia1ApSB2FFkXcutx56229jLahoGOt5Emm YqVfY3vHD4knbG+PYghRKA/2SAwnohKZaAJ9fXC5rxOWLv0xz94GaMUuDoSIjQfabDJH Jg9k5KgJIP6xaysu68DF6nrK0Fc216VkNUq2wljxylUADX+BtxDIL5GKxtL8q3mLvMqm xMXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="i2SQ/dTz"; 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 n2si2917936ejl.444.2021.02.10.17.25.30; Wed, 10 Feb 2021 17:25:53 -0800 (PST) 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=20161025 header.b="i2SQ/dTz"; 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 S229972AbhBKBYf (ORCPT + 99 others); Wed, 10 Feb 2021 20:24:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41658 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229584AbhBKBYd (ORCPT ); Wed, 10 Feb 2021 20:24:33 -0500 Received: from mail-il1-x134.google.com (mail-il1-x134.google.com [IPv6:2607:f8b0:4864:20::134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B4AFFC061756 for ; Wed, 10 Feb 2021 17:23:53 -0800 (PST) Received: by mail-il1-x134.google.com with SMTP id y5so3732119ilg.4 for ; Wed, 10 Feb 2021 17:23:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=pY8l/20On2UFTPjuvwZ65am2VYSsb4OULocEQ2YqOYM=; b=i2SQ/dTzzZaKwHrkjY3KBnmt1Bn1PjJF000isMS95u/EmLn1S8ZG4y4hQalydI1Jpm UXzPXSOgiUtofMLohzbgTgLytTOp7Y49G9UinDbwYl3WqURejDVKvG5wL04IgDQlH+6M jMibcB4RptQN8WwSdqlzWMLzwGPQvRjCSMP3Qf9xto7bbz0FUIQkWoAGUZgnSzVhtAPA t1atncLLFBei6BGFr4uqeIopdMS6mMI82yPVyew0i3KqTPy50lnYFu1sh2MQ0jNHG21y 53j9/+00boIBLiny465MpsTqhFmYOPD5cbL5e46IaDfcZT9TbUdZFSle/oK2YhWGKMAo pVag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=pY8l/20On2UFTPjuvwZ65am2VYSsb4OULocEQ2YqOYM=; b=TsXc8KN4XByaFK6wIefx8ahVhRo9VQmeQ/ks6ie7Raf9TgxppZpjXK9pY8+d6mGN8j rkpZ4IrFxE9YKyVBxjSgq9sxTXHektXkQUhTC5JWmtlT4fb7YfPG527M3N6RwX3ooP4H 9tcec8keSqaiD+c8yq0dLexYYVwzR5fkNtwo0E75ZhRNIEErixoRxk18Dd3O7lpvHib5 kBByqmDafQAnElUgtgvUKw9bV1RK3jUsHaSrLGNll4gybNDeBiCEoQjgZJLsyZGfRp8W 5rJ68tFoy1d3WnHZ7ooC+S/8i9xtW/LtAV7KRxTFS7v9rS3Il3ZfTj9shJfZHxe17dT5 WhUQ== X-Gm-Message-State: AOAM533Dv3BeCrtv6sDwYeISuD5QgWWD0ZtrwqQbslVpRfqUhQgjCjpi 6k/jr4A0WEa0RtZQ0853DkRozJh3XX6NUraWTfNqPg== X-Received: by 2002:a05:6e02:1888:: with SMTP id o8mr3508908ilu.154.1613006632917; Wed, 10 Feb 2021 17:23:52 -0800 (PST) MIME-Version: 1.0 References: <20210210230625.550939-1-seanjc@google.com> <20210210230625.550939-9-seanjc@google.com> In-Reply-To: <20210210230625.550939-9-seanjc@google.com> From: Ben Gardon Date: Wed, 10 Feb 2021 17:23:42 -0800 Message-ID: Subject: Re: [PATCH 08/15] KVM: selftests: Use perf util's per-vCPU GPA/pages in demand paging test To: Sean Christopherson Cc: Paolo Bonzini , kvm , LKML , Yanan Wang , Andrew Jones , Peter Xu , Aaron Lewis Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 10, 2021 at 3:06 PM Sean Christopherson wrote: > > Grab the per-vCPU GPA and number of pages from perf_util in the demand > paging test instead of duplicating perf_util's calculations. > > Note, this may or may not result in a functional change. It's not clear > that the test's calculations are guaranteed to yield the same value as > perf_util, e.g. if guest_percpu_mem_size != vcpu_args->pages. > > Signed-off-by: Sean Christopherson Reviewed-by: Ben Gardon > --- > .../selftests/kvm/demand_paging_test.c | 20 +++++-------------- > 1 file changed, 5 insertions(+), 15 deletions(-) > > diff --git a/tools/testing/selftests/kvm/demand_paging_test.c b/tools/testing/selftests/kvm/demand_paging_test.c > index 5f7a229c3af1..0cbf111e6c21 100644 > --- a/tools/testing/selftests/kvm/demand_paging_test.c > +++ b/tools/testing/selftests/kvm/demand_paging_test.c > @@ -294,24 +294,13 @@ static void run_test(enum vm_guest_mode mode, void *arg) > TEST_ASSERT(pipefds, "Unable to allocate memory for pipefd"); > > for (vcpu_id = 0; vcpu_id < nr_vcpus; vcpu_id++) { > - vm_paddr_t vcpu_gpa; > + struct perf_test_vcpu_args *vcpu_args; > void *vcpu_hva; > - uint64_t vcpu_mem_size; > > - > - if (p->partition_vcpu_memory_access) { > - vcpu_gpa = guest_test_phys_mem + > - (vcpu_id * guest_percpu_mem_size); > - vcpu_mem_size = guest_percpu_mem_size; > - } else { > - vcpu_gpa = guest_test_phys_mem; > - vcpu_mem_size = guest_percpu_mem_size * nr_vcpus; > - } > - PER_VCPU_DEBUG("Added VCPU %d with test mem gpa [%lx, %lx)\n", > - vcpu_id, vcpu_gpa, vcpu_gpa + vcpu_mem_size); > + vcpu_args = &perf_test_args.vcpu_args[vcpu_id]; > > /* Cache the HVA pointer of the region */ > - vcpu_hva = addr_gpa2hva(vm, vcpu_gpa); > + vcpu_hva = addr_gpa2hva(vm, vcpu_args->gpa); > > /* > * Set up user fault fd to handle demand paging > @@ -325,7 +314,8 @@ static void run_test(enum vm_guest_mode mode, void *arg) > &uffd_handler_threads[vcpu_id], > pipefds[vcpu_id * 2], > p->uffd_delay, &uffd_args[vcpu_id], > - vcpu_hva, vcpu_mem_size); > + vcpu_hva, > + vcpu_args->pages * perf_test_args.guest_page_size); > if (r < 0) > exit(-r); > } > -- > 2.30.0.478.g8a0d178c01-goog >