Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp981555ybz; Thu, 16 Apr 2020 00:03:33 -0700 (PDT) X-Google-Smtp-Source: APiQypLGmNpj8KSia3dtWioGTRRnJMogpct4Eyh1QECVNVkUOOwLvnK0MBkzcpm/pasDhHNgynfU X-Received: by 2002:a17:906:6c93:: with SMTP id s19mr8143372ejr.135.1587020613077; Thu, 16 Apr 2020 00:03:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587020613; cv=none; d=google.com; s=arc-20160816; b=TnbYIHGIhsrnAMsJa3h2O34Sa4nkXoQScpVwClLceOcZG+oXbpMHDVbrQeaCofH2SJ GP1P6079yOGVLEP6PI5L7XI8qF5h6sQ6YqAm1+7B7dVON8hMd19jSNeP4A6LsEM7hZAr miQ3HI/0N8yz8C7DRN0FQtUOwposy+Lxg7jkC6vWcvKQ/qZ6tMGYo10E/e7mG/sK7mY6 htZwNX9jOkkzgHCCTLmjqyZpWSRD5BJqhEyydIpAiua8g53FpXhDZEcIxRu5WnqnEGXE YW+ZSZTEMs3CIGDZpKhCAbF/dWa4X8ev3Wu+1+acEo7PZNS5iHHLJ1+ea9j8GskZrmLZ UcAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:organization:from:references:cc:to:subject:ironport-sdr :ironport-sdr; bh=aqxr05rowvAmD4bxejvNyoRgAQDpWmfQ98l9dDVFLGA=; b=OtyWyPltP25SdcscbtN8AkFDJor6i9HGlz/CUWaz7FylmUaixVoCWFhtOBkRiLqN9u xknmFZeqnIqo5w/ksKB6giEazA/xiUEVUryQoVCUzk7xv/1luBNPXVA4zYmVcsY16l/A cy0ghgC1qUNlGsxu/OcThCl7JUn2Co9H7nLE9EqNM4rG3XjWhzOKqVL/+MRLWH1hOfi3 ISrXd5/Sa3899a4mhOPtgUePPOSO/NkkY8rbr6bemKqjYs/sGtSvwMf6PmkE9h0uZlGH cde09Wq/goOXwcfRyr4Ui8ak5Jh0Q6cTSnAf7jjr/Iw/FAlq2oy2KybYT7lZwQCvv52X Xh1w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i4si11051216ejv.473.2020.04.16.00.03.10; Thu, 16 Apr 2020 00:03:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2437167AbgDPHB6 (ORCPT + 99 others); Thu, 16 Apr 2020 03:01:58 -0400 Received: from mga06.intel.com ([134.134.136.31]:47887 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2436624AbgDPHB4 (ORCPT ); Thu, 16 Apr 2020 03:01:56 -0400 IronPort-SDR: Cf/ZWQB1NbiFBk8Ls5UO4dmS88HY4EUItmbn5FJglP2+G42bTlKLXweztmWTiJLfPB7Af/uOaO aSZV1Y4oyNGw== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Apr 2020 00:01:53 -0700 IronPort-SDR: k/yOcRMuFyGyqEZZ2PfMRX65AImLqtwCpR3s3MdXAyaLGY25O9FqZsrOC3b/+ZrkqCTZzoTYju 5I+9mdKSZJOg== X-IronPort-AV: E=Sophos;i="5.72,390,1580803200"; d="scan'208";a="257119822" Received: from likexu-mobl1.ccr.corp.intel.com (HELO [10.238.4.236]) ([10.238.4.236]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Apr 2020 00:01:52 -0700 Subject: Re: [PATCH] x86, smpboot: Disable frequency invariance when it's unsupported To: Giovanni Gherdovich Cc: Peter Zijlstra , Ingo Molnar , Doug Smythies , "Rafael J . Wysocki" , LKML References: <20200416020700.167294-1-like.xu@linux.intel.com> <1587017284.32139.20.camel@suse.cz> From: Like Xu Organization: Intel OTC Message-ID: Date: Thu, 16 Apr 2020 15:01:49 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: <1587017284.32139.20.camel@suse.cz> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020/4/16 14:08, Giovanni Gherdovich wrote: > On Thu, 2020-04-16 at 10:12 +0800, Like Xu wrote: >> On the Intel SNR processors such as "Intel Atom(R) C6562", the >> turbo_freq for 4C turbo may be zero which causes a divide by zero >> exception and blocks the boot process when arch_scale_freq_tick(). >> >> When one of the preset base_freq or turbo_freq is meaningless, >> we may disable frequency invariance. >> >> Fixes: 1567c3e3467c ("x86, sched: Add support for frequency invariance") >> Signed-off-by: Like Xu >> --- >> arch/x86/kernel/smpboot.c | 3 +++ >> 1 file changed, 3 insertions(+) >> >> diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c >> index fe3ab9632f3b..741367ce4d14 100644 >> --- a/arch/x86/kernel/smpboot.c >> +++ b/arch/x86/kernel/smpboot.c >> @@ -1958,6 +1958,9 @@ static bool core_set_max_freq_ratio(u64 *base_freq, u64 *turbo_freq) >> *base_freq = (*base_freq >> 8) & 0xFF; /* max P state */ >> *turbo_freq = (*turbo_freq >> 24) & 0xFF; /* 4C turbo */ >> >> + if (*turbo_freq == 0 || *base_freq == 0) >> + return false; >> + >> return true; >> } >> > > Hello Like Xu, > > thanks for reporting this and for the patch. My preferred solution for when > the 4 cores turbo freq is detected as zero would be to look for the 1 core turbo > frequency, as we're likely on a machine with less than 4 cores. Is that the > case on your Atom C6562? I couldn't find it on ark.intel.com. The Atom C6562 is "24 cores" based on https://www.intel.com/content/dam/www/public/us/en/documents/product-briefs/atom-p5900-product-brief.pdf #define MSR_PLATFORM_INFO 0x000000ce the value for this msr is 80820f9801600 #define MSR_TURBO_RATIO_LIMIT 0x000001ad the value for this msr is 16 I know you didn't test your feature on this platform, but combinations of other various values ​​are also possible (unless it's made clear in the specification). > > As per why I'd like to go with 1 core turbo instead of bailing out of freq > invariance entirely, I've left a comment in the openSUSE bugzilla with some > details: https://bugzilla.opensuse.org/show_bug.cgi?id=1166664#c35 > The relevant part is: > > :: The fix in this case is to take the 1 core turbo as normalizing factor. The > :: other choice would be to use the base frequency (no turbo at all), but using > :: base freq for normalization means that the ratio becomes current_freq / base_freq > :: which is an over-estimation, which leads the frequency governor to think the > :: CPU is more loaded than it really is and raise the frequency a bit too > :: aggressively. This is tolerable in performance-oriented servers but > :: inappropriate on small machines with 2 cores." > > Regarding base_freq being reported as zero, you're right, that can happen too > and we've seen it in hypervisors. > > I've just sent fixes for these two problems here: > https://lore.kernel.org/lkml/20200416054745.740-1-ggherdovich@suse.cz/ Hence the "less than 4 cores" comment is weird for C6562 but the use of "1C turbo" looks good to me. Thanks, Like Xu > > > Thanks, > Giovanni Gherdovich >