2010-06-09 09:58:41

by Christoph Egger

[permalink] [raw]
Subject: [PATCH 0/5] Removing dead code

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/powerpc sourcetree
for
config Items not defined in Kconfig and found5 such chases. 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. However I've done a
testbuild on ppc with allmodconfig so it should at least build.

Please keep me informed of this patch getting confirmed /
merged so we can keep track of it.

Regards

Christoph Egger

[0] http://vamos1.informatik.uni-erlangen.de/

Christoph Egger (5):
Removing dead BOOK3E_MMU_TLB_STATS
Removing dead CONFIG_HIGHPTE
Removing dead CONFIG_SMP_750
Removing dead CONFIG_SERIAL_TEXT_DEBUG
Removing dead CONFIG_PPC47x

arch/powerpc/include/asm/exception-64e.h | 38 ------------------------------
arch/powerpc/kernel/head_40x.S | 19 ---------------
arch/powerpc/mm/44x_mmu.c | 4 ---
arch/powerpc/mm/pgtable_32.c | 4 ---
arch/powerpc/mm/tlb_hash32.c | 4 ---
arch/powerpc/mm/tlb_low_64e.S | 9 -------
6 files changed, 0 insertions(+), 78 deletions(-)


2010-06-09 09:59:28

by Christoph Egger

[permalink] [raw]
Subject: [PATCH 1/5] Removing dead BOOK3E_MMU_TLB_STATS

BOOK3E_MMU_TLB_STATS doesn't exist in Kconfig, therefore removing all
references for it from the source code.

Signed-off-by: Christoph Egger <[email protected]>
---
arch/powerpc/include/asm/exception-64e.h | 38 ------------------------------
arch/powerpc/mm/tlb_low_64e.S | 9 -------
2 files changed, 0 insertions(+), 47 deletions(-)

diff --git a/arch/powerpc/include/asm/exception-64e.h b/arch/powerpc/include/asm/exception-64e.h
index 6d53f31..db74814 100644
--- a/arch/powerpc/include/asm/exception-64e.h
+++ b/arch/powerpc/include/asm/exception-64e.h
@@ -65,14 +65,7 @@
#define EX_TLB_MMUCR0 (12 * 8) /* Level 0 */
#define EX_TLB_MAS1 (12 * 8) /* Level 0 */
#define EX_TLB_MAS2 (13 * 8) /* Level 0 */
-#ifdef CONFIG_BOOK3E_MMU_TLB_STATS
-#define EX_TLB_R8 (14 * 8)
-#define EX_TLB_R9 (15 * 8)
-#define EX_TLB_LR (16 * 8)
-#define EX_TLB_SIZE (17 * 8)
-#else
#define EX_TLB_SIZE (14 * 8)
-#endif

#define START_EXCEPTION(label) \
.globl exc_##label##_book3e; \
@@ -157,36 +150,6 @@ exc_##label##_book3e:
addi r11,r13,PACA_EXTLB; \
TLB_MISS_RESTORE(r11)

-#ifdef CONFIG_BOOK3E_MMU_TLB_STATS
-#define TLB_MISS_PROLOG_STATS \
- mflr r10; \
- std r8,EX_TLB_R8(r12); \
- std r9,EX_TLB_R9(r12); \
- std r10,EX_TLB_LR(r12);
-#define TLB_MISS_RESTORE_STATS \
- ld r16,EX_TLB_LR(r12); \
- ld r9,EX_TLB_R9(r12); \
- ld r8,EX_TLB_R8(r12); \
- mtlr r16;
-#define TLB_MISS_STATS_D(name) \
- addi r9,r13,MMSTAT_DSTATS+name; \
- bl .tlb_stat_inc;
-#define TLB_MISS_STATS_I(name) \
- addi r9,r13,MMSTAT_ISTATS+name; \
- bl .tlb_stat_inc;
-#define TLB_MISS_STATS_X(name) \
- ld r8,PACA_EXTLB+EX_TLB_ESR(r13); \
- cmpdi cr2,r8,-1; \
- beq cr2,61f; \
- addi r9,r13,MMSTAT_DSTATS+name; \
- b 62f; \
-61: addi r9,r13,MMSTAT_ISTATS+name; \
-62: bl .tlb_stat_inc;
-#define TLB_MISS_STATS_SAVE_INFO \
- std r14,EX_TLB_ESR(r12); /* save ESR */ \
-
-
-#else
#define TLB_MISS_PROLOG_STATS
#define TLB_MISS_RESTORE_STATS
#define TLB_MISS_STATS_D(name)
@@ -194,7 +157,6 @@ exc_##label##_book3e:
#define TLB_MISS_STATS_X(name)
#define TLB_MISS_STATS_Y(name)
#define TLB_MISS_STATS_SAVE_INFO
-#endif

