Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C9BB4C433DF for ; Thu, 14 May 2020 12:32:06 +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 9986A206DA for ; Thu, 14 May 2020 12:32:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9986A206DA Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=pass 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.92) (envelope-from ) id 1jZD1V-00063z-TR; Thu, 14 May 2020 12:31:37 +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.92) (envelope-from ) id 1jZD1U-00063u-KD for xen-devel@lists.xenproject.org; Thu, 14 May 2020 12:31:36 +0000 X-Inumbo-ID: d986612e-95de-11ea-a482-12813bfff9fa Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id d986612e-95de-11ea-a482-12813bfff9fa; Thu, 14 May 2020 12:31:35 +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 553DCAC22; Thu, 14 May 2020 12:31:37 +0000 (UTC) Subject: Re: [PATCH 4/4] x86/APIC: restrict certain messages to BSP To: =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= References: <60130f14-3fc5-e40d-fec6-2448fefa6fc4@suse.com> <513e4f93-a8a0-ae72-abcc-aa28531eca97@suse.com> <20200514100145.GA54375@Air-de-Roger> From: Jan Beulich Message-ID: Date: Thu, 14 May 2020 14:31:33 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 MIME-Version: 1.0 In-Reply-To: <20200514100145.GA54375@Air-de-Roger> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: "xen-devel@lists.xenproject.org" , Wei Liu , Andrew Cooper Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" On 14.05.2020 12:01, Roger Pau Monné wrote: > On Fri, Mar 13, 2020 at 10:26:47AM +0100, Jan Beulich wrote: >> 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 > > LGTM: > > Reviewed-by: Roger Pau Monné Thanks. > AFAICT this doesn't introduce any functional change in APIC setup or > behavior, the only functional change is the log message reduction. > Might be good to add a note to that effect to make this clear, since > the change from smp_processor_id() -> bsp might make this not obvious. I've added "No functional change from this" to the last paragraph. >> --- 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()); > > You might want to also drop the CPU#%d from the above messages, since > they would only be printed for the BSP. I want to specifically keep them, so that once (if ever) we introduce hot-unplug support for the BSP, the same or similar messages can be used and matched against earlier ones in the log. >> } >> 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; > > This would be shorter as: > > value = APIC_DM_NMI | (bsp ? 0 : APIC_LVT_MASKED); Indeed, at the expense of larger code churn. Seems like an at least partially unrelated change to me (at risk of obscuring the actual purpose of the change here). Jan