linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Andrea Arcangeli <andrea@qumranet.com>
To: Christoph Lameter <clameter@sgi.com>
Cc: Robin Holt <holt@sgi.com>, Avi Kivity <avi@qumranet.com>,
	Izik Eidus <izike@qumranet.com>,
	kvm-devel@lists.sourceforge.net,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	steiner@sgi.com, linux-kernel@vger.kernel.org,
	linux-mm@kvack.org, daniel.blueman@quadrics.com
Subject: Re: [PATCH] mmu notifiers #v5
Date: Fri, 1 Feb 2008 13:09:55 +0100	[thread overview]
Message-ID: <20080201120955.GX7185@v2.random> (raw)
In-Reply-To: <Pine.LNX.4.64.0801311738570.24297@schroedinger.engr.sgi.com>

On Thu, Jan 31, 2008 at 05:44:24PM -0800, Christoph Lameter wrote:
> The trouble is that the invalidates are much more expensive if you have to 
> send theses to remote partitions (XPmem). And its really great if you can 
> simple tear down everything. Certainly this is a significant improvement 
> over the earlier approach but you still have the invalidate_page calls in 
> ptep_clear_flush. So they fire needlessly?

Dunno, they certainly fire more frequently than yours, even _pages
fires more frequently than range_start,end but don't forget why!
That's because I've a different spinlock for every 512
ptes/4k-grub-tlbs that are being invalidated... So it pays off in
scalability. I'm unsure if gru could play tricks with your patch, to
still allow faults to still happen in parallel if they're on virtual
addresses not in the same 2M naturally aligned chunk.

> Serializing access in the device driver makes sense and comes with 
> additional possiblity of not having to increment page counts all the time. 
> So you trade one cacheline dirtying for many that are necessary if you 
> always increment the page count.

Note that my #v5 doesn't require to increase the page count all the
time, so GRU will work fine with #v5.

See this comment in my patch:

    /*
     * invalidate_page[s] is called in atomic context
     * after any pte has been updated and before
     * dropping the PT lock required to update any Linux pte.
     * Once the PT lock will be released the pte will have its
     * final value to export through the secondary MMU.
     * Before this is invoked any secondary MMU is still ok
     * to read/write to the page previously pointed by the
     * Linux pte because the old page hasn't been freed yet.
     * If required set_page_dirty has to be called internally
     * to this method.
     */


invalidate_page[s] is always called before the page is freed. This
will require modifications to the tlb flushing code logic to take
advantage of _pages in certain places. For now it's just safe.

> How does KVM insure the consistency of the shadow page tables? Atomic ops?

A per-VM mmu_lock spinlock is taken to serialize the access, plus
atomic ops for the cpu.

> The GRU has no page table on its own. It populates TLB entries on demand 
> using the linux page table. There is no way it can figure out when to 
> drop page counts again. The invalidate calls are turned directly into tlb 
> flushes.

Yes, this is why it can't serialize follow_page with only the PT lock
with your patch. KVM may do it once you add start,end to range_end
only thanks to the additional pin on the page.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2008-02-01 12:09 UTC|newest]

Thread overview: 63+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-31  4:57 [patch 0/3] [RFC] MMU Notifiers V4 Christoph Lameter
2008-01-31  4:57 ` [patch 1/3] mmu_notifier: Core code Christoph Lameter
2008-02-01  1:56   ` Jack Steiner
2008-02-01  2:24     ` Robin Holt
2008-02-01  2:37       ` Jack Steiner
2008-02-01  2:39         ` Christoph Lameter
2008-02-01  2:31   ` Robin Holt
2008-02-01  2:39     ` Christoph Lameter
2008-02-01  2:47       ` Robin Holt
2008-02-01  3:01         ` Christoph Lameter
2008-02-01  3:01       ` Jack Steiner
2008-02-01  3:03         ` Christoph Lameter
2008-02-01  3:52   ` Robin Holt
2008-02-01  3:58     ` Christoph Lameter
2008-02-01  4:15       ` Robin Holt
2008-02-03  1:33       ` Andrea Arcangeli
2008-02-04 19:13         ` Christoph Lameter
2008-01-31  4:57 ` [patch 2/3] mmu_notifier: Callbacks to invalidate address ranges Christoph Lameter
2008-01-31 12:31   ` Andrea Arcangeli
2008-01-31 20:07     ` Christoph Lameter
2008-01-31 22:01     ` mmu_notifier: close hole in fork Christoph Lameter
2008-01-31 22:16       ` mmu_notifier: reduce size of mm_struct if !CONFIG_MMU_NOTIFIER Christoph Lameter
2008-01-31 22:21       ` mmu_notifier: Move mmu_notifier_release up to get rid of the invalidat_all() callback Christoph Lameter
2008-02-01  0:13         ` Andrea Arcangeli
2008-02-01  1:52           ` Christoph Lameter
2008-02-01  1:57           ` mmu_notifier: invalidate_range for move_page_tables Christoph Lameter
2008-02-01  2:38             ` Robin Holt
2008-02-01  2:41               ` Christoph Lameter
2008-02-01  0:01       ` mmu_notifier: close hole in fork Andrea Arcangeli
2008-02-01  1:48         ` Christoph Lameter
2008-02-01  4:24   ` [patch 2/3] mmu_notifier: Callbacks to invalidate address ranges Robin Holt
2008-02-01  4:43     ` Christoph Lameter
2008-02-01 10:32       ` Robin Holt
2008-02-01 10:37         ` Robin Holt
2008-02-01 19:13         ` Christoph Lameter
2008-01-31  4:57 ` [patch 3/3] mmu_notifier: invalidate_page callbacks Christoph Lameter
2008-01-31 17:18 ` [PATCH] mmu notifiers #v5 Andrea Arcangeli
2008-01-31 20:18   ` Christoph Lameter
2008-01-31 23:09     ` Christoph Lameter
2008-01-31 23:41       ` Andrea Arcangeli
2008-02-01  1:44         ` Christoph Lameter
2008-02-01 12:09           ` Andrea Arcangeli [this message]
2008-02-01 19:23             ` Christoph Lameter
2008-02-03  2:17               ` Andrea Arcangeli
2008-02-03  3:14                 ` Jack Steiner
2008-02-03  3:33                   ` Andrea Arcangeli
2008-02-04 19:09                 ` Christoph Lameter
2008-02-05  5:25                   ` Andrea Arcangeli
2008-02-05  6:11                     ` Christoph Lameter
2008-02-05 18:08                       ` Andrea Arcangeli
2008-02-05 18:17                         ` Christoph Lameter
2008-02-05 20:55                           ` Andrea Arcangeli
2008-02-05 22:06                             ` Christoph Lameter
2008-02-05 22:12                               ` Robin Holt
2008-02-05 22:26                               ` Andrea Arcangeli
2008-02-05 23:10                                 ` Christoph Lameter
2008-02-05 23:47                                   ` Andrea Arcangeli
2008-02-06  0:04                                     ` Christoph Lameter
2008-01-31 23:28     ` Andrea Arcangeli
2008-02-01  1:37       ` Christoph Lameter
2008-02-01  2:23         ` Robin Holt
2008-02-01  2:26           ` Christoph Lameter
2008-02-01 12:00         ` Andrea Arcangeli

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=20080201120955.GX7185@v2.random \
    --to=andrea@qumranet.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=avi@qumranet.com \
    --cc=clameter@sgi.com \
    --cc=daniel.blueman@quadrics.com \
    --cc=holt@sgi.com \
    --cc=izike@qumranet.com \
    --cc=kvm-devel@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=steiner@sgi.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;
as well as URLs for NNTP newsgroup(s).