mce, amd: code rework and cleanups
cover mce, amd: code rework and cleanups
This patch set reworks code for the initial setup of MCE threshold block registers. It adds helper functions to make functions smaller and better to read. Finally some changes to error messages.
-Robert
PATCH 1/5 mce, amd: Implement mce_threshold_block_init() helper function
This patch adds a helper function for the initial setup of an mce threshold block. The LVT offset is passed as argument. Also making variable threshold_defaults local as it is only used in function mce_amd_feature_init(). Function threshold_restart_bank() is extended to setup the LVT offset, the change is backward compatible. Thus, now there is only a single wrmsrl() to setup the block.
--- arch/x86/kernel/cpu/mcheck/mce_amd.c | 48 ++++++++++++++++++++------------- 1 files changed, 29 insertions(+), 19 deletions(-)
arch/x86/kernel/cpu/mcheck/mce_amd.c +29 -19
@@ -59,12 +59,6 @@ struct threshold_block {struct list_head miscj; }; -/* defaults used early on boot */ -static struct threshold_block threshold_defaults = { - .interrupt_enable =0 , - .threshold_limit =THRESHOLD_MAX , -}; -struct threshold_bank {struct kobject *kobj;struct threshold_block *blocks;
@@ -89,6 +83,8 @@ static void amd_threshold_interrupt(void);struct thresh_restart {struct threshold_block *b;int reset; +int set_lvt_off; +int lvt_off;u16 old_limit; };
@@ -116,6 +112,12 @@ static void threshold_restart_bank(void *_tr) (new_count &THRESHOLD_MAX ); } +if (tr->set_lvt_off) { +/* set new lvt offset */ + mci_misc_hi &= ~MASK_LVTOFF_HI ; + mci_misc_hi |= tr->lvt_off <<20 ; + } + tr->b->interrupt_enable ? (mci_misc_hi = (mci_misc_hi & ~MASK_INT_TYPE_HI ) |INT_TYPE_APIC ) : (mci_misc_hi &= ~MASK_INT_TYPE_HI );
@@ -124,13 +126,25 @@ static void threshold_restart_bank(void *_tr)wrmsr (tr->b->address, mci_misc_lo, mci_misc_hi); } +static void mce_threshold_block_init (struct threshold_block *b,int offset) +{ +struct thresh_restart tr = { + .b = b, + .set_lvt_off =1 , + .lvt_off = offset, + }; + + b->threshold_limit =THRESHOLD_MAX ; +threshold_restart_bank (&tr); +}; +/* cpu init entry point, called from mce.c with preempt off */ void mce_amd_feature_init (struct cpuinfo_x86 *c) { +struct threshold_block b;unsigned int cpu =smp_processor_id ();u32 low =0 , high =0 , address =0 ;unsigned int bank, block; -struct thresh_restart tr;int lvt_off =-1 ;u8 offset;
@@ -186,16 +200,13 @@ void mce_amd_feature_init(struct cpuinfo_x86 *c)continue ; } - high &= ~MASK_LVTOFF_HI ; - high |= lvt_off <<20 ; -wrmsr (address, low, high); - - threshold_defaults.address = address; - tr.b = &threshold_defaults; - tr.reset =0 ; - tr.old_limit =0 ; -threshold_restart_bank (&tr); +memset (&b,0 ,sizeof (b)); + b.cpu = cpu; + b.bank = bank; + b.block = block; + b.address = address; +mce_threshold_block_init (&b, offset); mce_threshold_vector = amd_threshold_interrupt; } }
@@ -298,9 +309,8 @@ store_interrupt_enable(struct threshold_block *b, const char *buf, size_t size) b->interrupt_enable = !!new; +memset (&tr,0 ,sizeof (tr)); tr.b = b; - tr.reset =0 ; - tr.old_limit =0 ;smp_call_function_single (b->cpu, threshold_restart_bank, &tr,1 );
@@ -321,10 +331,10 @@ store_threshold_limit(struct threshold_block *b, const char *buf, size_t size)if (new <1 ) new =1 ; +memset (&tr,0 ,sizeof (tr)); tr.old_limit = b->threshold_limit; b->threshold_limit = new; tr.b = b; - tr.reset =0 ;smp_call_function_single (b->cpu, threshold_restart_bank, &tr,1 );
Signature · 1 line
1.7.3.1
[tip:x86/mce] mce, amd: Implement mce_threshold_block_init() helper function
Commit-ID: 9c37c9d89773ee9da9f6af28ee37d931bd045711 Gitweb: http://git.kernel.org/tip/9c37c9d89773ee9da9f6af28ee37d931bd045711 Author: Robert Richter <[email protected]> AuthorDate: Mon, 25 Oct 2010 16:03:35 +0200 Committer: Ingo Molnar <[email protected]> CommitDate: Mon, 25 Oct 2010 18:59:42 +0200
mce, amd: Implement mce_threshold_block_init() helper function
This patch adds a helper function for the initial setup of an mce threshold block. The LVT offset is passed as argument. Also making variable threshold_defaults local as it is only used in function mce_amd_feature_init(). Function threshold_restart_bank() is extended to setup the LVT offset, the change is backward compatible. Thus, now there is only a single wrmsrl() to setup the block.
LKML-Reference: <[email protected]>
--- arch/x86/kernel/cpu/mcheck/mce_amd.c | 48 ++++++++++++++++++++------------- 1 files changed, 29 insertions(+), 19 deletions(-)
arch/x86/kernel/cpu/mcheck/mce_amd.c +29 -19
@@ -59,12 +59,6 @@ struct threshold_block {struct list_head miscj; }; -/* defaults used early on boot */ -static struct threshold_block threshold_defaults = { - .interrupt_enable =0 , - .threshold_limit =THRESHOLD_MAX , -}; -struct threshold_bank {struct kobject *kobj;struct threshold_block *blocks;
@@ -89,6 +83,8 @@ static void amd_threshold_interrupt(void);struct thresh_restart {struct threshold_block *b;int reset; +int set_lvt_off; +int lvt_off;u16 old_limit; };
@@ -116,6 +112,12 @@ static void threshold_restart_bank(void *_tr) (new_count &THRESHOLD_MAX ); } +if (tr->set_lvt_off) { +/* set new lvt offset */ + mci_misc_hi &= ~MASK_LVTOFF_HI ; + mci_misc_hi |= tr->lvt_off <<20 ; + } + tr->b->interrupt_enable ? (mci_misc_hi = (mci_misc_hi & ~MASK_INT_TYPE_HI ) |INT_TYPE_APIC ) : (mci_misc_hi &= ~MASK_INT_TYPE_HI );
@@ -124,13 +126,25 @@ static void threshold_restart_bank(void *_tr)wrmsr (tr->b->address, mci_misc_lo, mci_misc_hi); } +static void mce_threshold_block_init (struct threshold_block *b,int offset) +{ +struct thresh_restart tr = { + .b = b, + .set_lvt_off =1 , + .lvt_off = offset, + }; + + b->threshold_limit =THRESHOLD_MAX ; +threshold_restart_bank (&tr); +}; +/* cpu init entry point, called from mce.c with preempt off */ void mce_amd_feature_init (struct cpuinfo_x86 *c) { +struct threshold_block b;unsigned int cpu =smp_processor_id ();u32 low =0 , high =0 , address =0 ;unsigned int bank, block; -struct thresh_restart tr;int lvt_off =-1 ;u8 offset;
@@ -186,16 +200,13 @@ void mce_amd_feature_init(struct cpuinfo_x86 *c)continue ; } - high &= ~MASK_LVTOFF_HI ; - high |= lvt_off <<20 ; -wrmsr (address, low, high); - - threshold_defaults.address = address; - tr.b = &threshold_defaults; - tr.reset =0 ; - tr.old_limit =0 ; -threshold_restart_bank (&tr); +memset (&b,0 ,sizeof (b)); + b.cpu = cpu; + b.bank = bank; + b.block = block; + b.address = address; +mce_threshold_block_init (&b, offset); mce_threshold_vector = amd_threshold_interrupt; } }
@@ -298,9 +309,8 @@ store_interrupt_enable(struct threshold_block *b, const char *buf, size_t size) b->interrupt_enable = !!new; +memset (&tr,0 ,sizeof (tr)); tr.b = b; - tr.reset =0 ; - tr.old_limit =0 ;smp_call_function_single (b->cpu, threshold_restart_bank, &tr,1 );
@@ -321,10 +331,10 @@ store_threshold_limit(struct threshold_block *b, const char *buf, size_t size)if (new <1 ) new =1 ; +memset (&tr,0 ,sizeof (tr)); tr.old_limit = b->threshold_limit; b->threshold_limit = new; tr.b = b; - tr.reset =0 ;smp_call_function_single (b->cpu, threshold_restart_bank, &tr,1 );
PATCH 2/5 mce, amd: Shorten local variables mci_misc_{hi,lo}
In reply to Robert RichterShorten this variables to make later changes more readable.
--- arch/x86/kernel/cpu/mcheck/mce_amd.c | 26 +++++++++++++------------- 1 files changed, 13 insertions(+), 13 deletions(-)
arch/x86/kernel/cpu/mcheck/mce_amd.c +13 -13
@@ -93,37 +93,37 @@ struct thresh_restart {static void threshold_restart_bank (void *_tr) {struct thresh_restart *tr = _tr; -u32 mci_misc_hi, mci_misc_lo; +u32 hi, lo; -rdmsr (tr->b->address, mci_misc_lo, mci_misc_hi); +rdmsr (tr->b->address, lo, hi); -if (tr->b->threshold_limit < (mci_misc_hi &THRESHOLD_MAX )) +if (tr->b->threshold_limit < (hi &THRESHOLD_MAX )) tr->reset =1 ;/* limit cannot be lower than err count */ if (tr->reset) {/* reset err count and overflow bit */ - mci_misc_hi = - (mci_misc_hi & ~(MASK_ERR_COUNT_HI |MASK_OVERFLOW_HI )) | + hi = + (hi & ~(MASK_ERR_COUNT_HI |MASK_OVERFLOW_HI )) | (THRESHOLD_MAX - tr->b->threshold_limit); }else if (tr->old_limit) {/* change limit w/o reset */ -int new_count = (mci_misc_hi &THRESHOLD_MAX ) + +int new_count = (hi &THRESHOLD_MAX ) + (tr->old_limit - tr->b->threshold_limit); - mci_misc_hi = (mci_misc_hi & ~MASK_ERR_COUNT_HI ) | + hi = (hi & ~MASK_ERR_COUNT_HI ) | (new_count &THRESHOLD_MAX ); }if (tr->set_lvt_off) {/* set new lvt offset */ - mci_misc_hi &= ~MASK_LVTOFF_HI ; - mci_misc_hi |= tr->lvt_off <<20 ; + hi &= ~MASK_LVTOFF_HI ; + hi |= tr->lvt_off <<20 ; } tr->b->interrupt_enable ? - (mci_misc_hi = (mci_misc_hi & ~MASK_INT_TYPE_HI ) |INT_TYPE_APIC ) : - (mci_misc_hi &= ~MASK_INT_TYPE_HI ); + (hi = (hi & ~MASK_INT_TYPE_HI ) |INT_TYPE_APIC ) : + (hi &= ~MASK_INT_TYPE_HI ); - mci_misc_hi |=MASK_COUNT_EN_HI ; -wrmsr (tr->b->address, mci_misc_lo, mci_misc_hi); + hi |=MASK_COUNT_EN_HI ; +wrmsr (tr->b->address, lo, hi); }static void mce_threshold_block_init (struct threshold_block *b,int offset)
Signature · 1 line
1.7.3.1
[tip:x86/mce] mce, amd: Shorten local variables mci_misc_{hi,lo}
Commit-ID: 7203a0494084541575bac6dfc4e153f9e28869b8 Gitweb: http://git.kernel.org/tip/7203a0494084541575bac6dfc4e153f9e28869b8 Author: Robert Richter <[email protected]> AuthorDate: Mon, 25 Oct 2010 16:03:36 +0200 Committer: Ingo Molnar <[email protected]> CommitDate: Mon, 25 Oct 2010 18:59:42 +0200
mce, amd: Shorten local variables mci_misc_{hi,lo}
Shorten this variables to make later changes more readable.
LKML-Reference: <[email protected]>
--- arch/x86/kernel/cpu/mcheck/mce_amd.c | 26 +++++++++++++------------- 1 files changed, 13 insertions(+), 13 deletions(-)
arch/x86/kernel/cpu/mcheck/mce_amd.c +13 -13
@@ -93,37 +93,37 @@ struct thresh_restart {static void threshold_restart_bank (void *_tr) {struct thresh_restart *tr = _tr; -u32 mci_misc_hi, mci_misc_lo; +u32 hi, lo; -rdmsr (tr->b->address, mci_misc_lo, mci_misc_hi); +rdmsr (tr->b->address, lo, hi); -if (tr->b->threshold_limit < (mci_misc_hi &THRESHOLD_MAX )) +if (tr->b->threshold_limit < (hi &THRESHOLD_MAX )) tr->reset =1 ;/* limit cannot be lower than err count */ if (tr->reset) {/* reset err count and overflow bit */ - mci_misc_hi = - (mci_misc_hi & ~(MASK_ERR_COUNT_HI |MASK_OVERFLOW_HI )) | + hi = + (hi & ~(MASK_ERR_COUNT_HI |MASK_OVERFLOW_HI )) | (THRESHOLD_MAX - tr->b->threshold_limit); }else if (tr->old_limit) {/* change limit w/o reset */ -int new_count = (mci_misc_hi &THRESHOLD_MAX ) + +int new_count = (hi &THRESHOLD_MAX ) + (tr->old_limit - tr->b->threshold_limit); - mci_misc_hi = (mci_misc_hi & ~MASK_ERR_COUNT_HI ) | + hi = (hi & ~MASK_ERR_COUNT_HI ) | (new_count &THRESHOLD_MAX ); }if (tr->set_lvt_off) {/* set new lvt offset */ - mci_misc_hi &= ~MASK_LVTOFF_HI ; - mci_misc_hi |= tr->lvt_off <<20 ; + hi &= ~MASK_LVTOFF_HI ; + hi |= tr->lvt_off <<20 ; } tr->b->interrupt_enable ? - (mci_misc_hi = (mci_misc_hi & ~MASK_INT_TYPE_HI ) |INT_TYPE_APIC ) : - (mci_misc_hi &= ~MASK_INT_TYPE_HI ); + (hi = (hi & ~MASK_INT_TYPE_HI ) |INT_TYPE_APIC ) : + (hi &= ~MASK_INT_TYPE_HI ); - mci_misc_hi |=MASK_COUNT_EN_HI ; -wrmsr (tr->b->address, mci_misc_lo, mci_misc_hi); + hi |=MASK_COUNT_EN_HI ; +wrmsr (tr->b->address, lo, hi); }static void mce_threshold_block_init (struct threshold_block *b,int offset)
PATCH 3/5 mce, amd: Add helper functions to setup APIC
In reply to Robert RichterThis patch reworks and cleans up mce_amd_feature_init() by introducing helper functions to setup and check the LVT offset. It also fixes line endings in pr_err() calls.
--- arch/x86/kernel/cpu/mcheck/mce_amd.c | 67 +++++++++++++++++++--------------- 1 files changed, 38 insertions(+), 29 deletions(-)
arch/x86/kernel/cpu/mcheck/mce_amd.c +38 -29
@@ -31,8 +31,6 @@#include <asm/mce.h> #include <asm/msr.h> -#define PFX "mce_threshold: " -#define VERSION "version 1.1.1"#define NR_BANKS 6#define NR_BLOCKS 9#define THRESHOLD_MAX 0xFFF
@@ -88,6 +86,27 @@ struct thresh_restart {u16 old_limit; }; +static int lvt_off_valid (struct threshold_block *b,int apic,u32 lo,u32 hi) +{ +int msr = (hi &MASK_LVTOFF_HI ) >>20 ; + +if (apic <0 ) { +pr_err (FW_BUG "cpu %d, failed to setup threshold interrupt " +"for bank %d, block %d (MSR%08X=0x%x%08x)\n" , b->cpu, + b->bank, b->block, b->address, hi, lo); +return 0 ; + } + +if (apic != msr) { +pr_err (FW_BUG "cpu %d, invalid threshold interrupt offset %d " +"for bank %d, block %d (MSR%08X=0x%x%08x)\n" , + b->cpu, apic, b->bank, b->block, b->address, hi, lo); +return 0 ; + } + +return 1 ; +}; +/* must be called with correct cpu affinity */ /* Called via smp_call_function_single() */ static void threshold_restart_bank (void *_tr)
@@ -113,9 +132,11 @@ static void threshold_restart_bank(void *_tr) }if (tr->set_lvt_off) { -/* set new lvt offset */ - hi &= ~MASK_LVTOFF_HI ; - hi |= tr->lvt_off <<20 ; +if (lvt_off_valid (tr->b, tr->lvt_off, lo, hi)) { +/* set new lvt offset */ + hi &= ~MASK_LVTOFF_HI ; + hi |= tr->lvt_off <<20 ; + } } tr->b->interrupt_enable ?
@@ -138,6 +159,15 @@ static void mce_threshold_block_init(struct threshold_block *b, int offset)threshold_restart_bank (&tr); }; +static int setup_APIC_mce (int reserved,int new) +{ +if (reserved <0 && !setup_APIC_eilvt (new,THRESHOLD_APIC_VECTOR , +APIC_EILVT_MSG_FIX ,0 )) +return new; + +return reserved; +} +/* cpu init entry point, called from mce.c with preempt off */ void mce_amd_feature_init (struct cpuinfo_x86 *c) {
@@ -145,8 +175,7 @@ void mce_amd_feature_init(struct cpuinfo_x86 *c)unsigned int cpu =smp_processor_id ();u32 low =0 , high =0 , address =0 ;unsigned int bank, block; -int lvt_off =-1 ; -u8 offset; +int offset =-1 ;for (bank =0 ; bank <NR_BANKS ; ++bank) {for (block =0 ; block <NR_BLOCKS ; ++block) {
@@ -177,28 +206,8 @@ void mce_amd_feature_init(struct cpuinfo_x86 *c)if (shared_bank[bank] && c->cpu_core_id)break ;#endif - offset = (high &MASK_LVTOFF_HI ) >>20 ; -if (lvt_off <0 ) { -if (setup_APIC_eilvt (offset, -THRESHOLD_APIC_VECTOR , -APIC_EILVT_MSG_FIX ,0 )) { -pr_err (FW_BUG "cpu %d, failed to " -"setup threshold interrupt " -"for bank %d, block %d " -"(MSR%08X=0x%x%08x)" , -smp_processor_id (), bank, block, - address, high, low); -continue ; - } - lvt_off = offset; - }else if (lvt_off != offset) { -pr_err (FW_BUG "cpu %d, invalid threshold " -"interrupt offset %d for bank %d," -"block %d (MSR%08X=0x%x%08x)" , -smp_processor_id (), lvt_off, bank, - block, address, high, low); -continue ; - } + offset =setup_APIC_mce (offset, + (high &MASK_LVTOFF_HI ) >>20 );memset (&b,0 ,sizeof (b)); b.cpu = cpu;
Signature · 1 line
1.7.3.1
[tip:x86/mce] mce, amd: Add helper functions to setup APIC
Commit-ID: bbaff08dca3c34d0fb6b4c4051354184e33e3df8 Gitweb: http://git.kernel.org/tip/bbaff08dca3c34d0fb6b4c4051354184e33e3df8 Author: Robert Richter <[email protected]> AuthorDate: Mon, 25 Oct 2010 16:03:37 +0200 Committer: Ingo Molnar <[email protected]> CommitDate: Mon, 25 Oct 2010 18:59:43 +0200
mce, amd: Add helper functions to setup APIC
This patch reworks and cleans up mce_amd_feature_init() by introducing helper functions to setup and check the LVT offset. It also fixes line endings in pr_err() calls.
LKML-Reference: <[email protected]>
--- arch/x86/kernel/cpu/mcheck/mce_amd.c | 67 +++++++++++++++++++--------------- 1 files changed, 38 insertions(+), 29 deletions(-)
arch/x86/kernel/cpu/mcheck/mce_amd.c +38 -29
@@ -31,8 +31,6 @@#include <asm/mce.h> #include <asm/msr.h> -#define PFX "mce_threshold: " -#define VERSION "version 1.1.1"#define NR_BANKS 6#define NR_BLOCKS 9#define THRESHOLD_MAX 0xFFF
@@ -88,6 +86,27 @@ struct thresh_restart {u16 old_limit; }; +static int lvt_off_valid (struct threshold_block *b,int apic,u32 lo,u32 hi) +{ +int msr = (hi &MASK_LVTOFF_HI ) >>20 ; + +if (apic <0 ) { +pr_err (FW_BUG "cpu %d, failed to setup threshold interrupt " +"for bank %d, block %d (MSR%08X=0x%x%08x)\n" , b->cpu, + b->bank, b->block, b->address, hi, lo); +return 0 ; + } + +if (apic != msr) { +pr_err (FW_BUG "cpu %d, invalid threshold interrupt offset %d " +"for bank %d, block %d (MSR%08X=0x%x%08x)\n" , + b->cpu, apic, b->bank, b->block, b->address, hi, lo); +return 0 ; + } + +return 1 ; +}; +/* must be called with correct cpu affinity */ /* Called via smp_call_function_single() */ static void threshold_restart_bank (void *_tr)
@@ -113,9 +132,11 @@ static void threshold_restart_bank(void *_tr) }if (tr->set_lvt_off) { -/* set new lvt offset */ - hi &= ~MASK_LVTOFF_HI ; - hi |= tr->lvt_off <<20 ; +if (lvt_off_valid (tr->b, tr->lvt_off, lo, hi)) { +/* set new lvt offset */ + hi &= ~MASK_LVTOFF_HI ; + hi |= tr->lvt_off <<20 ; + } } tr->b->interrupt_enable ?
@@ -138,6 +159,15 @@ static void mce_threshold_block_init(struct threshold_block *b, int offset)threshold_restart_bank (&tr); }; +static int setup_APIC_mce (int reserved,int new) +{ +if (reserved <0 && !setup_APIC_eilvt (new,THRESHOLD_APIC_VECTOR , +APIC_EILVT_MSG_FIX ,0 )) +return new; + +return reserved; +} +/* cpu init entry point, called from mce.c with preempt off */ void mce_amd_feature_init (struct cpuinfo_x86 *c) {
@@ -145,8 +175,7 @@ void mce_amd_feature_init(struct cpuinfo_x86 *c)unsigned int cpu =smp_processor_id ();u32 low =0 , high =0 , address =0 ;unsigned int bank, block; -int lvt_off =-1 ; -u8 offset; +int offset =-1 ;for (bank =0 ; bank <NR_BANKS ; ++bank) {for (block =0 ; block <NR_BLOCKS ; ++block) {
@@ -177,28 +206,8 @@ void mce_amd_feature_init(struct cpuinfo_x86 *c)if (shared_bank[bank] && c->cpu_core_id)break ;#endif - offset = (high &MASK_LVTOFF_HI ) >>20 ; -if (lvt_off <0 ) { -if (setup_APIC_eilvt (offset, -THRESHOLD_APIC_VECTOR , -APIC_EILVT_MSG_FIX ,0 )) { -pr_err (FW_BUG "cpu %d, failed to " -"setup threshold interrupt " -"for bank %d, block %d " -"(MSR%08X=0x%x%08x)" , -smp_processor_id (), bank, block, - address, high, low); -continue ; - } - lvt_off = offset; - }else if (lvt_off != offset) { -pr_err (FW_BUG "cpu %d, invalid threshold " -"interrupt offset %d for bank %d," -"block %d (MSR%08X=0x%x%08x)" , -smp_processor_id (), lvt_off, bank, - block, address, high, low); -continue ; - } + offset =setup_APIC_mce (offset, + (high &MASK_LVTOFF_HI ) >>20 );memset (&b,0 ,sizeof (b)); b.cpu = cpu;
PATCH 4/5 mce, amd: Remove goto in threshold_create_device()
In reply to Robert RichterRemoving the goto in threshold_create_device().
--- arch/x86/kernel/cpu/mcheck/mce_amd.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
arch/x86/kernel/cpu/mcheck/mce_amd.c +2 -2
@@ -622,9 +622,9 @@ static __cpuinit int threshold_create_device(unsigned int cpu)continue ; err =threshold_create_bank (cpu, bank);if (err) - goto out; +return err; } -out: +return err; }
Signature · 1 line
1.7.3.1
[tip:x86/mce] mce, amd: Remove goto in threshold_create_device()
Commit-ID: 0a17941e71f089b128514f7b5b486e20072ca7dc Gitweb: http://git.kernel.org/tip/0a17941e71f089b128514f7b5b486e20072ca7dc Author: Robert Richter <[email protected]> AuthorDate: Mon, 25 Oct 2010 16:03:38 +0200 Committer: Ingo Molnar <[email protected]> CommitDate: Mon, 25 Oct 2010 18:59:43 +0200
mce, amd: Remove goto in threshold_create_device()
Removing the goto in threshold_create_device().
LKML-Reference: <[email protected]>
--- arch/x86/kernel/cpu/mcheck/mce_amd.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
arch/x86/kernel/cpu/mcheck/mce_amd.c +2 -2
@@ -622,9 +622,9 @@ static __cpuinit int threshold_create_device(unsigned int cpu)continue ; err =threshold_create_bank (cpu, bank);if (err) - goto out; +return err; } -out: +return err; }
PATCH 5/5 apic, amd: Make firmware bug messages more meaningful
In reply to Robert RichterThis improves error messages in case the BIOS was setting up wrong LVT offsets.
--- arch/x86/kernel/apic/apic.c | 15 ++++++++------- arch/x86/oprofile/op_model_amd.c | 1 + 2 files changed, 9 insertions(+), 7 deletions(-)
arch/x86/kernel/apic/apic.c +8 -7
@@ -433,17 +433,18 @@ int setup_APIC_eilvt(u8 offset, u8 vector, u8 msg_type, u8 mask) reserved =reserve_eilvt_offset (offset, new);if (reserved != new) { -pr_err (FW_BUG "cpu %d, try to setup vector 0x%x, but " -"vector 0x%x was already reserved by another core, " -"APIC%lX=0x%x\n" , -smp_processor_id (), new, reserved, reg, old); +pr_err (FW_BUG "cpu %d, try to use APIC%lX (LVT offset %d) for " +"vector 0x%x, but the register is already in use for " +"vector 0x%x on another cpu\n" , +smp_processor_id (), reg, offset, new, reserved);return -EINVAL ; }if (!eilvt_entry_is_changeable (old, new)) { -pr_err (FW_BUG "cpu %d, try to setup vector 0x%x but " -"register already in use, APIC%lX=0x%x\n" , -smp_processor_id (), new, reg, old); +pr_err (FW_BUG "cpu %d, try to use APIC%lX (LVT offset %d) for " +"vector 0x%x, but the register is already in use for " +"vector 0x%x on this cpu\n" , +smp_processor_id (), reg, offset, new, old);return -EBUSY ; }
arch/x86/oprofile/op_model_amd.c +1 -0
@@ -566,6 +566,7 @@ static int force_ibs_eilvt_setup(void) ret =setup_ibs_ctl (i);if (ret)return ret; +pr_err (FW_BUG "using offset %d for IBS interrupts\n" , i);return 0 ; }
Signature · 1 line
1.7.3.1
[tip:x86/mce] apic, amd: Make firmware bug messages more meaningful
Commit-ID: eb48c9cb2053e7bb5f7f8f0371cb578a0d439450 Gitweb: http://git.kernel.org/tip/eb48c9cb2053e7bb5f7f8f0371cb578a0d439450 Author: Robert Richter <[email protected]> AuthorDate: Mon, 25 Oct 2010 16:03:39 +0200 Committer: Ingo Molnar <[email protected]> CommitDate: Mon, 25 Oct 2010 18:59:43 +0200
apic, amd: Make firmware bug messages more meaningful
This improves error messages in case the BIOS was setting up wrong LVT offsets.
LKML-Reference: <[email protected]>
--- arch/x86/kernel/apic/apic.c | 15 ++++++++------- arch/x86/oprofile/op_model_amd.c | 1 + 2 files changed, 9 insertions(+), 7 deletions(-)
arch/x86/kernel/apic/apic.c +8 -7
@@ -433,17 +433,18 @@ int setup_APIC_eilvt(u8 offset, u8 vector, u8 msg_type, u8 mask) reserved =reserve_eilvt_offset (offset, new);if (reserved != new) { -pr_err (FW_BUG "cpu %d, try to setup vector 0x%x, but " -"vector 0x%x was already reserved by another core, " -"APIC%lX=0x%x\n" , -smp_processor_id (), new, reserved, reg, old); +pr_err (FW_BUG "cpu %d, try to use APIC%lX (LVT offset %d) for " +"vector 0x%x, but the register is already in use for " +"vector 0x%x on another cpu\n" , +smp_processor_id (), reg, offset, new, reserved);return -EINVAL ; }if (!eilvt_entry_is_changeable (old, new)) { -pr_err (FW_BUG "cpu %d, try to setup vector 0x%x but " -"register already in use, APIC%lX=0x%x\n" , -smp_processor_id (), new, reg, old); +pr_err (FW_BUG "cpu %d, try to use APIC%lX (LVT offset %d) for " +"vector 0x%x, but the register is already in use for " +"vector 0x%x on this cpu\n" , +smp_processor_id (), reg, offset, new, old);return -EBUSY ; }
arch/x86/oprofile/op_model_amd.c +1 -0
@@ -566,6 +566,7 @@ static int force_ibs_eilvt_setup(void) ret =setup_ibs_ctl (i);if (ret)return ret; +pr_err (FW_BUG "using offset %d for IBS interrupts\n" , i);return 0 ; }