Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp4393391ybb; Tue, 14 Apr 2020 06:30:00 -0700 (PDT) X-Google-Smtp-Source: APiQypIXPM22YNBNnnQcl/RC+sbs1qJzelUWXj7yD8pti9ZRB57OxwOB+7d1IPJovpFehDJFHQjr X-Received: by 2002:a05:6402:b99:: with SMTP id cf25mr12877498edb.372.1586871000285; Tue, 14 Apr 2020 06:30:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586871000; cv=none; d=google.com; s=arc-20160816; b=KuwU7pS+pkaImC0UoJ77+bIGLg5zhtaXCOaXIAv7kwL1u/C6zanx0Du1Pm1I6SDkJn +/666RLp9wocT7YHA584YTLp7NMWJApsQ8UMxwgSZnbEy4mcpGNTLurS2PpPLw5Pf4Ri LGpqKupYqyjpnY3JU0gzRjG+jXpbibHsd6HDlHQsiIpJqK0Br1eMq4rAxkAmkune4laZ cypJKigVYaFU8ayWWDo2y3bOiXWPa2TfuvLfWuK225Ski5uhqHYcQMT2k36TqToQAhYh Z+gdDdbEvFMjmYk8qlQ16kZJmmlyFgdM5p0xl9dYxeilFg1gnFXOWe9+wAdHvqL7vJEN ucZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=LE4Q5pv4+ttMd6fa4HJ5hzCrYdDEL+fHTEMdK/F84bA=; b=tLmcnWs80IHf/XWS+GTCYTcRx87MZ4iRpUSA6exrH7s9SeANGtOpyFs/mz4+12wwSN RDgSnm31cYgClv3ZLghqPmVGc2IKl5CvLRfo0NtwL4K2/nv0UQx2fxwfiJRHNTTgZo4k knRjjX0FvgrnMPBUIObrI67Qu9jrdDOYU57TDKE3LuzTqQJ8eMHKKpzCrQ9vP2xQGcMJ O3gVUPf4OFE928okTCGJfA/s+vzVSJUvl2a9o4Y3G4nYiG3NG0rLg2CUPA7c4fb+Rpz5 Oy2cdfbR2xq80pYxKLpjHOSdOCo+q9fO56rqzE3C9hbS000chw5eZDHJHy3DKsIzV1rH EEJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=FZipqMQh; spf=pass (google.com: best guess record for 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=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y63si9106579eda.29.2020.04.14.06.29.36; Tue, 14 Apr 2020 06:30:00 -0700 (PDT) Received-SPF: pass (google.com: best guess record for 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=@redhat.com header.s=mimecast20190719 header.b=FZipqMQh; spf=pass (google.com: best guess record for 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=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387716AbgDMS1O (ORCPT + 99 others); Mon, 13 Apr 2020 14:27:14 -0400 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:30226 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387695AbgDMS1N (ORCPT ); Mon, 13 Apr 2020 14:27:13 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1586802431; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=LE4Q5pv4+ttMd6fa4HJ5hzCrYdDEL+fHTEMdK/F84bA=; b=FZipqMQhBvlY7tEs7XpZB5H6x8Z2aVqun4sxNnxGDkbJ0nIzeug6hLM9jlZq0Mbe8UeKwK aEmNMZJVepPFRuzyQtfesy9jBLMjkqsMJleSnjU5XhXEfYO2E92zWMmKtpien9d2DJaYO5 fEtUXz2CYzSVQLL+6OKWuERBLdzqEvA= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-12-fywtPCKvPym3A9psr-clxg-1; Mon, 13 Apr 2020 14:27:09 -0400 X-MC-Unique: fywtPCKvPym3A9psr-clxg-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id EE9EF18FE861; Mon, 13 Apr 2020 18:27:07 +0000 (UTC) Received: from localhost.localdomain (ovpn-116-15.gru2.redhat.com [10.97.116.15]) by smtp.corp.redhat.com (Postfix) with ESMTP id CD0CA5D9CD; Mon, 13 Apr 2020 18:26:57 +0000 (UTC) Subject: Re: [PATCH 01/10] KVM: selftests: Take vcpu pointer instead of id in vm_vcpu_rm() To: Sean Christopherson , Paolo Bonzini , Christian Borntraeger , Janosch Frank Cc: David Hildenbrand , Cornelia Huck , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Peter Xu , Andrew Jones References: <20200410231707.7128-1-sean.j.christopherson@intel.com> <20200410231707.7128-2-sean.j.christopherson@intel.com> From: Wainer dos Santos Moschetta Message-ID: Date: Mon, 13 Apr 2020 15:26:55 -0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 In-Reply-To: <20200410231707.7128-2-sean.j.christopherson@intel.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 4/10/20 8:16 PM, Sean Christopherson wrote: > The sole caller of vm_vcpu_rm() already has the vcpu pointer, take it > directly instead of doing an extra lookup. Most of (if not all) vcpu related functions in kvm_util.c receives an id, so this change creates an inconsistency. Disregarding the above comment, the changes look good to me. So: Reviewed-by: Wainer dos Santos Moschetta > > 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"