All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rafael@kernel.org>
To: Viresh Kumar <viresh.kumar@linaro.org>
Cc: "Peter Zijlstra" <peterz@infradead.org>,
	"Rafael Wysocki" <rjw@rjwysocki.net>,
	"Russell King" <linux@armlinux.org.uk>,
	"David S. Miller" <davem@davemloft.net>,
	"Thomas Gleixner" <tglx@linutronix.de>,
	"Ingo Molnar" <mingo@redhat.com>,
	"Borislav Petkov" <bp@alien8.de>,
	"H. Peter Anvin" <hpa@zytor.com>,
	"the arch/x86 maintainers" <x86@kernel.org>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Radim Krčmář" <rkrcmar@redhat.com>,
	"Linux PM" <linux-pm@vger.kernel.org>,
	"Vincent Guittot" <vincent.guittot@linaro.org>,
	"Linux ARM" <linux-arm-kernel@lists.infradead.org>,
	"Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>,
	sparclinux@vger.kernel.org, kvm@vger.kernel.org
Subject: Re: [PATCH V3] cpufreq: Call transition notifier only once for each policy
Date: Wed, 24 Apr 2019 09:26:50 +0200	[thread overview]
Message-ID: <CAJZ5v0jGofnUFKaM5-pRsZAiiQFumGGij8TE=SyX8DT8CUatQg@mail.gmail.com> (raw)
In-Reply-To: <20190424064753.lwfsdeodncaai5oz@vireshk-i7>

