From: Sergey Senozhatsky <sergey.senozhatsky at gmail.com>
To: powertop@lists.01.org
Subject: Re: [Powertop] [PATCH 2/8] Use MSR Lib MSR functions
Date: Sat, 13 Apr 2013 13:43:58 +0300 [thread overview]
Message-ID: <20130413104358.GC2181@swordfish> (raw)
In-Reply-To: 1365781628-11053-3-git-send-email-srinivas.pandruvada@linux.intel.com
[-- Attachment #1: Type: text/plain, Size: 2149 bytes --]
On (04/12/13 08:47), Srinivas Pandruvada wrote:
> Date: Fri, 12 Apr 2013 08:47:02 -0700
> From: Srinivas Pandruvada <srinivas.pandruvada(a)linux.intel.com>
> To: powertop(a)lists.01.org
> Subject: [Powertop] [PATCH 2/8] Use MSR Lib MSR functions
> X-Mailer: git-send-email 1.7.11.7
>
> MSR read is implemented in lib.c. Use this API instead.
>
oh, not again... I missed Cc list. sorry!
resending.
please merge with the master. this function is a bit ahead since
commit 4d636301f641855a0bf059928c7a395cecc272b1
Author: Jani Nikula <jani.nikula intel.com>
Date: Thu Feb 21 11:27:34 2013 +0200
-ss
> Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada(a)linux.intel.com>
> ---
> src/cpu/intel_cpus.cpp | 23 ++++-------------------
> 1 file changed, 4 insertions(+), 19 deletions(-)
>
> diff --git a/src/cpu/intel_cpus.cpp b/src/cpu/intel_cpus.cpp
> index 2b78d31..8d5f51a 100644
> --- a/src/cpu/intel_cpus.cpp
> +++ b/src/cpu/intel_cpus.cpp
> @@ -49,30 +49,15 @@ static uint64_t get_msr(int cpu, uint64_t offset)
> {
> ssize_t retval;
> uint64_t msr;
> - int fd;
> - char msr_path[256];
>
> - fd = sprintf(msr_path, "/dev/cpu/%d/msr", cpu);
> -
> - if (access(msr_path, R_OK) != 0){
> - fd = sprintf(msr_path, "/dev/msr%d", cpu);
> -
> - if (access(msr_path, R_OK) != 0){
> - fprintf(stderr, _("msr reg not found"));
> - exit(-2);
> - }
> - }
> -
> - fd = open(msr_path, O_RDONLY);
> -
> - retval = pread(fd, &msr, sizeof msr, offset);
> - if (retval != sizeof msr) {
> + retval = read_msr(cpu, offset, &msr);
> + if (retval < 0) {
> reset_display();
> - fprintf(stderr, _("pread cpu%d 0x%llx : "), cpu, (unsigned long long)offset);
> + fprintf(stderr, _("read_msr cpu%d 0x%llx : "), cpu, (unsigned long long)offset);
> fprintf(stderr, "%s\n", strerror(errno));
> exit(-2);
> }
> - close(fd);
> +
> return msr;
> }
>
> --
> 1.7.11.7
>
> _______________________________________________
> PowerTop mailing list
> PowerTop(a)lists.01.org
> https://lists.01.org/mailman/listinfo/powertop
>
next reply other threads:[~2013-04-13 10:43 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-13 10:43 Sergey Senozhatsky [this message]
-- strict thread matches above, loose matches on Subject: below --
2013-04-15 16:09 [Powertop] [PATCH 2/8] Use MSR Lib MSR functions Srinivas Pandruvada
2013-04-12 15:47 Srinivas Pandruvada
2013-04-11 23:58 Srinivas Pandruvada
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=20130413104358.GC2181@swordfish \
--to=powertop@lists.01.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.