From patchwork Fri Mar 13 09:25:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 11436431 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E4B7F1392 for ; Fri, 13 Mar 2020 09:26:30 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CA893206FA for ; Fri, 13 Mar 2020 09:26:30 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CA893206FA Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1jCgZW-0002Tq-34; Fri, 13 Mar 2020 09:25:38 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1jCgZU-0002Th-Si for xen-devel@lists.xenproject.org; Fri, 13 Mar 2020 09:25:36 +0000 X-Inumbo-ID: 9860c1e2-650c-11ea-a6c1-bc764e2007e4 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 9860c1e2-650c-11ea-a6c1-bc764e2007e4; Fri, 13 Mar 2020 09:25:36 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 69017B0BE; Fri, 13 Mar 2020 09:25:35 +0000 (UTC) From: Jan Beulich To: "xen-devel@lists.xenproject.org" References: <60130f14-3fc5-e40d-fec6-2448fefa6fc4@suse.com> Message-ID: <6c4e076d-867d-a930-55d4-b41cd3658888@suse.com> Date: Fri, 13 Mar 2020 10:25:38 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 In-Reply-To: <60130f14-3fc5-e40d-fec6-2448fefa6fc4@suse.com> Content-Language: en-US Subject: [Xen-devel] [PATCH 1/4] x86/APIC: adjust types and comments in calibrate_APIC_clock() X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Andrew Cooper , Wei Liu , =?utf-8?q?Roger_Pau_Monn=C3=A9?= Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" First and foremost the comment talking about potential underflow being taken care of by using signed long type variables was true only on 32-bit, which we've not been supporting for quite some time. Drop the comment and change all involved types to unsigned. Take the opportunity and also replace bus_cycle's fixed width type. Additionally there's no point using an "arbitrary (but long enough) timeout" here. Just use the maximum possible value; Linux does so too, just as an additional data point. Signed-off-by: Jan Beulich Reviewed-by: Andrew Cooper --- a/xen/arch/x86/apic.c +++ b/xen/arch/x86/apic.c @@ -1207,21 +1207,19 @@ static void wait_tick_pvh(void) static int __init calibrate_APIC_clock(void) { unsigned long long t1, t2; - long tt1, tt2; - long result; - int i; + unsigned long tt1, tt2, result; + unsigned int i; unsigned long bus_freq; /* KAF: pointer-size avoids compile warns. */ - u32 bus_cycle; /* length of one bus cycle in pico-seconds */ - const int LOOPS = HZ/10; + unsigned int bus_cycle; /* length of one bus cycle in pico-seconds */ + const unsigned int LOOPS = HZ/10; apic_printk(APIC_VERBOSE, "calibrating APIC timer ...\n"); /* - * Put whatever arbitrary (but long enough) timeout - * value into the APIC clock, we just want to get the - * counter running for calibration. + * Setup the APIC counter to maximum. There is no way the lapic + * can underflow in the 100ms detection time frame. */ - __setup_APIC_LVTT(1000000000); + __setup_APIC_LVTT(0xffffffff); if ( !xen_guest ) /* @@ -1251,14 +1249,6 @@ static int __init calibrate_APIC_clock(v tt2 = apic_read(APIC_TMCCT); t2 = rdtsc_ordered(); - /* - * The APIC bus clock counter is 32 bits only, it - * might have overflown, but note that we use signed - * longs, thus no extra care needed. - * - * underflown to be exact, as the timer counts down ;) - */ - result = (tt1-tt2)*APIC_DIVISOR/LOOPS; apic_printk(APIC_VERBOSE, "..... CPU clock speed is %ld.%04ld MHz.\n", From patchwork Fri Mar 13 09:25:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 11436433 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4DD2E921 for ; Fri, 13 Mar 2020 09:26:44 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 31433206FA for ; Fri, 13 Mar 2020 09:26:44 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 31433206FA Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1jCgZm-0002W1-CC; Fri, 13 Mar 2020 09:25:54 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1jCgZl-0002Vm-E3 for xen-devel@lists.xenproject.org; Fri, 13 Mar 2020 09:25:53 +0000 X-Inumbo-ID: a243c916-650c-11ea-a6c1-bc764e2007e4 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id a243c916-650c-11ea-a6c1-bc764e2007e4; Fri, 13 Mar 2020 09:25:52 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 34A50B0BA; Fri, 13 Mar 2020 09:25:52 +0000 (UTC) From: Jan Beulich To: "xen-devel@lists.xenproject.org" References: <60130f14-3fc5-e40d-fec6-2448fefa6fc4@suse.com> Message-ID: <9460a5f8-5b6e-bba9-79fc-dae54cc6b348@suse.com> Date: Fri, 13 Mar 2020 10:25:55 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 In-Reply-To: <60130f14-3fc5-e40d-fec6-2448fefa6fc4@suse.com> Content-Language: en-US Subject: [Xen-devel] [PATCH 2/4] x86/time: reduce rounding errors in calculations X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Andrew Cooper , Wei Liu , =?utf-8?q?Roger_Pau_Monn=C3=A9?= Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" Plain (unsigned) integer division simply truncates the results. The overall errors are smaller though if we use proper rounding. (Extend this to the purely cosmetic aspect of time.c's freq_string(), which before this change I've frequently observed to report e.g. NN.999MHz HPET clock speeds.) Signed-off-by: Jan Beulich --- We could switch at least the first div/rem pair in calibrate_APIC_clock() to use do_div(), but this would imply switching bus_freq (and then also result) to unsigned int (as the divisor has to be 32-bit). While I think there's pretty little risk for bus frequencies to go beyond 4GHz in the next so many years, I still wasn't certain enough this would be a welcome change. --- a/xen/arch/x86/apic.c +++ b/xen/arch/x86/apic.c @@ -1261,7 +1261,9 @@ static int __init calibrate_APIC_clock(v /* set up multipliers for accurate timer code */ bus_freq = result*HZ; bus_cycle = (u32) (1000000000000LL/bus_freq); /* in pico seconds */ + bus_cycle += (1000000000000UL % bus_freq) * 2 > bus_freq; bus_scale = (1000*262144)/bus_cycle; + bus_scale += ((1000 * 262144) % bus_cycle) * 2 > bus_cycle; apic_printk(APIC_VERBOSE, "..... bus_scale = %#x\n", bus_scale); /* reset APIC to zero timeout value */ --- a/xen/arch/x86/hpet.c +++ b/xen/arch/x86/hpet.c @@ -799,9 +799,9 @@ u64 __init hpet_setup(void) hpet_resume(hpet_boot_cfg); hpet_rate = 1000000000000000ULL; /* 10^15 */ - (void)do_div(hpet_rate, hpet_period); + last = do_div(hpet_rate, hpet_period); - return hpet_rate; + return hpet_rate + (last * 2 > hpet_period); } void hpet_resume(u32 *boot_cfg) --- a/xen/arch/x86/time.c +++ b/xen/arch/x86/time.c @@ -275,7 +275,10 @@ static char *freq_string(u64 freq) { static char s[20]; unsigned int x, y; - y = (unsigned int)do_div(freq, 1000000) / 1000; + + if ( do_div(freq, 1000) > 500 ) + ++freq; + y = (unsigned int)do_div(freq, 1000); x = (unsigned int)freq; snprintf(s, sizeof(s), "%u.%03uMHz", x, y); return s; From patchwork Fri Mar 13 09:26:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 11436435 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8D5041392 for ; Fri, 13 Mar 2020 09:27:11 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 73E46206FA for ; Fri, 13 Mar 2020 09:27:11 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 73E46206FA Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1jCgaC-0002dz-C8; Fri, 13 Mar 2020 09:26:20 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1jCgaA-0002dJ-LM for xen-devel@lists.xenproject.org; Fri, 13 Mar 2020 09:26:18 +0000 X-Inumbo-ID: b14d68cc-650c-11ea-b2ae-12813bfff9fa Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id b14d68cc-650c-11ea-b2ae-12813bfff9fa; Fri, 13 Mar 2020 09:26:18 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 40701B0BA; Fri, 13 Mar 2020 09:26:17 +0000 (UTC) From: Jan Beulich To: "xen-devel@lists.xenproject.org" References: <60130f14-3fc5-e40d-fec6-2448fefa6fc4@suse.com> Message-ID: <8221cc7f-ad33-03da-5780-8a76fbdc404a@suse.com> Date: Fri, 13 Mar 2020 10:26:20 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 In-Reply-To: <60130f14-3fc5-e40d-fec6-2448fefa6fc4@suse.com> Content-Language: en-US Subject: [Xen-devel] [PATCH 3/4] x86/APIC: reduce rounding errors in calculations X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Andrew Cooper , Wei Liu , =?utf-8?q?Roger_Pau_Monn=C3=A9?= Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" Dividing by HZ/10 just to subsequently multiply by HZ again in all uses of the respective variable is pretty pointlessly introducing rounding (really: truncation) errors. While transforming the respective expressions it became apparent that "result" would be left unused except for its use as function return value. As the sole caller of the function doesn't look at the returned value, simply convert the function to have "void" return type. Signed-off-by: Jan Beulich --- a/xen/arch/x86/apic.c +++ b/xen/arch/x86/apic.c @@ -1204,14 +1204,14 @@ static void wait_tick_pvh(void) * APIC irq that way. */ -static int __init calibrate_APIC_clock(void) +static void __init calibrate_APIC_clock(void) { unsigned long long t1, t2; - unsigned long tt1, tt2, result; + unsigned long tt1, tt2; unsigned int i; unsigned long bus_freq; /* KAF: pointer-size avoids compile warns. */ unsigned int bus_cycle; /* length of one bus cycle in pico-seconds */ - const unsigned int LOOPS = HZ/10; +#define LOOPS_FRAC 10U /* measure for one tenth of a second */ apic_printk(APIC_VERBOSE, "calibrating APIC timer ...\n"); @@ -1238,9 +1238,9 @@ static int __init calibrate_APIC_clock(v tt1 = apic_read(APIC_TMCCT); /* - * Let's wait LOOPS ticks: + * Let's wait HZ / LOOPS_FRAC ticks: */ - for (i = 0; i < LOOPS; i++) + for (i = 0; i < HZ / LOOPS_FRAC; i++) if ( !xen_guest ) wait_8254_wraparound(); else @@ -1249,17 +1249,16 @@ static int __init calibrate_APIC_clock(v tt2 = apic_read(APIC_TMCCT); t2 = rdtsc_ordered(); - result = (tt1-tt2)*APIC_DIVISOR/LOOPS; + bus_freq = (tt1 - tt2) * APIC_DIVISOR * LOOPS_FRAC; - apic_printk(APIC_VERBOSE, "..... CPU clock speed is %ld.%04ld MHz.\n", - ((long)(t2 - t1) / LOOPS) / (1000000 / HZ), - ((long)(t2 - t1) / LOOPS) % (1000000 / HZ)); + apic_printk(APIC_VERBOSE, "..... CPU clock speed is %lu.%04lu MHz.\n", + ((unsigned long)(t2 - t1) * LOOPS_FRAC) / 1000000, + ((unsigned long)(t2 - t1) * LOOPS_FRAC / 100) % 10000); apic_printk(APIC_VERBOSE, "..... host bus clock speed is %ld.%04ld MHz.\n", - result / (1000000 / HZ), result % (1000000 / HZ)); + bus_freq / 1000000, (bus_freq / 100) % 10000); /* set up multipliers for accurate timer code */ - bus_freq = result*HZ; bus_cycle = (u32) (1000000000000LL/bus_freq); /* in pico seconds */ bus_cycle += (1000000000000UL % bus_freq) * 2 > bus_freq; bus_scale = (1000*262144)/bus_cycle; @@ -1269,7 +1268,7 @@ static int __init calibrate_APIC_clock(v /* reset APIC to zero timeout value */ __setup_APIC_LVTT(0); - return result; +#undef LOOPS_FRAC } void __init setup_boot_APIC_clock(void) From patchwork Fri Mar 13 09:26:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 11436437 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CE973921 for ; Fri, 13 Mar 2020 09:27:38 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B50A72073E for ; Fri, 13 Mar 2020 09:27:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B50A72073E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1jCgad-0002nL-Lf; Fri, 13 Mar 2020 09:26:47 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1jCgac-0002n5-Kf for xen-devel@lists.xenproject.org; Fri, 13 Mar 2020 09:26:46 +0000 X-Inumbo-ID: c16f72fe-650c-11ea-b2af-12813bfff9fa Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id c16f72fe-650c-11ea-b2af-12813bfff9fa; Fri, 13 Mar 2020 09:26:45 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 7CCE0B0BA; Fri, 13 Mar 2020 09:26:44 +0000 (UTC) From: Jan Beulich To: "xen-devel@lists.xenproject.org" References: <60130f14-3fc5-e40d-fec6-2448fefa6fc4@suse.com> Message-ID: <513e4f93-a8a0-ae72-abcc-aa28531eca97@suse.com> Date: Fri, 13 Mar 2020 10:26:47 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 In-Reply-To: <60130f14-3fc5-e40d-fec6-2448fefa6fc4@suse.com> Content-Language: en-US Subject: [Xen-devel] [PATCH 4/4] x86/APIC: restrict certain messages to BSP X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Andrew Cooper , Wei Liu , =?utf-8?q?Roger_Pau_Monn=C3=A9?= Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" All CPUs get an equal setting of EOI broadcast suppression; no need to log one message per CPU, even if it's only in verbose APIC mode. Only the BSP is eligible to possibly get ExtINT enabled; no need to log that it gets disabled on all APs, even if - again - it's only in verbose APIC mode. Take the opportunity and introduce a "bsp" parameter to the function, to stop using smp_processor_id() to tell BSP from APs. Signed-off-by: Jan Beulich Reviewed-by: Roger Pau Monné --- a/xen/arch/x86/apic.c +++ b/xen/arch/x86/apic.c @@ -499,7 +499,7 @@ static void resume_x2apic(void) __enable_x2apic(); } -void setup_local_APIC(void) +void setup_local_APIC(bool bsp) { unsigned long oldvalue, value, maxlvt; int i, j; @@ -598,8 +598,8 @@ void setup_local_APIC(void) if ( directed_eoi_enabled ) { value |= APIC_SPIV_DIRECTED_EOI; - apic_printk(APIC_VERBOSE, "Suppress EOI broadcast on CPU#%d\n", - smp_processor_id()); + if ( bsp ) + apic_printk(APIC_VERBOSE, "Suppressing EOI broadcast\n"); } apic_write(APIC_SPIV, value); @@ -615,21 +615,22 @@ void setup_local_APIC(void) * TODO: set up through-local-APIC from through-I/O-APIC? --macro */ value = apic_read(APIC_LVT0) & APIC_LVT_MASKED; - if (!smp_processor_id() && (pic_mode || !value)) { + if (bsp && (pic_mode || !value)) { value = APIC_DM_EXTINT; apic_printk(APIC_VERBOSE, "enabled ExtINT on CPU#%d\n", smp_processor_id()); } else { value = APIC_DM_EXTINT | APIC_LVT_MASKED; - apic_printk(APIC_VERBOSE, "masked ExtINT on CPU#%d\n", - smp_processor_id()); + if (bsp) + apic_printk(APIC_VERBOSE, "masked ExtINT on CPU#%d\n", + smp_processor_id()); } apic_write(APIC_LVT0, value); /* * only the BP should see the LINT1 NMI signal, obviously. */ - if (!smp_processor_id()) + if (bsp) value = APIC_DM_NMI; else value = APIC_DM_NMI | APIC_LVT_MASKED; @@ -663,7 +664,7 @@ void setup_local_APIC(void) printk("Leaving ESR disabled.\n"); } - if (nmi_watchdog == NMI_LOCAL_APIC && smp_processor_id()) + if (nmi_watchdog == NMI_LOCAL_APIC && !bsp) setup_apic_nmi_watchdog(); apic_pm_activate(); } @@ -1474,7 +1475,7 @@ int __init APIC_init_uniprocessor (void) physids_clear(phys_cpu_present_map); physid_set(boot_cpu_physical_apicid, phys_cpu_present_map); - setup_local_APIC(); + setup_local_APIC(true); if (nmi_watchdog == NMI_LOCAL_APIC) check_nmi_watchdog(); --- a/xen/arch/x86/smpboot.c +++ b/xen/arch/x86/smpboot.c @@ -191,7 +191,7 @@ static void smp_callin(void) */ Dprintk("CALLIN, before setup_local_APIC().\n"); x2apic_ap_setup(); - setup_local_APIC(); + setup_local_APIC(false); /* Save our processor parameters. */ if ( !smp_store_cpu_info(cpu) ) @@ -1165,7 +1165,7 @@ void __init smp_prepare_cpus(void) verify_local_APIC(); connect_bsp_APIC(); - setup_local_APIC(); + setup_local_APIC(true); if ( !skip_ioapic_setup && nr_ioapics ) setup_IO_APIC(); --- a/xen/include/asm-x86/apic.h +++ b/xen/include/asm-x86/apic.h @@ -169,7 +169,7 @@ extern int verify_local_APIC (void); extern void cache_APIC_registers (void); extern void sync_Arb_IDs (void); extern void init_bsp_APIC (void); -extern void setup_local_APIC (void); +extern void setup_local_APIC(bool bsp); extern void init_apic_mappings (void); extern void smp_local_timer_interrupt (struct cpu_user_regs *regs); extern void setup_boot_APIC_clock (void);