* [PATCH 0/4] Removing dead code
@ 2010-08-10 9:11 Christian Dietrich
2010-08-10 9:11 ` [PATCH 1/4] arch/frv: Removing dead RAMKERNEL config option Christian Dietrich
` (3 more replies)
0 siblings, 4 replies; 10+ messages in thread
From: Christian Dietrich @ 2010-08-10 9:11 UTC (permalink / raw)
To: David Howells, KOSAKI Motohiro, Andreas Dilger, Jiri Kosina,
Andrew Morton, Rusty Russell, Thomas Gleixner, John Stultz,
Tejun Heo, linux-kernel
Cc: vamos-dev
Hi all!
As part of the VAMOS[0] research project at the University of
Erlangen we are looking at multiple integrity errors in linux'
configuration system.
I've been running a check on the arch/frv sourcetree for
config Items not defined in Kconfig and found 4 such cases. Sourcecode
blocks depending on these Items are not reachable from a vanilla
kernel -- dead code. I've seen such dead blocks made on purpose
e.g. while integrating new features into the kernel but generally
they're just useless.
Each of the patches in this patchset removes on such dead
config Item, I'd be glad if you consider applying them. I've been
doing deeper analysis of such issues before and can do so again but
I'm not so sure they were fastly usefull.
I wasn't able to build a vanilla kernel allyesconfig, therefore these
patches might break something. But because they are just removing dead
code it is unlikely.
Another problem i encountered was CONFIG_PREEMPT, which isn't
selectable in frv Kconfig because it doesn include
kernel/Kconfig.preempt. But there ist plenty of evidence for me, that
there is preemption support in frv.
Please keep me informed of this patch getting confirmed /
merged so we can keep track of it.
Regards
Christian Dietrich
[0] http://vamos1.informatik.uni-erlangen.de/
Christian Dietrich (4):
arch/frv: Removing dead RAMKERNEL config option
arch/frv: Removing dead HEARTBEAT config option
arch/frv: Removing dead NO_KERNEL_MSG config option
arch/frv: Removing dead DEBUG_STACK_USAGE config option
arch/frv/include/asm/bug.h | 4 ----
arch/frv/include/asm/thread_info.h | 11 -----------
arch/frv/kernel/debug-stub.c | 2 --
arch/frv/kernel/time.c | 6 ------
arch/frv/mm/init.c | 17 -----------------
5 files changed, 0 insertions(+), 40 deletions(-)
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 1/4] arch/frv: Removing dead RAMKERNEL config option
2010-08-10 9:11 [PATCH 0/4] Removing dead code Christian Dietrich
@ 2010-08-10 9:11 ` Christian Dietrich
2010-08-10 9:37 ` Felipe Balbi
2010-08-10 9:11 ` [PATCH 2/4] arch/frv: Removing dead HEARTBEAT " Christian Dietrich
` (2 subsequent siblings)
3 siblings, 1 reply; 10+ messages in thread
From: Christian Dietrich @ 2010-08-10 9:11 UTC (permalink / raw)
To: David Howells, Tejun Heo, linux-kernel; +Cc: vamos-dev
CONFIG_RAMKERNEL doesn't exist in Kconfig, therefore removing
all references to it from the source.
Signed-off-by: Christian Dietrich <qy03fugy@stud.informatik.uni-erlangen.de>
---
arch/frv/mm/init.c | 17 -----------------
1 files changed, 0 insertions(+), 17 deletions(-)
diff --git a/arch/frv/mm/init.c b/arch/frv/mm/init.c
index ed64588..73586ad 100644
--- a/arch/frv/mm/init.c
+++ b/arch/frv/mm/init.c
@@ -170,23 +170,6 @@ void __init mem_init(void)
*/
void free_initmem(void)
{
-#if defined(CONFIG_RAMKERNEL) && !defined(CONFIG_PROTECT_KERNEL)
- unsigned long start, end, addr;
-
- start = PAGE_ALIGN((unsigned long) &__init_begin); /* round up */
- end = ((unsigned long) &__init_end) & PAGE_MASK; /* round down */
-
- /* next to check that the page we free is not a partial page */
- for (addr = start; addr < end; addr += PAGE_SIZE) {
- ClearPageReserved(virt_to_page(addr));
- init_page_count(virt_to_page(addr));
- free_page(addr);
- totalram_pages++;
- }
-
- printk("Freeing unused kernel memory: %ldKiB freed (0x%lx - 0x%lx)\n",
- (end - start) >> 10, start, end);
-#endif
} /* end free_initmem() */
/*****************************************************************************/
--
1.7.0.4
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 2/4] arch/frv: Removing dead HEARTBEAT config option
2010-08-10 9:11 [PATCH 0/4] Removing dead code Christian Dietrich
2010-08-10 9:11 ` [PATCH 1/4] arch/frv: Removing dead RAMKERNEL config option Christian Dietrich
@ 2010-08-10 9:11 ` Christian Dietrich
2010-08-10 9:35 ` Felipe Balbi
2010-08-10 9:11 ` [PATCH 3/4] arch/frv: Removing dead NO_KERNEL_MSG " Christian Dietrich
2010-08-10 9:11 ` [PATCH 4/4] arch/frv: Removing dead DEBUG_STACK_USAGE " Christian Dietrich
3 siblings, 1 reply; 10+ messages in thread
From: Christian Dietrich @ 2010-08-10 9:11 UTC (permalink / raw)
To: David Howells, Thomas Gleixner, John Stultz, linux-kernel; +Cc: vamos-dev
CONFIG_HEARTBEAT doesn't exist in Kconfig, therefore removing
all references to it from the source.
Signed-off-by: Christian Dietrich <qy03fugy@stud.informatik.uni-erlangen.de>
---
arch/frv/kernel/time.c | 6 ------
1 files changed, 0 insertions(+), 6 deletions(-)
diff --git a/arch/frv/kernel/time.c b/arch/frv/kernel/time.c
index 0ddbbae..e86df6c 100644
--- a/arch/frv/kernel/time.c
+++ b/arch/frv/kernel/time.c
@@ -66,12 +66,6 @@ static irqreturn_t timer_interrupt(int irq, void *dummy)
do_timer(1);
-#ifdef CONFIG_HEARTBEAT
- static unsigned short n;
- n++;
- __set_LEDS(n);
-#endif /* CONFIG_HEARTBEAT */
-
write_sequnlock(&xtime_lock);
update_process_times(user_mode(get_irq_regs()));
--
1.7.0.4
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 3/4] arch/frv: Removing dead NO_KERNEL_MSG config option
2010-08-10 9:11 [PATCH 0/4] Removing dead code Christian Dietrich
2010-08-10 9:11 ` [PATCH 1/4] arch/frv: Removing dead RAMKERNEL config option Christian Dietrich
2010-08-10 9:11 ` [PATCH 2/4] arch/frv: Removing dead HEARTBEAT " Christian Dietrich
@ 2010-08-10 9:11 ` Christian Dietrich
2010-08-10 9:11 ` [PATCH 4/4] arch/frv: Removing dead DEBUG_STACK_USAGE " Christian Dietrich
3 siblings, 0 replies; 10+ messages in thread
From: Christian Dietrich @ 2010-08-10 9:11 UTC (permalink / raw)
To: David Howells, Andrew Morton, Rusty Russell, linux-kernel; +Cc: vamos-dev
CONFIG_NO_KERNEL_MSG doesn't exist in Kconfig, therefore removing
all references to it from the source.
Signed-off-by: Christian Dietrich <qy03fugy@stud.informatik.uni-erlangen.de>
---
arch/frv/include/asm/bug.h | 4 ----
arch/frv/kernel/debug-stub.c | 2 --
2 files changed, 0 insertions(+), 6 deletions(-)
diff --git a/arch/frv/include/asm/bug.h b/arch/frv/include/asm/bug.h
index 2e05450..ea6e986 100644
--- a/arch/frv/include/asm/bug.h
+++ b/arch/frv/include/asm/bug.h
@@ -19,12 +19,8 @@
*/
extern asmlinkage void __debug_bug_trap(int signr);
-#ifdef CONFIG_NO_KERNEL_MSG
-#define _debug_bug_printk()
-#else
extern void __debug_bug_printk(const char *file, unsigned line);
#define _debug_bug_printk() __debug_bug_printk(__FILE__, __LINE__)
-#endif
#define _debug_bug_trap(signr) \
do { \
diff --git a/arch/frv/kernel/debug-stub.c b/arch/frv/kernel/debug-stub.c
index 2845139..8752253 100644
--- a/arch/frv/kernel/debug-stub.c
+++ b/arch/frv/kernel/debug-stub.c
@@ -250,10 +250,8 @@ int __init console_get_baud(void)
/*
* display BUG() info
*/
-#ifndef CONFIG_NO_KERNEL_MSG
void __debug_bug_printk(const char *file, unsigned line)
{
printk("kernel BUG at %s:%d!\n", file, line);
} /* end __debug_bug_printk() */
-#endif
--
1.7.0.4
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 4/4] arch/frv: Removing dead DEBUG_STACK_USAGE config option
2010-08-10 9:11 [PATCH 0/4] Removing dead code Christian Dietrich
` (2 preceding siblings ...)
2010-08-10 9:11 ` [PATCH 3/4] arch/frv: Removing dead NO_KERNEL_MSG " Christian Dietrich
@ 2010-08-10 9:11 ` Christian Dietrich
3 siblings, 0 replies; 10+ messages in thread
From: Christian Dietrich @ 2010-08-10 9:11 UTC (permalink / raw)
To: David Howells, KOSAKI Motohiro, Andreas Dilger, Jiri Kosina,
linux-kernel
Cc: vamos-dev
CONFIG_DEBUG_STACK_USAGE doesn't exist in Kconfig, therefore removing
all references to it from the source.
Signed-off-by: Christian Dietrich <qy03fugy@stud.informatik.uni-erlangen.de>
---
arch/frv/include/asm/thread_info.h | 11 -----------
1 files changed, 0 insertions(+), 11 deletions(-)
diff --git a/arch/frv/include/asm/thread_info.h b/arch/frv/include/asm/thread_info.h
index 11f33ea..89ab701 100644
--- a/arch/frv/include/asm/thread_info.h
+++ b/arch/frv/include/asm/thread_info.h
@@ -83,18 +83,7 @@ register struct thread_info *__current_thread_info asm("gr15");
#define __HAVE_ARCH_THREAD_INFO_ALLOCATOR
/* thread information allocation */
-#ifdef CONFIG_DEBUG_STACK_USAGE
-#define alloc_thread_info(tsk) \
- ({ \
- struct thread_info *ret; \
- \
- ret = kzalloc(THREAD_SIZE, GFP_KERNEL); \
- \
- ret; \
- })
-#else
#define alloc_thread_info(tsk) kmalloc(THREAD_SIZE, GFP_KERNEL)
-#endif
#define free_thread_info(info) kfree(info)
--
1.7.0.4
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH 2/4] arch/frv: Removing dead HEARTBEAT config option
2010-08-10 9:11 ` [PATCH 2/4] arch/frv: Removing dead HEARTBEAT " Christian Dietrich
@ 2010-08-10 9:35 ` Felipe Balbi
2010-08-10 11:06 ` Christian Dietrich
0 siblings, 1 reply; 10+ messages in thread
From: Felipe Balbi @ 2010-08-10 9:35 UTC (permalink / raw)
To: ext Christian Dietrich
Cc: David Howells, Thomas Gleixner, John Stultz,
linux-kernel@vger.kernel.org,
vamos-dev@i4.informatik.uni-erlangen.de
Hi,
On Tue, Aug 10, 2010 at 11:11:13AM +0200, ext Christian Dietrich wrote:
>diff --git a/arch/frv/kernel/time.c b/arch/frv/kernel/time.c
>index 0ddbbae..e86df6c 100644
>--- a/arch/frv/kernel/time.c
>+++ b/arch/frv/kernel/time.c
>@@ -66,12 +66,6 @@ static irqreturn_t timer_interrupt(int irq, void *dummy)
>
> do_timer(1);
>
>-#ifdef CONFIG_HEARTBEAT
should you instead change to CONFIG_LEDS_TRIGGER_HEARTBEAT ?
--
balbi
DefectiveByDesign.org
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 1/4] arch/frv: Removing dead RAMKERNEL config option
2010-08-10 9:11 ` [PATCH 1/4] arch/frv: Removing dead RAMKERNEL config option Christian Dietrich
@ 2010-08-10 9:37 ` Felipe Balbi
2010-08-10 10:54 ` Christian Dietrich
0 siblings, 1 reply; 10+ messages in thread
From: Felipe Balbi @ 2010-08-10 9:37 UTC (permalink / raw)
To: ext Christian Dietrich
Cc: David Howells, Tejun Heo, linux-kernel@vger.kernel.org,
vamos-dev@i4.informatik.uni-erlangen.de
Hi,
On Tue, Aug 10, 2010 at 11:11:08AM +0200, ext Christian Dietrich wrote:
>diff --git a/arch/frv/mm/init.c b/arch/frv/mm/init.c
>index ed64588..73586ad 100644
>--- a/arch/frv/mm/init.c
>+++ b/arch/frv/mm/init.c
>@@ -170,23 +170,6 @@ void __init mem_init(void)
> */
> void free_initmem(void)
> {
>-#if defined(CONFIG_RAMKERNEL) && !defined(CONFIG_PROTECT_KERNEL)
>- unsigned long start, end, addr;
>-
>- start = PAGE_ALIGN((unsigned long) &__init_begin); /* round up */
>- end = ((unsigned long) &__init_end) & PAGE_MASK; /* round down */
>-
>- /* next to check that the page we free is not a partial page */
>- for (addr = start; addr < end; addr += PAGE_SIZE) {
>- ClearPageReserved(virt_to_page(addr));
>- init_page_count(virt_to_page(addr));
>- free_page(addr);
>- totalram_pages++;
>- }
>-
>- printk("Freeing unused kernel memory: %ldKiB freed (0x%lx - 0x%lx)\n",
>- (end - start) >> 10, start, end);
>-#endif
> } /* end free_initmem() */
and now you have an empty function... how about removing the function
completely and it's uses ?
--
balbi
DefectiveByDesign.org
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 1/4] arch/frv: Removing dead RAMKERNEL config option
2010-08-10 9:37 ` Felipe Balbi
@ 2010-08-10 10:54 ` Christian Dietrich
2010-08-10 11:54 ` Felipe Balbi
0 siblings, 1 reply; 10+ messages in thread
From: Christian Dietrich @ 2010-08-10 10:54 UTC (permalink / raw)
To: felipe.balbi
Cc: David Howells, Tejun Heo, linux-kernel@vger.kernel.org,
vamos-dev@i4.informatik.uni-erlangen.de
Felipe Balbi <felipe.balbi@nokia.com> writes:
> Hi,
>
> On Tue, Aug 10, 2010 at 11:11:08AM +0200, ext Christian Dietrich wrote:
>>diff --git a/arch/frv/mm/init.c b/arch/frv/mm/init.c
>>index ed64588..73586ad 100644
>>--- a/arch/frv/mm/init.c
>>+++ b/arch/frv/mm/init.c
>>@@ -170,23 +170,6 @@ void __init mem_init(void)
>> */
>> void free_initmem(void)
>> {
>>-#if defined(CONFIG_RAMKERNEL) && !defined(CONFIG_PROTECT_KERNEL)
>>- unsigned long start, end, addr;
>>-
>>- start = PAGE_ALIGN((unsigned long) &__init_begin); /* round up */
>>- end = ((unsigned long) &__init_end) & PAGE_MASK; /* round down */
>>-
>>- /* next to check that the page we free is not a partial page */
>>- for (addr = start; addr < end; addr += PAGE_SIZE) {
>>- ClearPageReserved(virt_to_page(addr));
>>- init_page_count(virt_to_page(addr));
>>- free_page(addr);
>>- totalram_pages++;
>>- }
>>-
>>- printk("Freeing unused kernel memory: %ldKiB freed (0x%lx - 0x%lx)\n",
>>- (end - start) >> 10, start, end);
>>-#endif
>> } /* end free_initmem() */
>
> and now you have an empty function... how about removing the function
> completely and it's uses ?
If you take a look at init/main.c:826 free_initmem() is called. perhaps
this can be resolved with a macro, but if anybody in the future wants to
add some functionality there, he won't be happy after grepping.
greetz didi
--
(λ x . x x) (λ x . x x) -- See how beatiful the lambda is
No documentation is better than bad documentation
-- Das Ausdrucken dieser Mail wird urheberrechtlich verfolgt.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 2/4] arch/frv: Removing dead HEARTBEAT config option
2010-08-10 9:35 ` Felipe Balbi
@ 2010-08-10 11:06 ` Christian Dietrich
0 siblings, 0 replies; 10+ messages in thread
From: Christian Dietrich @ 2010-08-10 11:06 UTC (permalink / raw)
To: felipe.balbi
Cc: David Howells, Thomas Gleixner, John Stultz,
linux-kernel@vger.kernel.org,
vamos-dev@i4.informatik.uni-erlangen.de
[-- Attachment #1: Type: text/plain, Size: 780 bytes --]
Felipe Balbi <felipe.balbi@nokia.com> writes:
> On Tue, Aug 10, 2010 at 11:11:13AM +0200, ext Christian Dietrich wrote:
>>diff --git a/arch/frv/kernel/time.c b/arch/frv/kernel/time.c
>>index 0ddbbae..e86df6c 100644
>>--- a/arch/frv/kernel/time.c
>>+++ b/arch/frv/kernel/time.c
>>@@ -66,12 +66,6 @@ static irqreturn_t timer_interrupt(int irq, void *dummy)
>>
>> do_timer(1);
>>
>>-#ifdef CONFIG_HEARTBEAT
>
> should you instead change to CONFIG_LEDS_TRIGGER_HEARTBEAT ?
I didn't know of this config option, but i think this would be better. I
attached a patch for it.
greetz didi
--
(λ x . x x) (λ x . x x) -- See how beatiful the lambda is
No documentation is better than bad documentation
-- Das Ausdrucken dieser Mail wird urheberrechtlich verfolgt.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-arch-frv-Rename-dead-HEARTBEAT-config-option.patch --]
[-- Type: text/x-diff, Size: 992 bytes --]
>From 36cfe416d7b099097ed3f37bb62134c674fc68ce Mon Sep 17 00:00:00 2001
From: Christian Dietrich <qy03fugy@stud.informatik.uni-erlangen.de>
Date: Tue, 10 Aug 2010 13:02:30 +0200
Subject: [PATCH] arch/frv: Rename dead HEARTBEAT config option
Because CONFIG_HEARTBEAT isn't defined for the frv arch, this block
would be dead. As suggested by Felipe Balbi CONFIG_HEARTBEAT was
replaced by CONFIG_LEDS_TRIGGER_HEARTBEAT.
---
arch/frv/kernel/time.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/frv/kernel/time.c b/arch/frv/kernel/time.c
index 0ddbbae..d8fff7e 100644
--- a/arch/frv/kernel/time.c
+++ b/arch/frv/kernel/time.c
@@ -66,11 +66,11 @@ static irqreturn_t timer_interrupt(int irq, void *dummy)
do_timer(1);
-#ifdef CONFIG_HEARTBEAT
+#ifdef CONFIG_LEDS_TRIGGER_HEARTBEAT
static unsigned short n;
n++;
__set_LEDS(n);
-#endif /* CONFIG_HEARTBEAT */
+#endif /* CONFIG_LEDS_TRIGGER_HEARTBEAT */
write_sequnlock(&xtime_lock);
--
1.7.0.4
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH 1/4] arch/frv: Removing dead RAMKERNEL config option
2010-08-10 10:54 ` Christian Dietrich
@ 2010-08-10 11:54 ` Felipe Balbi
0 siblings, 0 replies; 10+ messages in thread
From: Felipe Balbi @ 2010-08-10 11:54 UTC (permalink / raw)
To: ext Christian Dietrich
Cc: Balbi Felipe (Nokia-MS/Helsinki), David Howells, Tejun Heo,
linux-kernel@vger.kernel.org,
vamos-dev@i4.informatik.uni-erlangen.de
On Tue, Aug 10, 2010 at 12:54:16PM +0200, ext Christian Dietrich wrote:
>If you take a look at init/main.c:826 free_initmem() is called. perhaps
>this can be resolved with a macro, but if anybody in the future wants to
>add some functionality there, he won't be happy after grepping.
ok, sorry for that. Makes sense.
--
balbi
DefectiveByDesign.org
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2010-08-10 11:56 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-10 9:11 [PATCH 0/4] Removing dead code Christian Dietrich
2010-08-10 9:11 ` [PATCH 1/4] arch/frv: Removing dead RAMKERNEL config option Christian Dietrich
2010-08-10 9:37 ` Felipe Balbi
2010-08-10 10:54 ` Christian Dietrich
2010-08-10 11:54 ` Felipe Balbi
2010-08-10 9:11 ` [PATCH 2/4] arch/frv: Removing dead HEARTBEAT " Christian Dietrich
2010-08-10 9:35 ` Felipe Balbi
2010-08-10 11:06 ` Christian Dietrich
2010-08-10 9:11 ` [PATCH 3/4] arch/frv: Removing dead NO_KERNEL_MSG " Christian Dietrich
2010-08-10 9:11 ` [PATCH 4/4] arch/frv: Removing dead DEBUG_STACK_USAGE " Christian Dietrich
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox