Received: by 2002:a05:6359:6284:b0:131:369:b2a3 with SMTP id se4csp4670186rwb; Tue, 8 Aug 2023 11:51:15 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEUciVtOJBgE3ci76E37NwV1RdjkbGIsezRwONr0c/Iaprk7n2VuHIKAbp+s4AWwldcoIdM X-Received: by 2002:a17:907:a411:b0:993:f664:ce25 with SMTP id sg17-20020a170907a41100b00993f664ce25mr11504776ejc.19.1691520675024; Tue, 08 Aug 2023 11:51:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691520675; cv=none; d=google.com; s=arc-20160816; b=jyZO6cxsgORfvJSX7MTmqIIUHb3qGC+D7XP1pN35mkdJc7U+U43M+4SrCUZXBGKURf 38uTc3nifDECiMew4iJkzS1M/aEa12M2ZV2ModObokRDo9EO4F5ON71V15ZSDoqwFPxj 4kY7gPTY0HOmg+GseWzzizl0jnu2ukB+5Rs29Q+oBq+qglDHcwBeb5TXfCNFVYp/K5XD uU+LYAMQOdgxt2fnQtq/xNuDqz3Bpp5qZAbQczn6KjKqaaf3JGuH/tYc6VIiew52G1N9 Qs2pzw933t2/OrjfgwjGRZToV22CPUhsQ2kfoklcWltQ9VZiNj0jplcIEkVjdhYI+mUQ ggmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=1E5Xb4mTlI5my7Fl2wybf8Wnwo2X+ZiGlfBansiZhhQ=; fh=oPNGUt1IF6mwIdx12IIDVunQEbE8KJL7qEg7dEYyopc=; b=NDSpTRzuThFQc+PLrzRLrHpX1G33FLiCyQNEeBnG/Bx4MplXYppDa6hj0K152EMkgz x1l/YTpIcEYP03jbWsOFm/Ug2uXduAJe4iCGcQgvfCpx4BOrb3vzJWyviYbui+R7ENo1 +DFtyKthsjOwGPbaB0UhZ/Kt2vpWR/GyTbH2ksr/iBNj/NAg5gIOj2RkWsY0WlKzSUWq ra2sA6QMHUNLj+KleMzZBAWkDVJTpFOWZv6i0MA11Drn6ME10FUyTnTXRxPBvvwP4d5m ZVuual92jeD45u4mFylqYxExBw5MVJ9IB+UZRlmY+LU8awKbeqq9EurWT6wYmTTMqhzi qXAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=ZAtwYPsf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p6-20020a17090635c600b0099bd24d66aasi6620373ejb.383.2023.08.08.11.50.49; Tue, 08 Aug 2023 11:51:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=ZAtwYPsf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234712AbjHHRa2 (ORCPT + 99 others); Tue, 8 Aug 2023 13:30:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36234 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234626AbjHHR3x (ORCPT ); Tue, 8 Aug 2023 13:29:53 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DB67421786; Tue, 8 Aug 2023 09:12:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=1E5Xb4mTlI5my7Fl2wybf8Wnwo2X+ZiGlfBansiZhhQ=; b=ZAtwYPsfE60mHVpJIFk/gIvr7O 6vk8MaE6gPTwSXVl1PAaO4fggnI4YkMO2nNDjnLcdbbAXPRxrfM3+ib2XVBnWsAwFMgNSNtmxKA9N eC0WGKACsplVzoflNfcZ7dDrBun0Os47F4uZm3Yjuya8MEQ5bTbqFu192EO5wrOdw3swWmx+isshi N4dwURI0WMArg/qvkPlZBZyvQINv99TKUjplBNA24zvJQ6ZxEggsS1yhOEHcRN2Kg2VBgo68tCd3S Z1XPDBkjxhHIVYvSdpLD+0TcLFi7Np3pQwLRc1yzkzPAAaCp2SqoYhJZk04uZeHz1YCXkGjgPUqc+ Vtp85m6A==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1qTIfr-00GZEv-1b; Tue, 08 Aug 2023 09:06:43 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id DF7C730003A; Tue, 8 Aug 2023 11:06:41 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id C73062028B118; Tue, 8 Aug 2023 11:06:41 +0200 (CEST) Date: Tue, 8 Aug 2023 11:06:41 +0200 From: Peter Zijlstra To: Meng Li Cc: "Rafael J . Wysocki" , Huang Rui , 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, Nathan Fontenot , Deepak Sharma , Alex Deucher , Mario Limonciello , Shimmer Huang , Perry Yuan , Xiaojian Du , Viresh Kumar , Borislav Petkov Subject: Re: [PATCH V1 2/6] cpufreq: amd-pstate: Enable AMD Pstate Preferred Core Supporting. Message-ID: <20230808090641.GV212435@hirez.programming.kicks-ass.net> References: <20230808081001.2215240-1-li.meng@amd.com> <20230808081001.2215240-3-li.meng@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230808081001.2215240-3-li.meng@amd.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 08, 2023 at 04:09:57PM +0800, Meng Li wrote: > +static int amd_pstate_get_highest_perf(int cpu, u64 *highest_perf) > +{ > + int ret; > + > + if (boot_cpu_has(X86_FEATURE_CPPC)) { > + u64 cap1; > + > + ret = rdmsrl_safe_on_cpu(cpu, MSR_AMD_CPPC_CAP1, &cap1); > + if (ret) > + return ret; > + WRITE_ONCE(*highest_perf, AMD_CPPC_HIGHEST_PERF(cap1)); > + } else { > + ret = cppc_get_highest_perf(cpu, highest_perf); > + } > + > + return (ret); > +} > + > +static void amd_pstate_init_prefcore(void) > +{ > + int cpu, ret; > + u64 highest_perf; > + > + if (no_prefcore) > + return; > + > + for_each_possible_cpu(cpu) { > + ret = amd_pstate_get_highest_perf(cpu, &highest_perf); > + if (ret) > + break; So what is the intended behaviour when online != possible ? > + sched_set_itmt_core_prio(highest_perf, cpu); > + } > + > + /* > + * This code can be run during CPU online under the > + * CPU hotplug locks, so sched_set_amd_prefcore_support() > + * cannot be called from here. Queue up a work item > + * to invoke it. > + */ > + schedule_work(&sched_prefcore_work); > +}