From: "David S. Miller" <davem@davemloft.net>
To: "Luck, Tony" <tony.luck@intel.com>
Cc: hugh@veritas.com, akpm@osdl.org, nickpiggin@yahoo.com.au,
benh@kernel.crashing.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/5] freepgt: free_pgtables use vma list
Date: Mon, 21 Mar 2005 15:02:05 -0800 [thread overview]
Message-ID: <20050321150205.4af39064.davem@davemloft.net> (raw)
In-Reply-To: <B8E391BBE9FE384DAA4C5C003888BE6F03210DD4@scsmsx401.amr.corp.intel.com>
On Mon, 21 Mar 2005 14:31:36 -0800
"Luck, Tony" <tony.luck@intel.com> wrote:
> Builds clean and boots on ia64.
>
> I haven't tried any hugetlb operations on it though.
It works on ia64 because it doesn't actually do anything
in flush_tlb_pgtables(), I bet.
Hugh, I know the exact trigger case, it's unmapping a VMA
right before the stack segment. So the free_pgtables() call
happens with this state:
prev->vm_end == 0x70186000
next->vm_start == 0xefab8000
vma->vm_start == 0x70186000
vma->vm_end == 0x70188000
(so we're doing munmap(0x70186000, PAGE_SIZE), the sparc64
stack segment for 32-bit tasks grows down from 0xf0000000,
the bottom of it is at 0xefab8000 at this point in time)
So the free_pgtables() call will be with:
floor == 0x70186000
ceiling == 0xefab8000
This should be fairly simple, so let's analyze exactly what
happens:
1) vma == the munmap() call's VMA
next == stack segment VMA, which sits right after "vma"
addr == 0x70186000 (base of munmap() area)
2) VMA optimization loop runs:
next->vm_start is 0xefab8000
vma->vm_end is 0x70188000
on sparc64 PMD_SIZE is 1UL << 23 or 0x800000
therefore vma->vm_end + (2 * PMD_SIZE) is 0x71188000
this is much less than 0xefab8000 so the loop terminates
immediately
Therefore, next is unchanged.
3) free_pgd_range() is invoked with:
addr == 0x70186000
end == 0x70188000
floor == 0x70186000
ceiling == 0xefab8000
4) We mask addr with PMD_MASK (which is 0xffffffffff800000)
This sets addr to 0x70000000, which makes it less
than floor, therefore addr has PMD_SIZE added to it.
Now, addr is 0x70800000, this is the source of the
problems as this value determines the "start" argument
passed to flush_tlb_pgtables(). Note how it is larger
than "end".
5) We also mask ceiling with PMD_MASK.
This sets ceiling to 0xef800000.
Now addr is less than or equal to ceiling - 1 so
we continue.
6) start is set to addr, which as stated is 0x70800000,
the free_pud_range() loop is executed
7) start is 0x70800000 and end is 0x70188000
and here we have the problem that start > end,
flush_tlb_pgtables() is called with the arguments
like this and we trigger the aforementioned BUG().
This adjustment of addr relative to floor is very
strange, it can advance "addr" (and thus "start")
past the end of the VMA we are unmapping.
In fact, it is miraculious that this free_pud_range()
calling loop terminates properly! Actually, it is
no mystery, since the next PGD address is the same
for both the original and adjusted value of "addr".
So the loop terminates after the first iteration.
Anyways, there's the full analysis, what do you make
of this Hugh? :-)
next prev parent reply other threads:[~2005-03-21 23:11 UTC|newest]
Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-03-21 22:31 Luck, Tony
2005-03-21 23:02 ` David S. Miller [this message]
2005-03-22 4:14 ` Nick Piggin
2005-03-22 5:29 ` David S. Miller
2005-03-22 6:08 ` Hugh Dickins
2005-03-22 6:33 ` Nick Piggin
2005-03-22 17:52 ` David S. Miller
2005-03-22 17:55 ` David S. Miller
2005-03-22 5:42 ` Hugh Dickins
-- strict thread matches above, loose matches on Subject: below --
2005-03-22 23:53 Luck, Tony
2005-03-22 23:56 ` David S. Miller
2005-03-23 0:56 ` Hugh Dickins
2005-03-23 1:10 ` Andrew Morton
2005-03-23 2:00 ` David S. Miller
2005-03-23 2:10 ` Nick Piggin
2005-03-23 2:15 ` David S. Miller
2005-03-22 22:40 Luck, Tony
2005-03-22 23:30 ` David S. Miller
2005-03-23 0:40 ` Hugh Dickins
2005-03-22 18:06 Luck, Tony
2005-03-22 18:48 ` Hugh Dickins
2005-03-21 20:52 Hugh Dickins
2005-03-21 22:26 ` David S. Miller
2005-03-22 5:47 ` Hugh Dickins
2005-03-22 17:41 ` David S. Miller
2005-03-22 11:40 ` Andrew Morton
2005-03-22 12:17 ` Nick Piggin
2005-03-22 16:37 ` Hugh Dickins
2005-03-22 18:34 ` David S. Miller
2005-03-22 19:01 ` David S. Miller
2005-03-22 19:21 ` David S. Miller
2005-03-22 19:23 ` David S. Miller
2005-03-22 19:36 ` Hugh Dickins
2005-03-22 20:21 ` David S. Miller
2005-03-22 23:45 ` Benjamin Herrenschmidt
2005-03-22 20:33 ` David S. Miller
2005-03-22 21:51 ` Hugh Dickins
2005-03-22 22:41 ` David S. Miller
2005-03-23 0:51 ` Hugh Dickins
2005-03-23 2:09 ` David S. Miller
2005-03-22 23:32 ` Nick Piggin
2005-03-22 23:44 ` David S. Miller
2005-03-23 0:19 ` Nick Piggin
2005-03-23 0:20 ` David S. Miller
2005-03-23 0:00 ` David S. Miller
2005-03-23 0:03 ` David S. Miller
2005-03-22 21:28 ` David S. Miller
2005-03-22 23:30 ` Benjamin Herrenschmidt
2005-03-23 13:28 ` Hugh Dickins
2005-03-23 23:07 ` Benjamin Herrenschmidt
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=20050321150205.4af39064.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=akpm@osdl.org \
--cc=benh@kernel.crashing.org \
--cc=hugh@veritas.com \
--cc=linux-kernel@vger.kernel.org \
--cc=nickpiggin@yahoo.com.au \
--cc=tony.luck@intel.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
all inboxes | Powered by JetHome®