The RISC-V patch (2/3) is based on Gary's TLB flush patch series
https://patchwork.kernel.org/project/linux-riscv/list/?series=97315
The x86 kconfig fix patch(1/3) can be applied separately.
Chnages from v2->v3:
1. Fixed typos and commit text formatting.
Changes from v1->v2:
1. Move the arch specific config option to a common one as it touches
generic code.
2. Introduced another config that architectures can select to enable
tlbflush option.
Atish Patra (3):
x86: Move DEBUG_TLBFLUSH option.
RISC-V: Enable TLBFLUSH counters for debug kernel.
RISC-V: Update tlb flush counters
arch/riscv/Kconfig | 1 +
arch/riscv/include/asm/tlbflush.h | 5 +++++
arch/riscv/mm/tlbflush.c | 12 ++++++++++++
arch/x86/Kconfig | 1 +
arch/x86/Kconfig.debug | 19 -------------------
mm/Kconfig.debug | 13 +++++++++++++
6 files changed, 32 insertions(+), 19 deletions(-)
--
2.21.0
CONFIG_DEBUG_TLBFLUSH was added in
'commit 3df3212f9722 ("x86/tlb: add tlb_flushall_shift knob into debugfs")'
to support tlb_flushall_shift knob. The knob was removed in
'commit e9f4e0a9fe27 ("x86/mm: Rip out complicated, out-of-date, buggy
TLB flushing")'.
However, the debug option was never removed from Kconfig. It was reused
in commit
'9824cf9753ec ("mm: vmstats: tlb flush counters")'
but the commit text was never updated accordingly.
Update the Kconfig option description as per its current usage.
Take this opportunity to make this kconfig option a common option as it
touches the common vmstat code. Introduce another arch specific config
HAVE_ARCH_DEBUG_TLBFLUSH that can be selected to enable this config.
Signed-off-by: Atish Patra <[email protected]>
---
arch/x86/Kconfig | 1 +
arch/x86/Kconfig.debug | 19 -------------------
mm/Kconfig.debug | 13 +++++++++++++
3 files changed, 14 insertions(+), 19 deletions(-)
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 62fc3fda1a05..4c59f59e9491 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -132,6 +132,7 @@ config X86
select HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD if X86_64
select HAVE_ARCH_VMAP_STACK if X86_64
select HAVE_ARCH_WITHIN_STACK_FRAMES
+ select HAVE_ARCH_DEBUG_TLBFLUSH if DEBUG_KERNEL
select HAVE_CMPXCHG_DOUBLE
select HAVE_CMPXCHG_LOCAL
select HAVE_CONTEXT_TRACKING if X86_64
diff --git a/arch/x86/Kconfig.debug b/arch/x86/Kconfig.debug
index 15d0fbe27872..0c8f9931e901 100644
--- a/arch/x86/Kconfig.debug
+++ b/arch/x86/Kconfig.debug
@@ -124,25 +124,6 @@ config DOUBLEFAULT
option saves about 4k and might cause you much additional grey
hair.
-config DEBUG_TLBFLUSH
- bool "Set upper limit of TLB entries to flush one-by-one"
- depends on DEBUG_KERNEL
- ---help---
-
- X86-only for now.
-
- This option allows the user to tune the amount of TLB entries the
- kernel flushes one-by-one instead of doing a full TLB flush. In
- certain situations, the former is cheaper. This is controlled by the
- tlb_flushall_shift knob under /sys/kernel/debug/x86. If you set it
- to -1, the code flushes the whole TLB unconditionally. Otherwise,
- for positive values of it, the kernel will use single TLB entry
- invalidating instructions according to the following formula:
-
- flush_entries <= active_tlb_entries / 2^tlb_flushall_shift
-
- If in doubt, say "N".
-
config IOMMU_DEBUG
bool "Enable IOMMU debugging"
depends on GART_IOMMU && DEBUG_KERNEL
diff --git a/mm/Kconfig.debug b/mm/Kconfig.debug
index e3df921208c0..e8622b26f0c2 100644
--- a/mm/Kconfig.debug
+++ b/mm/Kconfig.debug
@@ -111,3 +111,16 @@ config DEBUG_RODATA_TEST
depends on STRICT_KERNEL_RWX
---help---
This option enables a testcase for the setting rodata read-only.
+
+config HAVE_ARCH_DEBUG_TLBFLUSH
+ bool
+ depends on DEBUG_KERNEL
+
+config DEBUG_TLBFLUSH
+ bool "Save tlb flush statistics to vmstat"
+ depends on HAVE_ARCH_DEBUG_TLBFLUSH
+ help
+
+ Add tlbflush statistics to vmstat. It is really helpful understand tlbflush
+ performance and behavior. It should be enabled only for debugging purpose
+ by individual architectures explicitly by selecting HAVE_ARCH_DEBUG_TLBFLUSH.
--
2.21.0
On Mon, 29 Apr 2019, Atish Patra wrote:
> CONFIG_DEBUG_TLBFLUSH was added in
>
> 'commit 3df3212f9722 ("x86/tlb: add tlb_flushall_shift knob into debugfs")'
> to support tlb_flushall_shift knob. The knob was removed in
>
> 'commit e9f4e0a9fe27 ("x86/mm: Rip out complicated, out-of-date, buggy
> TLB flushing")'.
> However, the debug option was never removed from Kconfig. It was reused
> in commit
>
> '9824cf9753ec ("mm: vmstats: tlb flush counters")'
> but the commit text was never updated accordingly.
>
> Update the Kconfig option description as per its current usage.
>
> Take this opportunity to make this kconfig option a common option as it
> touches the common vmstat code. Introduce another arch specific config
> HAVE_ARCH_DEBUG_TLBFLUSH that can be selected to enable this config.
Looks like this one still needs to be merged or acked by one of the x86
maintainers?
- Paul