All of lore.kernel.org
 help / color / mirror / Atom feed
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: Stefan Kuhne <stefan.kuhne@gmx.net>
Cc: xen-devel@lists.xen.org
Subject: Re: Using collectd: CPUFreq in dom0
Date: Mon, 7 Jan 2013 10:53:17 -0500	[thread overview]
Message-ID: <20130107155317.GG3219@phenom.dumpdata.com> (raw)
In-Reply-To: <50E749B5.3020003@access.denied>

On Fri, Jan 04, 2013 at 10:29:25PM +0100, Stefan Kuhne wrote:
> Am 04.01.2013 22:11, schrieb Konrad Rzeszutek Wilk:
> > On Tue, Dec 25, 2012 at 07:55:37PM +0100, Stefan Kuhne wrote:
> 
> Hello Konrad,
> 
> a happy new year and thanks for your reply.

Happy New Year as well!
> 
> >> I know that the value has to come from hypervisor and I've seen the code
> >> in xenpm.
> > 
> > Right. Did you look in the source code from xenpm?
> 
> I've took a look into it.
> So I've found how xenpm get the values.

Right, so it does some hypercalls to fetch that data.
> Is there code with sysfs?

I wrote some experimental that some time ago:

http://git.kernel.org/?p=linux/kernel/git/konrad/xen.git;a=shortlog;h=refs/heads/stable/cpufreq-xen.v6

but looking at it I am not even sure how it would properly
write the MHz values in SysFS. It just latches it to the perf
and that is it.

> 
> My problem is how I can create the required files in sysfs.
> Original they are created in cpufreq.c.

You are running in two problems:
 1). The cpufreq API is disabled when it boots under Xen. I did that
     so that the kernel wouldn't try to dispatch certain WRMSR which
     would be ignored by the hypervisor. This git commit 5e6262542
     has a nice description of why it was neccessary.

     You could "re-enable" the cpufreq (revert git commit 48cdd8287) and

 2). Have a new "xen" cpufreq driver. It would have to register
     itself for the cpufreq_register_governor and populate the
     policy->cpuinfo.min_freq/max_freq, min/max with the information
     that 'xenpm' would have gotten. In other words - you would need
     to shuffle parts of 'xenpm' source code in a new cpufreq
     governor driver. That by itself is not that hard (you could
     even create a thread that would do the hypercalls so often
     and just populate some internal structure with the new
     values).

     The problem is the hypercall. It is version gated on the
     do_sysctl:


     42     if ( op->interface_version != XEN_SYSCTL_INTERFACE_VERSION )
     43         return -EACCES;
     44 

     which for Xen 4.3 is
     37 #define XEN_SYSCTL_INTERFACE_VERSION 0x00000009
     but for Xen 4.1 is:
     #define XEN_SYSCTL_INTERFACE_VERSION 0x00000008

     So you would have to figure out what the version is to work with
     different versions of hypervisor.

> 
> 
> Regards,

Hope this helps.

It might be just easier to expand the 'xenpm' code to be invoked from
your collect scripts?

> Stefan Kuhne
> 

  parent reply	other threads:[~2013-01-07 15:53 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-25 18:55 Using collectd: CPUFreq in dom0 Stefan Kuhne
2013-01-04 21:11 ` Konrad Rzeszutek Wilk
2013-01-04 21:29   ` Stefan Kuhne
2013-01-07  6:54     ` Jan Beulich
2013-01-07 15:53     ` Konrad Rzeszutek Wilk [this message]
2013-01-07 16:27       ` Sander Eikelenboom
2013-01-07 19:13         ` Konrad Rzeszutek Wilk
2013-01-07 19:20           ` Sander Eikelenboom

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=20130107155317.GG3219@phenom.dumpdata.com \
    --to=konrad.wilk@oracle.com \
    --cc=stefan.kuhne@gmx.net \
    --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.