public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Vivek Goyal <vgoyal@redhat.com>
To: mingo@elte.hu
Cc: stable@kernel.org, linux-kernel@vger.kernel.org,
	Thomas Gleixner <tglx@linutronix.de>,
	Andi Kleen <andi@firstfloor.org>
Subject: Re: [patch 1/3] x86_64: CPA, fix cache attribute inconsistency bug, v2.6.22 backport
Date: Wed, 20 Feb 2008 15:30:18 -0500	[thread overview]
Message-ID: <20080220203018.GD7415@redhat.com> (raw)
In-Reply-To: <20080215195821.GA15432@elte.hu>

On Fri, Feb 15, 2008 at 08:58:22PM +0100, Ingo Molnar wrote:
> 
> fix CPA cache attribute bug in v2.6.23. When phys_base is nonzero
> (when CONFIG_RELOCATABLE=y) then change_page_attr_addr() miscalculates
> the secondary alias address by -14 MB (depending on the configured
> offset).
> 
> The default 64-bit kernels of Fedora and Ubuntu are affected:
> 
>    $ grep RELOCA /boot/config-2.6.23.9-85.fc8
>      CONFIG_RELOCATABLE=y
> 
>    $ grep RELOC /boot/config-2.6.22-14-generic
>      CONFIG_RELOCATABLE=y
> 
> and probably on many other distros as well.
> 
> the bug affects all pages in the first 40 MB of physical RAM that
> are allocated by some subsystem that does ioremap_nocache() on them:
> 
>        if (__pa(address) < KERNEL_TEXT_SIZE) {
> 
> Hence we might leave page table entries with inconsistent cache
> attributes around (pages mapped at both UnCacheable and Write-Back),
> and we can also set the wrong kernel text pages to UnCacheable.
> 
> the effects of this bug can be random slowdowns and other misbehavior.
> If for example AGP allocates its aperture pages into the first 40 MB
> of physical RAM, then the -14 MB bug might mark random kernel texto
> pages as uncacheable, slowing down a random portion of the 64-bit
> kernel until the AGP driver is unloaded.
> 
> Signed-off-by: Ingo Molnar <mingo@elte.hu>
> Acked-by: Thomas Gleixner <tglx@linutronix.de>
> ---
>  arch/x86_64/mm/pageattr.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> Index: linux-tmp/arch/x86_64/mm/pageattr.c
> ===================================================================
> --- linux-tmp.orig/arch/x86_64/mm/pageattr.c
> +++ linux-tmp/arch/x86_64/mm/pageattr.c
> @@ -204,7 +204,7 @@ int change_page_attr_addr(unsigned long 
>  		if (__pa(address) < KERNEL_TEXT_SIZE) {

Hi Ingo,

Should we change above condition also to something like following.

kernel_phys_start = __pa(__START_KERNEL_map) + phys_base
kernel_phys_end = kernel_phys_start + KERNEL_TEXT_SIZE

if (__pa(address) >= kernel_phys_start
	&& __pa(address) <= kernel_phys_end)  

Looks like we are trying to see if a physical page has been mapped
by kernel text/data region also then change the caching attributes there too.

In case of relocatable kernel, not necessarily first 40MB will be mapped by
the kernel text/data region, If boot loader decides to load kernel
at a higher address and phys_base is non-zero.

Thanks
Vivek

  parent reply	other threads:[~2008-02-20 20:31 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-15 19:55 [patch 0/3] x86_64: CPA, fix cache attribute inconsistency bug Ingo Molnar
2008-02-15 19:58 ` [patch 1/3] x86_64: CPA, fix cache attribute inconsistency bug, v2.6.22 backport Ingo Molnar
2008-02-15 20:00   ` Ingo Molnar
2008-02-15 20:41   ` Oliver Pinter
2008-02-20 20:30   ` Vivek Goyal [this message]
2008-02-20 20:44     ` Vivek Goyal
2008-02-15 19:58 ` [patch 2/3] x86_64: CPA, fix cache attribute inconsistency bug, v2.6.23 backport Ingo Molnar
2008-02-15 19:59 ` [patch 3/3] x86_64: CPA, fix cache attribute inconsistency bug, v2.6.24 backport Ingo Molnar

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=20080220203018.GD7415@redhat.com \
    --to=vgoyal@redhat.com \
    --cc=andi@firstfloor.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=stable@kernel.org \
    --cc=tglx@linutronix.de \
    /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