Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1624641
| From | Xiao Guangrong <guangrong.xiao@gmail.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] x86, kvm: Handle PFNs outside of kernel reach when touching GPTEs |
| Date | 2017-04-17 13:30 +0200 |
| Message-ID | <txd0Z-8uH-7@gated-at.bofh.it> (permalink) |
| References | <tsT0S-364-19@gated-at.bofh.it> <ttgAa-1jL-19@gated-at.bofh.it> <tvqlI-4Uw-23@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On 04/12/2017 09:16 PM, Sironi, Filippo wrote: > Thanks for taking the time and sorry for the delay. > >> On 6. Apr 2017, at 16:22, Radim Krčmář <rkrcmar@redhat.com> wrote: >> >> 2017-04-05 15:07+0200, Filippo Sironi: >>> cmpxchg_gpte() calls get_user_pages_fast() to retrieve the number of >>> pages and the respective struct pages for mapping in the kernel virtual >>> address space. >>> This doesn't work if get_user_pages_fast() is invoked with a userspace >>> virtual address that's backed by PFNs outside of kernel reach (e.g., >>> when limiting the kernel memory with mem= in the command line and using >>> /dev/mem to map memory). >>> >>> If get_user_pages_fast() fails, look up the VMA that backs the userspace >>> virtual address, compute the PFN and the physical address, and map it in >>> the kernel virtual address space with memremap(). >> >> What is the reason for a configuration that voluntarily restricts access >> to memory that it needs? > > By using /dev/mem to provide VM memory, one can avoid the overhead of allocating struct page(s) for the whole memory, which is wasteful when using a server entirely for hosting VMs. > Sounds reasonable, however it is incomplete so far as there are some code paths still do not support non-page backend memory, e.g, emulator_cmpxchg_emulated(). I would suggest to unify the code introduced in this patch with existing hva_to_pfn(), also we can introduce a common API, maybe named kvm_map_hva(), to improve the caller sides. BTW, i do not know why we used kmap_atomic() rather than kmap(), the path of cmpxchg_gpte() is sleep-able anyway. Thanks!
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: [PATCH] x86, kvm: Handle PFNs outside of kernel reach when touching GPTEs "Sironi, Filippo" <sironi@amazon.de> - 2017-04-12 15:20 +0200
Re: [PATCH] x86, kvm: Handle PFNs outside of kernel reach when touching GPTEs Xiao Guangrong <guangrong.xiao@gmail.com> - 2017-04-17 13:30 +0200
Re: [PATCH] x86, kvm: Handle PFNs outside of kernel reach when touching GPTEs Paolo Bonzini <pbonzini@redhat.com> - 2017-04-18 10:20 +0200
csiph-web