[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen master] x86/MCE: mctelem_init() cleanup
commit a9b87b3ccfdc7e2a6767e2ce7dcbe5c0b035acc2 Author: Jan Beulich <jbeulich@xxxxxxxx> AuthorDate: Mon Mar 10 11:12:30 2014 +0100 Commit: Jan Beulich <jbeulich@xxxxxxxx> CommitDate: Mon Mar 10 11:12:30 2014 +0100 x86/MCE: mctelem_init() cleanup The function can be __init with its caller taking care of only calling it on the BSP. And with that all its static variables can be dropped. Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx> Reviewed-by: Andrew Cooper <andrew.cooper@xxxxxxxxxx> Reviewed-by: Liu Jinsong <jinsong.liu@xxxxxxxxx> --- xen/arch/x86/cpu/mcheck/mce.c | 8 +++++--- xen/arch/x86/cpu/mcheck/mctelem.c | 21 +++++---------------- xen/arch/x86/cpu/mcheck/mctelem.h | 2 +- 3 files changed, 11 insertions(+), 20 deletions(-) diff --git a/xen/arch/x86/cpu/mcheck/mce.c b/xen/arch/x86/cpu/mcheck/mce.c index af6f0be..a81952c 100644 --- a/xen/arch/x86/cpu/mcheck/mce.c +++ b/xen/arch/x86/cpu/mcheck/mce.c @@ -775,13 +775,15 @@ void mcheck_init(struct cpuinfo_x86 *c, bool_t bsp) intpose_init(); - mctelem_init(sizeof(struct mc_info)); + if ( bsp ) + { + mctelem_init(sizeof(struct mc_info)); + register_cpu_notifier(&cpu_nfb); + } /* Turn on MCE now */ set_in_cr4(X86_CR4_MCE); - if ( bsp ) - register_cpu_notifier(&cpu_nfb); set_poll_bankmask(c); return; diff --git a/xen/arch/x86/cpu/mcheck/mctelem.c b/xen/arch/x86/cpu/mcheck/mctelem.c index ed8e8d2..b8da465 100644 --- a/xen/arch/x86/cpu/mcheck/mctelem.c +++ b/xen/arch/x86/cpu/mcheck/mctelem.c @@ -248,25 +248,14 @@ static void mctelem_processing_release(struct mctelem_ent *tep) } } -void mctelem_init(int reqdatasz) +void __init mctelem_init(unsigned int datasz) { - static int called = 0; - static int datasz = 0, realdatasz = 0; char *datarr; - int i; + unsigned int i; - BUG_ON(MC_URGENT != 0 || MC_NONURGENT != 1 || MC_NCLASSES != 2); - - /* Called from mcheck_init for all processors; initialize for the - * first call only (no race here since the boot cpu completes - * init before others start up). */ - if (++called == 1) { - realdatasz = reqdatasz; - datasz = (reqdatasz & ~0xf) + 0x10; /* 16 byte roundup */ - } else { - BUG_ON(reqdatasz != realdatasz); - return; - } + BUILD_BUG_ON(MC_URGENT != 0 || MC_NONURGENT != 1 || MC_NCLASSES != 2); + + datasz = (datasz & ~0xf) + 0x10; /* 16 byte roundup */ if ((mctctl.mctc_elems = xmalloc_array(struct mctelem_ent, MC_NENT)) == NULL || diff --git a/xen/arch/x86/cpu/mcheck/mctelem.h b/xen/arch/x86/cpu/mcheck/mctelem.h index e5514d9..4947b57 100644 --- a/xen/arch/x86/cpu/mcheck/mctelem.h +++ b/xen/arch/x86/cpu/mcheck/mctelem.h @@ -59,7 +59,7 @@ typedef enum mctelem_class { MC_NONURGENT } mctelem_class_t; -extern void mctelem_init(int); +extern void mctelem_init(unsigned int); extern mctelem_cookie_t mctelem_reserve(mctelem_class_t); extern void *mctelem_dataptr(mctelem_cookie_t); extern void mctelem_commit(mctelem_cookie_t); -- generated by git-patchbot for /home/xen/git/xen.git#master _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |