diff mbox

Oneiric SRU: x86, amd: Avoid cache aliasing penalties on AMD family 15h

Message ID 4E84ADE5.3090507@canonical.com
State New
Headers show

Pull-request

git://kernel.ubuntu.com/rtg/ubuntu-oneiric bdozer

Commit Message

Tim Gardner Sept. 29, 2011, 5:41 p.m. UTC
I've tested this patch series on the targeted CPU as well as regression 
testing on non-AMD CPUs. Without intricate and in-depth instrumentation 
I cannot tell if the patch has a positive impact, but I can at least be 
reasonably sure its not deleterious. The AMD guys are pretty hot for 
this patch set. Its been well discussed and merged into tip awaiting the 
3.2 merge window.

The following changes since commit c7d90650a63f4cca4af4df1bd1f97d642453f55f:
   Leann Ogasawara (1):
         UBUNTU: Start new release

are available in the git repository at:

   git://kernel.ubuntu.com/rtg/ubuntu-oneiric bdozer

Borislav Petkov (4):
       x86, amd: Avoid cache aliasing penalties on AMD family 15h
       x86: Add a BSP cpu_dev helper
       x86, amd: Move BSP code to cpu_dev helper
       x86-32, amd: Move va_align definition to unbreak 32-bit build

  Documentation/kernel-parameters.txt |   13 ++++++
  arch/x86/include/asm/elf.h          |   31 ++++++++++++++
  arch/x86/kernel/cpu/amd.c           |   46 +++++++++++++--------
  arch/x86/kernel/cpu/common.c        |    3 +
  arch/x86/kernel/cpu/cpu.h           |    1 +
  arch/x86/kernel/sys_x86_64.c        |   77 
+++++++++++++++++++++++++++++++++-
  arch/x86/mm/mmap.c                  |   20 ++-------
  arch/x86/vdso/vma.c                 |    9 ++++
  8 files changed, 164 insertions(+), 36 deletions(-)

Comments

Leann Ogasawara Sept. 29, 2011, 11:10 p.m. UTC | #1
On Thu, 2011-09-29 at 11:41 -0600, Tim Gardner wrote:
> I've tested this patch series on the targeted CPU as well as regression 
> testing on non-AMD CPUs. Without intricate and in-depth instrumentation 
> I cannot tell if the patch has a positive impact, but I can at least be 
> reasonably sure its not deleterious. The AMD guys are pretty hot for 
> this patch set. Its been well discussed and merged into tip awaiting the 
> 3.2 merge window.

Given testing hasn't produced negative impacts and this is slated to
land upstream for the v3.2.

Acked-by: Leann Ogasawara <leann.ogasawara@canonical.com>

> The following changes since commit c7d90650a63f4cca4af4df1bd1f97d642453f55f:
>    Leann Ogasawara (1):
>          UBUNTU: Start new release
> 
> are available in the git repository at:
> 
>    git://kernel.ubuntu.com/rtg/ubuntu-oneiric bdozer
> 
> Borislav Petkov (4):
>        x86, amd: Avoid cache aliasing penalties on AMD family 15h
>        x86: Add a BSP cpu_dev helper
>        x86, amd: Move BSP code to cpu_dev helper
>        x86-32, amd: Move va_align definition to unbreak 32-bit build
> 
>   Documentation/kernel-parameters.txt |   13 ++++++
>   arch/x86/include/asm/elf.h          |   31 ++++++++++++++
>   arch/x86/kernel/cpu/amd.c           |   46 +++++++++++++--------
>   arch/x86/kernel/cpu/common.c        |    3 +
>   arch/x86/kernel/cpu/cpu.h           |    1 +
>   arch/x86/kernel/sys_x86_64.c        |   77 
> +++++++++++++++++++++++++++++++++-
>   arch/x86/mm/mmap.c                  |   20 ++-------
>   arch/x86/vdso/vma.c                 |    9 ++++
>   8 files changed, 164 insertions(+), 36 deletions(-)
John Johansen Sept. 30, 2011, 12:17 a.m. UTC | #2
On 09/29/2011 10:41 AM, Tim Gardner wrote:
> I've tested this patch series on the targeted CPU as well as regression testing on non-AMD CPUs. Without intricate and in-depth instrumentation I cannot tell if the patch has a positive impact, but I can at least be reasonably sure its not deleterious. The AMD guys are pretty hot for this patch set. Its been well discussed and merged into tip awaiting the 3.2 merge window.
> 
> The following changes since commit c7d90650a63f4cca4af4df1bd1f97d642453f55f:
>   Leann Ogasawara (1):
>         UBUNTU: Start new release
> 
> are available in the git repository at:
> 
>   git://kernel.ubuntu.com/rtg/ubuntu-oneiric bdozer
> 
> Borislav Petkov (4):
>       x86, amd: Avoid cache aliasing penalties on AMD family 15h
>       x86: Add a BSP cpu_dev helper
>       x86, amd: Move BSP code to cpu_dev helper
>       x86-32, amd: Move va_align definition to unbreak 32-bit build
> 
>  Documentation/kernel-parameters.txt |   13 ++++++
>  arch/x86/include/asm/elf.h          |   31 ++++++++++++++
>  arch/x86/kernel/cpu/amd.c           |   46 +++++++++++++--------
>  arch/x86/kernel/cpu/common.c        |    3 +
>  arch/x86/kernel/cpu/cpu.h           |    1 +
>  arch/x86/kernel/sys_x86_64.c        |   77 +++++++++++++++++++++++++++++++++-
>  arch/x86/mm/mmap.c                  |   20 ++-------
>  arch/x86/vdso/vma.c                 |    9 ++++
>  8 files changed, 164 insertions(+), 36 deletions(-)
> 
> 

It looks good, and has regression testing, so

Acked-by: John Johansen <john.johansen@canonical.com>

Out of curiosity did you try this with any of AMDs current CPUs
Stefan Bader Sept. 30, 2011, 11:27 a.m. UTC | #3
On 29.09.2011 19:41, Tim Gardner wrote:
> I've tested this patch series on the targeted CPU as well as regression testing
> on non-AMD CPUs. Without intricate and in-depth instrumentation I cannot tell if
> the patch has a positive impact, but I can at least be reasonably sure its not
> deleterious. The AMD guys are pretty hot for this patch set. Its been well
> discussed and merged into tip awaiting the 3.2 merge window.
> 
> The following changes since commit c7d90650a63f4cca4af4df1bd1f97d642453f55f:
>   Leann Ogasawara (1):
>         UBUNTU: Start new release
> 
> are available in the git repository at:
> 
>   git://kernel.ubuntu.com/rtg/ubuntu-oneiric bdozer
> 
> Borislav Petkov (4):
>       x86, amd: Avoid cache aliasing penalties on AMD family 15h
>       x86: Add a BSP cpu_dev helper
>       x86, amd: Move BSP code to cpu_dev helper
>       x86-32, amd: Move va_align definition to unbreak 32-bit build
> 
>  Documentation/kernel-parameters.txt |   13 ++++++
>  arch/x86/include/asm/elf.h          |   31 ++++++++++++++
>  arch/x86/kernel/cpu/amd.c           |   46 +++++++++++++--------
>  arch/x86/kernel/cpu/common.c        |    3 +
>  arch/x86/kernel/cpu/cpu.h           |    1 +
>  arch/x86/kernel/sys_x86_64.c        |   77 +++++++++++++++++++++++++++++++++-
>  arch/x86/mm/mmap.c                  |   20 ++-------
>  arch/x86/vdso/vma.c                 |    9 ++++
>  8 files changed, 164 insertions(+), 36 deletions(-)
> 

It looks reasonably save. The only case that would get affected is running on a
type 0x15 AMD cpu. Testing seems to be ok.
Just the middle two seem to me only shuffeling things around. On the other hand
they do not hurt...

