From: Avi Kivity <avi@qumranet.com>
To: Marcelo Tosatti <mtosatti@redhat.com>
Cc: kvm@vger.kernel.org
Subject: Re: [patch 01/13] x86/mm: get_user_pages_fast_atomic
Date: Mon, 08 Sep 2008 17:20:42 +0300 [thread overview]
Message-ID: <48C534BA.1030107@qumranet.com> (raw)
In-Reply-To: <20080908061005.GB1014@dmt.cnet>
Marcelo Tosatti wrote:
> On Sun, Sep 07, 2008 at 11:42:18AM +0300, Avi Kivity wrote:
>
>> Marcelo Tosatti wrote:
>>
>>> From: Nick Piggin <nickpiggin@yahoo.com.au>
>>>
>>> Provide a lockless pagetable walk function without fallback to mmap_sem
>>> on error.
>>>
>>>
>> I would like to avoid this if possible. Not only is this a change to
>> the core (with backporting headaches),
>>
>
> Chris mentioned that the backport could use down_read_trylock(mmap_sem),
> and zap the page on failure. Its a simple solution and it should be rare
> for mmap_sem to be acquired in write mode.
>
>
Yes. Clever.
>> if we resync in atomic context
>> this can mean a long time spent with preemption disabled.
>>
>
> The resync time for a single page is comparable to prefetch_page (note
> that prefetch_page with direct access via gfn_to_page_atomic is about
> 50% faster than the current one) plus the gfn->pfn pagetable walks.
>
These could be very expensive as the gfn->pfn mapping is essentially
random and too big to be cached. 512 cache misses is a lot of time -
perhaps upwards of 50 microseconds.
Snapshotting is a must here IMO -- and it avoids the need for a walk
completely.
> It could simply resched based on need_resched after each page synced.
> Would that cover your concern?
>
>
I guess it's better than nothing.
> BTW, it might be interesting to spin_needbreak after resyncing a certain
> number of pages.
>
>
>> We might get around the need by dropping the lock when we resync, fetch
>> the gfns without the lock, and after reacquiring it check whether we can
>> proceed or whether we need to abort and let the guest retry. We can
>> probably proceed unless one of two things have happened: an mmu page was
>> zapped, or out page was oos'ed while we were resyncing it.
>>
>
> This sounds more complicated. First you have to grab the lock twice for
> each page synced. Secondly, the abort case due to oos'ed while resyncing
> means the page has to be zapped.
>
It is complicated, yes.
--
error compiling committee.c: too many arguments to function
next prev parent reply other threads:[~2008-09-08 14:20 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-09-06 18:48 [patch 00/13] RFC: out of sync shadow Marcelo Tosatti
2008-09-06 18:48 ` [patch 01/13] x86/mm: get_user_pages_fast_atomic Marcelo Tosatti
2008-09-07 8:42 ` Avi Kivity
2008-09-08 6:10 ` Marcelo Tosatti
2008-09-08 14:20 ` Avi Kivity [this message]
2008-09-06 18:48 ` [patch 02/13] KVM: MMU: switch to get_user_pages_fast Marcelo Tosatti
2008-09-07 8:45 ` Avi Kivity
2008-09-07 20:44 ` Marcelo Tosatti
2008-09-08 14:53 ` Avi Kivity
2008-09-09 12:21 ` Andrea Arcangeli
2008-09-09 13:57 ` Avi Kivity
2008-09-06 18:48 ` [patch 03/13] KVM: MMU: gfn_to_page_atomic Marcelo Tosatti
2008-09-06 18:48 ` [patch 04/13] KVM: MMU: switch prefetch_page to gfn_to_page_atomic Marcelo Tosatti
2008-09-06 18:48 ` [patch 05/13] KVM: MMU: do not write-protect large mappings Marcelo Tosatti
2008-09-07 9:04 ` Avi Kivity
2008-09-07 20:54 ` Marcelo Tosatti
2008-09-06 18:48 ` [patch 06/13] KVM: MMU: global page keeping Marcelo Tosatti
2008-09-07 9:16 ` Avi Kivity
2008-09-06 18:48 ` [patch 07/13] KVM: MMU: mode specific sync_page Marcelo Tosatti
2008-09-07 9:52 ` Avi Kivity
2008-09-08 6:03 ` Marcelo Tosatti
2008-09-08 9:50 ` Avi Kivity
2008-09-06 18:48 ` [patch 08/13] KVM: MMU: record guest root level on struct guest_walker Marcelo Tosatti
2008-09-06 18:48 ` [patch 09/13] KVM: MMU: out of sync shadow core Marcelo Tosatti
2008-09-07 11:01 ` Avi Kivity
2008-09-08 7:19 ` Marcelo Tosatti
2008-09-08 14:51 ` Avi Kivity
2008-09-11 8:19 ` Marcelo Tosatti
2008-09-11 13:15 ` Marcelo Tosatti
2008-09-06 18:48 ` [patch 10/13] KVM: MMU: sync roots on mmu reload Marcelo Tosatti
2008-09-06 18:48 ` [patch 11/13] KVM: MMU: sync global pages on cr0/cr4 writes Marcelo Tosatti
2008-09-06 18:48 ` [patch 12/13] KVM: x86: trap invlpg Marcelo Tosatti
2008-09-07 11:14 ` Avi Kivity
2008-09-06 18:48 ` [patch 13/13] KVM: MMU: ignore multiroot when unsyncing global pages Marcelo Tosatti
2008-09-07 11:22 ` [patch 00/13] RFC: out of sync shadow Avi Kivity
2008-09-08 7:23 ` Marcelo Tosatti
2008-09-08 14:56 ` Avi Kivity
2008-09-12 4:05 ` David S. Ahern
2008-09-12 11:51 ` Marcelo Tosatti
2008-09-12 15:12 ` David S. Ahern
2008-09-12 18:09 ` Marcelo Tosatti
2008-09-12 18:19 ` David S. Ahern
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=48C534BA.1030107@qumranet.com \
--to=avi@qumranet.com \
--cc=kvm@vger.kernel.org \
--cc=mtosatti@redhat.com \
/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