Received: by 10.223.164.202 with SMTP id h10csp194493wrb; Mon, 13 Nov 2017 05:05:26 -0800 (PST) X-Google-Smtp-Source: AGs4zMbHkUgVR6WU175obtss+aBUpp+5WuaXCRMxqlIad11nvABPxL27i+/L0Qw1bHgRktIbgH8v X-Received: by 10.84.139.129 with SMTP id 1mr9107670plr.167.1510578326296; Mon, 13 Nov 2017 05:05:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510578326; cv=none; d=google.com; s=arc-20160816; b=QViCULy9LCENjM3f1zxsBNNRV6g1b1VZZlCbttZaMg6ejXETNvA8Zvf6XxhG9ZTBDV AK34VBk1AYzm/fP3/HEqY1OIeRdhtbZETY4x3ng45ikBzrwG6WEng8lTyGqgOq7ygitt FhDFLza1o2E5MKb2eAFC1YodRhkmPCHZL0IPxpXV+aYTYH6pSYBsaswTgGlArOS+zBCF vKXJu3wlI6kuY/qcjDp0wzHfmMC8RKoAnzFRheN7lab5VmCWLU7Z1t4xx+P8cDEdoxv3 KK9wnksm/eb7zF9qnbAOLSfawfwV/IkdVbJvJiwTy5sB/KYPhHY7ANAZAXLqQ4P5h0vT IydA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=dy96qP/U70Z/0qR/Jj1IKzMhUjdVQFFeohfOgjfWKho=; b=hYhynBDE2h0VE/JOKnV/BPzYLs0E4PxePjrrFYsuSbKncPMep47puCH3AN2BDzftJK 4qGmVhXhfHgNGwwRdvz/OVxCcGMCO7kv6JYsy9I4PmiDc3ozebnyVJPYP9Cj3PRaVZsU /pnqWydhcADlM/uFphw4h/hO8+EcXnI6X/wHIh4cZUUkoXpYmVx/6C+IfXmWaQsNdv6n IIrydfqRMmpQKOKIK9743yyLOHbiTv7SvhfCMokUCdH/uaFnvnl0nMVVWkdKtwrMBSu4 RHhdWY8oL9vkWnD+fPgWEca/Ml8JPLP78woOX1Hud6vYJU3sG7/RPNNm6Q+d9P+u8iyZ 25CA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n8si13716825pgs.144.2017.11.13.05.05.13; Mon, 13 Nov 2017 05:05:26 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932092AbdKMNDU (ORCPT + 95 others); Mon, 13 Nov 2017 08:03:20 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:51398 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751593AbdKMNDR (ORCPT ); Mon, 13 Nov 2017 08:03:17 -0500 Received: from localhost (LFbn-1-12253-150.w90-92.abo.wanadoo.fr [90.92.67.150]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 4B94BAB5; Mon, 13 Nov 2017 13:03:16 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pavel Tatashin , Thomas Gleixner , peterz@infradead.org, bob.picco@oracle.com, steven.sistare@oracle.com, daniel.m.jordan@oracle.com Subject: [PATCH 4.9 86/87] x86/smpboot: Make optimization of delay calibration work correctly Date: Mon, 13 Nov 2017 13:56:43 +0100 Message-Id: <20171113125623.068658866@linuxfoundation.org> X-Mailer: git-send-email 2.15.0 In-Reply-To: <20171113125615.304035578@linuxfoundation.org> References: <20171113125615.304035578@linuxfoundation.org> User-Agent: quilt/0.65 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Pavel Tatashin commit 76ce7cfe35ef58f34e6ba85327afb5fbf6c3ff9b upstream. If the TSC has constant frequency then the delay calibration can be skipped when it has been calibrated for a package already. This is checked in calibrate_delay_is_known(), but that function is buggy in two aspects: It returns 'false' if (!tsc_disabled && !cpu_has(&cpu_data(cpu), X86_FEATURE_CONSTANT_TSC) which is obviously the reverse of the intended check and the check for the sibling mask cannot work either because the topology links have not been set up yet. Correct the condition and move the call to set_cpu_sibling_map() before invoking calibrate_delay() so the sibling check works correctly. [ tglx: Rewrote changelong ] Fixes: c25323c07345 ("x86/tsc: Use topology functions") Signed-off-by: Pavel Tatashin Signed-off-by: Thomas Gleixner Cc: peterz@infradead.org Cc: bob.picco@oracle.com Cc: steven.sistare@oracle.com Cc: daniel.m.jordan@oracle.com Link: https://lkml.kernel.org/r/20171028001100.26603-1-pasha.tatashin@oracle.com Signed-off-by: Greg Kroah-Hartman --- arch/x86/kernel/smpboot.c | 11 ++++++----- arch/x86/kernel/tsc.c | 8 +++----- 2 files changed, 9 insertions(+), 10 deletions(-) --- a/arch/x86/kernel/smpboot.c +++ b/arch/x86/kernel/smpboot.c @@ -181,6 +181,12 @@ static void smp_callin(void) smp_store_cpu_info(cpuid); /* + * The topology information must be up to date before + * calibrate_delay() and notify_cpu_starting(). + */ + set_cpu_sibling_map(raw_smp_processor_id()); + + /* * Get our bogomips. * Update loops_per_jiffy in cpu_data. Previous call to * smp_store_cpu_info() stored a value that is close but not as @@ -190,11 +196,6 @@ static void smp_callin(void) cpu_data(cpuid).loops_per_jiffy = loops_per_jiffy; pr_debug("Stack at about %p\n", &cpuid); - /* - * This must be done before setting cpu_online_mask - * or calling notify_cpu_starting. - */ - set_cpu_sibling_map(raw_smp_processor_id()); wmb(); notify_cpu_starting(cpuid); --- a/arch/x86/kernel/tsc.c +++ b/arch/x86/kernel/tsc.c @@ -1382,12 +1382,10 @@ void __init tsc_init(void) unsigned long calibrate_delay_is_known(void) { int sibling, cpu = smp_processor_id(); - struct cpumask *mask = topology_core_cpumask(cpu); + int constant_tsc = cpu_has(&cpu_data(cpu), X86_FEATURE_CONSTANT_TSC); + const struct cpumask *mask = topology_core_cpumask(cpu); - if (!tsc_disabled && !cpu_has(&cpu_data(cpu), X86_FEATURE_CONSTANT_TSC)) - return 0; - - if (!mask) + if (tsc_disabled || !constant_tsc || !mask) return 0; sibling = cpumask_any_but(mask, cpu); From 1583579786414275210@xxx Thu Nov 09 09:22:50 +0000 2017 X-GM-THRID: 1583575453692858557 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread