From: Peter Zijlstra <peterz@infradead.org>
To: David Dai <davidai@google.com>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>,
Viresh Kumar <viresh.kumar@linaro.org>,
Ingo Molnar <mingo@redhat.com>,
Juri Lelli <juri.lelli@redhat.com>,
Vincent Guittot <vincent.guittot@linaro.org>,
Dietmar Eggemann <dietmar.eggemann@arm.com>,
Steven Rostedt <rostedt@goodmis.org>,
Ben Segall <bsegall@google.com>, Mel Gorman <mgorman@suse.de>,
Daniel Bristot de Oliveira <bristot@redhat.com>,
Valentin Schneider <vschneid@redhat.com>,
Saravana Kannan <saravanak@google.com>,
kernel-team@android.com, linux-kernel@vger.kernel.org,
linux-pm@vger.kernel.org
Subject: Re: [RFC PATCH 6/6] cpufreq: add kvm-cpufreq driver
Date: Wed, 5 Apr 2023 10:22:56 +0200 [thread overview]
Message-ID: <20230405082256.GY4253@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <20230330224348.1006691-7-davidai@google.com>
On Thu, Mar 30, 2023 at 03:43:41PM -0700, David Dai wrote:
> +struct remote_data {
> + int ret;
> + struct cpufreq_frequency_table *table;
> +};
> +
> +static void remote_get_freqtbl_num_entries(void *data)
> +{
> + struct arm_smccc_res hvc_res;
> + u32 freq = 1UL;
> + int *idx = data;
> +
> + while (freq != CPUFREQ_TABLE_END) {
> + arm_smccc_1_1_invoke(ARM_SMCCC_VENDOR_HYP_KVM_GET_CPUFREQ_TBL_FUNC_ID,
> + *idx, &hvc_res);
> + if (hvc_res.a0) {
> + *idx = -ENODEV;
> + return;
> + }
> + freq = hvc_res.a1;
> + (*idx)++;
> + }
> +}
> +
> +static int kvm_cpufreq_get_freqtbl_num_entries(int cpu)
> +{
> + int num_entries = 0;
> +
> + smp_call_function_single(cpu, remote_get_freqtbl_num_entries, &num_entries, true);
> + return num_entries;
> +}
> +
> +static void remote_populate_freqtbl(void *data)
> +{
> + struct arm_smccc_res hvc_res;
> + struct remote_data *freq_data = data;
> + struct cpufreq_frequency_table *pos;
> + struct cpufreq_frequency_table *table = freq_data->table;
> + int idx;
> +
> + cpufreq_for_each_entry_idx(pos, table, idx) {
> + arm_smccc_1_1_invoke(ARM_SMCCC_VENDOR_HYP_KVM_GET_CPUFREQ_TBL_FUNC_ID,
> + idx, &hvc_res);
> + if (hvc_res.a0) {
> + freq_data->ret = -ENODEV;
> + return;
> + }
> + pos->frequency = hvc_res.a1;
> + }
> + freq_data->ret = 0;
> +}
> +
> +static int kvm_cpufreq_populate_freqtbl(struct cpufreq_frequency_table *table, int cpu)
> +{
> + struct remote_data freq_data;
> +
> + freq_data.table = table;
> + smp_call_function_single(cpu, remote_populate_freqtbl, &freq_data, true);
> + return freq_data.ret;
> +}
*WHY* are you sending IPIs to do a hypercall ?!?
You can simply have the hypercall tell what vCPU you're doing this for.
next prev parent reply other threads:[~2023-04-05 8:23 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-30 22:43 [RFC PATCH 0/6] Improve VM DVFS and task placement behavior David Dai
2023-03-30 22:43 ` [RFC PATCH 1/6] sched/fair: Add util_guest for tasks David Dai
2023-04-03 11:40 ` Dietmar Eggemann
2023-04-04 1:11 ` David Dai
2023-04-05 8:29 ` Quentin Perret
2023-04-05 10:50 ` Dietmar Eggemann
2023-04-05 21:42 ` Saravana Kannan
2023-04-05 23:36 ` David Dai
2023-04-05 8:14 ` Peter Zijlstra
2023-04-05 22:54 ` David Dai
2023-04-06 7:33 ` Peter Zijlstra
2023-03-30 22:43 ` [RFC PATCH 2/6] kvm: arm64: Add support for get_cur_cpufreq service David Dai
2023-04-05 8:04 ` Quentin Perret
2023-03-30 22:43 ` [RFC PATCH 3/6] kvm: arm64: Add support for util_hint service David Dai
2023-03-30 22:43 ` [RFC PATCH 4/6] kvm: arm64: Add support for get_freqtbl service David Dai
2023-03-30 22:43 ` [RFC PATCH 5/6] dt-bindings: cpufreq: add bindings for virtual kvm cpufreq David Dai
2023-03-30 22:43 ` [RFC PATCH 6/6] cpufreq: add kvm-cpufreq driver David Dai
2023-04-05 8:22 ` Peter Zijlstra [this message]
2023-04-05 22:42 ` David Dai
2023-03-30 23:20 ` [RFC PATCH 0/6] Improve VM DVFS and task placement behavior Oliver Upton
2023-03-30 23:36 ` Saravana Kannan
2023-03-30 23:40 ` Oliver Upton
2023-03-31 0:34 ` Saravana Kannan
2023-03-31 0:49 ` Matthew Wilcox
2023-04-03 10:18 ` Mel Gorman
2023-04-04 19:43 ` Oliver Upton
2023-04-04 20:49 ` Marc Zyngier
2023-04-05 7:48 ` Quentin Perret
2023-04-05 8:33 ` Vincent Guittot
2023-04-05 21:07 ` Saravana Kannan
2023-04-06 12:52 ` Quentin Perret
2023-04-06 21:39 ` David Dai
2023-04-05 21:00 ` Saravana Kannan
2023-04-06 8:42 ` Marc Zyngier
2023-04-05 8:05 ` Peter Zijlstra
2023-04-05 21:08 ` Saravana Kannan
2023-04-06 7:36 ` Peter Zijlstra
2023-04-06 7:38 ` Peter Zijlstra
2023-04-27 7:46 ` Pavan Kondeti
2023-04-27 9:52 ` Gupta, Pankaj
2023-04-27 11:26 ` Pavan Kondeti
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230405082256.GY4253@hirez.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=bristot@redhat.com \
--cc=bsegall@google.com \
--cc=davidai@google.com \
--cc=dietmar.eggemann@arm.com \
--cc=juri.lelli@redhat.com \
--cc=kernel-team@android.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=mgorman@suse.de \
--cc=mingo@redhat.com \
--cc=rafael@kernel.org \
--cc=rostedt@goodmis.org \
--cc=saravanak@google.com \
--cc=vincent.guittot@linaro.org \
--cc=viresh.kumar@linaro.org \
--cc=vschneid@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).