2009-11-13 20:30:21

by Dave Jones

[permalink] [raw]
Subject: [X86] Minimise printk spew from per-vendor init code.

In the default case where the kernel supports all CPU vendors,
we currently print out a bunch of not useful messages on every system.

32bit:
KERNEL supported cpus:
Intel GenuineIntel
AMD AuthenticAMD
NSC Geode by NSC
Cyrix CyrixInstead
Centaur CentaurHauls
Transmeta GenuineTMx86
Transmeta TransmetaCPU
UMC UMC UMC UMC

64bit:
KERNEL supported cpus:
Intel GenuineIntel
AMD AuthenticAMD
Centaur CentaurHauls


Given that "what CPUs does the kernel support" isn't useful for
the "support everything" case, we can suppress these printk's.

Signed-off-by: Dave Jones <[email protected]>

diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index cc25c2b..617a29f 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -656,6 +656,7 @@ static void __init early_identify_cpu(struct cpuinfo_x86 *c)

void __init early_cpu_init(void)
{
+#ifdef PROCESSOR_SELECT
const struct cpu_dev *const *cdev;
int count = 0;

@@ -676,7 +677,7 @@ void __init early_cpu_init(void)
cpudev->c_ident[j]);
}
}
-
+#endif
early_identify_cpu(&boot_cpu_data);
}


2009-11-14 00:34:06

by Dave Jones

[permalink] [raw]
Subject: [tip:x86/debug] x86: Minimise printk spew from per-vendor init code

Commit-ID: 0388423dba2217b4e5b6c61690b0506d13b25a49
Gitweb: http://git.kernel.org/tip/0388423dba2217b4e5b6c61690b0506d13b25a49
Author: Dave Jones <[email protected]>
AuthorDate: Fri, 13 Nov 2009 15:30:00 -0500
Committer: Ingo Molnar <[email protected]>
CommitDate: Sat, 14 Nov 2009 01:18:05 +0100

x86: Minimise printk spew from per-vendor init code

In the default case where the kernel supports all CPU vendors,
we currently print out a bunch of not useful messages on every
system.

32-bit:
KERNEL supported cpus:
Intel GenuineIntel
AMD AuthenticAMD
NSC Geode by NSC
Cyrix CyrixInstead
Centaur CentaurHauls
Transmeta GenuineTMx86
Transmeta TransmetaCPU
UMC UMC UMC UMC

64-bit:
KERNEL supported cpus:
Intel GenuineIntel
AMD AuthenticAMD
Centaur CentaurHauls

Given that "what CPUs does the kernel support" isn't useful for
the "support everything" case, we can suppress these printk's.

Signed-off-by: Dave Jones <[email protected]>
LKML-Reference: <[email protected]>
Signed-off-by: Ingo Molnar <[email protected]>
---
arch/x86/kernel/cpu/common.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index cc25c2b..617a29f 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -656,6 +656,7 @@ static void __init early_identify_cpu(struct cpuinfo_x86 *c)

void __init early_cpu_init(void)
{
+#ifdef PROCESSOR_SELECT
const struct cpu_dev *const *cdev;
int count = 0;

@@ -676,7 +677,7 @@ void __init early_cpu_init(void)
cpudev->c_ident[j]);
}
}
-
+#endif
early_identify_cpu(&boot_cpu_data);
}

2009-11-14 01:03:42

by Yinghai Lu

[permalink] [raw]
Subject: Re: [tip:x86/debug] x86: Minimise printk spew from per-vendor init code

On Fri, Nov 13, 2009 at 4:33 PM, tip-bot for Dave Jones
<[email protected]> wrote:
> Commit-ID: ?0388423dba2217b4e5b6c61690b0506d13b25a49
> Gitweb: ? ? http://git.kernel.org/tip/0388423dba2217b4e5b6c61690b0506d13b25a49
> Author: ? ? Dave Jones <[email protected]>
> AuthorDate: Fri, 13 Nov 2009 15:30:00 -0500
> Committer: ?Ingo Molnar <[email protected]>
> CommitDate: Sat, 14 Nov 2009 01:18:05 +0100
>
> x86: Minimise printk spew from per-vendor init code
>
> In the default case where the kernel supports all CPU vendors,
> we currently print out a bunch of not useful messages on every
> system.
>
> 32-bit:
> KERNEL supported cpus:
> ?Intel GenuineIntel
> ?AMD AuthenticAMD
> ?NSC Geode by NSC
> ?Cyrix CyrixInstead
> ?Centaur CentaurHauls
> ?Transmeta GenuineTMx86
> ?Transmeta TransmetaCPU
> ?UMC UMC UMC UMC
>
> 64-bit:
> KERNEL supported cpus:
> ?Intel GenuineIntel
> ?AMD AuthenticAMD
> ?Centaur CentaurHauls
>
> Given that "what CPUs does the kernel support" isn't useful for
> the "support everything" case, we can suppress these printk's.
>
> Signed-off-by: Dave Jones <[email protected]>
> LKML-Reference: <[email protected]>
> Signed-off-by: Ingo Molnar <[email protected]>
> ---
> ?arch/x86/kernel/cpu/common.c | ? ?3 ++-
> ?1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
> index cc25c2b..617a29f 100644
> --- a/arch/x86/kernel/cpu/common.c
> +++ b/arch/x86/kernel/cpu/common.c
> @@ -656,6 +656,7 @@ static void __init early_identify_cpu(struct cpuinfo_x86 *c)
>
> ?void __init early_cpu_init(void)
> ?{
> +#ifdef PROCESSOR_SELECT
> ? ? ? ?const struct cpu_dev *const *cdev;
> ? ? ? ?int count = 0;
>
> @@ -676,7 +677,7 @@ void __init early_cpu_init(void)
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?cpudev->c_ident[j]);
> ? ? ? ? ? ? ? ?}
> ? ? ? ?}
> -
> +#endif
> ? ? ? ?early_identify_cpu(&boot_cpu_data);
> ?}

