Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1275238 > unrolled thread

[PATCH] x86: correct saving and restoring of lapic vectors in suspend/resume

Started byJuergen Gross <jgross@suse.com>
First post2015-11-23 12:00 +0100
Last post2015-11-24 10:40 +0100
Articles 3 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] x86: correct saving and restoring of lapic vectors in suspend/resume Juergen Gross <jgross@suse.com> - 2015-11-23 12:00 +0100
    Re: [PATCH] x86: correct saving and restoring of lapic vectors in  suspend/resume Borislav Petkov <bp@alien8.de> - 2015-11-23 12:20 +0100
    [tip:x86/apic] x86/apic:   Fix the saving and restoring of lapic vectors during suspend/resume tip-bot for Juergen Gross <tipbot@zytor.com> - 2015-11-24 10:40 +0100

#1275238 — [PATCH] x86: correct saving and restoring of lapic vectors in suspend/resume

FromJuergen Gross <jgross@suse.com>
Date2015-11-23 12:00 +0100
Subject[PATCH] x86: correct saving and restoring of lapic vectors in suspend/resume
Message-ID<qxX0J-Ev-3@gated-at.bofh.it>
Saving and restoring lapic vectors in lapic_suspend() and
lapic_resume() is not consistent: the thmr vector saving is guarded
by a different config option than the restore part. The cmci vector
isn't handled at all.

Those inconsistencies are not very critical, as the missing cmci
vector will be set via mce resume handling, the wrong config option
used for restoring the thmr vector can't be configured differently
than the one which should be used.

Nevertheless correct the thmr vector restore and add cmci vector
handling.

Signed-off-by: Juergen Gross <jgross@suse.com>
---
 arch/x86/kernel/apic/apic.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c
index 2f69e3b..bc06c9d 100644
--- a/arch/x86/kernel/apic/apic.c
+++ b/arch/x86/kernel/apic/apic.c
@@ -2270,6 +2270,7 @@ static struct {
 	unsigned int apic_tmict;
 	unsigned int apic_tdcr;
 	unsigned int apic_thmr;
+	unsigned int apic_cmci;
 } apic_pm_state;
 
 static int lapic_suspend(void)
@@ -2299,6 +2300,10 @@ static int lapic_suspend(void)
 	if (maxlvt >= 5)
 		apic_pm_state.apic_thmr = apic_read(APIC_LVTTHMR);
 #endif
+#ifdef CONFIG_X86_MCE_INTEL
+	if (maxlvt >= 6)
+		apic_pm_state.apic_cmci = apic_read(APIC_LVTCMCI);
+#endif
 
 	local_irq_save(flags);
 	disable_local_APIC();
@@ -2355,10 +2360,14 @@ static void lapic_resume(void)
 	apic_write(APIC_SPIV, apic_pm_state.apic_spiv);
 	apic_write(APIC_LVT0, apic_pm_state.apic_lvt0);
 	apic_write(APIC_LVT1, apic_pm_state.apic_lvt1);
-#if defined(CONFIG_X86_MCE_INTEL)
+#if defined(CONFIG_X86_THERMAL_VECTOR)
 	if (maxlvt >= 5)
 		apic_write(APIC_LVTTHMR, apic_pm_state.apic_thmr);
 #endif
+#if defined(CONFIG_X86_MCE_INTEL)
+	if (maxlvt >= 6)
+		apic_write(APIC_LVTCMCI, apic_pm_state.apic_cmci);
+#endif
 	if (maxlvt >= 4)
 		apic_write(APIC_LVTPC, apic_pm_state.apic_lvtpc);
 	apic_write(APIC_LVTT, apic_pm_state.apic_lvtt);
-- 
2.6.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1275244 — Re: [PATCH] x86: correct saving and restoring of lapic vectors in suspend/resume

FromBorislav Petkov <bp@alien8.de>
Date2015-11-23 12:20 +0100
SubjectRe: [PATCH] x86: correct saving and restoring of lapic vectors in suspend/resume
Message-ID<qxXk5-123-11@gated-at.bofh.it>
In reply to#1275238
On Mon, Nov 23, 2015 at 11:59:24AM +0100, Juergen Gross wrote:
> Saving and restoring lapic vectors in lapic_suspend() and
> lapic_resume() is not consistent: the thmr vector saving is guarded
> by a different config option than the restore part. The cmci vector
> isn't handled at all.
> 
> Those inconsistencies are not very critical, as the missing cmci
> vector will be set via mce resume handling, the wrong config option
> used for restoring the thmr vector can't be configured differently
> than the one which should be used.
> 
> Nevertheless correct the thmr vector restore and add cmci vector
> handling.
> 
> Signed-off-by: Juergen Gross <jgross@suse.com>
> ---
>  arch/x86/kernel/apic/apic.c | 11 ++++++++++-
>  1 file changed, 10 insertions(+), 1 deletion(-)

Acked-by: Borislav Petkov <bp@suse.de>

Add Tony to CC and leave in the rest for him to look at:

> diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c
> index 2f69e3b..bc06c9d 100644
> --- a/arch/x86/kernel/apic/apic.c
> +++ b/arch/x86/kernel/apic/apic.c
> @@ -2270,6 +2270,7 @@ static struct {
>  	unsigned int apic_tmict;
>  	unsigned int apic_tdcr;
>  	unsigned int apic_thmr;
> +	unsigned int apic_cmci;
>  } apic_pm_state;
>  
>  static int lapic_suspend(void)
> @@ -2299,6 +2300,10 @@ static int lapic_suspend(void)
>  	if (maxlvt >= 5)
>  		apic_pm_state.apic_thmr = apic_read(APIC_LVTTHMR);
>  #endif
> +#ifdef CONFIG_X86_MCE_INTEL
> +	if (maxlvt >= 6)
> +		apic_pm_state.apic_cmci = apic_read(APIC_LVTCMCI);
> +#endif
>  
>  	local_irq_save(flags);
>  	disable_local_APIC();
> @@ -2355,10 +2360,14 @@ static void lapic_resume(void)
>  	apic_write(APIC_SPIV, apic_pm_state.apic_spiv);
>  	apic_write(APIC_LVT0, apic_pm_state.apic_lvt0);
>  	apic_write(APIC_LVT1, apic_pm_state.apic_lvt1);
> -#if defined(CONFIG_X86_MCE_INTEL)
> +#if defined(CONFIG_X86_THERMAL_VECTOR)
>  	if (maxlvt >= 5)
>  		apic_write(APIC_LVTTHMR, apic_pm_state.apic_thmr);
>  #endif
> +#if defined(CONFIG_X86_MCE_INTEL)
> +	if (maxlvt >= 6)
> +		apic_write(APIC_LVTCMCI, apic_pm_state.apic_cmci);
> +#endif
>  	if (maxlvt >= 4)
>  		apic_write(APIC_LVTPC, apic_pm_state.apic_lvtpc);
>  	apic_write(APIC_LVTT, apic_pm_state.apic_lvtt);
> -- 
> 2.6.2
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
> 

-- 
Regards/Gruss,
    Boris.

ECO tip #101: Trim your mails when you reply.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1276217 — [tip:x86/apic] x86/apic: Fix the saving and restoring of lapic vectors during suspend/resume

Fromtip-bot for Juergen Gross <tipbot@zytor.com>
Date2015-11-24 10:40 +0100
Subject[tip:x86/apic] x86/apic: Fix the saving and restoring of lapic vectors during suspend/resume
Message-ID<qyieU-6jd-77@gated-at.bofh.it>
In reply to#1275238
Commit-ID:  42baa2581c92f8d07e7260506c8d41caf14b0fc3
Gitweb:     http://git.kernel.org/tip/42baa2581c92f8d07e7260506c8d41caf14b0fc3
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Mon, 23 Nov 2015 11:59:24 +0100
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Tue, 24 Nov 2015 09:18:33 +0100

x86/apic: Fix the saving and restoring of lapic vectors during suspend/resume

Saving and restoring lapic vectors in lapic_suspend() and
lapic_resume() is not consistent: the thmr vector saving is
guarded by a different config option than the restore part. The
cmci vector isn't handled at all.

Those inconsistencies are not very critical, as the missing cmci
vector will be set via mce resume handling, the wrong config
option used for restoring the thmr vector can't be configured
differently than the one which should be used.

Nevertheless correct the thmr vector restore and add cmci vector
handling.

Signed-off-by: Juergen Gross <jgross@suse.com>
Acked-by: Borislav Petkov <bp@suse.de>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/1448276364-31334-1-git-send-email-jgross@suse.com
[ Minor code edits. ]
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 arch/x86/kernel/apic/apic.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c
index 2f69e3b..8d7df74 100644
--- a/arch/x86/kernel/apic/apic.c
+++ b/arch/x86/kernel/apic/apic.c
@@ -2270,6 +2270,7 @@ static struct {
 	unsigned int apic_tmict;
 	unsigned int apic_tdcr;
 	unsigned int apic_thmr;
+	unsigned int apic_cmci;
 } apic_pm_state;
 
 static int lapic_suspend(void)
@@ -2299,6 +2300,10 @@ static int lapic_suspend(void)
 	if (maxlvt >= 5)
 		apic_pm_state.apic_thmr = apic_read(APIC_LVTTHMR);
 #endif
+#ifdef CONFIG_X86_MCE_INTEL
+	if (maxlvt >= 6)
+		apic_pm_state.apic_cmci = apic_read(APIC_LVTCMCI);
+#endif
 
 	local_irq_save(flags);
 	disable_local_APIC();
@@ -2355,10 +2360,14 @@ static void lapic_resume(void)
 	apic_write(APIC_SPIV, apic_pm_state.apic_spiv);
 	apic_write(APIC_LVT0, apic_pm_state.apic_lvt0);
 	apic_write(APIC_LVT1, apic_pm_state.apic_lvt1);
-#if defined(CONFIG_X86_MCE_INTEL)
+#ifdef CONFIG_X86_THERMAL_VECTOR
 	if (maxlvt >= 5)
 		apic_write(APIC_LVTTHMR, apic_pm_state.apic_thmr);
 #endif
+#ifdef CONFIG_X86_MCE_INTEL
+	if (maxlvt >= 6)
+		apic_write(APIC_LVTCMCI, apic_pm_state.apic_cmci);
+#endif
 	if (maxlvt >= 4)
 		apic_write(APIC_LVTPC, apic_pm_state.apic_lvtpc);
 	apic_write(APIC_LVTT, apic_pm_state.apic_lvtt);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web