#define SET_IVOR(vector_number, vector_offset) \
li r3,vector_offset@l; \
diff --git a/arch/powerpc/mm/tlb_low_64e.S b/arch/powerpc/mm/tlb_low_64e.S
index 8b04c54..4d7d059 100644
--- a/arch/powerpc/mm/tlb_low_64e.S
+++ b/arch/powerpc/mm/tlb_low_64e.S
@@ -758,12 +758,3 @@ tlb_load_linear_fault:
1: TLB_MISS_EPILOG_ERROR_SPECIAL
b exc_instruction_storage_book3e

-
-#ifdef CONFIG_BOOK3E_MMU_TLB_STATS
-.tlb_stat_inc:
-1: ldarx r8,0,r9
- addi r8,r8,1
- stdcx. r8,0,r9
- bne- 1b
- blr
-#endif
--
1.6.3.3

2010-06-09 09:59:58

by Christoph Egger

[permalink] [raw]
Subject: [PATCH 2/5] Removing dead CONFIG_HIGHPTE

CONFIG_HIGHPTE doesn't exist in Kconfig, therefore removing all
references for it from the source code.

Signed-off-by: Christoph Egger <[email protected]>
---
arch/powerpc/mm/pgtable_32.c | 4 ----
1 files changed, 0 insertions(+), 4 deletions(-)

