Received: by 2002:a05:7412:3b8b:b0:fc:a2b0:25d7 with SMTP id nd11csp73637rdb; Wed, 7 Feb 2024 22:07:55 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWYx705NKGKVzDGeCRBvsfDnHmbNZG8xS0L2ANW8LturJ21b+RmijfkWmlRJ6ODjXfI4B47T7LjdxunzdGbxXp3d+6yUtFDYHojyqi46g== X-Google-Smtp-Source: AGHT+IGfw5jHTzdWmI+ySki0RCDaF0E+1ovDeLB1yzxm/5VT33MKp3YDsCTwb3VbeyXBhXeIgS4p X-Received: by 2002:a05:6a20:1609:b0:19c:a575:bc7e with SMTP id l9-20020a056a20160900b0019ca575bc7emr8049539pzj.45.1707372475307; Wed, 07 Feb 2024 22:07:55 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWQczwXyLg03UzNJfnn/4he4YFckI5c/d9Lg/JB00PvuhOyEyxXpjo/YvRWVXxlXu4cVvrtbSzx7sbjGm0bVtRmWHtz+f8FOz2gCtn7Ng== Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id w12-20020a17090a8a0c00b00296e0e28e02si411374pjn.0.2024.02.07.22.07.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Feb 2024 22:07:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-57492-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=DV8Frx95; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel+bounces-57492-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-57492-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id EABBB285EA3 for ; Thu, 8 Feb 2024 06:07:54 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0305A67C7C; Thu, 8 Feb 2024 06:07:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="DV8Frx95" Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2041.outbound.protection.outlook.com [40.107.236.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0EBA567C59; Thu, 8 Feb 2024 06:07:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.236.41 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707372467; cv=fail; b=u43JPLq7p0S4iK151mLDswUKqcn1lLb8j0NoZm46xtyKV/5NOBxlNsxJdfs4ljzPGW6RHzq0HDPY6CJdPqL5xJvihH/R86N5PVSBFjgjMhZ7T48fi59omHwX3KbJ6L4epdJl68dbxsZ9UVOzHT1auMR8+thXRlxuFl9LXyeAN6E= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707372467; c=relaxed/simple; bh=xPCiPZ3r6wB2dAdu9p2HDU+7xjPr+ggrmvwIPK4K71I=; h=Date:From:To:Cc:Subject:Message-ID:References:Content-Type: Content-Disposition:In-Reply-To:MIME-Version; b=oOjxsvHQa07JuA6GtuQoh0leVRNuctpLuG9PZc/C6+80QK4JTBycUUM/091ANFOp27LVxf6sZzMwtXfFHWG5yJHNq82fKlI3iZHWqL63yqZTV3H8Jc1wGrRa+sFzKwT4tS9gGLzUu0ag1JREX65erUkZ/1zTn0UegbOt4WaVHz8= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=DV8Frx95; arc=fail smtp.client-ip=40.107.236.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AiPjeVrB3xI3FwrSE2mTYzQ7+eQZcGINNrwVL+EaNULIMul//cw1jg9DH+sQNDCp2IU/waQuSFgyNFpXMPmav90Jn30q+dU/LMFEB6b7+CEvw9O2whV9dM97TirCjukQPYUPsWNC4U7clepSYouGLnWoTAp+58qfv/uRznnZ1qg5JpHP0t8lHM1EBF2M1/2TOAWJYNySzODUYv3fo0uzOvR501Ce3MAu20O8AtcBfwIt0ppOKr1waEbIoL6MxQpPCZFGztxk/XNRwVlXQouChHlgdCmXrGOiL0UGXAtf0EHClHSX6d02PtMciUj2wXMi5fb3NIgdzCYd5bGfEF9+wA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=jJ11YTQjrMDBjiEGjkBRWiXzHIptmO1mcDYFDefNz7Y=; b=eeLescEx8A+mHEOeVPpiinWZOPD4eM5gm9nzWfURHoJ0+Ti+LjcfvPFxBpumxTdbYn75myXA3t4PgknoImCj2p6QPV2eem5PZnaqhnvpldi7JtMgRIbRqbhcOhCsiIOXfvTHZ5DxxmKFu2ASSJGCZo+7E9uRbudpxakOBsYpPrC2/oEY8UL9hsJAVfP3xUHx4XL62S24CYrOFM2yVlI7lPdLTWWhJUCkRkvFpka/nw3q6/Ob6x/oyyMOvD+MHCo52BNonV9Thz4uuVmAQdjhGx8qm4wRPwrfGmSTyA6M197hpSEXPhGhfOHICTkWr5+/JHyUd9WD9wX6wBmzTRlVoA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=jJ11YTQjrMDBjiEGjkBRWiXzHIptmO1mcDYFDefNz7Y=; b=DV8Frx95j3bIKsCtxoboKNlg0VM5Vjwm8UVnYmQ5JyOqlnTdBmpySflSIiyO8bAZXH8YsdLGPjAmS2IJ3h/nzdWUoaQ298fxJUQ9G4JNOOgS5fYlZRyzoZQ8VoSYBp5/ZK826AOyh2myrgd1WryUtMtcD8kBNOJwNcqg/nOWc84= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; Received: from DS7PR12MB8252.namprd12.prod.outlook.com (2603:10b6:8:ee::7) by SJ2PR12MB9113.namprd12.prod.outlook.com (2603:10b6:a03:560::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7270.16; Thu, 8 Feb 2024 06:07:39 +0000 Received: from DS7PR12MB8252.namprd12.prod.outlook.com ([fe80::80bf:841d:6c75:64de]) by DS7PR12MB8252.namprd12.prod.outlook.com ([fe80::80bf:841d:6c75:64de%3]) with mapi id 15.20.7270.016; Thu, 8 Feb 2024 06:07:39 +0000 Date: Thu, 8 Feb 2024 11:37:29 +0530 From: "Gautham R. Shenoy" To: Perry Yuan Cc: rafael.j.wysocki@intel.com, Mario.Limonciello@amd.com, viresh.kumar@linaro.org, Ray.Huang@amd.com, Borislav.Petkov@amd.com, Alexander.Deucher@amd.com, Xinmei.Huang@amd.com, Xiaojian.Du@amd.com, Li.Meng@amd.com, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v6 2/6] cpufreq:amd-pstate: fix the nominal freq value set Message-ID: References: Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-ClientProxiedBy: PN2P287CA0009.INDP287.PROD.OUTLOOK.COM (2603:1096:c01:21b::19) To DS7PR12MB8252.namprd12.prod.outlook.com (2603:10b6:8:ee::7) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS7PR12MB8252:EE_|SJ2PR12MB9113:EE_ X-MS-Office365-Filtering-Correlation-Id: 3a879a62-af03-4071-4c63-08dc286c40c2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: vFKzBOs9muEy9jT2bzC58u9wWTz65V9gAMnfNOVUjk3KUAlxcAxMuVjojuaCp7YezUmYVZfQwX34kn7hFcuh+X+0EHJpGkC2z57JRerkQgIzZamtXYaTga3W7s/0FhZ3WUeG4BqF375DHk7ojJ5HZwy6rTbqj5ovZD4+IGKGEdaTPuFEWVfRGJX3ANXNp3GHtD9glfN3+sIT7a9mbzJhsprtBIBdz8nhiH1xHuCwccoJU1sb7Vic9h71vePlc/sWEiGUWax+D5TEWM5AF5wXRsoaUwpa8J8lk0G77fFs4uZFTX+GzqLfEGQu6ZODeyxvxAk2jmUOaCwBzgouvngDI0CeuC6PcaIWnPXvXozQRJFhIws5POk+B4MQJRuZox/bD7p+OTMhcbXWhLs8k0zQnM2OAp7AoDkjU6q6xN7s64P6mJ8poy3L8KmWm9Z42A3SPOZ+yMTjmuEitdljxNhA7WG7RwdbkKAxQMJJ2yW8+V/cRvhzQDEhv6N2vc52FFn5zijn+lYaoANaFNRf4f4oq5nU1qDDpqbNdS6jsKpyNtKGsds6hIIayYT7x5YCvcCR X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DS7PR12MB8252.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(376002)(346002)(136003)(396003)(39860400002)(366004)(230922051799003)(1800799012)(451199024)(186009)(64100799003)(2906002)(6666004)(8676002)(8936002)(4326008)(5660300002)(6636002)(316002)(6862004)(66946007)(66476007)(66556008)(6486002)(478600001)(26005)(6512007)(86362001)(41300700001)(6506007)(83380400001)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?I27UkG6PXkpojh3Prdh1XtdycUl3bqPRQsVHHXlkgNhJBQ3rVokOENSb2Oo+?= =?us-ascii?Q?zoqz1Vtavj2DTaDDIT49Etxe0OcGMHxCiZ9rZ9KNjzB5me1gHvahvpQxypLm?= =?us-ascii?Q?6mW+dUUwq/yfatp5GPn6xNuioxQ0o6O+VTIHJpin1+kZebzkUVo0fPBctnrV?= =?us-ascii?Q?UkGclKeHEuEG+2Rlu05G8hSgxRlngUfimZHV0utbNgkvhvIeYmSZ5ZRXZxBj?= =?us-ascii?Q?FcAFqkxHKEwAy9t0X0fJWxkBDVYP6WiMQ8ixlvJODQaZHT3/mZE3pKJ3DK2c?= =?us-ascii?Q?wcG6yTqseWaqB7AcxzXvfjE9ULoRwBWpHlUQOh6fDoNepq0sjDerlnloIbGB?= =?us-ascii?Q?kJEI8bVPVXdyhFYzuhwto8Tzd82gB0za65D00sinN6mvHAlDqTg36OJVsKIx?= =?us-ascii?Q?VLpI9PiXQV8Zs5bmwqgDDtH5oCPtyEVT4qFQp8gY5aQRqtP4Vro7c+UWgtTg?= =?us-ascii?Q?Q9+4U0ZdQW0U8IDiKyz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= =?us-ascii?Q?9z+emYusW9Ikm8sjryb5pPjhfoHkp9jPJP3QTqorJFDPFTzI8iihzW1q639e?= =?us-ascii?Q?ds5zvZJeRWwy3CGwyn1lYNwPAbxFZzm4UeV4oX0b3k+q6cF3JtZazUSJq41E?= =?us-ascii?Q?gNd6VFb/Vq9kM+oS5PbWFyDeSUKXotZF6uVGP75YHCouxtSe0ratQhoquijW?= =?us-ascii?Q?eOqPteso0KHF773YKaKybyud6SWAh4r7jlkUEL2/?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3a879a62-af03-4071-4c63-08dc286c40c2 X-MS-Exchange-CrossTenant-AuthSource: DS7PR12MB8252.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Feb 2024 06:07:39.1274 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: CGjBVfe2WXUANuuYWCfXKaosaCRxg3iKs7aDPp23CeF9afGPwe1sEZaib+RYz+HU/oN1VJLkHaKllLCFZ8eHsg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR12MB9113 On Thu, Feb 08, 2024 at 11:46:29AM +0800, Perry Yuan wrote: > Address an untested error where the nominal_freq was returned in KHz > instead of the correct MHz units, this oversight led to a wrong > nominal_freq set and resued, it will cause the max frequency of core to > be initialized with a wrong frequency value. The _CPC object on my Zen2 EPYC server which has CPPC v3, I see : 0x00000190, //LowestFrequency 0x000007D0 //NominalFrequency }) } where 0x7D0 is 2000 Mhz. Thus the value returend by cppc_perf.nominal_freq is in Mhz. In this patch, we are changing making amd_get_nominal_freq() return 2000 (Mhz) instead of 2000000 (Khz) as it was doing previously. amd_get_min_freq(), amd_get_max_freq(), amd_get_lowest_nonlinear_perf() -all these functions return the frequency in Khz units. These functions are used the initialize the value of cpudata->max_freq, cpu_data->min_freq, .... all of which are in Khz units. In, amd_pstate_set_boost(), we have: if (state) policy->cpuinfo.max_freq = cpudata->max_freq; <---- In Khz else policy->cpuinfo.max_freq = cpudata->nominal_freq; <--- Now in Mhz Since policy->cpuinfo.max_freq is expected to be in Khz, isn't this patch introducing an error ? Or perhaps this patch series is based on another patchset ? -- Thanks and Regards gautham. > > Cc: stable@vger.kernel.org > Fixes: ec437d71db7 ("cpufreq: amd-pstate: Introduce a new AMD P-State driver to support future processors") > Reviewed-by: Mario Limonciello > Signed-off-by: Perry Yuan > --- > drivers/cpufreq/amd-pstate.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c > index 08e112444c27..ac7faa98a450 100644 > --- a/drivers/cpufreq/amd-pstate.c > +++ b/drivers/cpufreq/amd-pstate.c > @@ -640,8 +640,7 @@ static int amd_get_nominal_freq(struct amd_cpudata *cpudata) > if (ret) > return ret; > > - /* Switch to khz */ > - return cppc_perf.nominal_freq * 1000; > + return cppc_perf.nominal_freq; > } > > static int amd_get_lowest_nonlinear_freq(struct amd_cpudata *cpudata) > -- > 2.34.1 >