NACK.

the function is initializing cpu_devs array.

YH

2009-11-14 01:39:10

by Dave Jones

[permalink] [raw]
Subject: Re: [tip:x86/debug] x86: Minimise printk spew from per-vendor init code

On Fri, Nov 13, 2009 at 05:03:44PM -0800, Yinghai Lu wrote:

> > --- a/arch/x86/kernel/cpu/common.c
> > +++ b/arch/x86/kernel/cpu/common.c
> > @@ -656,6 +656,7 @@ static void __init early_identify_cpu(struct cpuinfo_x86 *c)
> >
> > ?void __init early_cpu_init(void)
> > ?{
> > +#ifdef PROCESSOR_SELECT
> > ? ? ? ?const struct cpu_dev *const *cdev;
> > ? ? ? ?int count = 0;
> >
> > @@ -676,7 +677,7 @@ void __init early_cpu_init(void)
> > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?cpudev->c_ident[j]);
> > ? ? ? ? ? ? ? ?}
> > ? ? ? ?}
> > -
> > +#endif
> > ? ? ? ?early_identify_cpu(&boot_cpu_data);
> > ?}
>
> NACK.
>
> the function is initializing cpu_devs array.

Ugh, I don't know how I missed that. I also seem to have boot tested the wrong kernel.
Back to the drawing board.

Dave


2009-11-14 02:48:55

by Yinghai Lu

[permalink] [raw]
Subject: Re: [tip:x86/debug] x86: Minimise printk spew from per-vendor init code

On Fri, Nov 13, 2009 at 5:38 PM, Dave Jones <[email protected]> wrote:
> On Fri, Nov 13, 2009 at 05:03:44PM -0800, Yinghai Lu wrote:
>
> ?> > --- a/arch/x86/kernel/cpu/common.c
> ?> > +++ b/arch/x86/kernel/cpu/common.c
> ?> > @@ -656,6 +656,7 @@ static void __init early_identify_cpu(struct cpuinfo_x86 *c)
> ?> >
> ?> > ?void __init early_cpu_init(void)
> ?> > ?{
> ?> > +#ifdef PROCESSOR_SELECT
> ?> > ? ? ? ?const struct cpu_dev *const *cdev;
> ?> > ? ? ? ?int count = 0;
> ?> >
> ?> > @@ -676,7 +677,7 @@ void __init early_cpu_init(void)
> ?> > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?cpudev->c_ident[j]);
> ?> > ? ? ? ? ? ? ? ?}
> ?> > ? ? ? ?}
> ?> > -
> ?> > +#endif
> ?> > ? ? ? ?early_identify_cpu(&boot_cpu_data);
> ?> > ?}
> ?>
> ?> NACK.
> ?>
> ?> the function is initializing cpu_devs array.
>
> Ugh, I don't know how I missed that. ?I also seem to have boot tested the wrong kernel.
> Back to the drawing board.
>
use two loop instead?

YH

2009-11-14 09:38:16

by Ingo Molnar

[permalink] [raw]
Subject: Re: [tip:x86/debug] x86: Minimise printk spew from per-vendor init code


* Yinghai Lu <[email protected]> wrote:

