From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tsuyoshi Ozawa Subject: Re: R/W HG memory mappings with kvm? Date: Tue, 29 Sep 2009 03:27:41 +0900 Message-ID: <411a180c0909281127i749cb88aqae2bf1653d4de6ea@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Cc: kvm@vger.kernel.org To: Avi Kivity Return-path: Received: from mail-px0-f194.google.com ([209.85.216.194]:42214 "EHLO mail-px0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751535AbZI1S1i (ORCPT ); Mon, 28 Sep 2009 14:27:38 -0400 Received: by pxi32 with SMTP id 32so3670930pxi.4 for ; Mon, 28 Sep 2009 11:27:41 -0700 (PDT) Sender: kvm-owner@vger.kernel.org List-ID: Hello, >> Sorry about that. The issue is the BUG in gfn_to_pgn where the pfn is >> not calculated correctly after looking up the vma. >> I still don't see how to get the physical address from the vma, since >> vm_pgoff is zero, and the vm_ops are not filled. The vma does not seem >> to store the physical base address. > So it seems the only place the pfns are stored are in the ptes themselves. Is there an API to recover the ptes from a virtual address? We could use that instead. I'm also trying to share H/G memory with another solution - by overwriting shadow page table. It seems that gfn_to_pfn is the key function which associate guest memoy with host memory. So I changed gfn_to_pfn as follows: pfn_t gfn_to_pfn(struct kvm *kvm, gfn_t gfn) { ... } else if ( shared_gfn && shared_gfn == gfn ){ return shared_pfn; // return pfn which is wanted to share }else { pfn = page_to_pfn(page[0]); } } ... } Here, shared_gfn is registered by walking soft mmu with gva. And shared_pfn is the page frame number which is hostside. By rewriting adobe, kvm is foxed and make up new shadow page table with new mapping after zap all pages. But I failed to share the memory. Do I have any misunderstanding? Regards, Tsuyoshi Ozawa