diff --git a/arch/powerpc/mm/pgtable_32.c b/arch/powerpc/mm/pgtable_32.c
index 9fc02dc..34347b2 100644
--- a/arch/powerpc/mm/pgtable_32.c
+++ b/arch/powerpc/mm/pgtable_32.c
@@ -115,11 +115,7 @@ pgtable_t pte_alloc_one(struct mm_struct *mm, unsigned long address)
{
struct page *ptepage;

-#ifdef CONFIG_HIGHPTE
- gfp_t flags = GFP_KERNEL | __GFP_HIGHMEM | __GFP_REPEAT | __GFP_ZERO;
-#else
gfp_t flags = GFP_KERNEL | __GFP_REPEAT | __GFP_ZERO;
-#endif

ptepage = alloc_pages(flags, 0);
if (!ptepage)
--
1.6.3.3

2010-06-09 10:00:25

by Christoph Egger

[permalink] [raw]
Subject: [PATCH 3/5] Removing dead CONFIG_SMP_750

CONFIG_SMP_750 doesn't exist in Kconfig, therefore removing all
references for it from the source code.

Signed-off-by: Christoph Egger <[email protected]>
---
arch/powerpc/mm/tlb_hash32.c | 4 ----
1 files changed, 0 insertions(+), 4 deletions(-)

diff --git a/arch/powerpc/mm/tlb_hash32.c b/arch/powerpc/mm/tlb_hash32.c
index 8aaa8b7..925fecb 100644
--- a/arch/powerpc/mm/tlb_hash32.c
+++ b/arch/powerpc/mm/tlb_hash32.c
@@ -94,11 +94,7 @@ void tlb_flush(struct mmu_gather *tlb)
* the cache operations on the bus. Hence we need to use an IPI
* to get the other CPU(s) to invalidate their TLBs.
*/
-#ifdef CONFIG_SMP_750
-#define FINISH_FLUSH smp_send_tlb_invalidate(0)
-#else
#define FINISH_FLUSH do { } while (0)
-#endif

static void flush_range(struct mm_struct *mm, unsigned long start,
unsigned long end)
--
1.6.3.3

2010-06-09 10:00:50

by Christoph Egger

[permalink] [raw]
Subject: [PATCH 4/5] Removing dead CONFIG_SERIAL_TEXT_DEBUG

CONFIG_SERIAL_TEXT_DEBUG doesn't exist in Kconfig, therefore removing all
references for it from the source code.

Signed-off-by: Christoph Egger <[email protected]>
---
arch/powerpc/kernel/head_40x.S | 19 -------------------
1 files changed, 0 insertions(+), 19 deletions(-)

diff --git a/arch/powerpc/kernel/head_40x.S b/arch/powerpc/kernel/head_40x.S
index a90625f..1a10e4d 100644
--- a/arch/powerpc/kernel/head_40x.S
+++ b/arch/powerpc/kernel/head_40x.S
@@ -939,25 +939,6 @@ initial_mmu:
tlbwe r4,r0,TLB_DATA /* Load the data portion of the entry */
tlbwe r3,r0,TLB_TAG /* Load the tag portion of the entry */

-#if defined(CONFIG_SERIAL_TEXT_DEBUG) && defined(SERIAL_DEBUG_IO_BASE)
-
- /* Load a TLB entry for the UART, so that ppc4xx_progress() can use
- * the UARTs nice and early. We use a 4k real==virtual mapping. */
-
- lis r3,SERIAL_DEBUG_IO_BASE@h
- ori r3,r3,SERIAL_DEBUG_IO_BASE@l
- mr r4,r3
- clrrwi r4,r4,12
- ori r4,r4,(TLB_WR|TLB_I|TLB_M|TLB_G)
-
- clrrwi r3,r3,12
- ori r3,r3,(TLB_VALID | TLB_PAGESZ(PAGESZ_4K))
-
- li r0,0 /* TLB slot 0 */
- tlbwe r4,r0,TLB_DATA
- tlbwe r3,r0,TLB_TAG
-#endif /* CONFIG_SERIAL_DEBUG_TEXT && SERIAL_DEBUG_IO_BASE */
-
isync

/* Establish the exception vector base
--
1.6.3.3

2010-06-09 10:01:18

by Christoph Egger

[permalink] [raw]
Subject: [PATCH 5/5] Removing dead CONFIG_PPC47x

CONFIG_PPC47x doesn't exist in Kconfig, therefore removing all
references for it from the source code.

Signed-off-by: Christoph Egger <[email protected]>
---
arch/powerpc/mm/44x_mmu.c | 4 ----
1 files changed, 0 insertions(+), 4 deletions(-)

diff --git a/arch/powerpc/mm/44x_mmu.c b/arch/powerpc/mm/44x_mmu.c
index d8c6efb..f70da7e 100644
--- a/arch/powerpc/mm/44x_mmu.c
+++ b/arch/powerpc/mm/44x_mmu.c
@@ -76,11 +76,7 @@ static void __init ppc44x_pin_tlb(unsigned int virt, unsigned int phys)
"tlbwe %1,%3,%5\n"
"tlbwe %0,%3,%6\n"
:
-#ifdef CONFIG_PPC47x
- : "r" (PPC47x_TLB2_S_RWX),
-#else
: "r" (PPC44x_TLB_SW | PPC44x_TLB_SR | PPC44x_TLB_SX | PPC44x_TLB_G),
-#endif
"r" (phys),
"r" (virt | PPC44x_TLB_VALID | PPC44x_TLB_256M),
"r" (entry),
--
1.6.3.3

2010-06-09 10:28:24

by Josh Boyer

[permalink] [raw]
Subject: Re: [PATCH 4/5] Removing dead CONFIG_SERIAL_TEXT_DEBUG

On Wed, Jun 09, 2010 at 12:00:46PM +0200, Christoph Egger wrote:
>CONFIG_SERIAL_TEXT_DEBUG doesn't exist in Kconfig, therefore removing all
>references for it from the source code.
>
>Signed-off-by: Christoph Egger <[email protected]>

It would be better to conver this to work with CONFIG_PPC_EARLY_DEBUG and
CONFIG_PPC_EARLY_DEBUG_40x. I'd rather just leave this for now until we can
get it switched over.

josh

>---
> arch/powerpc/kernel/head_40x.S | 19 -------------------
> 1 files changed, 0 insertions(+), 19 deletions(-)
>
>diff --git a/arch/powerpc/kernel/head_40x.S b/arch/powerpc/kernel/head_40x.S
>index a90625f..1a10e4d 100644
>--- a/arch/powerpc/kernel/head_40x.S
>+++ b/arch/powerpc/kernel/head_40x.S
>@@ -939,25 +939,6 @@ initial_mmu:
> tlbwe r4,r0,TLB_DATA /* Load the data portion of the entry */
> tlbwe r3,r0,TLB_TAG /* Load the tag portion of the entry */
>
>-#if defined(CONFIG_SERIAL_TEXT_DEBUG) && defined(SERIAL_DEBUG_IO_BASE)
>-
>- /* Load a TLB entry for the UART, so that ppc4xx_progress() can use
>- * the UARTs nice and early. We use a 4k real==virtual mapping. */
>-
>- lis r3,SERIAL_DEBUG_IO_BASE@h
>- ori r3,r3,SERIAL_DEBUG_IO_BASE@l
>- mr r4,r3
>- clrrwi r4,r4,12
>- ori r4,r4,(TLB_WR|TLB_I|TLB_M|TLB_G)
>-
>- clrrwi r3,r3,12
>- ori r3,r3,(TLB_VALID | TLB_PAGESZ(PAGESZ_4K))
>-
>- li r0,0 /* TLB slot 0 */
>- tlbwe r4,r0,TLB_DATA
>- tlbwe r3,r0,TLB_TAG
>-#endif /* CONFIG_SERIAL_DEBUG_TEXT && SERIAL_DEBUG_IO_BASE */
>-
> isync
>
> /* Establish the exception vector base
>--
>1.6.3.3
>
>_______________________________________________
>Linuxppc-dev mailing list
>[email protected]
>https://lists.ozlabs.org/listinfo/linuxppc-dev

2010-06-09 11:02:43

by Christoph Egger

[permalink] [raw]
Subject: [PATCH 5b/5] Removing dead CONFIG_PPC47x

CONFIG_PPC47x should actually be spelled CONFIG_PPC_47x as reported by
Andreas Schwab.

Signed-off-by: Christoph Egger <[email protected]>
---
arch/powerpc/mm/44x_mmu.c | 4 ----
1 files changed, 0 insertions(+), 4 deletions(-)

diff --git a/arch/powerpc/mm/44x_mmu.c b/arch/powerpc/mm/44x_mmu.c
index d8c6efb..f70da7e 100644
--- a/arch/powerpc/mm/44x_mmu.c
+++ b/arch/powerpc/mm/44x_mmu.c
@@ -76,11 +76,11 @@ static void __init ppc44x_pin_tlb(unsigned int virt, unsigned int phys)
"tlbwe %1,%3,%5\n"
"tlbwe %0,%3,%6\n"
:
-#ifdef CONFIG_PPC47x
+#ifdef CONFIG_PPC_47x
: "r" (PPC47x_TLB2_S_RWX),
#else
: "r" (PPC44x_TLB_SW | PPC44x_TLB_SR | PPC44x_TLB_SX | PPC44x_TLB_G),
#endif
"r" (phys),
"r" (virt | PPC44x_TLB_VALID | PPC44x_TLB_256M),
"r" (entry),
--
1.6.3.3

2010-06-09 12:05:43

by Josh Boyer

[permalink] [raw]
Subject: Re: [PATCH 5b/5] Removing dead CONFIG_PPC47x

On Wed, Jun 09, 2010 at 01:02:39PM +0200, Christoph Egger wrote:
>CONFIG_PPC47x should actually be spelled CONFIG_PPC_47x as reported by
>Andreas Schwab.
>
>Signed-off-by: Christoph Egger <[email protected]>

Thanks, I'll pull this one in and get it merged.

josh

>---
> arch/powerpc/mm/44x_mmu.c | 4 ----
> 1 files changed, 0 insertions(+), 4 deletions(-)
>
>diff --git a/arch/powerpc/mm/44x_mmu.c b/arch/powerpc/mm/44x_mmu.c
>index d8c6efb..f70da7e 100644
>--- a/arch/powerpc/mm/44x_mmu.c
>+++ b/arch/powerpc/mm/44x_mmu.c
>@@ -76,11 +76,11 @@ static void __init ppc44x_pin_tlb(unsigned int virt, unsigned int phys)
> "tlbwe %1,%3,%5\n"
> "tlbwe %0,%3,%6\n"
> :
>-#ifdef CONFIG_PPC47x
>+#ifdef CONFIG_PPC_47x
> : "r" (PPC47x_TLB2_S_RWX),
> #else
> : "r" (PPC44x_TLB_SW | PPC44x_TLB_SR | PPC44x_TLB_SX | PPC44x_TLB_G),
> #endif
> "r" (phys),
> "r" (virt | PPC44x_TLB_VALID | PPC44x_TLB_256M),
> "r" (entry),
>--
>1.6.3.3
>

2010-06-09 12:36:13

by Josh Boyer

[permalink] [raw]
Subject: Re: [PATCH 3/5] Removing dead CONFIG_SMP_750

On Wed, Jun 09, 2010 at 12:00:21PM +0200, Christoph Egger wrote:
>CONFIG_SMP_750 doesn't exist in Kconfig, therefore removing all
>references for it from the source code.

Yeah, we don't support SMP on 750 at the moment. This code was carried over
from the arch/ppc days, and that code was present pre-git. I think we can
drop it, but I'll leave that up to Ben. Maybe he has crazy plans for a 750 SMP
board.

josh

>
>Signed-off-by: Christoph Egger <[email protected]>
>---
> arch/powerpc/mm/tlb_hash32.c | 4 ----
> 1 files changed, 0 insertions(+), 4 deletions(-)
>
>diff --git a/arch/powerpc/mm/tlb_hash32.c b/arch/powerpc/mm/tlb_hash32.c
>index 8aaa8b7..925fecb 100644
>--- a/arch/powerpc/mm/tlb_hash32.c
>+++ b/arch/powerpc/mm/tlb_hash32.c
>@@ -94,11 +94,7 @@ void tlb_flush(struct mmu_gather *tlb)
> * the cache operations on the bus. Hence we need to use an IPI
> * to get the other CPU(s) to invalidate their TLBs.
> */
>-#ifdef CONFIG_SMP_750
>-#define FINISH_FLUSH smp_send_tlb_invalidate(0)
>-#else
> #define FINISH_FLUSH do { } while (0)
>-#endif
>
> static void flush_range(struct mm_struct *mm, unsigned long start,
> unsigned long end)
>--
>1.6.3.3
>
>_______________________________________________
>Linuxppc-dev mailing list
>[email protected]
>https://lists.ozlabs.org/listinfo/linuxppc-dev

2010-06-10 06:14:46

by Benjamin Herrenschmidt

[permalink] [raw]
Subject: Re: [PATCH 3/5] Removing dead CONFIG_SMP_750

On Wed, 2010-06-09 at 08:35 -0400, Josh Boyer wrote:
> On Wed, Jun 09, 2010 at 12:00:21PM +0200, Christoph Egger wrote:
> >CONFIG_SMP_750 doesn't exist in Kconfig, therefore removing all
> >references for it from the source code.
>
> Yeah, we don't support SMP on 750 at the moment. This code was carried over
> from the arch/ppc days, and that code was present pre-git. I think we can
> drop it, but I'll leave that up to Ben. Maybe he has crazy plans for a 750 SMP
> board.

Nope :-) Though it would be nice to also remove the call sites too and
thus remove the macro entirely.