> On Fri, Nov 13, 2009 at 4:33 PM, tip-bot for Dave Jones
> <[email protected]> wrote:
> > Commit-ID: ?0388423dba2217b4e5b6c61690b0506d13b25a49
> > Gitweb: ? ? http://git.kernel.org/tip/0388423dba2217b4e5b6c61690b0506d13b25a49
> > Author: ? ? Dave Jones <[email protected]>
> > AuthorDate: Fri, 13 Nov 2009 15:30:00 -0500
> > Committer: ?Ingo Molnar <[email protected]>
> > CommitDate: Sat, 14 Nov 2009 01:18:05 +0100
> >
> > x86: Minimise printk spew from per-vendor init code
> >
> > In the default case where the kernel supports all CPU vendors,
> > we currently print out a bunch of not useful messages on every
> > system.
> >
> > 32-bit:
> > KERNEL supported cpus:
> > ?Intel GenuineIntel
> > ?AMD AuthenticAMD
> > ?NSC Geode by NSC
> > ?Cyrix CyrixInstead
> > ?Centaur CentaurHauls
> > ?Transmeta GenuineTMx86
> > ?Transmeta TransmetaCPU
> > ?UMC UMC UMC UMC
> >
> > 64-bit:
> > KERNEL supported cpus:
> > ?Intel GenuineIntel
> > ?AMD AuthenticAMD
> > ?Centaur CentaurHauls
> >
> > Given that "what CPUs does the kernel support" isn't useful for
> > the "support everything" case, we can suppress these printk's.
> >
> > Signed-off-by: Dave Jones <[email protected]>
> > LKML-Reference: <[email protected]>
> > Signed-off-by: Ingo Molnar <[email protected]>
> > ---
> > ?arch/x86/kernel/cpu/common.c | ? ?3 ++-
> > ?1 files changed, 2 insertions(+), 1 deletions(-)
> >
> > diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
> > index cc25c2b..617a29f 100644
> > --- a/arch/x86/kernel/cpu/common.c
> > +++ b/arch/x86/kernel/cpu/common.c
> > @@ -656,6 +656,7 @@ static void __init early_identify_cpu(struct cpuinfo_x86 *c)
> >
> > ?void __init early_cpu_init(void)
> > ?{
> > +#ifdef PROCESSOR_SELECT
> > ? ? ? ?const struct cpu_dev *const *cdev;
> > ? ? ? ?int count = 0;
> >
> > @@ -676,7 +677,7 @@ void __init early_cpu_init(void)
> > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?cpudev->c_ident[j]);
> > ? ? ? ? ? ? ? ?}
> > ? ? ? ?}
> > -
> > +#endif
> > ? ? ? ?early_identify_cpu(&boot_cpu_data);
> > ?}
>
> NACK.
>
> the function is initializing cpu_devs array.

Good point. I fixed this.

Ingo

2009-11-14 10:20:00

by Ingo Molnar

[permalink] [raw]
Subject: [tip:x86/debug] x86: Fix cpu_devs[] initialization in early_cpu_init()

Commit-ID: 31c997cac76e62918858a432fff6e43fd48425f9
Gitweb: http://git.kernel.org/tip/31c997cac76e62918858a432fff6e43fd48425f9
Author: Ingo Molnar <[email protected]>
AuthorDate: Sat, 14 Nov 2009 10:34:41 +0100
Committer: Ingo Molnar <[email protected]>
CommitDate: Sat, 14 Nov 2009 10:36:50 +0100

x86: Fix cpu_devs[] initialization in early_cpu_init()

Yinghai Lu noticed that this commit:

0388423: x86: Minimise printk spew from per-vendor init code

mistakenly left out the initialization of cpu_devs[] in the
!PROCESSOR_SELECT case. Fix it.

Reported-by: Yinghai Lu <[email protected]>
Cc: Dave Jones <[email protected]>
LKML-Reference: <[email protected]>
Signed-off-by: Ingo Molnar <[email protected]>
---
arch/x86/kernel/cpu/common.c | 22 ++++++++++++++--------
1 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index 9db1e24..61242a5 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -651,28 +651,34 @@ static void __init early_identify_cpu(struct cpuinfo_x86 *c)

void __init early_cpu_init(void)
{
-#ifdef PROCESSOR_SELECT
const struct cpu_dev *const *cdev;
int count = 0;

+#ifdef PROCESSOR_SELECT
printk(KERN_INFO "KERNEL supported cpus:\n");
+#endif
+
for (cdev = __x86_cpu_dev_start; cdev < __x86_cpu_dev_end; cdev++) {
const struct cpu_dev *cpudev = *cdev;
- unsigned int j;

if (count >= X86_VENDOR_NUM)
break;
cpu_devs[count] = cpudev;
count++;

- for (j = 0; j < 2; j++) {
- if (!cpudev->c_ident[j])
- continue;
- printk(KERN_INFO " %s %s\n", cpudev->c_vendor,
- cpudev->c_ident[j]);
+#ifdef PROCESSOR_SELECT
+ {
+ unsigned int j;
+
+ for (j = 0; j < 2; j++) {
+ if (!cpudev->c_ident[j])
+ continue;
+ printk(KERN_INFO " %s %s\n", cpudev->c_vendor,
+ cpudev->c_ident[j]);
+ }
}
- }
#endif
+ }
early_identify_cpu(&boot_cpu_data);
}