Acked-by: Stefan Bader <stefan.bader@canonical.com>
Tim Gardner Sept. 30, 2011, 2:01 p.m. UTC | #4
On 09/29/2011 11:41 AM, Tim Gardner wrote:
> I've tested this patch series on the targeted CPU as well as regression
> testing on non-AMD CPUs. Without intricate and in-depth instrumentation
> I cannot tell if the patch has a positive impact, but I can at least be
> reasonably sure its not deleterious. The AMD guys are pretty hot for
> this patch set. Its been well discussed and merged into tip awaiting the
> 3.2 merge window.
>
> The following changes since commit
> c7d90650a63f4cca4af4df1bd1f97d642453f55f:
> Leann Ogasawara (1):
> UBUNTU: Start new release
>
> are available in the git repository at:
>
> git://kernel.ubuntu.com/rtg/ubuntu-oneiric bdozer
>
> Borislav Petkov (4):
> x86, amd: Avoid cache aliasing penalties on AMD family 15h
> x86: Add a BSP cpu_dev helper
> x86, amd: Move BSP code to cpu_dev helper
> x86-32, amd: Move va_align definition to unbreak 32-bit build
>
> Documentation/kernel-parameters.txt | 13 ++++++
> arch/x86/include/asm/elf.h | 31 ++++++++++++++
> arch/x86/kernel/cpu/amd.c | 46 +++++++++++++--------
> arch/x86/kernel/cpu/common.c | 3 +
> arch/x86/kernel/cpu/cpu.h | 1 +
> arch/x86/kernel/sys_x86_64.c | 77 +++++++++++++++++++++++++++++++++-
> arch/x86/mm/mmap.c | 20 ++-------
> arch/x86/vdso/vma.c | 9 ++++
> 8 files changed, 164 insertions(+), 36 deletions(-)
>
Tim Gardner Sept. 30, 2011, 3:01 p.m. UTC | #5
On 09/29/2011 06:17 PM, John Johansen wrote:
> On 09/29/2011 10:41 AM, Tim Gardner wrote:
>> I've tested this patch series on the targeted CPU as well as regression testing on non-AMD CPUs. Without intricate and in-depth instrumentation I cannot tell if the patch has a positive impact, but I can at least be reasonably sure its not deleterious. The AMD guys are pretty hot for this patch set. Its been well discussed and merged into tip awaiting the 3.2 merge window.
>>
>> The following changes since commit c7d90650a63f4cca4af4df1bd1f97d642453f55f:
>>    Leann Ogasawara (1):
>>          UBUNTU: Start new release
>>
>> are available in the git repository at:
>>
>>    git://kernel.ubuntu.com/rtg/ubuntu-oneiric bdozer
>>
>> Borislav Petkov (4):
>>        x86, amd: Avoid cache aliasing penalties on AMD family 15h
>>        x86: Add a BSP cpu_dev helper
>>        x86, amd: Move BSP code to cpu_dev helper
>>        x86-32, amd: Move va_align definition to unbreak 32-bit build
>>
>>   Documentation/kernel-parameters.txt |   13 ++++++
>>   arch/x86/include/asm/elf.h          |   31 ++++++++++++++
>>   arch/x86/kernel/cpu/amd.c           |   46 +++++++++++++--------
>>   arch/x86/kernel/cpu/common.c        |    3 +
>>   arch/x86/kernel/cpu/cpu.h           |    1 +
>>   arch/x86/kernel/sys_x86_64.c        |   77 +++++++++++++++++++++++++++++++++-
>>   arch/x86/mm/mmap.c                  |   20 ++-------
>>   arch/x86/vdso/vma.c                 |    9 ++++
>>   8 files changed, 164 insertions(+), 36 deletions(-)
>>
>>
>
> It looks good, and has regression testing, so
>
> Acked-by: John Johansen<john.johansen@canonical.com>
>
> Out of curiosity did you try this with any of AMDs current CPUs

John - I've only tried this on the affected AMD CPU as its the only AMD 
I have in my possession.
diff mbox

Patch

From ced0a60251915b657103239c88fee60117988ddf Mon Sep 17 00:00:00 2001
From: Borislav Petkov <borislav.petkov@amd.com>
Date: Sat, 6 Aug 2011 14:31:38 +0200
Subject: [PATCH 4/4] x86-32, amd: Move va_align definition to unbreak 32-bit build

BugLink: http://bugs.launchpad.net/bugs/862583

hpa reported that dfb09f9b7ab03fd367740e541a5caf830ed56726 breaks 32-bit
builds with the following error message:

/home/hpa/kernel/linux-tip.cpu/arch/x86/kernel/cpu/amd.c:437: undefined
reference to `va_align'
/home/hpa/kernel/linux-tip.cpu/arch/x86/kernel/cpu/amd.c:436: undefined
reference to `va_align'

This is due to the fact that va_align is a global in a 64-bit only
compilation unit. Move it to mmap.c where it is visible to both
subarches.

Signed-off-by: Borislav Petkov <borislav.petkov@amd.com>
Link: http://lkml.kernel.org/r/1312633899-1131-1-git-send-email-bp@amd64.org
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
(cherry picked from git://tesla.tglx.de/git/linux-2.6-tip x86/cpu commit 9387f774d61b01ab71bade85e6d0bfab0b3419bd)

Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
---
 arch/x86/kernel/sys_x86_64.c |    4 ----
 arch/x86/mm/mmap.c           |    5 ++++-
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/arch/x86/kernel/sys_x86_64.c b/arch/x86/kernel/sys_x86_64.c
index aaa8d09..fe7d2da 100644
--- a/arch/x86/kernel/sys_x86_64.c
+++ b/arch/x86/kernel/sys_x86_64.c
@@ -18,10 +18,6 @@ 
 #include <asm/ia32.h>
 #include <asm/syscalls.h>
 
-struct __read_mostly va_alignment va_align = {
-	.flags = -1,
-};
-
 /*
  * Align a virtual address to avoid aliasing in the I$ on AMD F15h.
  *
diff --git a/arch/x86/mm/mmap.c b/arch/x86/mm/mmap.c
index 019ae78..ea640c0 100644
--- a/arch/x86/mm/mmap.c
+++ b/arch/x86/mm/mmap.c
@@ -31,6 +31,10 @@ 
 #include <linux/sched.h>
 #include <asm/elf.h>
 
+struct __read_mostly va_alignment va_align = {
+	.flags = -1,
+};
+
 static unsigned int stack_maxrandom_size(void)
 {
 	unsigned int max = 0;
@@ -42,7 +46,6 @@  static unsigned int stack_maxrandom_size(void)
 	return max;
 }
 
-
 /*
  * Top of mmap area (just below the process stack).
  *
-- 
1.7.0.4