Cheers,
Ben.

> josh
>
> >
> >Signed-off-by: Christoph Egger <[email protected]>
> >---
> > arch/powerpc/mm/tlb_hash32.c | 4 ----
> > 1 files changed, 0 insertions(+), 4 deletions(-)
> >
> >diff --git a/arch/powerpc/mm/tlb_hash32.c b/arch/powerpc/mm/tlb_hash32.c
> >index 8aaa8b7..925fecb 100644
> >--- a/arch/powerpc/mm/tlb_hash32.c
> >+++ b/arch/powerpc/mm/tlb_hash32.c
> >@@ -94,11 +94,7 @@ void tlb_flush(struct mmu_gather *tlb)
> > * the cache operations on the bus. Hence we need to use an IPI
> > * to get the other CPU(s) to invalidate their TLBs.
> > */
> >-#ifdef CONFIG_SMP_750
> >-#define FINISH_FLUSH smp_send_tlb_invalidate(0)
> >-#else
> > #define FINISH_FLUSH do { } while (0)
> >-#endif
> >
> > static void flush_range(struct mm_struct *mm, unsigned long start,
> > unsigned long end)
> >--
> >1.6.3.3
> >
> >_______________________________________________
> >Linuxppc-dev mailing list
> >[email protected]
> >https://lists.ozlabs.org/listinfo/linuxppc-dev
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/

