From: Steve Capper <steve.capper@arm.com>
To: Christoffer Dall <c.dall@virtualopensystems.com>
Cc: Steve Capper <Steve.Capper@arm.com>,
"linux-arch@vger.kernel.org" <linux-arch@vger.kernel.org>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
"aarcange@redhat.com" <aarcange@redhat.com>,
"bill4carson@gmail.com" <bill4carson@gmail.com>,
"tawfik@marvell.com" <tawfik@marvell.com>,
Catalin Marinas <Catalin.Marinas@arm.com>,
Will Deacon <Will.Deacon@arm.com>,
"cmetcalf@tilera.com" <cmetcalf@tilera.com>,
"mhocko@suse.cz" <mhocko@suse.cz>,
"maen@marvell.com" <maen@marvell.com>,
"hoffman@marvell.com" <hoffman@marvell.com>,
"notasas@gmail.com" <notasas@gmail.com>,
"kirill@shutemov.name" <kirill@shutemov.name>,
"akpm@linux-foundation.org" <akpm@linux-foundation.org>,
"shadi@marvell.com" <shadi@marvell.com>
Subject: Re: [RFC PATCH 1/6] ARM: mm: correct pte_same behaviour for LPAE.
Date: Tue, 8 Jan 2013 17:56:30 +0000 [thread overview]
Message-ID: <20130108175630.GA18347@e103986-lin> (raw)
In-Reply-To: <CANM98qJEigKksbv5QdGLWzCdaSj9NipJ-RYrouzWPRn6XVCw0Q@mail.gmail.com>
On Fri, Jan 04, 2013 at 05:03:26AM +0000, Christoffer Dall wrote:
> On Thu, Oct 18, 2012 at 12:15 PM, Steve Capper <steve.capper@arm.com> wrote:
> >
> > /*
> > + * For 3 levels of paging the PTE_EXT_NG bit will be set for user address ptes
> > + * that are written to a page table but not for ptes created with mk_pte.
> > + *
>
> Why is this not the case for 2 levels of paging as well?
>
> Is that because it's always checked against the Linux version, or?
>
>
Yes that's the case, I'll update the comment to reflect that.
> > + * This can cause some comparison tests made by pte_same to fail spuriously and
> > + * lead to other problems.
> > + *
> > + * To correct this behaviour, we mask off PTE_EXT_NG for any pte that is
> > + * present before running the comparison.
>
> nit: This comment doesn't really explain the rationale, I'm assuming
> that pte_same is used to compare only which page gets mapped, assuming
> the attributes etc. remain the same? or also the attributes should be
> the same, only mk_pte sets all of these except the NG bit.
>
I'll expand the comment to include the actual case. Essentially hugetlb_nopage
calls mk_pte to give new_pte and passes this to hugetlb_cow which then performs
a pte_same test against a pte that has already been written out to a page
table; the test fails erroneously due to the mismatch in NG bit.
Unfortunately this then causes a memory leak.
> > + */
> > +#define __HAVE_ARCH_PTE_SAME
> > +static inline int pte_same(pte_t pte_a, pte_t pte_b)
> > +{
> > + pteval_t vala = pte_val(pte_a), valb = pte_val(pte_b);
> > + if (pte_present(pte_a))
> > + vala &= ~L_PTE_CMP_MASKOFF;
> > +
> > + if (pte_present(pte_b))
> > + valb &= ~L_PTE_CMP_MASKOFF;
> > +
> > + return vala == valb;
> > +}
> > +
> > +/*
> > * Encode and decode a swap entry. Swap entries are stored in the Linux
> > * page tables as follows:
> > *
> > --
> > 1.7.9.5
> >
> >
> >
> > _______________________________________________
> > linux-arm-kernel mailing list
> > linux-arm-kernel@lists.infradead.org
> > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
>
next prev parent reply other threads:[~2013-01-08 17:56 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-18 16:15 [RFC PATCH 0/6] ARM: mm: HugeTLB + THP support Steve Capper
2012-10-18 16:15 ` [RFC PATCH 1/6] ARM: mm: correct pte_same behaviour for LPAE Steve Capper
2013-01-04 5:03 ` Christoffer Dall
2013-01-08 17:56 ` Steve Capper [this message]
2012-10-18 16:15 ` [RFC PATCH 2/6] ARM: mm: Add support for flushing HugeTLB pages Steve Capper
2013-01-04 5:03 ` Christoffer Dall
2013-01-08 17:56 ` Steve Capper
2012-10-18 16:15 ` [RFC PATCH 3/6] ARM: mm: HugeTLB support for LPAE systems Steve Capper
2013-01-04 5:03 ` Christoffer Dall
2013-01-08 17:57 ` Steve Capper
2013-01-08 18:10 ` Christoffer Dall
2012-10-18 16:15 ` [RFC PATCH 4/6] ARM: mm: HugeTLB support for non-LPAE systems Steve Capper
2013-01-04 5:04 ` Christoffer Dall
2013-01-04 5:04 ` Christoffer Dall
2013-01-08 17:58 ` Steve Capper
2013-01-08 18:13 ` Christoffer Dall
2013-01-08 18:13 ` Christoffer Dall
2012-10-18 16:15 ` [RFC PATCH 5/6] ARM: mm: Transparent huge page support for LPAE systems Steve Capper
2013-01-04 5:04 ` Christoffer Dall
2013-01-08 17:59 ` Steve Capper
2013-01-08 18:15 ` Christoffer Dall
2012-10-18 16:15 ` [RFC PATCH 6/6] ARM: mm: Transparent huge page support for non-LPAE systems Steve Capper
2013-01-04 5:04 ` Christoffer Dall
2013-01-08 17:59 ` Steve Capper
2013-01-08 18:17 ` Christoffer Dall
2012-12-21 13:41 ` [RFC PATCH 0/6] ARM: mm: HugeTLB + THP support Gregory CLEMENT
2012-12-23 11:11 ` Will Deacon
2012-12-23 11:11 ` Will Deacon
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=20130108175630.GA18347@e103986-lin \
--to=steve.capper@arm.com \
--cc=Catalin.Marinas@arm.com \
--cc=Will.Deacon@arm.com \
--cc=aarcange@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=bill4carson@gmail.com \
--cc=c.dall@virtualopensystems.com \
--cc=cmetcalf@tilera.com \
--cc=hoffman@marvell.com \
--cc=kirill@shutemov.name \
--cc=linux-arch@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=maen@marvell.com \
--cc=mhocko@suse.cz \
--cc=notasas@gmail.com \
--cc=shadi@marvell.com \
--cc=tawfik@marvell.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).