Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 93463E7BD98 for ; Mon, 16 Feb 2026 11:24:01 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.1234018.1537386 (Exim 4.92) (envelope-from ) id 1vrwhg-0002sp-Aa; Mon, 16 Feb 2026 11:23:48 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 1234018.1537386; Mon, 16 Feb 2026 11:23:48 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1vrwhg-0002si-7R; Mon, 16 Feb 2026 11:23:48 +0000 Received: by outflank-mailman (input) for mailman id 1234018; Mon, 16 Feb 2026 11:23:47 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1vrwhf-0002sc-1z for xen-devel@lists.xenproject.org; Mon, 16 Feb 2026 11:23:47 +0000 Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [2a00:1450:4864:20::336]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id f4b6c3a9-0b29-11f1-b163-2bf370ae4941; Mon, 16 Feb 2026 12:23:45 +0100 (CET) Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-480706554beso29280795e9.1 for ; Mon, 16 Feb 2026 03:23:45 -0800 (PST) Received: from [10.156.60.236] (ip-037-024-206-209.um08.pools.vodafone-ip.de. [37.24.206.209]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-48371998777sm295430595e9.1.2026.02.16.03.23.44 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 16 Feb 2026 03:23:44 -0800 (PST) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: f4b6c3a9-0b29-11f1-b163-2bf370ae4941 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1771241025; x=1771845825; darn=lists.xenproject.org; h=content-transfer-encoding:in-reply-to:autocrypt:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:from:to:cc:subject:date:message-id:reply-to; bh=d0MRGEe9PhdyZSVoZm7FCFw+73byShpcGFnVOpsdpPk=; b=V2D1mry7c0/sGmKAQ+luiwNur7qjHf0U8rFUaI7XtZHL2xHzeP62FHdRpJ53s+5Ncf SbNfmH9+hM4B9vMYZx+YKMcKjnvJd+BBgcmsSESLcgsGns798x1ha7fqCPjuOf3ED3mZ /CBEehPSWUszrspNDgk82OrYhgQb9sUhUysIdLL9kAGCMQpRboK3NT/dT3DyQNEHlxH5 q+/auf2qBo7dVYjNgL5y78G3t6yhXEqJzD9DBOhxTMrG+Lz2Fy0Fgu0ueywVpbIFJeq0 vAIqsjX2iAAQRPYhNNbmVrim+x31qCUeculaH1+fmErsYV/0PT5ihaLz1MVQLG0vbNjW vL5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771241025; x=1771845825; h=content-transfer-encoding:in-reply-to:autocrypt:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=d0MRGEe9PhdyZSVoZm7FCFw+73byShpcGFnVOpsdpPk=; b=TMQpV5UeZQTIuxahxlHizi12f/SmlfXJgjMY6b8BtOIgXGAb1hzgqvZKABMewiOCwZ 7w0JBTOE0pr6oue3vcLeEK/iH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:47e:e48b:506d with SMTP id 5b1f17b1804b1-48379bab48bmr144721495e9.16.1771241024628; Mon, 16 Feb 2026 03:23:44 -0800 (PST) Message-ID: <444c41c8-a0ed-4780-81a2-c04df7938ed2@suse.com> Date: Mon, 16 Feb 2026 12:23:46 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v4] x86/cpufreq: Add Kconfig option for CPU frequency scaling To: Stefano Stabellini Cc: andrew.cooper3@citrix.com, roger.pau@citrix.com, jason.andryuk@amd.com, alejandro.garciavallejo@amd.com, xen-devel@lists.xenproject.org References: <20260213235102.359472-1-stefano.stabellini@amd.com> Content-Language: en-US From: Jan Beulich Autocrypt: addr=jbeulich@suse.com; keydata= xsDiBFk3nEQRBADAEaSw6zC/EJkiwGPXbWtPxl2xCdSoeepS07jW8UgcHNurfHvUzogEq5xk hu507c3BarVjyWCJOylMNR98Yd8VqD9UfmX0Hb8/BrA+Hl6/DB/eqGptrf4BSRwcZQM32aZK 7Pj2XbGWIUrZrd70x1eAP9QE3P79Y2oLrsCgbZJfEwCgvz9JjGmQqQkRiTVzlZVCJYcyGGsD /0tbFCzD2h20ahe8rC1gbb3K3qk+LpBtvjBu1RY9drYk0NymiGbJWZgab6t1jM7sk2vuf0Py O9Hf9XBmK0uE9IgMaiCpc32XV9oASz6UJebwkX+zF2jG5I1BfnO9g7KlotcA/v5ClMjgo6Gl MDY4HxoSRu3i1cqqSDtVlt+AOVBJBACrZcnHAUSuCXBPy0jOlBhxPqRWv6ND4c9PH1xjQ3NP nxJuMBS8rnNg22uyfAgmBKNLpLgAGVRMZGaGoJObGf72s6TeIqKJo/LtggAS9qAUiuKVnygo 3wjfkS9A3DRO+SpU7JqWdsveeIQyeyEJ/8PTowmSQLakF+3fote9ybzd880fSmFuIEJldWxp Y2ggPGpiZXVsaWNoQHN1c2UuY29tPsJgBBMRAgAgBQJZN5xEAhsDBgsJCAcDAgQVAggDBBYC AwECHgECF4AACgkQoDSui/t3IH4J+wCfQ5jHdEjCRHj23O/5ttg9r9OIruwAn3103WUITZee e7Sbg12UgcQ5lv7SzsFNBFk3nEQQCACCuTjCjFOUdi5Nm244F+78kLghRcin/awv+IrTcIWF hUpSs1Y91iQQ7KItirz5uwCPlwejSJDQJLIS+QtJHaXDXeV6NI0Uef1hP20+y8qydDiVkv6l IreXjTb7DvksRgJNvCkWtYnlS3mYvQ9NzS9PhyALWbXnH6sIJd2O9lKS1Mrfq+y0IXCP10eS FFGg+Av3IQeFatkJAyju0PPthyTqxSI4lZYuJVPknzgaeuJv/2NccrPvmeDg6Coe7ZIeQ8Yj t0ARxu2xytAkkLCel1Lz1WLmwLstV30g80nkgZf/wr+/BXJW/oIvRlonUkxv+IbBM3dX2OV8 AmRv1ySWPTP7AAMFB/9PQK/VtlNUJvg8GXj9ootzrteGfVZVVT4XBJkfwBcpC/XcPzldjv+3 HYudvpdNK3lLujXeA5fLOH+Z/G9WBc5pFVSMocI71I8bT8lIAzreg0WvkWg5V2WZsUMlnDL9 mpwIGFhlbM3gfDMs7MPMu8YQRFVdUvtSpaAs8OFfGQ0ia3LGZcjA6Ik2+xcqscEJzNH+qh8V m5jjp28yZgaqTaRbg3M/+MTbMpicpZuqF4rnB0AQD12/3BNWDR6bmh+EkYSMcEIpQmBM51qM EKYTQGybRCjpnKHGOxG0rfFY1085mBDZCH5Kx0cl0HVJuQKC+dV2ZY5AqjcKwAxpE75MLFkr wkkEGBECAAkFAlk3nEQCGwwACgkQoDSui/t3IH7nnwCfcJWUDUFKdCsBH/E5d+0ZnMQi+G0A nAuWpQkjM1ASeQwSHEeAWPgskBQL In-Reply-To: <20260213235102.359472-1-stefano.stabellini@amd.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 14.02.2026 00:51, Stefano Stabellini wrote: > Add CONFIG_CPUFREQ to allow CPU frequency scaling support to be > disabled at build time. When disabled, this removes cpufreq code > from the build. > > Introduce IS_ENABLED(CONFIG_CPUFREQ) checks for relevant do_pm_op and > do_platform_op subops and other functions that require CONFIG_CPUFREQ to > work. > > Add stubs where necessary. > > Signed-off-by: Stefano Stabellini > --- > Changes in v4: > - fix IS_ENABLED(CPUFREQ) > - remove #ifdef in platform_hypercall.c and use DCE > - move cpufreq_controller enum out of #ifdef Where did the v3 revlog go? Especially when submit patches faster than people can look at them, they might skip a version (or more), while still having looked at a yet earlier one. > --- a/xen/drivers/acpi/pm-op.c > +++ b/xen/drivers/acpi/pm-op.c > @@ -367,7 +367,8 @@ int do_pm_op(struct xen_sysctl_pm_op *op) > return ret; > } > > - if ( op->cpuid >= nr_cpu_ids || !cpu_online(op->cpuid) ) > + if ( op->cpuid >= nr_cpu_ids || !cpu_online(op->cpuid) || > + !IS_ENABLED(CONFIG_CPUFREQ) ) Have the compile time constant part first? Else any possible side effects of the other expressions may prevent the compiler from fully dropping all code here. > --- a/xen/include/acpi/cpufreq/cpufreq.h > +++ b/xen/include/acpi/cpufreq/cpufreq.h > @@ -381,8 +381,19 @@ int write_ondemand_up_threshold(unsigned int up_threshold); > > int write_userspace_scaling_setspeed(unsigned int cpu, unsigned int freq); > > +#ifdef CONFIG_CPUFREQ > +int cpufreq_add_cpu(unsigned int cpu); > +int cpufreq_del_cpu(unsigned int cpu); > + > void cpufreq_dbs_timer_suspend(void); > void cpufreq_dbs_timer_resume(void); > +#else > +static inline int cpufreq_add_cpu(unsigned int cpu) { return -EOPNOTSUPP; } > +static inline int cpufreq_del_cpu(unsigned int cpu) { return -EOPNOTSUPP; } Returning an error here looks wrong, even if technically it is benign right now (as the one [each] remaining call doesn't check the error code). > --- a/xen/include/xen/acpi.h > +++ b/xen/include/xen/acpi.h > @@ -186,7 +186,15 @@ static inline void acpi_set_csubstate_limit(unsigned int new_limit) { return; } > #endif > > #ifdef XEN_GUEST_HANDLE > +#ifdef CONFIG_CPUFREQ > int acpi_set_pdc_bits(unsigned int acpi_id, XEN_GUEST_HANDLE(uint32)); > +#else > +static inline int acpi_set_pdc_bits(unsigned int acpi_id, > + XEN_GUEST_HANDLE(uint32) pdc) > +{ > + return -EOPNOTSUPP; Here use of an error indicator would result in the XENPF_set_processor_pminfo sub-op failing. That's not correct, as this is a notification from Dom0 to us. If we can't make use of the provided data, we should silently ignore it. > --- a/xen/include/xen/pmstat.h > +++ b/xen/include/xen/pmstat.h > @@ -5,10 +5,23 @@ > #include /* for struct xen_processor_power */ > #include /* for struct pm_cx_stat */ > > +#ifdef CONFIG_CPUFREQ > int set_px_pminfo(uint32_t acpi_id, struct xen_processor_performance *perf); > -long set_cx_pminfo(uint32_t acpi_id, struct xen_processor_power *power); > int set_cppc_pminfo(unsigned int acpi_id, > const struct xen_processor_cppc *cppc_data); > +#else > +static inline int set_px_pminfo(uint32_t acpi_id, > + struct xen_processor_performance *perf) > +{ > + return -EOPNOTSUPP; > +} > +static inline int set_cppc_pminfo(unsigned int acpi_id, > + const struct xen_processor_cppc *cppc_data) > +{ > + return -EOPNOTSUPP; > +} Same here, I suppose. > --- a/xen/include/xen/sched.h > +++ b/xen/include/xen/sched.h > @@ -1259,6 +1259,7 @@ extern enum cpufreq_controller { > FREQCTL_none, FREQCTL_dom0_kernel, FREQCTL_xen > } cpufreq_controller; As previously indicated, these might better be invisible when CPUFREQ=n. But see also below. How about (name subject to improvement) static inline is_hwdom_cpufreq_controller(void) { #ifdef CONFIG_CPUFREQ return cpufreq_controller == FREQCTL_dom0_kernel; #else return false; #endif } for use both ... > +#ifdef CONFIG_CPUFREQ > static always_inline bool is_cpufreq_controller(const struct domain *d) > { > /* > @@ -1274,6 +1275,12 @@ static always_inline bool is_cpufreq_controller(const struct domain *d) > return (is_pv_domain(d) && is_hardware_domain(d) && > cpufreq_controller == FREQCTL_dom0_kernel); ... here and in do_platform_op()? Or, keeping the enum visible, static inline is_hwdom_cpufreq_controller(void) { return IS_ENABLED(CONFIG_CPUFREQ) && cpufreq_controller == FREQCTL_dom0_kernel; } Of course the possibly-compile-time-constant part of the expression would then want to move first, to allow the fencing in is_pv_domain() to also be dropped. > } > +#else > +static always_inline bool is_cpufreq_controller(const struct domain *d) > +{ > + return false; > +} > +#endif Too much redundancy: The #ifdef would better be in the function body. But with the other adjustment the need for an #ifdef would disappear here anyway. Jan