2010-06-10 06:18:09

by Benjamin Herrenschmidt

[permalink] [raw]
Subject: Re: [PATCH 1/5] Removing dead BOOK3E_MMU_TLB_STATS

On Wed, 2010-06-09 at 11:59 +0200, Christoph Egger wrote:
> BOOK3E_MMU_TLB_STATS doesn't exist in Kconfig, therefore removing all
> references for it from the source code.

Heh, thanks but no :-)

I want to keep that code here, until we hook it up again. It was hooked
up properly in some internal stuff that didn't go upstream for some
reason and I need to fix that.

Cheers,
Ben.

> Signed-off-by: Christoph Egger <[email protected]>
> ---
> arch/powerpc/include/asm/exception-64e.h | 38 ------------------------------
> arch/powerpc/mm/tlb_low_64e.S | 9 -------
> 2 files changed, 0 insertions(+), 47 deletions(-)
>
> diff --git a/arch/powerpc/include/asm/exception-64e.h b/arch/powerpc/include/asm/exception-64e.h
> index 6d53f31..db74814 100644
> --- a/arch/powerpc/include/asm/exception-64e.h
> +++ b/arch/powerpc/include/asm/exception-64e.h
> @@ -65,14 +65,7 @@
> #define EX_TLB_MMUCR0 (12 * 8) /* Level 0 */
> #define EX_TLB_MAS1 (12 * 8) /* Level 0 */
> #define EX_TLB_MAS2 (13 * 8) /* Level 0 */
> -#ifdef CONFIG_BOOK3E_MMU_TLB_STATS
> -#define EX_TLB_R8 (14 * 8)
> -#define EX_TLB_R9 (15 * 8)
> -#define EX_TLB_LR (16 * 8)
> -#define EX_TLB_SIZE (17 * 8)
> -#else
> #define EX_TLB_SIZE (14 * 8)
> -#endif
>
> #define START_EXCEPTION(label) \
> .globl exc_##label##_book3e; \
> @@ -157,36 +150,6 @@ exc_##label##_book3e:
> addi r11,r13,PACA_EXTLB; \
> TLB_MISS_RESTORE(r11)
>
> -#ifdef CONFIG_BOOK3E_MMU_TLB_STATS
> -#define TLB_MISS_PROLOG_STATS \
> - mflr r10; \
> - std r8,EX_TLB_R8(r12); \
> - std r9,EX_TLB_R9(r12); \
> - std r10,EX_TLB_LR(r12);
> -#define TLB_MISS_RESTORE_STATS \
> - ld r16,EX_TLB_LR(r12); \
> - ld r9,EX_TLB_R9(r12); \
> - ld r8,EX_TLB_R8(r12); \
> - mtlr r16;
> -#define TLB_MISS_STATS_D(name) \
> - addi r9,r13,MMSTAT_DSTATS+name; \
> - bl .tlb_stat_inc;
> -#define TLB_MISS_STATS_I(name) \
> - addi r9,r13,MMSTAT_ISTATS+name; \
> - bl .tlb_stat_inc;
> -#define TLB_MISS_STATS_X(name) \
> - ld r8,PACA_EXTLB+EX_TLB_ESR(r13); \
> - cmpdi cr2,r8,-1; \
> - beq cr2,61f; \
> - addi r9,r13,MMSTAT_DSTATS+name; \
> - b 62f; \
> -61: addi r9,r13,MMSTAT_ISTATS+name; \
> -62: bl .tlb_stat_inc;
> -#define TLB_MISS_STATS_SAVE_INFO \
> - std r14,EX_TLB_ESR(r12); /* save ESR */ \
> -
> -
> -#else
> #define TLB_MISS_PROLOG_STATS
> #define TLB_MISS_RESTORE_STATS
> #define TLB_MISS_STATS_D(name)
> @@ -194,7 +157,6 @@ exc_##label##_book3e:
> #define TLB_MISS_STATS_X(name)
> #define TLB_MISS_STATS_Y(name)
> #define TLB_MISS_STATS_SAVE_INFO
> -#endif
>
> #define SET_IVOR(vector_number, vector_offset) \
> li r3,vector_offset@l; \
> diff --git a/arch/powerpc/mm/tlb_low_64e.S b/arch/powerpc/mm/tlb_low_64e.S
> index 8b04c54..4d7d059 100644
> --- a/arch/powerpc/mm/tlb_low_64e.S
> +++ b/arch/powerpc/mm/tlb_low_64e.S
> @@ -758,12 +758,3 @@ tlb_load_linear_fault:
> 1: TLB_MISS_EPILOG_ERROR_SPECIAL
> b exc_instruction_storage_book3e
>
> -
> -#ifdef CONFIG_BOOK3E_MMU_TLB_STATS
> -.tlb_stat_inc:
> -1: ldarx r8,0,r9
> - addi r8,r8,1
> - stdcx. r8,0,r9
> - bne- 1b
> - blr
> -#endif

