From patchwork Sat Mar 5 03:40:20 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takuya Yoshikawa X-Patchwork-Id: 611701 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p253eeD3014500 for ; Sat, 5 Mar 2011 03:40:40 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752276Ab1CEDk2 (ORCPT ); Fri, 4 Mar 2011 22:40:28 -0500 Received: from mail-gw0-f51.google.com ([74.125.83.51]:46196 "EHLO mail-gw0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752166Ab1CEDk1 (ORCPT ); Fri, 4 Mar 2011 22:40:27 -0500 Received: by gwb15 with SMTP id 15so1496102gwb.10 for ; Fri, 04 Mar 2011 19:40:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:date:from:to:cc:subject:message-id:x-mailer :mime-version:content-type:content-transfer-encoding; bh=NSJsXLemQ18eRTw0QFKEWhZQav9WVcG4TrBIvc8x3f4=; b=iiqIH29V56Hunm7GUmJS+kufpXkRvS0VA8AZe5uMAI44MTfrERxKZhg7E4m/cIMTw1 EQt2mSFOYrKd6ACNjOI9M9tMPUbq/8W/tz0Tos/phyCzoKk8gENlgAzCPTGjIY3R1R1m +9JtdskhSakcq768M+2rKZdZ6CZLcGX2ThSaY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:x-mailer:mime-version :content-type:content-transfer-encoding; b=xiOfyc0z0/2HobTlcL2B2Vcob5/MkrP77nNPP5sn2oEj2GiLmV/QrZJ2oiYVI41xUk neL2E+TyHSr2fAey6GMk3VYqHsbbl6Y96TToVYDQn0Pqiu3IPEs7O9kgdrE4CpkXnrzd nF9SsY4IqrZwFnvRPoejc+FnKrIMqTcKX6s+Y= Received: by 10.150.75.6 with SMTP id x6mr1696250yba.217.1299296426369; Fri, 04 Mar 2011 19:40:26 -0800 (PST) Received: from atom (u061190.dynamic.ppp.asahi-net.or.jp [203.212.61.190]) by mx.google.com with ESMTPS id h30sm95998yhm.0.2011.03.04.19.40.23 (version=SSLv3 cipher=OTHER); Fri, 04 Mar 2011 19:40:24 -0800 (PST) Date: Sat, 5 Mar 2011 12:40:20 +0900 From: Takuya Yoshikawa To: avi@redhat.com, mtosatti@redhat.com Cc: kvm@vger.kernel.org, yoshikawa.takuya@oss.ntt.co.jp Subject: [PATCH] KVM: x86: Remove useless regs_page pointer from kvm_lapic Message-Id: <20110305124020.a3427a4c.takuya.yoshikawa@gmail.com> X-Mailer: Sylpheed 3.1.0beta2 (GTK+ 2.22.0; i686-pc-linux-gnu) Mime-Version: 1.0 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Sat, 05 Mar 2011 03:40:40 +0000 (UTC) diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c index 0171e66..2b2255b 100644 --- a/arch/x86/kvm/lapic.c +++ b/arch/x86/kvm/lapic.c @@ -871,8 +871,8 @@ void kvm_free_lapic(struct kvm_vcpu *vcpu) hrtimer_cancel(&vcpu->arch.apic->lapic_timer.timer); - if (vcpu->arch.apic->regs_page) - __free_page(vcpu->arch.apic->regs_page); + if (vcpu->arch.apic->regs) + free_page((unsigned long)vcpu->arch.apic->regs); kfree(vcpu->arch.apic); } @@ -1061,13 +1061,12 @@ int kvm_create_lapic(struct kvm_vcpu *vcpu) vcpu->arch.apic = apic; - apic->regs_page = alloc_page(GFP_KERNEL|__GFP_ZERO); - if (apic->regs_page == NULL) { + apic->regs = (void *)get_zeroed_page(GFP_KERNEL); + if (!apic->regs) { printk(KERN_ERR "malloc apic regs error for vcpu %x\n", vcpu->vcpu_id); goto nomem_free_apic; } - apic->regs = page_address(apic->regs_page); apic->vcpu = vcpu; hrtimer_init(&apic->lapic_timer.timer, CLOCK_MONOTONIC, diff --git a/arch/x86/kvm/lapic.h b/arch/x86/kvm/lapic.h index f5fe32c..52c9e6b 100644 --- a/arch/x86/kvm/lapic.h +++ b/arch/x86/kvm/lapic.h @@ -13,7 +13,6 @@ struct kvm_lapic { u32 divide_count; struct kvm_vcpu *vcpu; bool irr_pending; - struct page *regs_page; void *regs; gpa_t vapic_addr; struct page *vapic_page; diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index e2b8c6b..3febb76 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -2821,7 +2821,7 @@ static int vmx_vcpu_reset(struct kvm_vcpu *vcpu) vmcs_write64(VIRTUAL_APIC_PAGE_ADDR, 0); if (vm_need_tpr_shadow(vmx->vcpu.kvm)) vmcs_write64(VIRTUAL_APIC_PAGE_ADDR, - page_to_phys(vmx->vcpu.arch.apic->regs_page)); + __pa(vmx->vcpu.arch.apic->regs)); vmcs_write32(TPR_THRESHOLD, 0); }