linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Nick Piggin <nickpiggin@yahoo.com.au>
To: Jack Steiner <steiner@sgi.com>
Cc: Nick Piggin <npiggin@suse.de>,
	Andrew Morton <akpm@linux-foundation.org>,
	Linux Memory Management List <linux-mm@kvack.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: GRU driver feedback
Date: Tue, 29 Jul 2008 12:00:09 +1000	[thread overview]
Message-ID: <200807291200.09907.nickpiggin@yahoo.com.au> (raw)
In-Reply-To: <20080728173605.GB28480@sgi.com>

On Tuesday 29 July 2008 03:36, Jack Steiner wrote:
> I appreciate the thorough review. The GRU is a complicated device. I
> tried to provide comments in the code but I know it is still difficult
> to understand.
>
> You appear to have a pretty good idea of how it works. I've added a
> few new comments to the code to make it clearer in a few cases.

Hi Jack,

Thanks very much for your thorough comments in return. I will take longer
to digest them, but quick reply now because you're probably rushing to
get things merged... So I think you've resolved all my concerns except one.


> > - GRU driver -- gru_intr finds mm to fault pages from, does an "atomic
> > pte lookup" which looks up the pte atomically using similar lockless
> > pagetable walk from get_user_pages_fast. This only works because it can
> > guarantee page table existence by disabling interrupts on the CPU where
> > mm is currently running.  It looks like atomic pte lookup can be run on
> > mms which are not presently running on the local CPU. This would have
> > been noticed if it had been using a specialised function in
> > arch/*/mm/gup.c, because it would not have provided an mm_struct
> > parameter ;)
>
> Existence of the mm is guaranteed thru an indirect path. The  mm
> struct cannot go away until the GRU context that caused the interrupt
> is unloaded.  When the GRU hardware sends an interrupt, it locks the
> context & prevents it from being unloaded until the interrupt is
> serviced.  If the atomic pte is successful, the subsequent TLB dropin
> will unlock the context to allow it to be unloaded. The mm can't go
> away until the context is unloaded.

It is not existence of the mm that I am worried about, but existence
of the page tables. get_user_pages_fast works the way it does on x86
because x86's pagetable shootdown and TLB flushing requires that an
IPI be sent to all running threads of a process before page tables
are freed. So if `current` is one such thread, and wants to do a page
table walk of its own mm, then it can guarantee page table existence
by turning off interrupts (and so blocking the IPI).

This will not work if you are trying to walk down somebody else's
page tables because there is nothing to say the processor you are
running on will get an IPI. This is why get_user_pages_fast can not
work if task != current or mm != current->mm.

So I think there is still a problem.

--
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>

  parent reply	other threads:[~2008-07-29  2:00 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-23 14:12 Nick Piggin
2008-07-24  2:41 ` Nick Piggin
2008-07-24  3:26 ` Jack Steiner
2008-07-24  6:52   ` Nick Piggin
2008-07-28 17:36 ` Jack Steiner
2008-07-28 17:44   ` Jack Steiner
2008-07-29  2:00   ` Nick Piggin [this message]
2008-07-29 18:53     ` Robin Holt
2008-07-30  5:50       ` Nick Piggin
2008-07-31  7:14         ` Nick Piggin
2008-07-31 12:40           ` Jack Steiner
2008-08-01 12:11             ` Hugh Dickins
2008-08-01 20:09               ` Jack Steiner

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=200807291200.09907.nickpiggin@yahoo.com.au \
    --to=nickpiggin@yahoo.com.au \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=npiggin@suse.de \
    --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