Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp1250063rdb; Wed, 6 Dec 2023 12:58:51 -0800 (PST) X-Google-Smtp-Source: AGHT+IHLDgOTrywRjSs/q7NLK6gVVO4EpW7H1fpX/E7wUO9i7kgIr9IgF4hx28hu53Plq/yA6dMI X-Received: by 2002:a17:903:2307:b0:1d0:7f06:1741 with SMTP id d7-20020a170903230700b001d07f061741mr2065816plh.30.1701896331177; Wed, 06 Dec 2023 12:58:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701896331; cv=none; d=google.com; s=arc-20160816; b=HRPdIuaHOCCMQKb4LUC4BZo9gcSG8IbesfGq8bFqGuyyq17ePENrjt/K6R3g87osda aAraaFcNMXVP+G3b2FzPG9XfpZT6HC3sblm1r2XBfDsjAfYgIZ3UlEBMk4YF9UgleXvP Q/67noZApdhkfrGhi00qCnmaChbkoQdIUDVRsyT8DnR52okZnDoYqeo6EP7WBDlBcu0a nYNdiq59pcNWXavJXHxcdn4bENMts0SSptqps2I0N7YAOBbJRvP7BVlgStVlQLnAoAYA cQNepcHFWUyrWrgKL8vUXa6jdCS8CQ5c5NwQiVrhPDyVXaSCjh8TB4inCleQ+gzGmAhf phMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version; bh=AOeoclVMPx893aaW3hH5EpjAN+ZaLyumged6Cal0Tuw=; fh=dJukztSS+APvLpN6QR1cNhy7RO46D45kkbc/OJdzGAk=; b=D0NI8SK8au6i4qcWWo3QRYxkpJqeXO05rok/drYUFaSrZrnBfSl2dnQyri3lV2/hJS 62QZtPnm+wteQJGoxaOoOtzYKFRmfQT5lqj+7t35jZKQvjhVhBuvCjD+uJNCguB8noxg NvYHngU8wU9aSrsu0Y5ifZhFnpOqQUZS7uMWNDF1m8o8Z/FSKmY/v8GwX0ppQ9PlXkse b7RwnQ429yEdTrUhbF/JrC2YHMEGGIE+nOAWpYOI68shC2ZB362YPNtPDf4+tLhi+ZBc pnvLBlwzUQTVPZrzS8H0ifLMG6jlr/gLsR0s4zSjmWU4/g8yj3AFtN6C30oDZp6r0Jo7 tzZQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id h24-20020a170902ac9800b001d006d3b84csi355151plr.1.2023.12.06.12.58.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 12:58:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id B06EA80909F7; Wed, 6 Dec 2023 12:58:49 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379443AbjLFU6j convert rfc822-to-8bit (ORCPT + 99 others); Wed, 6 Dec 2023 15:58:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33330 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229780AbjLFU6h (ORCPT ); Wed, 6 Dec 2023 15:58:37 -0500 Received: from mail-oo1-f54.google.com (mail-oo1-f54.google.com [209.85.161.54]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3A628DC; Wed, 6 Dec 2023 12:58:44 -0800 (PST) Received: by mail-oo1-f54.google.com with SMTP id 006d021491bc7-58de9deec94so21994eaf.0; Wed, 06 Dec 2023 12:58:44 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701896323; x=1702501123; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=VteboLc0PuWVvYglmZVfyeUmWI8ColgUVaYDoWTMUuk=; b=IEAciPc5rtiIfN024Ww/2B0YoAxwZcs8rycx7ueswpPW2tUMNsKbJZm8NAZeAVskzm Qm9Ssy7s81GKMhVmm9xgzwcnBUzQLYyw5TypPWMUoK4LwS/huI/364XpKyAxOEg24LW/ lmvUjniR3e4tYdyDFJf+Dwd1lMqlVFE20kgsRG7YeRbykPQqb9yTIZ3rbZ1PnDjr/7Z0 +xgU4GvKbBtxtNMleUdLNcb+KVsmIcqhIX1/llWn8zsZa7meEywDYHn3mIENjRL2hjEO b+EbmWcCTMZHgJb/aRDBkKHP3L1JjGh1Ueq9H7+gBgBgnN/arNGgoBAFL8jZWgrdia1V XYVw== X-Gm-Message-State: AOJu0YyRnFEFXs9fkfN03t2Dd0gGkqwK4bbjnvNr6e9BOWchCUXBL9Hg 6ofylTTLsCMAM4odkhWH6U8+EQuSJzcuLOZTFpE= X-Received: by 2002:a05:6870:9e84:b0:1fa:f195:e3b4 with SMTP id pu4-20020a0568709e8400b001faf195e3b4mr3122262oab.2.1701896323415; Wed, 06 Dec 2023 12:58:43 -0800 (PST) MIME-Version: 1.0 References: <20231205063537.872834-1-li.meng@amd.com> <20231205063537.872834-5-li.meng@amd.com> In-Reply-To: <20231205063537.872834-5-li.meng@amd.com> From: "Rafael J. Wysocki" Date: Wed, 6 Dec 2023 21:58:32 +0100 Message-ID: Subject: Re: [PATCH V12 4/7] cpufreq: Add a notification message that the highest perf has changed 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 , Oleksandr Natalenko Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Wed, 06 Dec 2023 12:58:49 -0800 (PST) On Tue, Dec 5, 2023 at 7:38 AM Meng Li wrote: > > ACPI 6.5 section 8.4.6.1.1.1 specifies that Notify event 0x85 can be > emmitted to cause the the OSPM to re-evaluate the highest performance Typos above. Given the number of iterations of this patch, this is kind of disappointing. > register. Add support for this event. Also it would be nice to describe how this is supposed to work at least roughly, so it is not necessary to reverse-engineer the patch to find out that. > Tested-by: Oleksandr Natalenko > Reviewed-by: Mario Limonciello > Reviewed-by: Huang Rui > Reviewed-by: Perry Yuan > Signed-off-by: Meng Li > Link: https://uefi.org/specs/ACPI/6.5/05_ACPI_Software_Programming_Model.html#processor-device-notification-values > --- > drivers/acpi/processor_driver.c | 6 ++++++ > drivers/cpufreq/cpufreq.c | 13 +++++++++++++ > include/linux/cpufreq.h | 5 +++++ > 3 files changed, 24 insertions(+) > > diff --git a/drivers/acpi/processor_driver.c b/drivers/acpi/processor_driver.c > index 4bd16b3f0781..29b2fb68a35d 100644 > --- a/drivers/acpi/processor_driver.c > +++ b/drivers/acpi/processor_driver.c > @@ -27,6 +27,7 @@ > #define ACPI_PROCESSOR_NOTIFY_PERFORMANCE 0x80 > #define ACPI_PROCESSOR_NOTIFY_POWER 0x81 > #define ACPI_PROCESSOR_NOTIFY_THROTTLING 0x82 > +#define ACPI_PROCESSOR_NOTIFY_HIGEST_PERF_CHANGED 0x85 > > MODULE_AUTHOR("Paul Diefenbaugh"); > MODULE_DESCRIPTION("ACPI Processor Driver"); > @@ -83,6 +84,11 @@ static void acpi_processor_notify(acpi_handle handle, u32 event, void *data) > acpi_bus_generate_netlink_event(device->pnp.device_class, > dev_name(&device->dev), event, 0); > break; > + case ACPI_PROCESSOR_NOTIFY_HIGEST_PERF_CHANGED: > + cpufreq_update_highest_perf(pr->id); And the design appears to be a bit ad-hoc here. Because why does it have anything to do with cpufreq? > + acpi_bus_generate_netlink_event(device->pnp.device_class, > + dev_name(&device->dev), event, 0); > + break; > default: > acpi_handle_debug(handle, "Unsupported event [0x%x]\n", event); > break; > diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c > index 934d35f570b7..14a4cbc6dd05 100644 > --- a/drivers/cpufreq/cpufreq.c > +++ b/drivers/cpufreq/cpufreq.c > @@ -2717,6 +2717,19 @@ void cpufreq_update_limits(unsigned int cpu) > } > EXPORT_SYMBOL_GPL(cpufreq_update_limits); > > +/** > + * cpufreq_update_highest_perf - Update highest performance for a given CPU. > + * @cpu: CPU to update the highest performance for. > + * > + * Invoke the driver's ->update_highest_perf callback if present > + */ > +void cpufreq_update_highest_perf(unsigned int cpu) > +{ > + if (cpufreq_driver->update_highest_perf) > + cpufreq_driver->update_highest_perf(cpu); > +} > +EXPORT_SYMBOL_GPL(cpufreq_update_highest_perf); > + > /********************************************************************* > * BOOST * > *********************************************************************/ > diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h > index 1c5ca92a0555..f62257b2a42f 100644 > --- a/include/linux/cpufreq.h > +++ b/include/linux/cpufreq.h > @@ -235,6 +235,7 @@ int cpufreq_get_policy(struct cpufreq_policy *policy, unsigned int cpu); > void refresh_frequency_limits(struct cpufreq_policy *policy); > void cpufreq_update_policy(unsigned int cpu); > void cpufreq_update_limits(unsigned int cpu); > +void cpufreq_update_highest_perf(unsigned int cpu); > bool have_governor_per_policy(void); > bool cpufreq_supports_freq_invariance(void); > struct kobject *get_governor_parent_kobj(struct cpufreq_policy *policy); > @@ -263,6 +264,7 @@ static inline bool cpufreq_supports_freq_invariance(void) > return false; > } > static inline void disable_cpufreq(void) { } > +static inline void cpufreq_update_highest_perf(unsigned int cpu) { } > #endif > > #ifdef CONFIG_CPU_FREQ_STAT > @@ -380,6 +382,9 @@ struct cpufreq_driver { > /* Called to update policy limits on firmware notifications. */ > void (*update_limits)(unsigned int cpu); > > + /* Called to update highest performance on firmware notifications. */ > + void (*update_highest_perf)(unsigned int cpu); > + > /* optional */ > int (*bios_limit)(int cpu, unsigned int *limit); > > -- > 2.34.1 > >