Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp2650958rdg; Mon, 16 Oct 2023 10:27:35 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFF7ccDw98Q8ieE4HHlnQ0Sjb9z1O1h6ndKcBqXm31SMjK5+6ZQMoxphgbF9LA26ozkrNg9 X-Received: by 2002:a17:90a:be16:b0:27d:7ebe:2e8 with SMTP id a22-20020a17090abe1600b0027d7ebe02e8mr4109652pjs.9.1697477255086; Mon, 16 Oct 2023 10:27:35 -0700 (PDT) Return-Path: Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id oa8-20020a17090b1bc800b0027d535cebb9si6899157pjb.128.2023.10.16.10.27.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 10:27:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=ifJCNV9s; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id A3DC58020FA0; Mon, 16 Oct 2023 10:27:32 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232709AbjJPR1U (ORCPT + 99 others); Mon, 16 Oct 2023 13:27:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55916 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232295AbjJPR1S (ORCPT ); Mon, 16 Oct 2023 13:27:18 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.7]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0ADD3A2; Mon, 16 Oct 2023 10:27:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1697477237; x=1729013237; h=message-id:date:subject:to:cc:references:from: in-reply-to:content-transfer-encoding:mime-version; bh=FLb/iaBsDgmtPKRnNCTcAPNw9W60fhMt+PB23hULpi8=; b=ifJCNV9sc7WAHA2pWJFUCpZ/Bz26wgbWBBHNAbaOA/hAip9A4Yk9rAdz Yi7Rf9LxUwOcgxEDEv6ckOGB1cOSQAESAX3xSIX9tN/rwTiWQcr/dDpPV NGpINEhvOivpVfPRcOnMzBOHmvMkkTnfn22w6KNC6eX76txSiFQxueNdc noMkAbiINVuUkDEZeOJqI4JstVJ5JcLzKAcbJMJnnaTshD7DXmr4RbacZ 7a8jT1w4z1Hzmaj7HV8E6QtT2VxbSv0t2ReHZrg1naVBouagS1s2W3TND PK9LZDbxLorhpYKueSsOwhAaGZDvXBgYDsNIaccg4rSesRMFThaXk9mDf A==; X-IronPort-AV: E=McAfee;i="6600,9927,10865"; a="7163216" X-IronPort-AV: E=Sophos;i="6.03,229,1694761200"; d="scan'208";a="7163216" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmvoesa101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Oct 2023 10:27:17 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10865"; a="821647830" X-IronPort-AV: E=Sophos;i="6.03,229,1694761200"; d="scan'208";a="821647830" Received: from fmsmsx603.amr.corp.intel.com ([10.18.126.83]) by fmsmga008.fm.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 16 Oct 2023 10:27:16 -0700 Received: from fmsmsx612.amr.corp.intel.com (10.18.126.92) by fmsmsx603.amr.corp.intel.com (10.18.126.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.32; Mon, 16 Oct 2023 10:27:15 -0700 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx612.amr.corp.intel.com (10.18.126.92) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.32; Mon, 16 Oct 2023 10:27:15 -0700 Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.32 via Frontend Transport; Mon, 16 Oct 2023 10:27:15 -0700 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (104.47.70.100) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.32; Mon, 16 Oct 2023 10:27:13 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QfC3NNC6297nqqedtvpjKoTZCCe+K7a3HOO+lEr4/2UFVF2WyOKrZLqgopgKtpzHKWAhEq5j1X6WE/YD9gieLk6FftQ8IRfN29/iEtc1kksNuqFhfHWOjpuIsEp0bp8MggWoBTyucoLx0Yr3efiC/7SMEiZit7vBaElq7R5aJo96JAWaSocRH6T5bVx5G5sfipj5FFgdQUgkYUYflx5IoZ/Ce9FxZ7WaupstoV1U2N+eS7KAgvB1oyYA+Juwr8j6OADoD6NcNJKHpojM9qhrIzKEMD8wOV2wrQ5bm1jZWCi4MKNXopGQ2/BdZMJ90wUYoGw4uy7UkkPF3EbZst5zWg== 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=SzkO46YvHGWdujnr43Gw5LuPBto2TBqZe84AnZwXrPo=; b=On+fGsvP4rMyDY3wMrf+tRtk5BuPzbrK5BffBU/UuF2xtkCT/JfcK48k5fq+oTnU2eYQes7kwM2uy0ExR+2UQ5JABrKp1nuX2zcTYlf3gxVct/lnKSa5ERiQCdQPXHFVf40yIofzUGsPcHLn7SFFrtxWMyX8RSIfBYrEQWhCHA13RpU7+q9JE0qiE/zqHnimyJQtj8evRj9TVU4k8/o2lDCghv9Eww8jDl4IMklwAy+nlpSrwSHo6V98XGCp69TFArQxwKjicvsIpLoVIv23RbEHUBjpGtt0QzqPNRoFKG/qSW+mJ35HRvRXVQYKOiw5rLmoCUmKmOj0RHWf7LsI8Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from MW5PR11MB5810.namprd11.prod.outlook.com (2603:10b6:303:192::22) by BL1PR11MB6027.namprd11.prod.outlook.com (2603:10b6:208:392::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.45; Mon, 16 Oct 2023 17:27:11 +0000 Received: from MW5PR11MB5810.namprd11.prod.outlook.com ([fe80::e420:d67c:ef82:cb64]) by MW5PR11MB5810.namprd11.prod.outlook.com ([fe80::e420:d67c:ef82:cb64%4]) with mapi id 15.20.6863.046; Mon, 16 Oct 2023 17:27:11 +0000 Message-ID: Date: Mon, 16 Oct 2023 19:27:03 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.15.1 Subject: Re: [RESEND PATCH V9 3/7] cpufreq: amd-pstate: Enable amd-pstate preferred core supporting. Content-Language: en-US To: Peter Zijlstra , "Meng, Li (Jassmine)" , Srinivas Pandruvada CC: "Huang, Ray" , "linux-pm@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "x86@kernel.org" , "linux-acpi@vger.kernel.org" , Shuah Khan , "linux-kselftest@vger.kernel.org" , "Fontenot, Nathan" , "Sharma, Deepak" , "Deucher, Alexander" , "Limonciello, Mario" , "Huang, Shimmer" , "Yuan, Perry" , "Du, Xiaojian" , "Viresh Kumar" , Borislav Petkov , "Oleksandr Natalenko" , "Karny, Wyes" References: <20231013033118.3759311-1-li.meng@amd.com> <20231013033118.3759311-4-li.meng@amd.com> <20231013160128.GB36211@noisy.programming.kicks-ass.net> <20231016105845.GA33217@noisy.programming.kicks-ass.net> From: "Wysocki, Rafael J" In-Reply-To: <20231016105845.GA33217@noisy.programming.kicks-ass.net> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: WA0P291CA0001.POLP291.PROD.OUTLOOK.COM (2603:10a6:1d0:1::27) To MW5PR11MB5810.namprd11.prod.outlook.com (2603:10b6:303:192::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MW5PR11MB5810:EE_|BL1PR11MB6027:EE_ X-MS-Office365-Filtering-Correlation-Id: 86243206-5069-4e18-7e11-08dbce6d2179 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: hGbw8wvQvXOHLgqb58ufbsl4j2pxsxmCL8VS1lEV+DdTq6tlFqGd8rvihsctrGOsz3vKE7VYvJT4NBaVJjuEYcL30We1z5QsE1sVixs+/NgQzgrTOEESDLfk4ruTaNNFKEH6Phn446utGpwXva7j2EOpWzbGt/P+cOZqT7gz7j6EVV+/XAJOmz4r22RZe9wjb0Gq1fy1sLzuTa6sY0Wnzivaj8AK1TFXRrzbuYjzaim385HlpWhO1MG43ODEnw+T8CPmMYk+Cp0vqlB2Wg6rnaMxdoiBeP3Ebt7OynHOZXZJ3Eube9j1EO3Z9cEUvpx5NovLmEHFBwL2agRkZ4A3QC0XbBmKG/bhtuF+kjuzVhIBv0NZalfIAMh4LEtPjbDm2ve+TCqqFhe7YUOv04xDGFXYin/JX0FfrIi2HaANc3leCCcZE+lse7FhBhwhotJdAmS2YyimsI7WrkbfTQbN/ly9sTaAK19jUvehpXyITuo0ZVHaEZwTUv+WBUAQEGfucAnKrgsPQFn4MnQ38xmU56/byAnfBpLS3kcqRjCcxb51vsiGgrsC5nzz5nzc7bYBo0+D90/cWjmFGL8i1m0Zs/CwO8PEjSUKQS7xxkVRevSglrgEWI9PCg4AGyktqBF/CKJXmNv+e1Xv2O0iD5W7BA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MW5PR11MB5810.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(396003)(39860400002)(136003)(346002)(366004)(376002)(230922051799003)(64100799003)(451199024)(186009)(1800799009)(316002)(66476007)(66556008)(54906003)(110136005)(66946007)(2906002)(36756003)(38100700002)(7416002)(86362001)(31696002)(82960400001)(41300700001)(4326008)(8936002)(5660300002)(8676002)(6512007)(2616005)(6666004)(6506007)(53546011)(26005)(31686004)(478600001)(6486002)(43740500002)(45980500001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?Qzl1VE00UzFKeXRtdU00L3J3MjduK0gvTTlpSm5aL1plL2VmTjY1U1lISHQ5?= =?utf-8?B?NjFadDN4aWRYQUNQQ3VwRzkycEVaS3lZWjExUHhrWmtIaTlLSjEyRzJRcjRi?= =?utf-8?B?akF2dkhNajc5aDVOM2pPdU5aN25kaGJPMGwvc0FqWTJZUjRIbG15Y3I0aTlE?= =?utf-8?B?bFd1Z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hUzBpYUN3?= =?utf-8?B?d0dzdHZKOEhhN3VDOWVrOTg1UXYxQTVRUnhnQ052VnNZNlZOdmNITXJ4bDRl?= =?utf-8?B?TlVJWUNLdTVwd05uTmQzb0VUYmFJYlIvSnlZWXV5ckRMaWhJcDg0TWQxOFJs?= =?utf-8?B?NTYvc2plT3hHbnBDZWs1VkdZV0hlMUNCY3RhQmZDTkx6Y3dZMlNndEpDTHpU?= =?utf-8?B?aXc9PQ==?= X-MS-Exchange-CrossTenant-Network-Message-Id: 86243206-5069-4e18-7e11-08dbce6d2179 X-MS-Exchange-CrossTenant-AuthSource: MW5PR11MB5810.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Oct 2023 17:27:11.4062 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 3eTYn9fFAa7Ho1BShqUDYB/7sZLJANQzse8ADU1C/bDdw4+QUTTl3He4U17EyWxd+V+iGdqwUlsbyvoZplgtwG5wBkrkA33ocJn5UtcJaSo= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL1PR11MB6027 X-OriginatorOrg: intel.com X-Spam-Status: No, score=-4.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Mon, 16 Oct 2023 10:27:32 -0700 (PDT) On 10/16/2023 12:58 PM, Peter Zijlstra wrote: > On Mon, Oct 16, 2023 at 06:20:53AM +0000, Meng, Li (Jassmine) wrote: >>>> +static void amd_pstate_init_prefcore(struct amd_cpudata *cpudata) { >>>> + int ret, prio; >>>> + u32 highest_perf; >>>> + static u32 max_highest_perf = 0, min_highest_perf = U32_MAX; >>> What serializes these things? >>> >>> Also, *why* are you using u32 here, what's wrong with something like: >>> >>> int max_hp = INT_MIN, min_hp = INT_MAX; >>> >> [Meng, Li (Jassmine)] >> We use ITMT architecture to utilize preferred core features. >> Therefore, we need to try to be consistent with Intel's implementation >> as much as possible. For details, please refer to the >> intel_pstate_set_itmt_prio function in file intel_pstate.c. (Line 355) >> >> I think using the data type of u32 is consistent with the data >> structures of cppc_perf_ctrls and amd_cpudata etc. > Rafael, should we fix intel_pstate too? Srinivas should be more familiar with this code than I am, so adding him. > The point is, that sched_asym_prefer(), the final consumer of these > values uses int and thus an explicitly signed compare. > > Using u32 and U32_MAX anywhere near the setting the priority makes > absolutely no sense. > > If you were to have the high bit set, things do not behave as expected. Right, but in practice these values are always between 0 and 255 inclusive AFAICS. It would have been better to use u8 I suppose. > Also, same question as to the amd folks; what serializes those static > variables? That's a good one.