2010-06-10 08:59:31

by Benjamin Herrenschmidt

[permalink] [raw]
Subject: Re: [PATCH 5b/5] Removing dead CONFIG_PPC47x

On Wed, 2010-06-09 at 08:05 -0400, Josh Boyer wrote:
> On Wed, Jun 09, 2010 at 01:02:39PM +0200, Christoph Egger wrote:
> >CONFIG_PPC47x should actually be spelled CONFIG_PPC_47x as reported by
> >Andreas Schwab.
> >
> >Signed-off-by: Christoph Egger <[email protected]>
>
> Thanks, I'll pull this one in and get it merged.

I pulled your tree along with a couple of other things. I'll do a few
tests tomorrow before sending to Linus.

Cheers,
Ben.

> josh
>
> >---
> > arch/powerpc/mm/44x_mmu.c | 4 ----
> > 1 files changed, 0 insertions(+), 4 deletions(-)
> >
> >diff --git a/arch/powerpc/mm/44x_mmu.c b/arch/powerpc/mm/44x_mmu.c
> >index d8c6efb..f70da7e 100644
> >--- a/arch/powerpc/mm/44x_mmu.c
> >+++ b/arch/powerpc/mm/44x_mmu.c
> >@@ -76,11 +76,11 @@ static void __init ppc44x_pin_tlb(unsigned int virt, unsigned int phys)
> > "tlbwe %1,%3,%5\n"
> > "tlbwe %0,%3,%6\n"
> > :
> >-#ifdef CONFIG_PPC47x
> >+#ifdef CONFIG_PPC_47x
> > : "r" (PPC47x_TLB2_S_RWX),
> > #else
> > : "r" (PPC44x_TLB_SW | PPC44x_TLB_SR | PPC44x_TLB_SX | PPC44x_TLB_G),
> > #endif
> > "r" (phys),
> > "r" (virt | PPC44x_TLB_VALID | PPC44x_TLB_256M),
> > "r" (entry),
> >--
> >1.6.3.3
> >

