2019-04-12 01:45:02

by Sinan Kaya

[permalink] [raw]
Subject: [PATCH v4 0/5] init: Do not select DEBUG_KERNEL by default

CONFIG_DEBUG_KERNEL has been designed to just enable Kconfig options.
Kernel code generatoin should not depend on CONFIG_DEBUG_KERNEL.

Proposed alternative plan: let's add a new symbol, something like
DEBUG_MISC ("Miscellaneous debug code that should be under a more
specific debug option but isn't"), make it depend on DEBUG_KERNEL and be
"default DEBUG_KERNEL" but allow itself to be turned off, and then
mechanically change the small handful of "#ifdef CONFIG_DEBUG_KERNEL" to
"#ifdef CONFIG_DEBUG_MISC".

Sinan Kaya (5):
init: Introduce DEBUG_MISC option
powerpc: Replace CONFIG_DEBUG_KERNEL with CONFIG_DEBUG_MISC
mips: Replace CONFIG_DEBUG_KERNEL with CONFIG_DEBUG_MISC
xtensa: Replace CONFIG_DEBUG_KERNEL with CONFIG_DEBUG_MISC
net: Replace CONFIG_DEBUG_KERNEL with CONFIG_DEBUG_MISC

arch/mips/kernel/setup.c | 2 +-
arch/powerpc/kernel/sysfs.c | 8 ++++----
arch/xtensa/include/asm/irqflags.h | 2 +-
arch/xtensa/kernel/smp.c | 2 +-
lib/Kconfig.debug | 9 +++++++++
net/netfilter/core.c | 2 +-
6 files changed, 17 insertions(+), 8 deletions(-)

--
2.21.0


2019-04-12 01:45:07

by Sinan Kaya

[permalink] [raw]
Subject: [PATCH v4 1/5] init: Introduce DEBUG_MISC option

Introduce DEBUG_MISC ("Miscellaneous debug code that should be under a more
specific debug option but isn't"), make it depend on DEBUG_KERNEL and be
"default DEBUG_KERNEL" but allow itself to be turned off, and then
mechanically change the small handful of "#ifdef CONFIG_DEBUG_KERNEL" to
"#ifdef CONFIG_DEBUG_MISC".

Signed-off-by: Sinan Kaya <[email protected]>
---
lib/Kconfig.debug | 9 +++++++++
1 file changed, 9 insertions(+)

diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index 0d9e81779e37..2f80ebaa6d9a 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -438,6 +438,15 @@ config DEBUG_KERNEL
Say Y here if you are developing drivers or trying to debug and
identify kernel problems.

+config DEBUG_MISC
+ bool "Miscellaneous debug code"
+ default DEBUG_KERNEL
+ depends on DEBUG_KERNEL
+ help
+ Say Y here if you need to enable Miscellaneous debug code that should
+ be under a more specific debug option but isn't.
+
+
menu "Memory Debugging"

source "mm/Kconfig.debug"
--
2.21.0

2019-04-12 01:45:13

by Sinan Kaya

[permalink] [raw]
Subject: [PATCH v4 2/5] powerpc: Replace CONFIG_DEBUG_KERNEL with CONFIG_DEBUG_MISC

CONFIG_DEBUG_KERNEL should not impact code generation. Use the newly
defined CONFIG_DEBUG_MISC instead to keep the current code.

Signed-off-by: Sinan Kaya <[email protected]>
---
arch/powerpc/kernel/sysfs.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/powerpc/kernel/sysfs.c b/arch/powerpc/kernel/sysfs.c
index e8e93c2c7d03..7a1708875d27 100644
--- a/arch/powerpc/kernel/sysfs.c
+++ b/arch/powerpc/kernel/sysfs.c
@@ -610,7 +610,7 @@ SYSFS_PMCSETUP(pa6t_pmc2, SPRN_PA6T_PMC2);
SYSFS_PMCSETUP(pa6t_pmc3, SPRN_PA6T_PMC3);
SYSFS_PMCSETUP(pa6t_pmc4, SPRN_PA6T_PMC4);
SYSFS_PMCSETUP(pa6t_pmc5, SPRN_PA6T_PMC5);
-#ifdef CONFIG_DEBUG_KERNEL
+#ifdef CONFIG_DEBUG_MISC
SYSFS_SPRSETUP(hid0, SPRN_HID0);
SYSFS_SPRSETUP(hid1, SPRN_HID1);
SYSFS_SPRSETUP(hid4, SPRN_HID4);
@@ -639,7 +639,7 @@ SYSFS_SPRSETUP(tsr0, SPRN_PA6T_TSR0);
SYSFS_SPRSETUP(tsr1, SPRN_PA6T_TSR1);
SYSFS_SPRSETUP(tsr2, SPRN_PA6T_TSR2);
SYSFS_SPRSETUP(tsr3, SPRN_PA6T_TSR3);
-#endif /* CONFIG_DEBUG_KERNEL */
+#endif /* CONFIG_DEBUG_MISC */
#endif /* HAS_PPC_PMC_PA6T */

#ifdef HAS_PPC_PMC_IBM
@@ -680,7 +680,7 @@ static struct device_attribute pa6t_attrs[] = {
__ATTR(pmc3, 0600, show_pa6t_pmc3, store_pa6t_pmc3),
__ATTR(pmc4, 0600, show_pa6t_pmc4, store_pa6t_pmc4),
__ATTR(pmc5, 0600, show_pa6t_pmc5, store_pa6t_pmc5),
-#ifdef CONFIG_DEBUG_KERNEL
+#ifdef CONFIG_DEBUG_MISC
__ATTR(hid0, 0600, show_hid0, store_hid0),
__ATTR(hid1, 0600, show_hid1, store_hid1),
__ATTR(hid4, 0600, show_hid4, store_hid4),
@@ -709,7 +709,7 @@ static struct device_attribute pa6t_attrs[] = {
__ATTR(tsr1, 0600, show_tsr1, store_tsr1),
__ATTR(tsr2, 0600, show_tsr2, store_tsr2),
__ATTR(tsr3, 0600, show_tsr3, store_tsr3),
-#endif /* CONFIG_DEBUG_KERNEL */
+#endif /* CONFIG_DEBUG_MISC */
};
#endif /* HAS_PPC_PMC_PA6T */
#endif /* HAS_PPC_PMC_CLASSIC */
--
2.21.0

2019-04-12 01:45:19

by Sinan Kaya

[permalink] [raw]
Subject: [PATCH v4 3/5] mips: Replace CONFIG_DEBUG_KERNEL with CONFIG_DEBUG_MISC

CONFIG_DEBUG_KERNEL should not impact code generation. Use the newly
defined CONFIG_DEBUG_MISC instead to keep the current code.

Signed-off-by: Sinan Kaya <[email protected]>
---
arch/mips/kernel/setup.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c
index 8d1dc6c71173..9fc8fadb8418 100644
--- a/arch/mips/kernel/setup.c
+++ b/arch/mips/kernel/setup.c
@@ -563,7 +563,7 @@ static void __init bootmem_init(void)
offset = __pa_symbol(_text) - __pa_symbol(VMLINUX_LOAD_ADDRESS);
memblock_free(__pa_symbol(VMLINUX_LOAD_ADDRESS), offset);

-#if defined(CONFIG_DEBUG_KERNEL) && defined(CONFIG_DEBUG_INFO)
+#if defined(CONFIG_DEBUG_MISC) && defined(CONFIG_DEBUG_INFO)
/*
* This information is necessary when debugging the kernel
* But is a security vulnerability otherwise!
--
2.21.0

2019-04-12 01:46:20

by Sinan Kaya

[permalink] [raw]
Subject: [PATCH v4 5/5] net: Replace CONFIG_DEBUG_KERNEL with CONFIG_DEBUG_MISC

CONFIG_DEBUG_KERNEL should not impact code generation. Use the newly
defined CONFIG_DEBUG_MISC instead to keep the current code.

Signed-off-by: Sinan Kaya <[email protected]>
---
net/netfilter/core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/netfilter/core.c b/net/netfilter/core.c
index 93aaec3a54ec..cac3bad47f5e 100644
--- a/net/netfilter/core.c
+++ b/net/netfilter/core.c
@@ -162,7 +162,7 @@ nf_hook_entries_grow(const struct nf_hook_entries *old,

static void hooks_validate(const struct nf_hook_entries *hooks)
{
-#ifdef CONFIG_DEBUG_KERNEL
+#ifdef CONFIG_DEBUG_MISC
struct nf_hook_ops **orig_ops;
int prio = INT_MIN;
size_t i = 0;
--
2.21.0

2019-04-12 01:46:50

by Sinan Kaya

[permalink] [raw]
Subject: [PATCH v4 4/5] xtensa: Replace CONFIG_DEBUG_KERNEL with CONFIG_DEBUG_MISC

CONFIG_DEBUG_KERNEL should not impact code generation. Use the newly
defined CONFIG_DEBUG_MISC instead to keep the current code.

Signed-off-by: Sinan Kaya <[email protected]>
---
arch/xtensa/include/asm/irqflags.h | 2 +-
arch/xtensa/kernel/smp.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/xtensa/include/asm/irqflags.h b/arch/xtensa/include/asm/irqflags.h
index 9b5e8526afe5..12890681587b 100644
--- a/arch/xtensa/include/asm/irqflags.h
+++ b/arch/xtensa/include/asm/irqflags.h
@@ -27,7 +27,7 @@ static inline unsigned long arch_local_irq_save(void)
{
unsigned long flags;
#if XTENSA_FAKE_NMI
-#if defined(CONFIG_DEBUG_KERNEL) && (LOCKLEVEL | TOPLEVEL) >= XCHAL_DEBUGLEVEL
+#if defined(CONFIG_DEBUG_MISC) && (LOCKLEVEL | TOPLEVEL) >= XCHAL_DEBUGLEVEL
unsigned long tmp;

asm volatile("rsr %0, ps\t\n"
diff --git a/arch/xtensa/kernel/smp.c b/arch/xtensa/kernel/smp.c
index 3699d6d3e479..83b244ce61ee 100644
--- a/arch/xtensa/kernel/smp.c
+++ b/arch/xtensa/kernel/smp.c
@@ -126,7 +126,7 @@ void secondary_start_kernel(void)

init_mmu();

-#ifdef CONFIG_DEBUG_KERNEL
+#ifdef CONFIG_DEBUG_MISC
if (boot_secondary_processors == 0) {
pr_debug("%s: boot_secondary_processors:%d; Hanging cpu:%d\n",
__func__, boot_secondary_processors, cpu);
--
2.21.0

2019-04-12 03:02:17

by Josh Triplett

[permalink] [raw]
Subject: Re: [PATCH v4 1/5] init: Introduce DEBUG_MISC option

On Fri, Apr 12, 2019 at 01:43:51AM +0000, Sinan Kaya wrote:
> Introduce DEBUG_MISC ("Miscellaneous debug code that should be under a more
> specific debug option but isn't"), make it depend on DEBUG_KERNEL and be
> "default DEBUG_KERNEL" but allow itself to be turned off, and then
> mechanically change the small handful of "#ifdef CONFIG_DEBUG_KERNEL" to
> "#ifdef CONFIG_DEBUG_MISC".
>
> Signed-off-by: Sinan Kaya <[email protected]>

Minor typo below; with that:
Reviewed-by: Josh Triplett <[email protected]>

And thank you!

> ---
> lib/Kconfig.debug | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
> index 0d9e81779e37..2f80ebaa6d9a 100644
> --- a/lib/Kconfig.debug
> +++ b/lib/Kconfig.debug
> @@ -438,6 +438,15 @@ config DEBUG_KERNEL
> Say Y here if you are developing drivers or trying to debug and
> identify kernel problems.
>
> +config DEBUG_MISC
> + bool "Miscellaneous debug code"
> + default DEBUG_KERNEL
> + depends on DEBUG_KERNEL
> + help
> + Say Y here if you need to enable Miscellaneous debug code that should

Nit: s/Miscellaneous/miscellaneous/

> + be under a more specific debug option but isn't.
> +
> +
> menu "Memory Debugging"
>
> source "mm/Kconfig.debug"
> --
> 2.21.0
>

2019-04-12 03:03:39

by Josh Triplett

[permalink] [raw]
Subject: Re: [PATCH v4 0/5] init: Do not select DEBUG_KERNEL by default

On Fri, Apr 12, 2019 at 01:43:50AM +0000, Sinan Kaya wrote:
> CONFIG_DEBUG_KERNEL has been designed to just enable Kconfig options.
> Kernel code generatoin should not depend on CONFIG_DEBUG_KERNEL.
>
> Proposed alternative plan: let's add a new symbol, something like
> DEBUG_MISC ("Miscellaneous debug code that should be under a more
> specific debug option but isn't"), make it depend on DEBUG_KERNEL and be
> "default DEBUG_KERNEL" but allow itself to be turned off, and then
> mechanically change the small handful of "#ifdef CONFIG_DEBUG_KERNEL" to
> "#ifdef CONFIG_DEBUG_MISC".
>
> Sinan Kaya (5):
> init: Introduce DEBUG_MISC option
> powerpc: Replace CONFIG_DEBUG_KERNEL with CONFIG_DEBUG_MISC
> mips: Replace CONFIG_DEBUG_KERNEL with CONFIG_DEBUG_MISC
> xtensa: Replace CONFIG_DEBUG_KERNEL with CONFIG_DEBUG_MISC
> net: Replace CONFIG_DEBUG_KERNEL with CONFIG_DEBUG_MISC

I noticed one minor typo in patch 1/5, with that fixed, for the whole
series:

Reviewed-by: Josh Triplett <[email protected]>

2019-04-12 03:14:36

by Sinan Kaya

[permalink] [raw]
Subject: Re: [PATCH v4 0/5] init: Do not select DEBUG_KERNEL by default

On 4/11/2019 11:02 PM, Josh Triplett wrote:
> I noticed one minor typo in patch 1/5, with that fixed, for the whole
> series:

Can you point to the typo?

2019-04-12 04:08:23

by Josh Triplett

[permalink] [raw]
Subject: Re: [PATCH v4 0/5] init: Do not select DEBUG_KERNEL by default

On Thu, Apr 11, 2019 at 11:13:42PM -0400, Sinan Kaya wrote:
> On 4/11/2019 11:02 PM, Josh Triplett wrote:
> > I noticed one minor typo in patch 1/5, with that fixed, for the whole
> > series:
>
> Can you point to the typo?

I did, in my response to the patch itself:
s/Miscellaneous/miscellaneous/ in the new option's description, since it
isn't at the start of a sentence.

2019-04-12 04:08:23

by Sinan Kaya

[permalink] [raw]
Subject: Re: [PATCH v4 0/5] init: Do not select DEBUG_KERNEL by default

On 4/12/2019 12:05 AM, Josh Triplett wrote:
>> Can you point to the typo?
> I did, in my response to the patch itself:
> s/Miscellaneous/miscellaneous/ in the new option's description, since it
> isn't at the start of a sentence.
>

Thanks, your emails arrived out of order. I got them now.

2019-04-12 08:10:31

by Florian Westphal

[permalink] [raw]
Subject: Re: [PATCH v4 5/5] net: Replace CONFIG_DEBUG_KERNEL with CONFIG_DEBUG_MISC

Sinan Kaya <[email protected]> wrote:
> CONFIG_DEBUG_KERNEL should not impact code generation. Use the newly
> defined CONFIG_DEBUG_MISC instead to keep the current code.

Acked-by: Florian Westphal <[email protected]>