On Wed, Apr 24, 2019 at 8:48 AM Viresh Kumar <viresh.kumar@linaro.org> wrote:
>
> On 22-03-19, 11:49, Viresh Kumar wrote:
> > On 21-03-19, 12:45, Peter Zijlstra wrote:
> > > On Wed, Mar 20, 2019 at 10:22:23AM +0530, Viresh Kumar wrote:
>
> > > > diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> > > > index 65e4559eef2f..1ac8c710cccc 100644
> > > > --- a/arch/x86/kvm/x86.c
> > > > +++ b/arch/x86/kvm/x86.c
> > > > @@ -6649,10 +6649,8 @@ static void kvm_hyperv_tsc_notifier(void)
> > > >  }
> > > >  #endif
> > > >
> > > > -static int kvmclock_cpufreq_notifier(struct notifier_block *nb, unsigned long val,
> > > > -                              void *data)
> > > > +static void __kvmclock_cpufreq_notifier(struct cpufreq_freqs *freq, int cpu)
> > > >  {
> > > > - struct cpufreq_freqs *freq = data;
> > > >   struct kvm *kvm;
> > > >   struct kvm_vcpu *vcpu;
> > > >   int i, send_ipi = 0;
> > > > @@ -6696,17 +6694,12 @@ static int kvmclock_cpufreq_notifier(struct notifier_block *nb, unsigned long va
> > > >    *
> > > >    */
> > > >
> > > > - if (val == CPUFREQ_PRECHANGE && freq->old > freq->new)
> > > > -         return 0;
> > > > - if (val == CPUFREQ_POSTCHANGE && freq->old < freq->new)
> > > > -         return 0;
> > > > -
> > > > - smp_call_function_single(freq->cpu, tsc_khz_changed, freq, 1);
> > > > + smp_call_function_single(cpu, tsc_khz_changed, freq, 1);
> > > >
> > > >   spin_lock(&kvm_lock);
> > > >   list_for_each_entry(kvm, &vm_list, vm_list) {
> > > >           kvm_for_each_vcpu(i, vcpu, kvm) {
> > > > -                 if (vcpu->cpu != freq->cpu)
> > > > +                 if (vcpu->cpu != cpu)
> > > >                           continue;
> > > >                   kvm_make_request(KVM_REQ_CLOCK_UPDATE, vcpu);
> > > >                   if (vcpu->cpu != smp_processor_id())
> > > > @@ -6728,8 +6721,24 @@ static int kvmclock_cpufreq_notifier(struct notifier_block *nb, unsigned long va
> > > >            * guest context is entered kvmclock will be updated,
> > > >            * so the guest will not see stale values.
> > > >            */
> > > > -         smp_call_function_single(freq->cpu, tsc_khz_changed, freq, 1);
> > > > +         smp_call_function_single(cpu, tsc_khz_changed, freq, 1);
> > > >   }
> > > > +}
> > > > +
> > > > +static int kvmclock_cpufreq_notifier(struct notifier_block *nb, unsigned long val,
> > > > +                              void *data)
> > > > +{
> > > > + struct cpufreq_freqs *freq = data;
> > > > + int cpu;
> > > > +
> > > > + if (val == CPUFREQ_PRECHANGE && freq->old > freq->new)
> > > > +         return 0;
> > > > + if (val == CPUFREQ_POSTCHANGE && freq->old < freq->new)
> > > > +         return 0;
> > > > +
> > > > + for_each_cpu(cpu, freq->policy->cpus)
> > > > +         __kvmclock_cpufreq_notifier(freq, cpu);
> > > > +
> > > >   return 0;
> > > >  }
> > > >
> > >
> > > Then why to we pretend otherwise here?
> >
> > My intention was to not add any bug here because of lack of my
> > knowledge of the architecture in question and so I tried to be safe.
> >
> > If you guys think the behavior should be same here as of the tsc, then
> > we can add similar checks here.
>
> I am rebasing this patch over Rafael's patch [1] and wondering if I
> should change anything here.

I guess please repost when my patch makes it into linux-next.

> [1] https://lore.kernel.org/lkml/38900622.ao2n2t5aPS@kreacher/

WARNING: multiple messages have this Message-ID (diff)
From: "Rafael J. Wysocki" <rafael@kernel.org>
To: Viresh Kumar <viresh.kumar@linaro.org>
Cc: "Peter Zijlstra" <peterz@infradead.org>,
	"Rafael Wysocki" <rjw@rjwysocki.net>,
	"Russell King" <linux@armlinux.org.uk>,
	"David S. Miller" <davem@davemloft.net>,
	"Thomas Gleixner" <tglx@linutronix.de>,
	"Ingo Molnar" <mingo@redhat.com>,
	"Borislav Petkov" <bp@alien8.de>,
	"H. Peter Anvin" <hpa@zytor.com>,
	"the arch/x86 maintainers" <x86@kernel.org>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Radim Krčmář" <rkrcmar@redhat.com>,
	"Linux PM" <linux-pm@vger.kernel.org>,
	"Vincent Guittot" <vincent.guittot@linaro.org>,
	"Linux ARM" <linux-arm-kernel@lists.infradead.org>,
	"Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>,
	sparclinux@vger.kernel.org, kvm@vger.kernel.org
Subject: Re: [PATCH V3] cpufreq: Call transition notifier only once for each policy
Date: Wed, 24 Apr 2019 07:26:50 +0000	[thread overview]
Message-ID: <CAJZ5v0jGofnUFKaM5-pRsZAiiQFumGGij8TE=SyX8DT8CUatQg@mail.gmail.com> (raw)
In-Reply-To: <20190424064753.lwfsdeodncaai5oz@vireshk-i7>

On Wed, Apr 24, 2019 at 8:48 AM Viresh Kumar <viresh.kumar@linaro.org> wrote:
>
> On 22-03-19, 11:49, Viresh Kumar wrote:
> > On 21-03-19, 12:45, Peter Zijlstra wrote:
> > > On Wed, Mar 20, 2019 at 10:22:23AM +0530, Viresh Kumar wrote:
>
> > > > diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> > > > index 65e4559eef2f..1ac8c710cccc 100644
> > > > --- a/arch/x86/kvm/x86.c
> > > > +++ b/arch/x86/kvm/x86.c
> > > > @@ -6649,10 +6649,8 @@ static void kvm_hyperv_tsc_notifier(void)
> > > >  }
> > > >  #endif
> > > >
> > > > -static int kvmclock_cpufreq_notifier(struct notifier_block *nb, unsigned long val,
> > > > -                              void *data)
> > > > +static void __kvmclock_cpufreq_notifier(struct cpufreq_freqs *freq, int cpu)
> > > >  {
> > > > - struct cpufreq_freqs *freq = data;
> > > >   struct kvm *kvm;
> > > >   struct kvm_vcpu *vcpu;
> > > >   int i, send_ipi = 0;
> > > > @@ -6696,17 +6694,12 @@ static int kvmclock_cpufreq_notifier(struct notifier_block *nb, unsigned long va
> > > >    *
> > > >    */
> > > >
> > > > - if (val = CPUFREQ_PRECHANGE && freq->old > freq->new)
> > > > -         return 0;
> > > > - if (val = CPUFREQ_POSTCHANGE && freq->old < freq->new)
> > > > -         return 0;
> > > > -
> > > > - smp_call_function_single(freq->cpu, tsc_khz_changed, freq, 1);
> > > > + smp_call_function_single(cpu, tsc_khz_changed, freq, 1);
> > > >
> > > >   spin_lock(&kvm_lock);
> > > >   list_for_each_entry(kvm, &vm_list, vm_list) {
> > > >           kvm_for_each_vcpu(i, vcpu, kvm) {
> > > > -                 if (vcpu->cpu != freq->cpu)
> > > > +                 if (vcpu->cpu != cpu)
> > > >                           continue;
> > > >                   kvm_make_request(KVM_REQ_CLOCK_UPDATE, vcpu);
> > > >                   if (vcpu->cpu != smp_processor_id())
> > > > @@ -6728,8 +6721,24 @@ static int kvmclock_cpufreq_notifier(struct notifier_block *nb, unsigned long va
> > > >            * guest context is entered kvmclock will be updated,
> > > >            * so the guest will not see stale values.
> > > >            */
> > > > -         smp_call_function_single(freq->cpu, tsc_khz_changed, freq, 1);
> > > > +         smp_call_function_single(cpu, tsc_khz_changed, freq, 1);
> > > >   }
> > > > +}
> > > > +
> > > > +static int kvmclock_cpufreq_notifier(struct notifier_block *nb, unsigned long val,
> > > > +                              void *data)
> > > > +{
> > > > + struct cpufreq_freqs *freq = data;
> > > > + int cpu;
> > > > +
> > > > + if (val = CPUFREQ_PRECHANGE && freq->old > freq->new)
> > > > +         return 0;
> > > > + if (val = CPUFREQ_POSTCHANGE && freq->old < freq->new)
> > > > +         return 0;
> > > > +
> > > > + for_each_cpu(cpu, freq->policy->cpus)
> > > > +         __kvmclock_cpufreq_notifier(freq, cpu);
> > > > +
> > > >   return 0;
> > > >  }
> > > >
> > >
> > > Then why to we pretend otherwise here?
> >
> > My intention was to not add any bug here because of lack of my
> > knowledge of the architecture in question and so I tried to be safe.
> >
> > If you guys think the behavior should be same here as of the tsc, then
> > we can add similar checks here.
>
> I am rebasing this patch over Rafael's patch [1] and wondering if I
> should change anything here.

I guess please repost when my patch makes it into linux-next.

> [1] https://lore.kernel.org/lkml/38900622.ao2n2t5aPS@kreacher/

WARNING: multiple messages have this Message-ID (diff)
From: "Rafael J. Wysocki" <rafael@kernel.org>
To: Viresh Kumar <viresh.kumar@linaro.org>
Cc: "Vincent Guittot" <vincent.guittot@linaro.org>,
	kvm@vger.kernel.org, "Radim Krčmář" <rkrcmar@redhat.com>,
	"Peter Zijlstra" <peterz@infradead.org>,
	"Linux PM" <linux-pm@vger.kernel.org>,
	"the arch/x86 maintainers" <x86@kernel.org>,
	"Rafael Wysocki" <rjw@rjwysocki.net>,
	"Russell King" <linux@armlinux.org.uk>,
	"Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>,
	"Ingo Molnar" <mingo@redhat.com>,
	"Borislav Petkov" <bp@alien8.de>,
	"H. Peter Anvin" <hpa@zytor.com>,
	sparclinux@vger.kernel.org, "Paolo Bonzini" <pbonzini@redhat.com>,
	"Thomas Gleixner" <tglx@linutronix.de>,
	"David S. Miller" <davem@davemloft.net>,
	"Linux ARM" <linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH V3] cpufreq: Call transition notifier only once for each policy
Date: Wed, 24 Apr 2019 09:26:50 +0200	[thread overview]
Message-ID: <CAJZ5v0jGofnUFKaM5-pRsZAiiQFumGGij8TE=SyX8DT8CUatQg@mail.gmail.com> (raw)
In-Reply-To: <20190424064753.lwfsdeodncaai5oz@vireshk-i7>

On Wed, Apr 24, 2019 at 8:48 AM Viresh Kumar <viresh.kumar@linaro.org> wrote:
>
> On 22-03-19, 11:49, Viresh Kumar wrote:
> > On 21-03-19, 12:45, Peter Zijlstra wrote:
> > > On Wed, Mar 20, 2019 at 10:22:23AM +0530, Viresh Kumar wrote:
>
> > > > diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> > > > index 65e4559eef2f..1ac8c710cccc 100644
> > > > --- a/arch/x86/kvm/x86.c
> > > > +++ b/arch/x86/kvm/x86.c
> > > > @@ -6649,10 +6649,8 @@ static void kvm_hyperv_tsc_notifier(void)
> > > >  }
> > > >  #endif
> > > >
> > > > -static int kvmclock_cpufreq_notifier(struct notifier_block *nb, unsigned long val,
> > > > -                              void *data)
> > > > +static void __kvmclock_cpufreq_notifier(struct cpufreq_freqs *freq, int cpu)
> > > >  {
> > > > - struct cpufreq_freqs *freq = data;
> > > >   struct kvm *kvm;
> > > >   struct kvm_vcpu *vcpu;
> > > >   int i, send_ipi = 0;
> > > > @@ -6696,17 +6694,12 @@ static int kvmclock_cpufreq_notifier(struct notifier_block *nb, unsigned long va
> > > >    *
> > > >    */
> > > >
> > > > - if (val == CPUFREQ_PRECHANGE && freq->old > freq->new)
> > > > -         return 0;
> > > > - if (val == CPUFREQ_POSTCHANGE && freq->old < freq->new)
> > > > -         return 0;
> > > > -
> > > > - smp_call_function_single(freq->cpu, tsc_khz_changed, freq, 1);
> > > > + smp_call_function_single(cpu, tsc_khz_changed, freq, 1);
> > > >
> > > >   spin_lock(&kvm_lock);
> > > >   list_for_each_entry(kvm, &vm_list, vm_list) {
> > > >           kvm_for_each_vcpu(i, vcpu, kvm) {
> > > > -                 if (vcpu->cpu != freq->cpu)
> > > > +                 if (vcpu->cpu != cpu)
> > > >                           continue;
> > > >                   kvm_make_request(KVM_REQ_CLOCK_UPDATE, vcpu);
> > > >                   if (vcpu->cpu != smp_processor_id())
> > > > @@ -6728,8 +6721,24 @@ static int kvmclock_cpufreq_notifier(struct notifier_block *nb, unsigned long va
> > > >            * guest context is entered kvmclock will be updated,
> > > >            * so the guest will not see stale values.
> > > >            */
> > > > -         smp_call_function_single(freq->cpu, tsc_khz_changed, freq, 1);
> > > > +         smp_call_function_single(cpu, tsc_khz_changed, freq, 1);
> > > >   }
> > > > +}
> > > > +
> > > > +static int kvmclock_cpufreq_notifier(struct notifier_block *nb, unsigned long val,
> > > > +                              void *data)
> > > > +{
> > > > + struct cpufreq_freqs *freq = data;
> > > > + int cpu;
> > > > +
> > > > + if (val == CPUFREQ_PRECHANGE && freq->old > freq->new)
> > > > +         return 0;
> > > > + if (val == CPUFREQ_POSTCHANGE && freq->old < freq->new)
> > > > +         return 0;
> > > > +
> > > > + for_each_cpu(cpu, freq->policy->cpus)
> > > > +         __kvmclock_cpufreq_notifier(freq, cpu);
> > > > +
> > > >   return 0;
> > > >  }
> > > >
> > >
> > > Then why to we pretend otherwise here?
> >
> > My intention was to not add any bug here because of lack of my
> > knowledge of the architecture in question and so I tried to be safe.
> >
> > If you guys think the behavior should be same here as of the tsc, then
> > we can add similar checks here.
>
> I am rebasing this patch over Rafael's patch [1] and wondering if I
> should change anything here.

I guess please repost when my patch makes it into linux-next.

> [1] https://lore.kernel.org/lkml/38900622.ao2n2t5aPS@kreacher/

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2019-04-24  7:27 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-20  4:52 [PATCH V3] cpufreq: Call transition notifier only once for each policy Viresh Kumar
2019-03-20  4:52 ` Viresh Kumar
2019-03-20  4:52 ` Viresh Kumar
2019-03-21 11:45 ` Peter Zijlstra
2019-03-21 11:45   ` Peter Zijlstra
2019-03-21 11:45   ` Peter Zijlstra
2019-03-21 11:45   ` Peter Zijlstra
2019-03-22  6:19   ` Viresh Kumar
2019-03-22  6:31     ` Viresh Kumar
2019-03-22  6:19     ` Viresh Kumar
2019-04-24  6:47     ` Viresh Kumar
2019-04-24  6:59       ` Viresh Kumar
2019-04-24  6:47       ` Viresh Kumar
2019-04-24  7:26       ` Rafael J. Wysocki [this message]
2019-04-24  7:26         ` Rafael J. Wysocki
2019-04-24  7:26         ` Rafael J. Wysocki
2019-03-21 15:49 ` Thomas Gleixner
2019-03-21 15:49   ` Thomas Gleixner
2019-03-21 15:49   ` Thomas Gleixner
2019-03-22  6:27   ` Viresh Kumar
2019-03-22  6:39     ` Viresh Kumar
2019-03-22  6:27     ` Viresh Kumar
2019-03-22  9:55     ` Rafael J. Wysocki
2019-03-22  9:55       ` Rafael J. Wysocki
2019-03-22  9:55       ` Rafael J. Wysocki

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='CAJZ5v0jGofnUFKaM5-pRsZAiiQFumGGij8TE=SyX8DT8CUatQg@mail.gmail.com' \
    --to=rafael@kernel.org \
    --cc=bp@alien8.de \
    --cc=davem@davemloft.net \
    --cc=hpa@zytor.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=mingo@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rjw@rjwysocki.net \
    --cc=rkrcmar@redhat.com \
    --cc=sparclinux@vger.kernel.org \
    --cc=tglx@linutronix.de \
    --cc=vincent.guittot@linaro.org \
    --cc=viresh.kumar@linaro.org \
    --cc=x86@kernel.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.