Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp5123418iog; Wed, 22 Jun 2022 12:30:07 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uhafXjCVrPjdbhw7R2IgRPa/GIwNuhSH8iNNVTddBgHFsNfWVFatJJYDXmoyfFNog8kArJ X-Received: by 2002:a17:902:e809:b0:16a:22dc:d23a with SMTP id u9-20020a170902e80900b0016a22dcd23amr17942543plg.119.1655926207744; Wed, 22 Jun 2022 12:30:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655926207; cv=none; d=google.com; s=arc-20160816; b=hNxVOU4uDnZtYNRTaaH22S/2tX7DUFxcIPVt95AMI37cI1rwtAvAY+Ks3QCjxcYum2 ZH3Xe4esOyayfTixy9GP/DY7z/1j5yVrZwatlxfLMrFdGzUep50mndB/xz+TAVW6ZfEx grgPzqTpN7dg2QPn1HZH6UyltdoDKh0QgOcCKPBD3cfW5Aa6NYg+NWz1QNT3lKPeCmKd pxURk94oeeOke1RFc9uqDS/nTOq0mS0uwlF8BTbV3Yf4VUr4bTMCjpCKKTj+C8AwhxZX NDyO9FaT9+HzxKzrMs/yyoVavLexdODtxbthbSZSEbdoO1jFGm9cHMx9RjIEJ4n6BAB1 MFBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=VYUzovwXlyWEqHWEr/0eyCJlm/77MGoPfdijVMP4XpY=; b=xE3erS/5uJXVPvbAF9N/MZ2Y4coFBfDDBZxXC7nlCLcfLmL78KMxMRj1yOywEby96p RVeD6iWvL+YIXMeBucVsstHdKd4zqBon49zhfCE6Gouam0Yeg9mAvNw4FwMXkyBljiFr QU/477JuvzFWooGIyYlMHMAhvfCl0ByypcrulvObneYkDtuFtc2XvvizIGD0PMpzc3F7 KBjMqFN02dkpsPg9Yk9dAEkb3lLx8LNSO9nGAvQwNBuEyuACG2FfdI/VqZeq6EVSREJ1 elCYzqcx+9W6H1Qb2lOQKc8zgLrsaUAKXI3OA5eC4S218ye6Bko+f4ubISiMPXfYTPK5 5c+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=C3hbHiKN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 63-20020a630042000000b0040c6b32d48bsi22143263pga.549.2022.06.22.12.29.53; Wed, 22 Jun 2022 12:30:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=C3hbHiKN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S1358752AbiFVT1w (ORCPT + 99 others); Wed, 22 Jun 2022 15:27:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33586 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1357066AbiFVT1Z (ORCPT ); Wed, 22 Jun 2022 15:27:25 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 99C3E3BF88 for ; Wed, 22 Jun 2022 12:27:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1655926039; 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=VYUzovwXlyWEqHWEr/0eyCJlm/77MGoPfdijVMP4XpY=; b=C3hbHiKNaiow2LYSss1f3jKR+VeDEK4tnt36oWTzmGhq9gOIS8vZEoFSKI+VEFG0s8m8dA tM/9ykNnBjsgShFmEY5izHEoQHB4CMMkA5XqRfEUhbhVDubHMvAgbOogA3hJzLu8xeTXaW 7hMHfgvVoj7JnT55Z0LwoZeu/oWyvCk= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-248-4_a3NbfDPa6vyHqb9eMy7w-1; Wed, 22 Jun 2022 15:27:16 -0400 X-MC-Unique: 4_a3NbfDPa6vyHqb9eMy7w-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8B7ED3810782; Wed, 22 Jun 2022 19:27:15 +0000 (UTC) Received: from virtlab701.virt.lab.eng.bos.redhat.com (virtlab701.virt.lab.eng.bos.redhat.com [10.19.152.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id 37719141510C; Wed, 22 Jun 2022 19:27:15 +0000 (UTC) From: Paolo Bonzini To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: maz@kernel.org, anup@brainfault.org, seanjc@google.com, bgardon@google.com, peterx@redhat.com, maciej.szmigiero@oracle.com, kvmarm@lists.cs.columbia.edu, linux-mips@vger.kernel.org, kvm-riscv@lists.infradead.org, pfeiner@google.com, jiangshanlai@gmail.com, dmatlack@google.com Subject: [PATCH v7 11/23] KVM: x86/mmu: Replace vcpu with kvm in kvm_mmu_alloc_shadow_page() Date: Wed, 22 Jun 2022 15:26:58 -0400 Message-Id: <20220622192710.2547152-12-pbonzini@redhat.com> In-Reply-To: <20220622192710.2547152-1-pbonzini@redhat.com> References: <20220622192710.2547152-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.85 on 10.11.54.7 X-Spam-Status: No, score=-3.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: David Matlack The vcpu pointer in kvm_mmu_alloc_shadow_page() is only used to get the kvm pointer. So drop the vcpu pointer and just pass in the kvm pointer. No functional change intended. Signed-off-by: David Matlack Message-Id: <20220516232138.1783324-12-dmatlack@google.com> Signed-off-by: Paolo Bonzini --- arch/x86/kvm/mmu/mmu.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c index fab417e7bf6c..c5a88e8d1b53 100644 --- a/arch/x86/kvm/mmu/mmu.c +++ b/arch/x86/kvm/mmu/mmu.c @@ -2056,7 +2056,7 @@ struct shadow_page_caches { struct kvm_mmu_memory_cache *gfn_array_cache; }; -static struct kvm_mmu_page *kvm_mmu_alloc_shadow_page(struct kvm_vcpu *vcpu, +static struct kvm_mmu_page *kvm_mmu_alloc_shadow_page(struct kvm *kvm, struct shadow_page_caches *caches, gfn_t gfn, struct hlist_head *sp_list, @@ -2076,15 +2076,15 @@ static struct kvm_mmu_page *kvm_mmu_alloc_shadow_page(struct kvm_vcpu *vcpu, * depends on valid pages being added to the head of the list. See * comments in kvm_zap_obsolete_pages(). */ - sp->mmu_valid_gen = vcpu->kvm->arch.mmu_valid_gen; - list_add(&sp->link, &vcpu->kvm->arch.active_mmu_pages); - kvm_mod_used_mmu_pages(vcpu->kvm, +1); + sp->mmu_valid_gen = kvm->arch.mmu_valid_gen; + list_add(&sp->link, &kvm->arch.active_mmu_pages); + kvm_mod_used_mmu_pages(kvm, +1); sp->gfn = gfn; sp->role = role; hlist_add_head(&sp->hash_link, sp_list); if (sp_has_gptes(sp)) - account_shadowed(vcpu->kvm, sp); + account_shadowed(kvm, sp); return sp; } @@ -2103,7 +2103,7 @@ static struct kvm_mmu_page *__kvm_mmu_get_shadow_page(struct kvm_vcpu *vcpu, sp = kvm_mmu_find_shadow_page(vcpu, gfn, sp_list, role); if (!sp) { created = true; - sp = kvm_mmu_alloc_shadow_page(vcpu, caches, gfn, sp_list, role); + sp = kvm_mmu_alloc_shadow_page(vcpu->kvm, caches, gfn, sp_list, role); } trace_kvm_mmu_get_page(sp, created); -- 2.31.1