[Debian] [Fwd: [PATCH] Fix speedstep-centino driver in
VCPU presence]
Vasily Tarasov
vtaras at openvz.org
Fri Apr 27 04:45:18 EDT 2007
On Thu, 2007-04-26 at 20:02 +0200, Ola Lundqvist wrote:
> Hi
>
> On Thu, Apr 26, 2007 at 08:45:25PM +0400, Kirill Korotaev wrote:
> > Ola Lundqvist wrote:
> > > Hi Kiril
> > >
> > > Thanks. Do this apply to the Debian kernel or is it against the
> > > vanilla kernel?
> >
> > against vanilla, but should apply well against debian as well (haven't checked).
> > I've added this patch to coming 028stab031 kernel already.
>
> Last time I applied a patch against Debian kernel (for a patch created for vanilla)
> I got about 30 rejected files or so... :)
>
> Vasily may correct me if I'm wrong.
You're right. If you're applying the cumulative OpenVZ patch to Debian
kernel we have quite a lot of rejects, because Debian kernel
incorporates much fixes from mainstream, that OpenVZ patch also owns.
So, when I porting OpenVZ to Debian kernel I don't use cumulative patch.
I get a list of separate OpenVZ patches (for example from .spec file of
src.rpm) and apply them one by one. In this case I can easily note, that
certain patches are mainstream fixes, which are in Debian kernel
already, and miss these patches.
HTH,
Vasily.
>
> Regards,
>
> // Ola
>
> > Thanks,
> > Kirill
> >
> >
> > >
> > > Regards,
> > >
> > > // Ola
> > >
> > > On Thu, Apr 26, 2007 at 04:15:06PM +0400, Kirill Korotaev wrote:
> > >
> > >>Ola,
> > >>
> > >>FYI, debian bug 420708 will be fixed in 2.6.18-028stab031
> > >>patch attached.
> > >>
> > >>Thanks,
> > >>Kirill
> > >>
> > >>
> > >>-------- Original Message --------
> > >>Subject: [PATCH] Fix speedstep-centino driver in VCPU presence
> > >>Date: Thu, 26 Apr 2007 14:35:45 +0400
> > >>From: Alexey Dobriyan <adobriyan at sw.ru>
> > >>To: dev at sw.ru
> > >>CC: vz at sw.ru
> > >>
> > >>Patch from Alexey Dobriyan (adobriyan@)
> > >>
> > >>speedstep-centrino cpufreq driver was using set_cpus_allowed() and
> > >>checks for smp_processor_id() to confine itself to given CPU. In
> > >>presence of VCPU freature this doesn't work.
> > >>
> > >>Switch to rdmsr_on_cpu/wrmsr_on_cpu() infrastructure.
> > >>
> > >>Closes http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=420708
> > >>
> > >
> > >
> > >>--- a/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c
> > >>+++ b/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c
> > >>@@ -17,7 +17,6 @@ #include <linux/kernel.h>
> > >> #include <linux/module.h>
> > >> #include <linux/init.h>
> > >> #include <linux/cpufreq.h>
> > >>-#include <linux/sched.h> /* current */
> > >> #include <linux/delay.h>
> > >> #include <linux/compiler.h>
> > >>
> > >>@@ -319,14 +318,8 @@ static unsigned int get_cur_freq(unsigne
> > >> {
> > >> unsigned l, h;
> > >> unsigned clock_freq;
> > >>- cpumask_t saved_mask;
> > >>
> > >>- saved_mask = current->cpus_allowed;
> > >>- set_cpus_allowed(current, cpumask_of_cpu(cpu));
> > >>- if (smp_processor_id() != cpu)
> > >>- return 0;
> > >>-
> > >>- rdmsr(MSR_IA32_PERF_STATUS, l, h);
> > >>+ rdmsr_on_cpu(cpu, MSR_IA32_PERF_STATUS, &l, &h);
> > >> clock_freq = extract_clock(l, cpu, 0);
> > >>
> > >> if (unlikely(clock_freq == 0)) {
> > >>@@ -336,11 +329,10 @@ static unsigned int get_cur_freq(unsigne
> > >> * P-state transition (like TM2). Get the last freq set
> > >> * in PERF_CTL.
> > >> */
> > >>- rdmsr(MSR_IA32_PERF_CTL, l, h);
> > >>+ rdmsr_on_cpu(cpu, MSR_IA32_PERF_CTL, &l, &h);
> > >> clock_freq = extract_clock(l, cpu, 1);
> > >> }
> > >>
> > >>- set_cpus_allowed(current, saved_mask);
> > >> return clock_freq;
> > >> }
> > >>
> > >>@@ -550,15 +542,15 @@ static int centrino_cpu_init(struct cpuf
> > >>
> > >> /* Check to see if Enhanced SpeedStep is enabled, and try to
> > >> enable it if not. */
> > >>- rdmsr(MSR_IA32_MISC_ENABLE, l, h);
> > >>+ rdmsr_on_cpu(policy->cpu, MSR_IA32_MISC_ENABLE, &l, &h);
> > >>
> > >> if (!(l & (1<<16))) {
> > >> l |= (1<<16);
> > >> dprintk("trying to enable Enhanced SpeedStep (%x)\n", l);
> > >>- wrmsr(MSR_IA32_MISC_ENABLE, l, h);
> > >>+ wrmsr_on_cpu(policy->cpu, MSR_IA32_MISC_ENABLE, l, h);
> > >>
> > >> /* check to see if it stuck */
> > >>- rdmsr(MSR_IA32_MISC_ENABLE, l, h);
> > >>+ rdmsr_on_cpu(policy->cpu, MSR_IA32_MISC_ENABLE, &l, &h);
> > >> if (!(l & (1<<16))) {
> > >> printk(KERN_INFO PFX "couldn't enable Enhanced SpeedStep\n");
> > >> return -ENODEV;
> > >>@@ -638,7 +630,6 @@ static int centrino_target (struct cpufr
> > >> unsigned int msr, oldmsr = 0, h = 0, cpu = policy->cpu;
> > >> struct cpufreq_freqs freqs;
> > >> cpumask_t online_policy_cpus;
> > >>- cpumask_t saved_mask;
> > >> cpumask_t set_mask;
> > >> cpumask_t covered_cpus;
> > >> int retval = 0;
> > >>@@ -662,7 +653,6 @@ #else
> > >> online_policy_cpus = policy->cpus;
> > >> #endif
> > >>
> > >>- saved_mask = current->cpus_allowed;
> > >> first_cpu = 1;
> > >> cpus_clear(covered_cpus);
> > >> for_each_cpu_mask(j, online_policy_cpus) {
> > >>@@ -676,8 +666,7 @@ #endif
> > >> else
> > >> cpu_set(j, set_mask);
> > >>
> > >>- set_cpus_allowed(current, set_mask);
> > >>- if (unlikely(!cpu_isset(smp_processor_id(), set_mask))) {
> > >>+ if (unlikely(!cpu_isset(j, set_mask))) {
> > >> dprintk("couldn't limit to CPUs in this domain\n");
> > >> retval = -EAGAIN;
> > >> if (first_cpu) {
> > >>@@ -690,7 +679,7 @@ #endif
> > >> msr = centrino_model[cpu]->op_points[newstate].index;
> > >>
> > >> if (first_cpu) {
> > >>- rdmsr(MSR_IA32_PERF_CTL, oldmsr, h);
> > >>+ rdmsr_on_cpu(j, MSR_IA32_PERF_CTL, &oldmsr, &h);
> > >> if (msr == (oldmsr & 0xffff)) {
> > >> dprintk("no change needed - msr was and needs "
> > >> "to be %x\n", oldmsr);
> > >>@@ -717,7 +706,7 @@ #endif
> > >> oldmsr |= msr;
> > >> }
> > >>
> > >>- wrmsr(MSR_IA32_PERF_CTL, oldmsr, h);
> > >>+ wrmsr_on_cpu(j, MSR_IA32_PERF_CTL, oldmsr, h);
> > >> if (policy->shared_type == CPUFREQ_SHARED_TYPE_ANY)
> > >> break;
> > >>
> > >>@@ -739,8 +728,7 @@ #endif
> > >>
> > >> if (!cpus_empty(covered_cpus)) {
> > >> for_each_cpu_mask(j, covered_cpus) {
> > >>- set_cpus_allowed(current, cpumask_of_cpu(j));
> > >>- wrmsr(MSR_IA32_PERF_CTL, oldmsr, h);
> > >>+ wrmsr_on_cpu(j, MSR_IA32_PERF_CTL, oldmsr, h);
> > >> }
> > >> }
> > >>
> > >>@@ -755,7 +743,6 @@ #endif
> > >> }
> > >>
> > >> migrate_end:
> > >>- set_cpus_allowed(current, saved_mask);
> > >> return 0;
> > >> }
> > >>
> > >>
> > >
> > >
> > >>_______________________________________________
> > >>Debian mailing list
> > >>Debian at openvz.org
> > >>https://openvz.org/mailman/listinfo/debian
> > >
> > >
> > >
> >
> >
>
More information about the Debian
mailing list