linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrea Arcangeli <aarcange@redhat.com>
To: Andy Whitcroft <apw@canonical.com>
Cc: Borislav Petkov <bp@alien8.de>,
	Stefan Bader <stefan.bader@canonical.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Ingo Molnar <mingo@kernel.org>, Mel Gorman <mgorman@suse.de>
Subject: Re: x86/mm/pageattr: Code without effect?
Date: Mon, 8 Apr 2013 17:32:23 +0200	[thread overview]
Message-ID: <20130408153223.GA14121@redhat.com> (raw)
In-Reply-To: <20130408145331.GA3303@dm>

On Mon, Apr 08, 2013 at 03:53:31PM +0100, Andy Whitcroft wrote:
> On Sat, Apr 06, 2013 at 04:58:04PM +0200, Andrea Arcangeli wrote:
> 
> > You're right, so this location clearly didn't trigger the problem so I
> > didn't notice the noop here. I only exercised the fix in the other
> > locations of the file that had the same problem.
> > 
> > It was a noop, so it really couldn't hurt but the below change should
> > activate the fix there too. On the same lines, there was a superfluous
> > initialization of new_prot too which I cleaned up.
> 
> Although the new code is essentially noop, the other part of the change
> in try_preserve_large_page() moves the canon_pgprot() up above the
> static_protections() incantation which replaces its value, thus we lose
> the effect of that on the protection bits.  I suspect this only affects
> older CPUs (?) but I do think there is a negative semantic change here:
> 
> +       new_prot = canon_pgprot(new_prot);
> [...]
>         new_prot = static_protections(req_prot, address, pfn);
> [...]
> -               new_pte = pfn_pte(pte_pfn(old_pte), canon_pgprot(new_prot));
> +               new_pte = pfn_pte(pte_pfn(old_pte), new_prot);

Agreed, canon_pgprot is only for old cpus so it went unnoticed. The
patch I posted yesterday will fix that too.

static_protections only clear bits. canon_pgprot only clear bits
too. So the order won't matter. And unless we want to enforce
canon_pgprot to always run after static_protections for whatever
reason it should be fine now. If you want to enforce canon_pgprot to
always run last let me know.

Thanks,
Andrea

      reply	other threads:[~2013-04-08 15:34 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-05  9:01 x86/mm/pageattr: Code without effect? Stefan Bader
2013-04-05 14:21 ` Borislav Petkov
2013-04-06 14:58   ` Andrea Arcangeli
2013-04-06 15:47     ` Borislav Petkov
2013-04-08 11:53       ` Ingo Molnar
2013-04-08 11:59         ` Borislav Petkov
2013-04-08 12:28           ` Stefan Bader
2013-04-08 12:51             ` Borislav Petkov
2013-04-08 13:10               ` Stefan Bader
2013-04-08 14:15                 ` Borislav Petkov
2013-04-08 14:51                   ` Stefan Bader
2013-04-08 14:53     ` Andy Whitcroft
2013-04-08 15:32       ` Andrea Arcangeli [this message]

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=20130408153223.GA14121@redhat.com \
    --to=aarcange@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=apw@canonical.com \
    --cc=bp@alien8.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mgorman@suse.de \
    --cc=mingo@kernel.org \
    --cc=stefan.bader@canonical.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).