From aaa6b5352420aaaf9d46848facb5854927b3130e Mon Sep 17 00:00:00 2001 From: Carlos Eduardo Seo Date: Fri, 29 Jul 2016 14:02:26 -0300 Subject: [PATCH] runtime: insufficient padding in the `p` structure The current padding in the 'p' struct is hardcoded at 64 bytes. It should be the cache line size. On ppc64x, the current value is only okay because sys.CacheLineSize is wrong at 64 bytes. This change fixes that by making the padding equal to the cache line size. It also fixes the cache line size for ppc64/ppc64le to 128 bytes. Fixes #16477 Change-Id: Ib7ec5195685116eb11ba312a064f41920373d4a3 Reviewed-on: https://go-review.googlesource.com/25370 Reviewed-by: Lynn Boger Reviewed-by: Minux Ma Run-TryBot: Michael Munday TryBot-Result: Gobot Gobot --- src/runtime/internal/sys/arch_ppc64.go | 2 +- src/runtime/internal/sys/arch_ppc64le.go | 2 +- src/runtime/runtime2.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/runtime/internal/sys/arch_ppc64.go b/src/runtime/internal/sys/arch_ppc64.go index cdec63ff71..f908ce2173 100644 --- a/src/runtime/internal/sys/arch_ppc64.go +++ b/src/runtime/internal/sys/arch_ppc64.go @@ -7,7 +7,7 @@ package sys const ( ArchFamily = PPC64 BigEndian = 1 - CacheLineSize = 64 + CacheLineSize = 128 PhysPageSize = 65536 PCQuantum = 4 Int64Align = 8 diff --git a/src/runtime/internal/sys/arch_ppc64le.go b/src/runtime/internal/sys/arch_ppc64le.go index 4fd68f9ce3..3d95f9e96c 100644 --- a/src/runtime/internal/sys/arch_ppc64le.go +++ b/src/runtime/internal/sys/arch_ppc64le.go @@ -7,7 +7,7 @@ package sys const ( ArchFamily = PPC64 BigEndian = 0 - CacheLineSize = 64 + CacheLineSize = 128 PhysPageSize = 65536 PCQuantum = 4 Int64Align = 8 diff --git a/src/runtime/runtime2.go b/src/runtime/runtime2.go index 24f85d943d..2e886742b5 100644 --- a/src/runtime/runtime2.go +++ b/src/runtime/runtime2.go @@ -498,7 +498,7 @@ type p struct { runSafePointFn uint32 // if 1, run sched.safePointFn at next safe point - pad [64]byte + pad [sys.CacheLineSize]byte } const ( -- 2.48.1