lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 5 Apr 2023 10:22:56 +0200
From:   Peter Zijlstra <peterz@...radead.org>
To:     David Dai <davidai@...gle.com>
Cc:     "Rafael J. Wysocki" <rafael@...nel.org>,
        Viresh Kumar <viresh.kumar@...aro.org>,
        Ingo Molnar <mingo@...hat.com>,
        Juri Lelli <juri.lelli@...hat.com>,
        Vincent Guittot <vincent.guittot@...aro.org>,
        Dietmar Eggemann <dietmar.eggemann@....com>,
        Steven Rostedt <rostedt@...dmis.org>,
        Ben Segall <bsegall@...gle.com>, Mel Gorman <mgorman@...e.de>,
        Daniel Bristot de Oliveira <bristot@...hat.com>,
        Valentin Schneider <vschneid@...hat.com>,
        Saravana Kannan <saravanak@...gle.com>,
        kernel-team@...roid.com, linux-kernel@...r.kernel.org,
        linux-pm@...r.kernel.org
Subject: Re: [RFC PATCH 6/6] cpufreq: add kvm-cpufreq driver

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.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