All of lore.kernel.org
 help / color / mirror / Atom feed
From: Julien Grall <julien.grall@linaro.org>
To: Oleksandr Dmytryshyn <oleksandr.dmytryshyn@globallogic.com>,
	xen-devel@lists.xen.org
Cc: Stefano Stabellini <stefano.stabellini@citrix.com>,
	Tim Deegan <tim@xen.org>, Ian Campbell <ian.campbell@citrix.com>
Subject: Re: [RFC PATCH v3 11/12] xen: arm: implement XEN_SYSCTL_cpufreq_op
Date: Thu, 23 Oct 2014 17:27:27 +0100	[thread overview]
Message-ID: <54492C6F.8020806@linaro.org> (raw)
In-Reply-To: <1414076867-2148-12-git-send-email-oleksandr.dmytryshyn@globallogic.com>

Hi Oleksandr,

On 10/23/2014 04:07 PM, Oleksandr Dmytryshyn wrote:
> Kernel uses this op to get some parameters for the
> xen-cpufreq driver to change CPUs frequency.

The XSM bit is missing for this new sysctl (see flask_sysctl).

> diff --git a/xen/drivers/cpufreq/hwdom-cpufreq.c b/xen/drivers/cpufreq/hwdom-cpufreq.c
> index 67c9e1d..cc97f37 100644
> --- a/xen/drivers/cpufreq/hwdom-cpufreq.c
> +++ b/xen/drivers/cpufreq/hwdom-cpufreq.c
> @@ -34,12 +34,53 @@ struct hwdom_cpufreq_data {
>  };
>  
>  static struct hwdom_cpufreq_data *hwdom_cpufreq_drv_data[NR_CPUS];
> +static DEFINE_SPINLOCK(sysctl_cpufreq_lock);
> +
> +struct sysctl_cpufreq_data {
> +    uint32_t cpu;
> +    uint32_t freq;
> +    uint32_t relation;
> +    int32_t result;
> +};
> +
> +static struct sysctl_cpufreq_data sysctl_cpufreq_data;
>  
>  int cpufreq_cpu_init(unsigned int cpuid)
>  {
>      return cpufreq_add_cpu(cpuid);
>  }
>  
> +static void notify_cpufreq_domains(void)
> +{
> +    send_global_virq(VIRQ_CPUFREQ);
> +}
> +
> +int sysctl_cpufreq_op(xen_sysctl_cpufreq_op_t *op)
> +{
> +    int ret = 0;

AFAIU, the cpufreq will always run in the hardware domain. Therefore,
shouldn't you check that the sysctl is effectively executed by this domain?

>  static int hwdom_cpufreq_verify(struct cpufreq_policy *policy)
>  {
>      struct hwdom_cpufreq_data *data;
> @@ -97,6 +138,17 @@ static int hwdom_cpufreq_target(struct cpufreq_policy *policy,
>      freqs.old = perf->states[perf->state].core_frequency * 1000;
>      freqs.new = data->freq_table[next_state].frequency;
>  
> +    /* Do send cmd for Dom0 */

s/Dom0/Hardware domain/

> +    spin_lock(&sysctl_cpufreq_lock);
> +    /* return previous result */
> +    ret = sysctl_cpufreq_data.result;
> +
> +    sysctl_cpufreq_data.cpu = policy->cpu;
> +    sysctl_cpufreq_data.freq = freqs.new;
> +    sysctl_cpufreq_data.relation = (uint32_t)relation;
> +    spin_unlock(&sysctl_cpufreq_lock);
> +    notify_cpufreq_domains();
> +
>      for_each_cpu( j, &online_policy_cpus )
>          cpufreq_statistic_update(j, perf->state, next_perf_state);
>  
> diff --git a/xen/include/public/sysctl.h b/xen/include/public/sysctl.h
> index 8437d31..ecd4674 100644
> --- a/xen/include/public/sysctl.h
> +++ b/xen/include/public/sysctl.h
> @@ -632,6 +632,23 @@ struct xen_sysctl_coverage_op {
>  typedef struct xen_sysctl_coverage_op xen_sysctl_coverage_op_t;
>  DEFINE_XEN_GUEST_HANDLE(xen_sysctl_coverage_op_t);
>  
> +#define XEN_SYSCTL_CPUFREQ_get_target      0
> +#define XEN_SYSCTL_CPUFREQ_set_result      1
> +
> +struct xen_sysctl_cpufreq_op {
> +    uint32_t cmd;
> +    union {
> +        struct {
> +            uint32_t cpu;
> +            uint32_t freq;
> +            uint32_t relation;
> +        } target;
> +        uint32_t result;
> +    } u;
> +};

Can you document this structure?

Regards,

-- 
Julien Grall

  reply	other threads:[~2014-10-23 16:27 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-23 15:07 [RFC PATCH v3 00/12]xen_cpufreq implementation in Xen hypervisor Oleksandr Dmytryshyn
2014-10-23 15:07 ` [RFC PATCH v3 01/12] cpufreq: move cpufreq.h file to the xen/include/xen location Oleksandr Dmytryshyn
2014-10-23 15:07 ` [RFC PATCH v3 02/12] pm: move processor_perf.h " Oleksandr Dmytryshyn
2014-10-23 15:07 ` [RFC PATCH v3 03/12] pmstat: move pmstat.c file to the xen/drivers/pm/stat.c location Oleksandr Dmytryshyn
2014-10-23 15:07 ` [RFC PATCH v3 04/12] cpufreq: make turbo settings to be configurable Oleksandr Dmytryshyn
2014-10-23 15:07 ` [RFC PATCH v3 05/12] pmstat: make pmstat functions more generalizable Oleksandr Dmytryshyn
2014-10-23 15:07 ` [RFC PATCH v3 06/12] cpufreq: make cpufreq driver " Oleksandr Dmytryshyn
2014-10-23 15:07 ` [RFC PATCH v3 07/12] arch/arm: create device tree nodes for hwdom cpufreq cpu driver Oleksandr Dmytryshyn
2014-10-23 15:49   ` Julien Grall
2014-10-24 10:24     ` Oleksandr Dmytryshyn
2014-10-27 10:52       ` Oleksandr Dmytryshyn
2014-10-27 13:15         ` Julien Grall
2014-10-27 13:32           ` Oleksandr Dmytryshyn
2014-10-23 15:07 ` [RFC PATCH v3 08/12] xsm: enable xsm_platform_op hook for all architectures Oleksandr Dmytryshyn
2014-10-23 16:11   ` Julien Grall
2014-10-24 10:24     ` Oleksandr Dmytryshyn
2014-10-24 10:27       ` Oleksandr Dmytryshyn
2014-10-24 11:38         ` Julien Grall
2014-10-23 15:07 ` [RFC PATCH v3 09/12] xen: arm: implement platform hypercall Oleksandr Dmytryshyn
2014-10-23 15:07 ` [RFC PATCH v3 10/12] cpufreq: add hwdom-cpufreq driver Oleksandr Dmytryshyn
2014-10-23 16:42   ` Julien Grall
2014-10-24 10:30     ` Oleksandr Dmytryshyn
2014-10-24 11:45       ` Julien Grall
2014-10-24 13:05         ` Oleksandr Dmytryshyn
2014-10-24 13:08           ` Julien Grall
2014-10-27 13:29             ` Oleksandr Dmytryshyn
2014-10-23 15:07 ` [RFC PATCH v3 11/12] xen: arm: implement XEN_SYSCTL_cpufreq_op Oleksandr Dmytryshyn
2014-10-23 16:27   ` Julien Grall [this message]
2014-10-24 10:37     ` Oleksandr Dmytryshyn
2014-10-26 17:41   ` Stefano Stabellini
2014-10-27 16:27     ` Oleksandr Dmytryshyn
2014-10-23 15:07 ` [RFC PATCH v3 12/12] xen/arm: enable cpufreq functionality for ARM Oleksandr Dmytryshyn

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=54492C6F.8020806@linaro.org \
    --to=julien.grall@linaro.org \
    --cc=ian.campbell@citrix.com \
    --cc=oleksandr.dmytryshyn@globallogic.com \
    --cc=stefano.stabellini@citrix.com \
    --cc=tim@xen.org \
    --cc=xen-devel@lists.xen.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.