Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp1128526ybb; Fri, 20 Mar 2020 13:57:37 -0700 (PDT) X-Google-Smtp-Source: ADFU+vvhIRGqIWQfUw2A+1MJNfWvvZWqSJ5/G8t+ulY8Sm3mqfmkyG6gSyQM0SUECQR5ZesNrNmy X-Received: by 2002:aca:5d8a:: with SMTP id r132mr6497752oib.129.1584737856964; Fri, 20 Mar 2020 13:57:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584737856; cv=none; d=google.com; s=arc-20160816; b=ODalOvBclbplhv1j8ZXqJ5wSZiFx1c1h9rjEbcrbRKfGIHhMbz0+/Fs/MJ7rMivumf bYtUpxTTFXY0rareH/uoD7b6DZcpjW9Spe/JwOi37TUwa1OlCsSHUHH9uykC0XFGzRhP ei86vwlEACR2a5JVeGGrNQtCdCUiL/PjDOBddQUv7+fvp1hRfZ4nx68ZAAShahBIMmVu SWhvBuJZn/yRh6GKTdV3QYboTrFD1pjxtXIpwyJEkJq2OmTQUYpTpchQ3FFwdJshJbv2 93sb/72n7W2hlI4ARhWmoiZOo3O4lS1i9G0rE5FuS1Tfs0/ONpE6LxmXoWFr5rAGwgGp rftQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :ironport-sdr:ironport-sdr; bh=9JgmNsY6puEE6ECFmRNXCF3iu33iC+VfhCm/6fBh6gI=; b=q4JAIOc4at05LQkOFfmuJa6H6vOfANSIFIuEu77FOayq8M62NgPZ1SRzz6tOqCKUNM oE24y45vRkb0nUycD2Nl0VoZeYTqV0mtmN8CBAT20S1fexujYnXqqTT82F9HCL5ELa0n YMPC0oV2m0Nly281mlCMf3QZReM7TTYI3WuawRnq7BPvXQLX7+7BPGEZX11Aw7ebXvpW 3jUMXQn4r9Ev4DlsB84HFtkQQDscMuKLRFfKYaFzOns42KCfPoTexkgbqNBK4rC9Jgqm VyJENm0Zgb8V+rBRuc3P+TJK0VxcKatJaoNtyroP0Y4QYZ02NBQlbRuvqvDMVk2E9yhL 4fig== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i7si3798334otp.96.2020.03.20.13.57.24; Fri, 20 Mar 2020 13:57:36 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727384AbgCTU4L (ORCPT + 99 others); Fri, 20 Mar 2020 16:56:11 -0400 Received: from mga11.intel.com ([192.55.52.93]:32133 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727202AbgCTUzs (ORCPT ); Fri, 20 Mar 2020 16:55:48 -0400 IronPort-SDR: Wc3WN+IL7OXdYlYJOJqLWRLz+B0iccnMlhm3GVaySI99H7a9LvF579M309Lwv/u2MrIy69vyPQ uvpHg3cRw86A== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Mar 2020 13:55:48 -0700 IronPort-SDR: mecXOMDxpsSnYWlW+kNP6pgB55m4qSt40p2DV2i7agnEreJw/r+sNhb4EwakwhirV08mPlHP0I 18mI0TIKMxOA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,285,1580803200"; d="scan'208";a="280543323" Received: from sjchrist-coffee.jf.intel.com ([10.54.74.202]) by fmsmga002.fm.intel.com with ESMTP; 20 Mar 2020 13:55:48 -0700 From: Sean Christopherson To: Christian Borntraeger , Janosch Frank , Paolo Bonzini Cc: David Hildenbrand , Cornelia Huck , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Qian Cai , Peter Xu Subject: [PATCH 3/7] KVM: selftests: Take vcpu pointer instead of id in vm_vcpu_rm() Date: Fri, 20 Mar 2020 13:55:42 -0700 Message-Id: <20200320205546.2396-4-sean.j.christopherson@intel.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200320205546.2396-1-sean.j.christopherson@intel.com> References: <20200320205546.2396-1-sean.j.christopherson@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The sole caller of vm_vcpu_rm() already has the vcpu pointer, take it directly instead of doing an extra lookup. Signed-off-by: Sean Christopherson --- tools/testing/selftests/kvm/lib/kvm_util.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tools/testing/selftests/kvm/lib/kvm_util.c b/tools/testing/selftests/kvm/lib/kvm_util.c index 8a3523d4434f..9a783c20dd26 100644 --- a/tools/testing/selftests/kvm/lib/kvm_util.c +++ b/tools/testing/selftests/kvm/lib/kvm_util.c @@ -393,7 +393,7 @@ struct vcpu *vcpu_find(struct kvm_vm *vm, uint32_t vcpuid) * * Input Args: * vm - Virtual Machine - * vcpuid - VCPU ID + * vcpu - VCPU to remove * * Output Args: None * @@ -401,9 +401,8 @@ struct vcpu *vcpu_find(struct kvm_vm *vm, uint32_t vcpuid) * * Within the VM specified by vm, removes the VCPU given by vcpuid. */ -static void vm_vcpu_rm(struct kvm_vm *vm, uint32_t vcpuid) +static void vm_vcpu_rm(struct kvm_vm *vm, struct vcpu *vcpu) { - struct vcpu *vcpu = vcpu_find(vm, vcpuid); int ret; ret = munmap(vcpu->state, sizeof(*vcpu->state)); @@ -427,7 +426,7 @@ void kvm_vm_release(struct kvm_vm *vmp) int ret; while (vmp->vcpu_head) - vm_vcpu_rm(vmp, vmp->vcpu_head->id); + vm_vcpu_rm(vmp, vmp->vcpu_head); ret = close(vmp->fd); TEST_ASSERT(ret == 0, "Close of vm fd failed,\n" -- 2.24.1