From mboxrd@z Thu Jan 1 00:00:00 1970 From: Konrad Rzeszutek Wilk Subject: Re: [PATCH v5 04/13] KVM: Introduce a new guest mapping API Date: Wed, 23 Jan 2019 12:50:18 -0500 Message-ID: <20190123175014.GK19289@Konrads-MacBook-Pro.local> References: <1547026933-31226-1-git-send-email-karahmed@amazon.de> <1547026933-31226-5-git-send-email-karahmed@amazon.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, pbonzini@redhat.com, rkrcmar@redhat.com To: KarimAllah Ahmed Return-path: Content-Disposition: inline In-Reply-To: <1547026933-31226-5-git-send-email-karahmed@amazon.de> Sender: linux-kernel-owner@vger.kernel.org List-Id: kvm.vger.kernel.org > + if (dirty) > + kvm_release_pfn_dirty(map->pfn); > + else > + kvm_release_pfn_clean(map->pfn); > + map->hva = NULL; I keep on having this gnawing feeling that we MUST set map->page to NULL. That is I can see how it is not needed if you are using 'map' and 'unmap' together - for that we are good. But what I am worried is that some one unmaps it .. and instead of checking map->hva they end up checking map->page and think the page is mapped. Would you be OK adding that extra statement just as a fail-safe mechanism in case someones misues the APIs?