From: Keir Fraser Subject: Re: [PATCH] let set_phys_to_machine return the old entry Date: Thu, 20 Apr 2006 20:08:08 +0100 Message-ID: <6b520e874730fddf011bf0d2d0ec10d5@cl.cam.ac.uk> References: <1145558053.10850.6.camel@localhost.localdomain> Mime-Version: 1.0 (Apple Message framework v623) Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1145558053.10850.6.camel@localhost.localdomain> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Stefan Berger Cc: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org On 20 Apr 2006, at 19:34, Stefan Berger wrote: > The attached patch makes set_phys_to_machine(pfn,mfn) return the old > entry in the array, such that the old entry can be restored again using > the same call. If the feature XENFEAT_auto_translate_physmap is not > enabled, then these two calls will end up in no-op relative to changes > to the phys_to_machine_mapping array. > > There's currently only one occurrence where remembering the entry from > the array is necessary and this is in the vTPM backend driver. > > This patch builds on top of the previously posted TPM backend patch. Why do you need to mess with the phys_to_machine table at all? You install the mapping only for a very short time, to do a memcpy or copy_from_user: neither of which will use that p2m entry. Even if you really do want to set the p2m entry properly you know that its old value must be INVALID_P2M_ENTRY because you obtained that kernel virtual address via balloon_alloc_empty_page_range(). You should probably just delete the p2m code from that copy routine. -- Keir