All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andi Kleen <ak@suse.de>
To: Stuart_Hayes@Dell.com
Cc: riel@redhat.com, ak@suse.de, andrea@suse.dk,
	linux-kernel@vger.kernel.org
Subject: Re: page allocation/attributes question (i386/x86_64 specific)
Date: Sat, 25 Jun 2005 04:28:12 +0200	[thread overview]
Message-ID: <20050625022811.GY14251@wotan.suse.de> (raw)
In-Reply-To: <7A8F92187EF7A249BF847F1BF4903C040AFD05@ausx2kmpc103.aus.amer.dell.com>

On Fri, Jun 24, 2005 at 01:20:04PM -0500, Stuart_Hayes@Dell.com wrote:
> Rik Van Riel wrote:
> > On Wed, 22 Jun 2005 Stuart_Hayes@Dell.com wrote:
> > 
> >> My question is this:  when split_large_page() is called, should it
> >> make the other 511 PTEs inherit the page attributes from the large
> >> page (with the exception of PAGE_PSE, obviously)?
> > 
> > I suspect it should.
> 
> (Copying Andi Kleen & Andrea Arcangeli since they were involved in a
> previous discussion of this.  I'm trying to fix the NX handling when
> change_page_attr() is called in i386.)
> 
> After looking into it further, I agree completely.  I found a thread in
> which this was discussed
> (http://marc.theaimsgroup.com/?l=linux-kernel&m=109964359124731&w=2),
> and discovered that this has been addressed in the X86_64 kernel.

You don't say which kernel you were working against. 2.6.11 has
some fixes in this area (in particular with the reference counts) 

> However, when I used "change_page_attr()" to change the page to
> PAGE_KERNEL, it did just that.  But PAGE_KERNEL has the _PAGE_NX bit set
> and isn't executable.  And, since PAGE_KERNEL (with _PAGE_NX set) didn't
> match the original pages attributes, the 512 PTEs weren't reverted back
> into a large page.  (Also, __change_page_attr() did *another* get_page()
> on the page containing these 512 PTEs, so now the page_count has gone up
> to 3, instead of going back down to 1 (or staying at 2).)

That should be already fixed.
> 
> Is the function that calls "change_page_attr()" expected to look at the
> attributes of the page before calling change_page_attr(), so it knows
> how to un-change the attributes when it is finished with the page (since
> PAGE_KERNEL isn't always what the page was originally)?

No, it's not supposed to do such checks on its own.

> 
> Or should "change_page_attr()" ignore the NX bit in the "pgprot_t prot"
> parameter that's passed to it, and just inherit NX from the
> large/existing page?  Then change_page_attr(page,PAGE_KERNEL) could be
> used to undo changes, but change_page_attr() couldn't be used to modify
> the NX bit.

I don't think that makes sense. It should exactly set the protection
the caller requested and revert when the protection is exactly like
it was before.

-Andi

  reply	other threads:[~2005-06-25  2:28 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-06-24 18:20 page allocation/attributes question (i386/x86_64 specific) Stuart_Hayes
2005-06-25  2:28 ` Andi Kleen [this message]
  -- strict thread matches above, loose matches on Subject: below --
2005-07-20 19:24 Stuart_Hayes
2005-07-20 15:06 Stuart_Hayes
2005-07-20 20:45 ` Ingo Molnar
2005-07-20 14:51 Stuart_Hayes
2005-07-20 15:00 ` Ingo Molnar
2005-07-19 21:20 Stuart Hayes
2005-07-19 22:04 ` Ingo Molnar
2005-07-07 17:21 Stuart_Hayes
2005-07-05 21:35 Stuart_Hayes
2005-07-05 22:00 ` randy_dunlap
2005-07-05 20:02 Stuart_Hayes
2005-07-05 21:27 ` randy_dunlap
2005-07-07 14:33 ` Andi Kleen
2005-07-01 20:33 Stuart_Hayes
2005-06-30 19:11 Stuart_Hayes
2005-06-30 17:14 Stuart_Hayes
2005-06-30 16:56 Stuart_Hayes
2005-06-30 17:34 ` Arjan van de Ven
2005-06-29 17:20 Stuart_Hayes
2005-06-28 20:16 Stuart_Hayes
2005-06-30 16:15 ` Andi Kleen
2005-06-22 17:11 Stuart_Hayes
2005-06-22 23:54 ` Rik Van Riel

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=20050625022811.GY14251@wotan.suse.de \
    --to=ak@suse.de \
    --cc=Stuart_Hayes@Dell.com \
    --cc=andrea@suse.dk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=riel@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.