From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [RFC PATCH 0/2] Expose available KVM free memory slot count to help avoid aborts Date: Thu, 24 Feb 2011 14:34:50 +0200 Message-ID: <4D66506A.3030203@redhat.com> References: <20110121233040.22262.68117.stgit@s20.home> <20110124093241.GA28654@amt.cnet> <4D3D89B1.30300@siemens.com> <1295883899.3230.9.camel@x201> <1295933876.3230.46.camel@x201> <20110131191834.GA27154@amt.cnet> <1298497605.18387.70.camel@x201> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: Marcelo Tosatti , Jan Kiszka , "kvm@vger.kernel.org" , "ddutile@redhat.com" , "mst@redhat.com" , "chrisw@redhat.com" To: Alex Williamson Return-path: Received: from mx1.redhat.com ([209.132.183.28]:61046 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754735Ab1BXMe4 (ORCPT ); Thu, 24 Feb 2011 07:34:56 -0500 In-Reply-To: <1298497605.18387.70.camel@x201> Sender: kvm-owner@vger.kernel.org List-ID: On 02/23/2011 11:46 PM, Alex Williamson wrote: > > > > But kvm_arch_flush_shadow() takes mmu_lock currently, so that needs > > fixing. > > Hmm, I tried to follow the example in the !npages path just above this > that does: > > rcu_assign_pointer() > synchronize_srcu_expedited() > kvm_arch_flush_shadow() > > Do we have an existing issue there with mmu_lock? Thanks, > It's the issue I pointed out - after rcu_assign_pointer and before kvm_arch_flush_shadow() we can still get shadow pages created, so we have a mix of direct and indirect bitmap. Either my solution (recording whether the bitmap is direct or not in kvm_mmu_page) or Marcelo's (preventing shadow instantiation during this period) should work. Hmm, your patch dereferences kvm->memslots without rcu_dereference(). That's a mortal (as in oops) sin. Note that sticking an rcu_dereference() blindly may or may not work - we might end up using information from two different generations of kvm->memslots, and using inconsistent data. -- error compiling committee.c: too many arguments to function