diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index 8bcd353e333e..4826d10e9f37 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -1101,6 +1101,16 @@ config ARCH_HAS_CACHE_LINE_SIZE config ARCH_ENABLE_SPLIT_PMD_PTLOCK def_bool y if PGTABLE_LEVELS > 2 +config ARCH_LLC_128_WORKAROUND + bool "Workaround for 128 bytes LLC cacheline" + depends on ARM64 + default n + help + LLC cacheline size may be up to 128 bytes, and this + is useful if you want to do workaround on such + case. It can be used to align memory address to get + good cache utilization et al. + config SECCOMP bool "Enable seccomp to safely compute untrusted bytecode" ---help--- diff --git a/arch/arm64/configs/tencent.config b/arch/arm64/configs/tencent.config index 59bb3fe625f5..d89c63cbe2bd 100644 --- a/arch/arm64/configs/tencent.config +++ b/arch/arm64/configs/tencent.config @@ -666,6 +666,7 @@ CONFIG_SCSI_AIC7XXX=m CONFIG_SCSI_AIC79XX=m CONFIG_AIC79XX_CMDS_PER_DEVICE=4 CONFIG_AIC79XX_RESET_DELAY_MS=15000 +CONFIG_ARCH_LLC_128_WORKAROUND=y # CONFIG_AIC79XX_DEBUG_ENABLE is not set # CONFIG_AIC79XX_REG_PRETTY_PRINT is not set CONFIG_SCSI_AIC94XX=m diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c index 2bc278dd9854..384e6216336d 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c @@ -46,9 +46,24 @@ enum timekeeping_adv_mode { * cache line. */ static struct { +#ifdef CONFIG_ARCH_LLC_128_WORKAROUND + /* Start seq on the middle of 128 bytes aligned address to + * keep some members of tk_core in the same 64 bytes for + * principle of locality while pushing others to another LLC + * cacheline to avoid false sharing. + */ + u8 padding1[64]; + seqcount_t seq; + /* Push some timekeeper memebers to another LLC cacheline */ + u8 padding2[16]; + struct timekeeper timekeeper; + /* For 128 bytes LLC cacheline */ +} tk_core __aligned(128) = { +#else seqcount_t seq; struct timekeeper timekeeper; } tk_core ____cacheline_aligned = { +#endif .seq = SEQCNT_ZERO(tk_core.seq), };