2010-06-10 12:30:59

by Christoph Egger

[permalink] [raw]
Subject: Re: [PATCH 3/5] Removing dead CONFIG_SMP_750

On Thu, Jun 10, 2010 at 04:14:21PM +1000, Benjamin Herrenschmidt wrote:
> On Wed, 2010-06-09 at 08:35 -0400, Josh Boyer wrote:
> > On Wed, Jun 09, 2010 at 12:00:21PM +0200, Christoph Egger wrote:
> > >CONFIG_SMP_750 doesn't exist in Kconfig, therefore removing all
> > >references for it from the source code.
> >
> > Yeah, we don't support SMP on 750 at the moment. This code was carried over
> > from the arch/ppc days, and that code was present pre-git. I think we can
> > drop it, but I'll leave that up to Ben. Maybe he has crazy plans for a 750 SMP
> > board.
>
> Nope :-) Though it would be nice to also remove the call sites too and
> thus remove the macro entirely.

SOmething like below?

-----
From: Christoph Egger <[email protected]>
Subject: [PATCH 3/5] Removing dead CONFIG_SMP_750

CONFIG_SMP_750 doesn't exist in Kconfig, therefore removing all
references for it from the source code.

Signed-off-by: Christoph Egger <[email protected]>

diff --git a/arch/powerpc/mm/tlb_hash32.c b/arch/powerpc/mm/tlb_hash32.c
index 8aaa8b7..09c7820 100644
--- a/arch/powerpc/mm/tlb_hash32.c
+++ b/arch/powerpc/mm/tlb_hash32.c
@@ -94,11 +94,6 @@ void tlb_flush(struct mmu_gather *tlb)
* the cache operations on the bus. Hence we need to use an IPI
* to get the other CPU(s) to invalidate their TLBs.
*/
-#ifdef CONFIG_SMP_750
-#define FINISH_FLUSH smp_send_tlb_invalidate(0)
-#else
-#define FINISH_FLUSH do { } while (0)
-#endif

static void flush_range(struct mm_struct *mm, unsigned long start,
unsigned long end)
@@ -138,7 +133,6 @@ static void flush_range(struct mm_struct *mm, unsigned long start,
void flush_tlb_kernel_range(unsigned long start, unsigned long end)
{
flush_range(&init_mm, start, end);
- FINISH_FLUSH;
}
EXPORT_SYMBOL(flush_tlb_kernel_range);

@@ -162,7 +156,6 @@ void flush_tlb_mm(struct mm_struct *mm)
*/
for (mp = mm->mmap; mp != NULL; mp = mp->vm_next)
flush_range(mp->vm_mm, mp->vm_start, mp->vm_end);
- FINISH_FLUSH;
}
EXPORT_SYMBOL(flush_tlb_mm);

@@ -179,7 +172,6 @@ void flush_tlb_page(struct vm_area_struct *vma, unsigned long vmaddr)
pmd = pmd_offset(pud_offset(pgd_offset(mm, vmaddr), vmaddr), vmaddr);
if (!pmd_none(*pmd))
flush_hash_pages(mm->context.id, vmaddr, pmd_val(*pmd), 1);
- FINISH_FLUSH;
}
EXPORT_SYMBOL(flush_tlb_page);

@@ -192,6 +184,5 @@ void flush_tlb_range(struct vm_area_struct *vma, unsigned long start,
unsigned long end)
{
flush_range(vma->vm_mm, start, end);
- FINISH_FLUSH;
}
EXPORT_SYMBOL(flush_tlb_range);
--
1.6.3.3

2010-06-10 18:46:55

by Joe Perches

[permalink] [raw]
Subject: Re: [PATCH 0/5] Removing dead code

