All of lore.kernel.org
 help / color / mirror / Atom feed
From: davej@redhat.com (Dave Jones)
To: Rudolf Marek <r.marek@assembler.cz>
Cc: hpa@zytor.com, norsk5@xmission.com,
	lkml <linux-kernel@vger.kernel.org>,
	LM Sensors <lm-sensors@lm-sensors.org>,
	bluesmoke-devel@lists.sourceforge.net
Subject: [lm-sensors] [RFC] new MSR r/w functions per CPU
Date: Wed, 13 Dec 2006 22:10:26 +0000	[thread overview]
Message-ID: <20061213221026.GF2418@redhat.com> (raw)
In-Reply-To: <45807469.6040609@assembler.cz>

On Wed, Dec 13, 2006 at 10:45:13PM +0100, Rudolf Marek wrote:
 > Hello all,
 > 
 > For my new coretemp driver[1], I need to execute the rdmsr on particular 
 > processor.  There is no such "global" function for that in the kernel so far.
 > 
 > The per CPU msr_read and msr_write are used in following drivers:
 > 
 > msr.c (it is static there now)
 > k8-edac.c  (duplicated right now -> driver in -mm)
 > coretemp.c (my new Core temperature sensor -> driver [1])
 > 
 > Question is how make an access to that functions. Enclosed patch does simple 
 > EXPORT_SYMBOL_GPL for them, but then both drivers (k8-edac.c and coretemp.c) 
 > would depend on the MSR driver. The ultimate solution would be to move this type
 > of function to separate module, but perhaps this is just bit overkill?

Exposing the guts of the msr driver like that doesn't seem too clean.
For in-kernel use, why not just add something like this..
(note:not even compile tested)..

void rdmsr_on_cpu(unsigned int cpu, unsigned long msr, unsigned long *lo, unsigned long *hi)
{
    cpumask_t oldmask;

    oldmask = current->cpus_allowed;
    set_cpus_allowed(current, cpumask_of_cpu(cpu));

	rdmsr(msr, &lo, &hi);

    set_cpus_allowed(current, oldmask);
}


		Dave

-- 
http://www.codemonkey.org.uk


WARNING: multiple messages have this Message-ID (diff)
From: Dave Jones <davej@redhat.com>
To: Rudolf Marek <r.marek@assembler.cz>
Cc: hpa@zytor.com, norsk5@xmission.com,
	lkml <linux-kernel@vger.kernel.org>,
	LM Sensors <lm-sensors@lm-sensors.org>,
	bluesmoke-devel@lists.sourceforge.net
Subject: Re: [RFC] new MSR r/w functions per CPU
Date: Wed, 13 Dec 2006 17:10:26 -0500	[thread overview]
Message-ID: <20061213221026.GF2418@redhat.com> (raw)
In-Reply-To: <45807469.6040609@assembler.cz>

On Wed, Dec 13, 2006 at 10:45:13PM +0100, Rudolf Marek wrote:
 > Hello all,
 > 
 > For my new coretemp driver[1], I need to execute the rdmsr on particular 
 > processor.  There is no such "global" function for that in the kernel so far.
 > 
 > The per CPU msr_read and msr_write are used in following drivers:
 > 
 > msr.c (it is static there now)
 > k8-edac.c  (duplicated right now -> driver in -mm)
 > coretemp.c (my new Core temperature sensor -> driver [1])
 > 
 > Question is how make an access to that functions. Enclosed patch does simple 
 > EXPORT_SYMBOL_GPL for them, but then both drivers (k8-edac.c and coretemp.c) 
 > would depend on the MSR driver. The ultimate solution would be to move this type
 > of function to separate module, but perhaps this is just bit overkill?

Exposing the guts of the msr driver like that doesn't seem too clean.
For in-kernel use, why not just add something like this..
(note:not even compile tested)..

void rdmsr_on_cpu(unsigned int cpu, unsigned long msr, unsigned long *lo, unsigned long *hi)
{
    cpumask_t oldmask;

    oldmask = current->cpus_allowed;
    set_cpus_allowed(current, cpumask_of_cpu(cpu));

	rdmsr(msr, &lo, &hi);

    set_cpus_allowed(current, oldmask);
}


		Dave

-- 
http://www.codemonkey.org.uk

  parent reply	other threads:[~2006-12-13 22:10 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-12-13 21:45 [lm-sensors] [RFC] new MSR r/w functions per CPU Rudolf Marek
2006-12-13 21:45 ` Rudolf Marek
2006-12-13 22:01 ` [lm-sensors] " H. Peter Anvin
2006-12-13 22:01   ` H. Peter Anvin
2006-12-13 22:10 ` Dave Jones [this message]
2006-12-13 22:10   ` Dave Jones
2006-12-13 22:19   ` [lm-sensors] " H. Peter Anvin
2006-12-13 22:19     ` H. Peter Anvin
2006-12-13 22:26     ` [lm-sensors] " Dave Jones
2006-12-13 22:26       ` Dave Jones
2006-12-13 22:45       ` [lm-sensors] " H. Peter Anvin
2006-12-13 22:45         ` H. Peter Anvin

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=20061213221026.GF2418@redhat.com \
    --to=davej@redhat.com \
    --cc=bluesmoke-devel@lists.sourceforge.net \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lm-sensors@lm-sensors.org \
    --cc=norsk5@xmission.com \
    --cc=r.marek@assembler.cz \
    /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.