From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753255AbaHSJD1 (ORCPT ); Tue, 19 Aug 2014 05:03:27 -0400 Received: from mx1.redhat.com ([209.132.183.28]:38835 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752007AbaHSJDV (ORCPT ); Tue, 19 Aug 2014 05:03:21 -0400 Message-ID: <53F312CE.9090004@redhat.com> Date: Tue, 19 Aug 2014 11:03:10 +0200 From: Paolo Bonzini User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.7.0 MIME-Version: 1.0 To: Xiao Guangrong , David Matlack CC: Gleb Natapov , Avi Kivity , mtosatti@redhat.com, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, stable@vger.kernel.org Subject: Re: [PATCH 1/2] KVM: fix cache stale memslot info with correct mmio generation number References: <1407999713-3726-1-git-send-email-xiaoguangrong@linux.vnet.ibm.com> <53F20653.2030204@redhat.com> <9AD43423-2FF3-422D-A5AD-61CAE6339CCC@linux.vnet.ibm.com> <53F24A49.2010807@redhat.com> <53F2C997.6070605@linux.vnet.ibm.com> <53F30AA4.4050803@redhat.com> <53F30FCD.3080109@linux.vnet.ibm.com> In-Reply-To: <53F30FCD.3080109@linux.vnet.ibm.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Il 19/08/2014 10:50, Xiao Guangrong ha scritto: > Okay, what confused me it that it seems that the single line patch > is ok to you. :) No, it was late and I was confused. :) > Now, do we really need to care the case 2? like David said: > "Sorry I didn't explain myself very well: Since we can get a single wrong > mmio exit no matter what, it has to be handled in userspace. So my point > was, it doesn't really help to fix that one very specific way that it can > happen, because it can just happen in other ways. (E.g. update memslots > occurs after is_noslot_pfn() and before mmio exit)." > > What's your idea? > > > I think if you always treat the low bit as zero in mmio sptes, you can > > do that without losing a bit of the generation. > > What's you did is avoiding cache a invalid generation number into spte, but > actually if we can figure it out when we check mmio access, it's ok. Like the > updated patch i posted should fix it, that way avoids doubly increase the number. Yes. > Okay, if you're interested increasing the number doubly, there is the simpler > one: This wastes a bit in the mmio spte though. My idea is to increase the memslots generation twice, but drop the low bit in the mmio spte. Paolo