(cc's trimmed and rpjday added)

On Wed, 2010-06-09 at 11:58 +0200, Christoph Egger wrote:
> I've been running a check on the arch/powerpc sourcetree for
> config Items not defined in Kconfig and found5 such chases.

Are you aware of
http://www.crashcourse.ca/wiki/index.php/Kernel_cleanup_scripts

> [0] http://vamos1.informatik.uni-erlangen.de/

2010-06-11 06:41:26

by Benjamin Herrenschmidt

[permalink] [raw]
Subject: Re: [PATCH 3/5] Removing dead CONFIG_SMP_750

On Thu, 2010-06-10 at 14:23 +0200, Christoph Egger wrote:
> On Thu, Jun 10, 2010 at 04:14:21PM +1000, Benjamin Herrenschmidt wrote:
> > On Wed, 2010-06-09 at 08:35 -0400, Josh Boyer wrote:
> > > On Wed, Jun 09, 2010 at 12:00:21PM +0200, Christoph Egger wrote:
> > > >CONFIG_SMP_750 doesn't exist in Kconfig, therefore removing all
> > > >references for it from the source code.
> > >
> > > Yeah, we don't support SMP on 750 at the moment. This code was carried over
> > > from the arch/ppc days, and that code was present pre-git. I think we can
> > > drop it, but I'll leave that up to Ben. Maybe he has crazy plans for a 750 SMP
> > > board.
> >
> > Nope :-) Though it would be nice to also remove the call sites too and
> > thus remove the macro entirely.
>
> SOmething like below?

Excellent. Thanks. I'll add that to the batch I'm preparing for Linus.

Cheers,
Ben.

> -----
> From: Christoph Egger <[email protected]>
> Subject: [PATCH 3/5] Removing dead CONFIG_SMP_750
>
> CONFIG_SMP_750 doesn't exist in Kconfig, therefore removing all
> references for it from the source code.
>
> Signed-off-by: Christoph Egger <[email protected]>
>
> diff --git a/arch/powerpc/mm/tlb_hash32.c b/arch/powerpc/mm/tlb_hash32.c
> index 8aaa8b7..09c7820 100644
> --- a/arch/powerpc/mm/tlb_hash32.c
> +++ b/arch/powerpc/mm/tlb_hash32.c
> @@ -94,11 +94,6 @@ void tlb_flush(struct mmu_gather *tlb)
> * the cache operations on the bus. Hence we need to use an IPI
> * to get the other CPU(s) to invalidate their TLBs.
> */
> -#ifdef CONFIG_SMP_750
> -#define FINISH_FLUSH smp_send_tlb_invalidate(0)
> -#else
> -#define FINISH_FLUSH do { } while (0)
> -#endif
>
> static void flush_range(struct mm_struct *mm, unsigned long start,
> unsigned long end)
> @@ -138,7 +133,6 @@ static void flush_range(struct mm_struct *mm, unsigned long start,
> void flush_tlb_kernel_range(unsigned long start, unsigned long end)
> {
> flush_range(&init_mm, start, end);
> - FINISH_FLUSH;
> }
> EXPORT_SYMBOL(flush_tlb_kernel_range);
>
> @@ -162,7 +156,6 @@ void flush_tlb_mm(struct mm_struct *mm)
> */
> for (mp = mm->mmap; mp != NULL; mp = mp->vm_next)
> flush_range(mp->vm_mm, mp->vm_start, mp->vm_end);
> - FINISH_FLUSH;
> }
> EXPORT_SYMBOL(flush_tlb_mm);
>
> @@ -179,7 +172,6 @@ void flush_tlb_page(struct vm_area_struct *vma, unsigned long vmaddr)
> pmd = pmd_offset(pud_offset(pgd_offset(mm, vmaddr), vmaddr), vmaddr);
> if (!pmd_none(*pmd))
> flush_hash_pages(mm->context.id, vmaddr, pmd_val(*pmd), 1);
> - FINISH_FLUSH;
> }
> EXPORT_SYMBOL(flush_tlb_page);
>
> @@ -192,6 +184,5 @@ void flush_tlb_range(struct vm_area_struct *vma, unsigned long start,
> unsigned long end)
> {
> flush_range(vma->vm_mm, start, end);
> - FINISH_FLUSH;
> }
> EXPORT_SYMBOL(flush_tlb_range);

2010-06-11 07:34:51

by Reinhard Tartler

[permalink] [raw]
Subject: Re: [PATCH 0/5] Removing dead code

Joe Perches <[email protected]> writes:

> (cc's trimmed and rpjday added)
>
> On Wed, 2010-06-09 at 11:58 +0200, Christoph Egger wrote:
>> I've been running a check on the arch/powerpc sourcetree for
>> config Items not defined in Kconfig and found5 such chases.
>
> Are you aware of
> http://www.crashcourse.ca/wiki/index.php/Kernel_cleanup_scripts

Yes, we are. These scripts aim at a very similar goal. However, we are
using a more sound approach that actually involves parsing CPP
statements and the kconfig language and checking the resulting
constraints with SAT solving tools. This way, we get way more precise
results.

You can read about our approach in [1].

[1] http://portal.acm.org/citation.cfm?id=1629732

--
Reinhard Tartler Department of Computer Science IV
Martensstr 1, 91058 Erlangen Germany, University of Erlangen-Nuremberg
http://www4.informatik.uni-erlangen.de/~tartler