From: Marcelo Tosatti <mtosatti@redhat.com>
To: David Daney <ddaney.cavm@gmail.com>
Cc: KVM devel mailing list <kvm@vger.kernel.org>,
Ralf Baechle <ralf@linux-mips.org>
Subject: Re: Q: Why not use struct mm_struct to manage guest physical addresses in new port?
Date: Fri, 8 Feb 2013 20:11:51 -0200 [thread overview]
Message-ID: <20130208221151.GA27012@amt.cnet> (raw)
In-Reply-To: <51115748.2090203@gmail.com>
On Tue, Feb 05, 2013 at 11:02:32AM -0800, David Daney wrote:
> Hi,
>
> I am starting to working on a port of KVM to an architecture that
> has a dual TLB. The Guest Virtual Addresses (GVA) are translated to
> Guest Physical Addresses (GPA) by the first TLB, then a second TLB
> translates the GPA to a Root Physical Address (RPA). For the sake
> of this question, we will ignore the GVA->GPA TLB and consider only
> the GPA->RPA TLB.
>
> I seems that most existing ports have a bunch of custom code that
> manages the GPA->RPA TLB and page tables.
>
> Here is what I would like to try: Create a mm for the GPA->RPA
> mappings each vma would have a fault handler that calls gfn_to_pfn()
> to look up the proper page. In kvm_arch_vcpu_ioctl_run() we would
> call switch_mm() to this new 'gva_mm'.
gfn_to_pfn uses the address space of the controlling process. GPA->RPA
translation does:
1) Find 'memory slot' (indexed by gfn)
2) From 'memory slot', find virtual address (relative to controlling
process).
3) Walk pagetable of controlling process and page retrieve physical address.
> Upon exiting guest mode we
> would switch back to the original mm of the controlling process.
> For me the benefit of this approach is that all the code that
> manages the TLB is already implemented and works well for struct
> mm_struct. The only thing I need to do is write a vma fault
> handler. That is a lot easier and less error prone than maintaining
> a parallel TLB management framework and making sure it interacts
> properly with the existing TLB code for 'normal' processes.
>
>
> Q1: Am I crazy for wanting to try this?
You need the mm_struct of the controlling to be active, when doing
GPA->RPA translations.
> Q2: Have others tried this and rejected it? What were the reasons?
I think you'll have to switch_mm back to the controlling process mm on
every page fault (and then back to gva_mm).
>
> Thanks in advance,
> David Daney
> Cavium, Inc.
'vma' `is a process
> --
> To unsubscribe from this list: send the line "unsubscribe kvm" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2013-02-08 22:12 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-05 19:02 Q: Why not use struct mm_struct to manage guest physical addresses in new port? David Daney
2013-02-08 22:11 ` Marcelo Tosatti [this message]
2013-02-08 23:08 ` David Daney
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130208221151.GA27012@amt.cnet \
--to=mtosatti@redhat.com \
--cc=ddaney.cavm@gmail.com \
--cc=kvm@vger.kernel.org \
--cc=ralf@linux-mips.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox