Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3075304imu; Mon, 19 Nov 2018 10:14:33 -0800 (PST) X-Google-Smtp-Source: AJdET5faKMY6J3HgUHtH/4IXKtvhmAdmkrlr9cWJBOz1kAY+gVMU3sPwjLPmCc4rNiaryhnZR/IY X-Received: by 2002:a63:cf08:: with SMTP id j8mr21423772pgg.113.1542651273609; Mon, 19 Nov 2018 10:14:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542651273; cv=none; d=google.com; s=arc-20160816; b=z3adLQrnVV48Ir/AYSTrT33CcdzPY79nA5n+/g+a0e3+PnSbKu5FrwjdV/wbliLIVV 0fxtGXRziLXkODnAWcPmt0IfaDcyznZwjHxFn3TgLZdOkdpIuYp/sVjjWSeVrNU5DUsJ UIUmlaeWGcJEJ6bg/vyWpxABhcgc67P5wNFigqOb29ATZu7Hip8+KaoNYU/3LBpSI2VL +ffbggpn4WCoGvr2zT2I3dl/kjNg075PHdkmz/904XonxxHdQi4RYyx9XFVJk8ILcuEt NBQRGD9f2EViI3NECnyRSWkNYSCI3EO97BmSzEQen/ZDXlkmWEoZd1gTX4a3UklWT4/t eVlA== 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:from:references:cc:to:subject; bh=YkD2ZyUBMuEA1DL2Z7a5Xw/31E/7SCvGyASl9j1u9f4=; b=WzvzYvRXMWNk2nAuCQhOIZDMC3VSMpypACScoMBKvBu2UHtrSnDU0NxAaCW5gE6DtA XYvJ1qRKIUaCJEx0UIkq9357qfGU3nfhLq58SYucqAf2Gm+hO+nqMdwuFo85TMEPjg/4 713/sstn7LVBHskFC3rGKbBQiif+HBcl62Q7mE1puB0MaWJBrh3ATFsOctxvV79cCs14 L3lqGbVOkwzxcYd44TB1Xy+/BiJdg282qbc0tR9ssgIq82Ny7Sotu9ZpASsF9j+JbdaQ C0nCDrnIYqzv3t200LZEgAALYCcy6N5juLsqBCkW8/QaWR7kqxUldnUTs7R7nA7hOBt/ s89g== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c76si27774633pga.70.2018.11.19.10.14.04; Mon, 19 Nov 2018 10:14:33 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730108AbeKTEgd (ORCPT + 99 others); Mon, 19 Nov 2018 23:36:33 -0500 Received: from mx1.redhat.com ([209.132.183.28]:38534 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729975AbeKTEgd (ORCPT ); Mon, 19 Nov 2018 23:36:33 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6DCABC059B78; Mon, 19 Nov 2018 18:11:55 +0000 (UTC) Received: from prarit.bos.redhat.com (prarit-guest.khw1.lab.eng.bos.redhat.com [10.16.200.63]) by smtp.corp.redhat.com (Postfix) with ESMTP id C5FC45D76C; Mon, 19 Nov 2018 18:11:54 +0000 (UTC) Subject: Re: [PATCH 3.18 16/90] cpupower: Fix coredump on VMWare To: Greg Kroah-Hartman , linux-kernel@vger.kernel.org Cc: stable@vger.kernel.org, Shuah Khan , Stafford Horne , Sasha Levin References: <20181119162620.585061184@linuxfoundation.org> <20181119162623.516060898@linuxfoundation.org> From: Prarit Bhargava Message-ID: Date: Mon, 19 Nov 2018 13:11:54 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20181119162623.516060898@linuxfoundation.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Mon, 19 Nov 2018 18:11:55 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/19/2018 11:28 AM, Greg Kroah-Hartman wrote: > 3.18-stable review patch. If anyone has any objections, please let me know. > > ------------------ > > From: Prarit Bhargava > > [ Upstream commit f69ffc5d3db8f1f03fd6d1df5930f9a1fbd787b6 ] Greg, as previously mentioned to Sasha, this patch also needs 8c22e2f69592 ("cpupower: Fix AMD Family 0x17 msr_pstate size"). I did not see a message indicating that 8c22e2f69592 was also being backported to 3.18-stable. My apologies if I missed it. P. > > cpupower crashes on VMWare guests. The guests have the AMD PStateDef MSR > (0xC0010064 + state number) set to zero. As a result fid and did are zero > and the crash occurs because of a divide by zero (cof = fid/did). This > can be prevented by checking the enable bit in the PStateDef MSR before > calculating cof. By doing this the value of pstate[i] remains zero and > the value can be tested before displaying the active Pstates. > > Check the enable bit in the PstateDef register for all supported families > and only print out enabled Pstates. > > Signed-off-by: Prarit Bhargava > Cc: Shuah Khan > Cc: Stafford Horne > Signed-off-by: Shuah Khan (Samsung OSG) > Signed-off-by: Sasha Levin > Signed-off-by: Greg Kroah-Hartman > --- > tools/power/cpupower/utils/cpufreq-info.c | 2 ++ > tools/power/cpupower/utils/helpers/amd.c | 5 +++++ > 2 files changed, 7 insertions(+) > > --- a/tools/power/cpupower/utils/cpufreq-info.c > +++ b/tools/power/cpupower/utils/cpufreq-info.c > @@ -200,6 +200,8 @@ static int get_boost_mode(unsigned int c > printf(_(" Boost States: %d\n"), b_states); > printf(_(" Total States: %d\n"), pstate_no); > for (i = 0; i < pstate_no; i++) { > + if (!pstates[i]) > + continue; > if (i < b_states) > printf(_(" Pstate-Pb%d: %luMHz (boost state)" > "\n"), i, pstates[i]); > --- a/tools/power/cpupower/utils/helpers/amd.c > +++ b/tools/power/cpupower/utils/helpers/amd.c > @@ -103,6 +103,11 @@ int decode_pstates(unsigned int cpu, uns > } > if (read_msr(cpu, MSR_AMD_PSTATE + i, &pstate.val)) > return -1; > + if ((cpu_family == 0x17) && (!pstate.fam17h_bits.en)) > + continue; > + else if (!pstate.bits.en) > + continue; > + > pstates[i] = get_cof(cpu_family, pstate); > } > *no = i; > >