Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp2413876rdg; Mon, 16 Oct 2023 03:59:32 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEzi6jxf4khC5bG05j3WLujfZ24sida0rb4R3ox0xSyxKv8WPkft4KxV0l2NFzPtxvU0Mfr X-Received: by 2002:a17:903:18a:b0:1c8:91d8:d5ca with SMTP id z10-20020a170903018a00b001c891d8d5camr24337776plg.42.1697453972237; Mon, 16 Oct 2023 03:59:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697453972; cv=none; d=google.com; s=arc-20160816; b=wWBboqwc9nUEbtQtK4z5ZRp8T95MUIXi/BYdSPUU6aL86fiBosoMhld8jasdMi7Re+ oOGQkcmV4G8NSEM46vNSbEZDFblVogU13Nch20538PVMzjI8E7deG+OvoWCv1pk2J2ZZ P95p2d3hdUyJGclJ9V/gtqQxs0l71BdF1qrermF+BNmJaaOJMockoegz9lU2+4FJoXar uLE3nD6aOzvdbeUejm1vWbKmcn/C0EHYOj2cVPIXAXN4aJAjpsSOr0AdxPf/OmKRSPBr Dx2mLss/WpBwttaW01+x+lSW+xYK56Re6g7/fnptkz2foCYd8QO7sYlp8kgvxAPzHGJ8 To1g== 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=P5ifjwAGWvwt8UdPAGRFDaEieTTOaEIZSTQ8cKCMbcA=; fh=XEfdWVU23ZHBnGq1w2ksn9kDHrmYBuulKZRo1Fv8Yg8=; b=IuFmkbWjOXZNrFtVBX3HmWcSTSxqmbZtpsPd7QIFECGPblidEZrfWLXLfe+GrUfaTL GXsrkGiO0eObORJIPy/A81hctrIgXbO7HgESh9KsDokmGo/uqxNklqn6oNW2l5r+5fAt oFY2+95v0TdyYG27D9mpQUCZpGRMZJQ10ZsDM2eTc+qUOZTKkp9jSGcafYi9o1b0FNr+ TgtpHeGeqY3wmWPWCi1Fwkc0fmBjUUB/arZJCzHycYB3XFYIgl3bsWQ0ERt94+GkGSwg Dgis804Pqx19QooiJJzH9OD1Sgk7iV9Wavbve/GoPK9yks922b5T0aF/zWyGFUCV+PEW 4FvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=cs7JmvWN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id r24-20020a170902be1800b001bbacfdad2fsi10092029pls.291.2023.10.16.03.59.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 03:59:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=cs7JmvWN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id CC28E808EEC8; Mon, 16 Oct 2023 03:59:29 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232986AbjJPK7V (ORCPT + 99 others); Mon, 16 Oct 2023 06:59:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60004 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230116AbjJPK7U (ORCPT ); Mon, 16 Oct 2023 06:59:20 -0400 Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 98C2795; Mon, 16 Oct 2023 03:59:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; 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=P5ifjwAGWvwt8UdPAGRFDaEieTTOaEIZSTQ8cKCMbcA=; b=cs7JmvWNb3ISfTeRVqrLDJ3hb6 4ejwBMKbJkO52e9dcJ0rJy3p6TH/1AcjMnL3vbVyA3AT3LgrwqkXMvgecAumcGpwX92Nrq7hlN8eY xRX9RPg6sT8dmS172NUE3cZRZk0ldfrB74gOYnO3otY0BZYHEocfAtWm18AWU+zKy4pSzNszJJ7/4 5oVtl1bL+1sSPuDZmzmsLkrkKbm6QR27dHMPH0Vo27gdhhJ1DSVzYQ+7KIGcttZQ0pgdlsy9kA/lz IExW1dYrYUX+pblYqRwDdd0hDvaunDI1tg7W6TsWAVi3oLqE/4scNTbUWWk1Oka/KccmsJ68uIcqq 9xfrY0Aw==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.96 #2 (Red Hat Linux)) id 1qsLJ6-005woe-0M; Mon, 16 Oct 2023 10:58:47 +0000 Received: by noisy.programming.kicks-ass.net (Postfix, from userid 1000) id 39C6B3005AA; Mon, 16 Oct 2023 12:58:45 +0200 (CEST) Date: Mon, 16 Oct 2023 12:58:45 +0200 From: Peter Zijlstra To: "Meng, Li (Jassmine)" Cc: "Rafael J . Wysocki" , "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" Subject: Re: [RESEND PATCH V9 3/7] cpufreq: amd-pstate: Enable amd-pstate preferred core supporting. Message-ID: <20231016105845.GA33217@noisy.programming.kicks-ass.net> References: <20231013033118.3759311-1-li.meng@amd.com> <20231013033118.3759311-4-li.meng@amd.com> <20231013160128.GB36211@noisy.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, 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 fry.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 (fry.vger.email [0.0.0.0]); Mon, 16 Oct 2023 03:59:30 -0700 (PDT) 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? 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. Also, same question as to the amd folks; what serializes those static variables?