2009-11-11 07:51:44

by Yong Wang

[permalink] [raw]
Subject: [PATCH] x86: Mark the thermal init functions __init

Mark the thermal init functions __init so that the init memory can be freed.

Signed-off-by: Yong Wang <[email protected]>
---
arch/x86/kernel/cpu/mcheck/therm_throt.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kernel/cpu/mcheck/therm_throt.c b/arch/x86/kernel/cpu/mcheck/therm_throt.c
index 7f3cf36..8a73d5c 100644
--- a/arch/x86/kernel/cpu/mcheck/therm_throt.c
+++ b/arch/x86/kernel/cpu/mcheck/therm_throt.c
@@ -256,7 +256,7 @@ asmlinkage void smp_thermal_interrupt(struct pt_regs *regs)
ack_APIC_irq();
}

-void mcheck_intel_therm_init(void)
+void __init mcheck_intel_therm_init(void)
{
/*
* This function is only called on boot CPU. Save the init thermal
@@ -268,7 +268,7 @@ void mcheck_intel_therm_init(void)
lvtthmr_init = apic_read(APIC_LVTTHMR);
}

-void intel_init_thermal(struct cpuinfo_x86 *c)
+void __init intel_init_thermal(struct cpuinfo_x86 *c)
{
unsigned int cpu = smp_processor_id();
int tm2 = 0;


2009-11-11 11:43:18

by Yong Wang

[permalink] [raw]
Subject: [tip:perf/mce] x86: Mark the thermal init functions __init

Commit-ID: ce6b5d768c79b9d5dd6345c033bae781d5ca9b8e
Gitweb: http://git.kernel.org/tip/ce6b5d768c79b9d5dd6345c033bae781d5ca9b8e
Author: Yong Wang <[email protected]>
AuthorDate: Wed, 11 Nov 2009 15:51:25 +0800
Committer: Ingo Molnar <[email protected]>
CommitDate: Wed, 11 Nov 2009 12:33:32 +0100

x86: Mark the thermal init functions __init

Mark the thermal init functions __init so that the init memory
can be freed.

Signed-off-by: Yong Wang <[email protected]>
LKML-Reference: <[email protected]>
Signed-off-by: Ingo Molnar <[email protected]>
---
arch/x86/kernel/cpu/mcheck/therm_throt.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kernel/cpu/mcheck/therm_throt.c b/arch/x86/kernel/cpu/mcheck/therm_throt.c
index 7f3cf36..8a73d5c 100644
--- a/arch/x86/kernel/cpu/mcheck/therm_throt.c
+++ b/arch/x86/kernel/cpu/mcheck/therm_throt.c
@@ -256,7 +256,7 @@ asmlinkage void smp_thermal_interrupt(struct pt_regs *regs)
ack_APIC_irq();
}

-void mcheck_intel_therm_init(void)
+void __init mcheck_intel_therm_init(void)
{
/*
* This function is only called on boot CPU. Save the init thermal
@@ -268,7 +268,7 @@ void mcheck_intel_therm_init(void)
lvtthmr_init = apic_read(APIC_LVTTHMR);
}

-void intel_init_thermal(struct cpuinfo_x86 *c)
+void __init intel_init_thermal(struct cpuinfo_x86 *c)
{
unsigned int cpu = smp_processor_id();
int tm2 = 0;

2009-11-12 05:28:40

by Hidetoshi Seto

[permalink] [raw]
Subject: Re: [PATCH] x86: Mark the thermal init functions __init

Yong Wang wrote:
> Mark the thermal init functions __init so that the init memory can be freed.
>
> Signed-off-by: Yong Wang <[email protected]>
> ---
> arch/x86/kernel/cpu/mcheck/therm_throt.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/x86/kernel/cpu/mcheck/therm_throt.c b/arch/x86/kernel/cpu/mcheck/therm_throt.c
> index 7f3cf36..8a73d5c 100644
> --- a/arch/x86/kernel/cpu/mcheck/therm_throt.c
> +++ b/arch/x86/kernel/cpu/mcheck/therm_throt.c
> @@ -256,7 +256,7 @@ asmlinkage void smp_thermal_interrupt(struct pt_regs *regs)
> ack_APIC_irq();
> }
>
> -void mcheck_intel_therm_init(void)
> +void __init mcheck_intel_therm_init(void)
> {
> /*
> * This function is only called on boot CPU. Save the init thermal

It's OK because it is called only on BP.

> @@ -268,7 +268,7 @@ void mcheck_intel_therm_init(void)
> lvtthmr_init = apic_read(APIC_LVTTHMR);
> }
>
> -void intel_init_thermal(struct cpuinfo_x86 *c)
> +void __init intel_init_thermal(struct cpuinfo_x86 *c)
> {
> unsigned int cpu = smp_processor_id();
> int tm2 = 0;

But I think this could be called on hot-plugged AP.
Should be __cpuinit ?

void __cpuinit mcheck_cpu_init(struct cpuinfo_x86 *c)
-> static void __mcheck_cpu_init_vendor(struct cpuinfo_x86 *c)
-> void mce_intel_feature_init(struct cpuinfo_x86 *c)
-> void intel_init_thermal(struct cpuinfo_x86 *c)

Thanks,
H.Seto

2009-11-12 06:52:52

by Hidetoshi Seto

[permalink] [raw]
Subject: [PATCH] x86, mce: fix __init annotations

Hidetoshi Seto wrote:
> Yong Wang wrote:
>> @@ -268,7 +268,7 @@ void mcheck_intel_therm_init(void)
>> lvtthmr_init = apic_read(APIC_LVTTHMR);
>> }
>>
>> -void intel_init_thermal(struct cpuinfo_x86 *c)
>> +void __init intel_init_thermal(struct cpuinfo_x86 *c)
>> {
>> unsigned int cpu = smp_processor_id();
>> int tm2 = 0;
>
> But I think this could be called on hot-plugged AP.
> Should be __cpuinit ?
>
> void __cpuinit mcheck_cpu_init(struct cpuinfo_x86 *c)
> -> static void __mcheck_cpu_init_vendor(struct cpuinfo_x86 *c)
> -> void mce_intel_feature_init(struct cpuinfo_x86 *c)
> -> void intel_init_thermal(struct cpuinfo_x86 *c)

I found it is called from resume path, so neither __init nor __cpuinit
will be applicable...

static int mce_resume(struct sys_device *dev)
-> static void __mcheck_cpu_init_vendor(struct cpuinfo_x86 *c)
-> void mce_intel_feature_init(struct cpuinfo_x86 *c)
-> void intel_init_thermal(struct cpuinfo_x86 *c)

Following patch is based on tip:perf/mce.


Thanks,
H.Seto

===

Subject: [PATCH] x86, mce: fix __init annotations

The intel_init_thermal() is called from resume path, so it cannot be
marked as __init.

OTOH mce_banks_init() is only called from __mcheck_cpu_cap_init()
which is marked as __cpuinit, so it can be also marked as __cpuinit.

Signed-off-by: Hidetoshi Seto <[email protected]>
---
arch/x86/kernel/cpu/mcheck/mce.c | 4 ++--
arch/x86/kernel/cpu/mcheck/therm_throt.c | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c
index 0d41020..5f277ca 100644
--- a/arch/x86/kernel/cpu/mcheck/mce.c
+++ b/arch/x86/kernel/cpu/mcheck/mce.c
@@ -1201,7 +1201,7 @@ int mce_notify_irq(void)
}
EXPORT_SYMBOL_GPL(mce_notify_irq);

-static int mce_banks_init(void)
+static int __cpuinit __mcheck_cpu_mce_banks_init(void)
{
int i;

@@ -1242,7 +1242,7 @@ static int __cpuinit __mcheck_cpu_cap_init(void)
WARN_ON(banks != 0 && b != banks);
banks = b;
if (!mce_banks) {
- int err = mce_banks_init();
+ int err = __mcheck_cpu_mce_banks_init();

if (err)
return err;
diff --git a/arch/x86/kernel/cpu/mcheck/therm_throt.c b/arch/x86/kernel/cpu/mcheck/therm_throt.c
index 8a73d5c..4fef985 100644
--- a/arch/x86/kernel/cpu/mcheck/therm_throt.c
+++ b/arch/x86/kernel/cpu/mcheck/therm_throt.c
@@ -268,7 +268,7 @@ void __init mcheck_intel_therm_init(void)
lvtthmr_init = apic_read(APIC_LVTTHMR);
}

-void __init intel_init_thermal(struct cpuinfo_x86 *c)
+void intel_init_thermal(struct cpuinfo_x86 *c)
{
unsigned int cpu = smp_processor_id();
int tm2 = 0;
--
1.6.5.2

2009-11-12 08:12:43

by Yong Wang

[permalink] [raw]
Subject: Re: [PATCH] x86, mce: fix __init annotations

On Thu, Nov 12, 2009 at 03:52:40PM +0900, Hidetoshi Seto wrote:
> Hidetoshi Seto wrote:
> > Yong Wang wrote:
> >> @@ -268,7 +268,7 @@ void mcheck_intel_therm_init(void)
> >> lvtthmr_init = apic_read(APIC_LVTTHMR);
> >> }
> >>
> >> -void intel_init_thermal(struct cpuinfo_x86 *c)
> >> +void __init intel_init_thermal(struct cpuinfo_x86 *c)
> >> {
> >> unsigned int cpu = smp_processor_id();
> >> int tm2 = 0;
> >
> > But I think this could be called on hot-plugged AP.
> > Should be __cpuinit ?
> >
> > void __cpuinit mcheck_cpu_init(struct cpuinfo_x86 *c)
> > -> static void __mcheck_cpu_init_vendor(struct cpuinfo_x86 *c)
> > -> void mce_intel_feature_init(struct cpuinfo_x86 *c)
> > -> void intel_init_thermal(struct cpuinfo_x86 *c)
>
> I found it is called from resume path, so neither __init nor __cpuinit
> will be applicable...
>
> static int mce_resume(struct sys_device *dev)
> -> static void __mcheck_cpu_init_vendor(struct cpuinfo_x86 *c)
> -> void mce_intel_feature_init(struct cpuinfo_x86 *c)
> -> void intel_init_thermal(struct cpuinfo_x86 *c)
>
> Following patch is based on tip:perf/mce.
>
>
> Thanks,
> H.Seto
>
> ===
>
> Subject: [PATCH] x86, mce: fix __init annotations
>
> The intel_init_thermal() is called from resume path, so it cannot be
> marked as __init.
>
> OTOH mce_banks_init() is only called from __mcheck_cpu_cap_init()
> which is marked as __cpuinit, so it can be also marked as __cpuinit.
>
> Signed-off-by: Hidetoshi Seto <[email protected]>
> ---
> arch/x86/kernel/cpu/mcheck/mce.c | 4 ++--
> arch/x86/kernel/cpu/mcheck/therm_throt.c | 2 +-
> 2 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c
> index 0d41020..5f277ca 100644
> --- a/arch/x86/kernel/cpu/mcheck/mce.c
> +++ b/arch/x86/kernel/cpu/mcheck/mce.c
> @@ -1201,7 +1201,7 @@ int mce_notify_irq(void)
> }
> EXPORT_SYMBOL_GPL(mce_notify_irq);
>
> -static int mce_banks_init(void)
> +static int __cpuinit __mcheck_cpu_mce_banks_init(void)
> {
> int i;
>
> @@ -1242,7 +1242,7 @@ static int __cpuinit __mcheck_cpu_cap_init(void)
> WARN_ON(banks != 0 && b != banks);
> banks = b;
> if (!mce_banks) {
> - int err = mce_banks_init();
> + int err = __mcheck_cpu_mce_banks_init();
>
> if (err)
> return err;
> diff --git a/arch/x86/kernel/cpu/mcheck/therm_throt.c b/arch/x86/kernel/cpu/mcheck/therm_throt.c
> index 8a73d5c..4fef985 100644
> --- a/arch/x86/kernel/cpu/mcheck/therm_throt.c
> +++ b/arch/x86/kernel/cpu/mcheck/therm_throt.c
> @@ -268,7 +268,7 @@ void __init mcheck_intel_therm_init(void)
> lvtthmr_init = apic_read(APIC_LVTTHMR);
> }
>
> -void __init intel_init_thermal(struct cpuinfo_x86 *c)
> +void intel_init_thermal(struct cpuinfo_x86 *c)
> {
> unsigned int cpu = smp_processor_id();
> int tm2 = 0;
>

Oh, yeah. We should only mark mcheck_intel_therm_init as __init for the
thermal part. Thanks for spotting.

2009-11-12 08:22:42

by Hidetoshi Seto

[permalink] [raw]
Subject: [tip:perf/mce] x86, mce: Fix __init annotations

Commit-ID: cffd377e5879ea58522224a785a083f201afd80e
Gitweb: http://git.kernel.org/tip/cffd377e5879ea58522224a785a083f201afd80e
Author: Hidetoshi Seto <[email protected]>
AuthorDate: Thu, 12 Nov 2009 15:52:40 +0900
Committer: Ingo Molnar <[email protected]>
CommitDate: Thu, 12 Nov 2009 09:17:11 +0100

x86, mce: Fix __init annotations

The intel_init_thermal() is called from resume path, so it
cannot be marked as __init.

OTOH mce_banks_init() is only called from
__mcheck_cpu_cap_init() which is marked as __cpuinit, so it can
be also marked as __cpuinit.

Signed-off-by: Hidetoshi Seto <[email protected]>
Acked-by: Yong Wang <[email protected]>
LKML-Reference: <[email protected]>
Signed-off-by: Ingo Molnar <[email protected]>
---
arch/x86/kernel/cpu/mcheck/mce.c | 4 ++--
arch/x86/kernel/cpu/mcheck/therm_throt.c | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c
index 0d41020..5f277ca 100644
--- a/arch/x86/kernel/cpu/mcheck/mce.c
+++ b/arch/x86/kernel/cpu/mcheck/mce.c
@@ -1201,7 +1201,7 @@ int mce_notify_irq(void)
}
EXPORT_SYMBOL_GPL(mce_notify_irq);

-static int mce_banks_init(void)
+static int __cpuinit __mcheck_cpu_mce_banks_init(void)
{
int i;

@@ -1242,7 +1242,7 @@ static int __cpuinit __mcheck_cpu_cap_init(void)
WARN_ON(banks != 0 && b != banks);
banks = b;
if (!mce_banks) {
- int err = mce_banks_init();
+ int err = __mcheck_cpu_mce_banks_init();

if (err)
return err;
diff --git a/arch/x86/kernel/cpu/mcheck/therm_throt.c b/arch/x86/kernel/cpu/mcheck/therm_throt.c
index 8a73d5c..4fef985 100644
--- a/arch/x86/kernel/cpu/mcheck/therm_throt.c
+++ b/arch/x86/kernel/cpu/mcheck/therm_throt.c
@@ -268,7 +268,7 @@ void __init mcheck_intel_therm_init(void)
lvtthmr_init = apic_read(APIC_LVTTHMR);
}

-void __init intel_init_thermal(struct cpuinfo_x86 *c)
+void intel_init_thermal(struct cpuinfo_x86 *c)
{
unsigned int cpu = smp_processor_id();
int tm2 = 0;