[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] x86 ucode: microcode logic update
# HG changeset patch # User Keir Fraser <keir.fraser@xxxxxxxxxx> # Date 1232622670 0 # Node ID a1d0868ffadf171ce9f4c61f4dc57f4d4abe4e4c # Parent 97228980cd0425130eceb958b02f5fcaa8511860 x86 ucode: microcode logic update Update microcode logic: 1. separate microcode_fini_cpu() into 2 level to avoid deadlock (when fail at microcode_update_cpu); 2. cancel redundant collect_cpu_info at microcode.c level, use relative function at microcode driver level; 3. separate microcode_resume_cpu from microcode_update_cpu, because it's redundant (should only be called when S3 wakeup) and will block newer microcode update when user update newer microcode.dat from user level Signed-off-by: Liu, Jinsong <jinsong.liu@xxxxxxxxx> --- xen/arch/x86/microcode.c | 37 ++++++++++++++----------------------- xen/arch/x86/microcode_intel.c | 2 ++ 2 files changed, 16 insertions(+), 23 deletions(-) diff -r 97228980cd04 -r a1d0868ffadf xen/arch/x86/microcode.c --- a/xen/arch/x86/microcode.c Thu Jan 22 11:10:04 2009 +0000 +++ b/xen/arch/x86/microcode.c Thu Jan 22 11:11:10 2009 +0000 @@ -49,25 +49,22 @@ struct microcode_info { char buffer[1]; }; -static void microcode_fini_cpu(int cpu) +static void __microcode_fini_cpu(int cpu) { struct ucode_cpu_info *uci = ucode_cpu_info + cpu; + xfree(uci->mc.mc_valid); + memset(uci, 0, sizeof(*uci)); +} + +static void microcode_fini_cpu(int cpu) +{ spin_lock(µcode_mutex); - xfree(uci->mc.mc_valid); - uci->mc.mc_valid = NULL; + __microcode_fini_cpu(cpu); spin_unlock(µcode_mutex); } -static int collect_cpu_info(int cpu) -{ - struct ucode_cpu_info *uci = ucode_cpu_info + cpu; - - memset(uci, 0, sizeof(*uci)); - return microcode_ops->collect_cpu_info(cpu, &uci->cpu_sig); -} - -static int microcode_resume_cpu(int cpu) +int microcode_resume_cpu(int cpu) { int err = 0; struct ucode_cpu_info *uci = ucode_cpu_info + cpu; @@ -107,17 +104,11 @@ static int microcode_update_cpu(const vo spin_lock(µcode_mutex); - /* - * Check if the system resume is in progress (uci->mc.mc_valid != NULL), - * otherwise just request a firmware: - */ - if ( uci->mc.mc_valid ) { - err = microcode_resume_cpu(cpu); - } else { - err = collect_cpu_info(cpu); - if ( !err ) - err = microcode_ops->cpu_request_microcode(cpu, buf, size); - } + err = microcode_ops->collect_cpu_info(cpu, &uci->cpu_sig); + if ( likely(!err) ) + err = microcode_ops->cpu_request_microcode(cpu, buf, size); + else + __microcode_fini_cpu(cpu); spin_unlock(µcode_mutex); diff -r 97228980cd04 -r a1d0868ffadf xen/arch/x86/microcode_intel.c --- a/xen/arch/x86/microcode_intel.c Thu Jan 22 11:10:04 2009 +0000 +++ b/xen/arch/x86/microcode_intel.c Thu Jan 22 11:11:10 2009 +0000 @@ -63,6 +63,8 @@ static int collect_cpu_info(int cpu_num, { struct cpuinfo_x86 *c = &cpu_data[cpu_num]; unsigned int val[2]; + + BUG_ON(cpu_num != smp_processor_id()); memset(csig, 0, sizeof(*csig)); _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |