From patchwork Tue Mar 8 03:08:59 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Gibson X-Patchwork-Id: 593837 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 095681401CA for ; Tue, 8 Mar 2016 14:38:12 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=gibson.dropbear.id.au header.i=@gibson.dropbear.id.au header.b=V5RTW3Qq; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id D9C341A1A0C for ; Tue, 8 Mar 2016 14:38:11 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=gibson.dropbear.id.au header.i=@gibson.dropbear.id.au header.b=V5RTW3Qq; dkim-atps=neutral X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Received: from ozlabs.org (ozlabs.org [103.22.144.67]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3CFCC1A02E6 for ; Tue, 8 Mar 2016 14:09:14 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gibson.dropbear.id.au header.i=@gibson.dropbear.id.au header.b=V5RTW3Qq; dkim-atps=neutral Received: by ozlabs.org (Postfix, from userid 1007) id EA324140C1F; Tue, 8 Mar 2016 14:09:11 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1457406553; bh=GQdt7mk1Ds3PjC5MYEleZwix5tSeRc4vykpKztRFt5g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=V5RTW3QqKVDObCigzEwyMhBgnnBtgXq8TOsQWcYsluZSwaWv3h/1bkO1qpW9RVSTI HvyADMTEUrsWcDyhJhizRsZeLKSOtm9aAylMvq4M046d96/aAfgItxS75NsZRMCV7H GiGDeTmRio5ZmSUmLLM3Ukle247QExpLiMZfaq5o= From: David Gibson To: paulus@samba.org, aik@ozlabs.ru, benh@kernel.crashing.org Subject: [RFCv2 22/25] powerpc/kvm: Exclude HPT resizes when collecting the dirty log Date: Tue, 8 Mar 2016 14:08:59 +1100 Message-Id: <1457406542-6210-23-git-send-email-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1457406542-6210-1-git-send-email-david@gibson.dropbear.id.au> References: <1457406542-6210-1-git-send-email-david@gibson.dropbear.id.au> X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Gibson , linuxppc-dev@lists.ozlabs.org, bharata@linux.vnet.ibm.com MIME-Version: 1.0 Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" While there is an active HPT resize in progress, working out which guest pages are dirty is rather more complicated, because depending on exactly the phase of the resize the information could be in either the current, tentative or previous HPT or reverse map of the guest. To avoid this problem, for now we just exclude collecting the dirty map while a resize is in progress, blocking the dirty map operation until the resize is complete. Signed-off-by: David Gibson --- arch/powerpc/kvm/book3s_64_mmu_hv.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/powerpc/kvm/book3s_64_mmu_hv.c b/arch/powerpc/kvm/book3s_64_mmu_hv.c index 5b84347..c4c1814 100644 --- a/arch/powerpc/kvm/book3s_64_mmu_hv.c +++ b/arch/powerpc/kvm/book3s_64_mmu_hv.c @@ -1128,6 +1128,7 @@ long kvmppc_hv_get_dirty_log(struct kvm *kvm, struct kvm_memory_slot *memslot, unsigned long *rmapp; struct kvm_vcpu *vcpu; + mutex_lock(&kvm->arch.resize_hpt_mutex); /* exclude a concurrent HPT resize */ preempt_disable(); rmapp = memslot->arch.rmap; for (i = 0; i < memslot->npages; ++i) { @@ -1152,6 +1153,7 @@ long kvmppc_hv_get_dirty_log(struct kvm *kvm, struct kvm_memory_slot *memslot, spin_unlock(&vcpu->arch.vpa_update_lock); } preempt_enable(); + mutex_unlock(&kvm->arch.resize_hpt_mutex); return 0; }