From mboxrd@z Thu Jan 1 00:00:00 1970 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 8D4DFC43217 for ; Wed, 4 May 2022 23:07:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1383629AbiEDXHS (ORCPT ); Wed, 4 May 2022 19:07:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58552 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380511AbiEDXAE (ORCPT ); Wed, 4 May 2022 19:00:04 -0400 Received: from mail-yb1-xb49.google.com (mail-yb1-xb49.google.com [IPv6:2607:f8b0:4864:20::b49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 88D5C57B2D for ; Wed, 4 May 2022 15:53:28 -0700 (PDT) Received: by mail-yb1-xb49.google.com with SMTP id b33-20020a25aea1000000b0064588c45fbaso2271859ybj.16 for ; Wed, 04 May 2022 15:53:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=reply-to:date:in-reply-to:message-id:mime-version:references :subject:from:to:cc; bh=1Ko89WgoR4QoPr6VqUAmRTjNB65KGevR+vu8Lfe+KrY=; b=hpwTYNVKayJGrqxOPwmZTNGFN/7HtMmZwmydASwz0toZ91ismPoEA3BHf7yB3mF0uI 0ZZwLS7tDoAO9i9jqoXZLfJh0hnPWnyvQoGSUwnAwkFvYIFwM+ghzuoRM+KIXOi9y5bG w2zCfbsMMH+e3h+27GWN/m/TvbtQdMFculxXV3ABs29LwJOdf9lllFbHo+jQH/kHirNb xoA0grfeZl8pLt/Uq+fWXcupWBFmHXvjHK3ANNVFC7/C0qx60/zHA0F5+dfiiS8Jsg8S 8kju4HrgNQwiCDoKQDiGnYlEVPBYFafuUR0QQKJZnwiPwHpozct6r4AABGnbqZ2NX38Z CV+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:reply-to:date:in-reply-to:message-id :mime-version:references:subject:from:to:cc; bh=1Ko89WgoR4QoPr6VqUAmRTjNB65KGevR+vu8Lfe+KrY=; b=5NvDq6XVuR2hZ+GMN3dlDzJv9ZuOMMUwqeIoZin4aio6i0Be5GmHyEitztaDOLrOr8 Is+FbXms2QHDiDL7RIxk9ZyagW5J9kjFrxP+ODMDSXNg1ZPZBppdsH3H5a9UcU7kpbll 9A8vPaXa6MzJAmrZ4mQFCDWGf2+4A7Pza4uMxIgiuFY5bwt88t+6khzfQojUj/OTWw2N 3G0EYFoiCqwFboj8WGWOH+8M/zDroN8Vf99MvpDoxyHoWPdQhK/sR9UcPUeeK2eFePA0 6VZlqY8Kz85t4b/WqNTbhsdwm5KPMrkzt/UyXSFbr7qQ8IqByjEWLAljrG8aW0tCVTxu UV+w== X-Gm-Message-State: AOAM532egIZVEac93nviRH3NTaL2EmM+vrK1DQEKAXAT0jK+mLCHU5xi Hv++4MwLcC+tcwJQhcXKk9o58Nd0x2Q= X-Google-Smtp-Source: ABdhPJxIyNosEuODp1hRl7pKdS4yHHRTzfhNLT+Ogmit5H7vWGukQNk7xEe18n7Uyy+dvIAC6pWKQmdzoOE= X-Received: from seanjc.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:3e5]) (user=seanjc job=sendgmr) by 2002:a25:2646:0:b0:645:8261:d7ff with SMTP id m67-20020a252646000000b006458261d7ffmr20289498ybm.351.1651704774982; Wed, 04 May 2022 15:52:54 -0700 (PDT) Reply-To: Sean Christopherson Date: Wed, 4 May 2022 22:49:04 +0000 In-Reply-To: <20220504224914.1654036-1-seanjc@google.com> Message-Id: <20220504224914.1654036-119-seanjc@google.com> Mime-Version: 1.0 References: <20220504224914.1654036-1-seanjc@google.com> X-Mailer: git-send-email 2.36.0.464.gb9c8b46e94-goog Subject: [PATCH 118/128] KVM: selftests: Remove vcpu_get() usage from dirty_log_test From: Sean Christopherson To: Paolo Bonzini Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, Vitaly Kuznetsov , Andrew Jones , David Matlack , Ben Gardon , Oliver Upton , Sean Christopherson Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Grab the vCPU from vm_vcpu_add() directly instead of doing vcpu_get() after the fact. This will allow removing vcpu_get() entirely. Signed-off-by: Sean Christopherson --- tools/testing/selftests/kvm/dirty_log_test.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/tools/testing/selftests/kvm/dirty_log_test.c b/tools/testing/selftests/kvm/dirty_log_test.c index b61af23ba434..73c6fd9c850c 100644 --- a/tools/testing/selftests/kvm/dirty_log_test.c +++ b/tools/testing/selftests/kvm/dirty_log_test.c @@ -668,7 +668,7 @@ static void vm_dirty_log_verify(enum vm_guest_mode mode, unsigned long *bmap) } } -static struct kvm_vm *create_vm(enum vm_guest_mode mode, uint32_t vcpuid, +static struct kvm_vm *create_vm(enum vm_guest_mode mode, struct kvm_vcpu **vcpu, uint64_t extra_mem_pages, void *guest_code) { struct kvm_vm *vm; @@ -679,7 +679,7 @@ static struct kvm_vm *create_vm(enum vm_guest_mode mode, uint32_t vcpuid, vm = __vm_create(mode, DEFAULT_GUEST_PHY_PAGES + extra_pg_pages); log_mode_create_vm_done(vm); - vm_vcpu_add(vm, vcpuid, guest_code); + *vcpu = vm_vcpu_add(vm, 0, guest_code); return vm; } @@ -713,10 +713,8 @@ static void run_test(enum vm_guest_mode mode, void *arg) * (e.g., 64K page size guest will need even less memory for * page tables). */ - vm = create_vm(mode, 0, - 2ul << (DIRTY_MEM_BITS - PAGE_SHIFT_4K), - guest_code); - vcpu = vcpu_get(vm, 0); + vm = create_vm(mode, &vcpu, + 2ul << (DIRTY_MEM_BITS - PAGE_SHIFT_4K), guest_code); guest_page_size = vm_get_page_size(vm); /* -- 2.36.0.464.gb9c8b46e94-goog