Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1343686

Re: [RFCv7 PATCH 02/10] cpufreq: introduce cpufreq_driver_is_slow

From "Rafael J. Wysocki" <rjw@rjwysocki.net>
Newsgroups linux.kernel
Subject Re: [RFCv7 PATCH 02/10] cpufreq: introduce cpufreq_driver_is_slow
Date 2016-02-26 02:20 +0100
Message-ID <r6fey-40K-7@gated-at.bofh.it> (permalink)
References <r59Xz-6rQ-1@gated-at.bofh.it> <r5a7i-6wg-29@gated-at.bofh.it> <r6f4T-3Xh-47@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Thursday, February 25, 2016 04:50:29 PM Michael Turquette wrote:
> Quoting Rafael J. Wysocki (2016-02-22 17:31:09)
> > On Tue, Feb 23, 2016 at 2:22 AM, Steve Muckle <steve.muckle@linaro.org> wrote:
> > > From: Michael Turquette <mturquette@baylibre.com>
> > >
> > > Some architectures and platforms perform CPU frequency transitions
> > > through a non-blocking method, while some might block or sleep. Even
> > > when frequency transitions do not block or sleep they may be very slow.
> > > This distinction is important when trying to change frequency from
> > > a non-interruptible context in a scheduler hot path.
> > >
> > > Describe this distinction with a cpufreq driver flag,
> > > CPUFREQ_DRIVER_FAST. The default is to not have this flag set,
> > > thus erring on the side of caution.
> > >
> > > cpufreq_driver_is_slow() is also introduced in this patch. Setting
> > > the above flag will allow this function to return false.
> > >
> > > [smuckle@linaro.org: change flag/API to include drivers that are too
> > >  slow for scheduler hot paths, in addition to those that block/sleep]
> > >
> > > Cc: Rafael J. Wysocki <rafael@kernel.org>
> > > Cc: Viresh Kumar <viresh.kumar@linaro.org>
> > > Signed-off-by: Michael Turquette <mturquette@baylibre.com>
> > > Signed-off-by: Steve Muckle <smuckle@linaro.org>
> > 
> > Something more sophisticated than this is needed, because one driver
> > may actually be able to do "fast" switching in some cases and may not
> > be able to do that in other cases.
> 
> Those drivers can set the flag dynamically when they probe based on
> their ACPI tables.

No, they can't.

Being able to to the "fast" switching is a property of the policy and
the driver together and it may change with CPU going online/offline.

> > 
> > For example, in the acpi-cpufreq case all depends on what's there in
> > the ACPI tables.
> 
> It's all a moot point until the locking in cpufreq is changed.

No, it isn't.  Look at this, for example: https://patchwork.kernel.org/patch/8426741/

> Until those changes are made it is a bad idea to call cpufreq_driver_target()
> from schedule() context, regardless of the underlying hardware, and all
> platforms should kick that work out to the kthread.

Calling cpufreq_driver_target() from the scheduler is a bad idea overall,
not just because of the locking.

But there are other ways to switch frequencies from scheduler paths.  I run
such code on my test box daily without any problems.

Thanks,
Rafael

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[RFCv7 PATCH 00/10] sched: scheduler-driven CPU frequency selection Steve Muckle <steve.muckle@linaro.org> - 2016-02-23 02:30 +0100
  [RFCv7 PATCH 07/10] sched/fair: jump to max OPP when crossing UP threshold Steve Muckle <steve.muckle@linaro.org> - 2016-02-23 02:30 +0100
  [RFCv7 PATCH 09/10] sched/deadline: split rt_avg in 2 distincts metrics Steve Muckle <steve.muckle@linaro.org> - 2016-02-23 02:30 +0100
  [RFCv7 PATCH 10/10] sched: rt scheduler sets capacity requirement Steve Muckle <steve.muckle@linaro.org> - 2016-02-23 02:30 +0100
  [RFCv7 PATCH 08/10] sched: remove call of sched_avg_update from sched_rt_avg_update Steve Muckle <steve.muckle@linaro.org> - 2016-02-23 02:30 +0100
  [RFCv7 PATCH 02/10] cpufreq: introduce cpufreq_driver_is_slow Steve Muckle <steve.muckle@linaro.org> - 2016-02-23 02:30 +0100
    Re: [RFCv7 PATCH 02/10] cpufreq: introduce cpufreq_driver_is_slow "Rafael J. Wysocki" <rafael@kernel.org> - 2016-02-23 02:40 +0100
      Re: [RFCv7 PATCH 02/10] cpufreq: introduce cpufreq_driver_is_slow Michael Turquette <mturquette@baylibre.com> - 2016-02-26 02:10 +0100
        Re: [RFCv7 PATCH 02/10] cpufreq: introduce cpufreq_driver_is_slow "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2016-02-26 02:20 +0100
          Re: [RFCv7 PATCH 02/10] cpufreq: introduce cpufreq_driver_is_slow "Rafael J. Wysocki" <rafael@kernel.org> - 2016-02-26 22:10 +0100
        Re: [RFCv7 PATCH 02/10] cpufreq: introduce cpufreq_driver_is_slow Steve Muckle <steve.muckle@linaro.org> - 2016-02-26 02:20 +0100
  [RFCv7 PATCH 06/10] sched/fair: cpufreq_sched triggers for load balancing Steve Muckle <steve.muckle@linaro.org> - 2016-02-23 02:30 +0100
  [RFCv7 PATCH 04/10] sched/fair: add triggers for OPP change requests Steve Muckle <steve.muckle@linaro.org> - 2016-02-23 02:30 +0100
    Re: [RFCv7 PATCH 04/10] sched/fair: add triggers for OPP change requests Ricky Liang <jcliang@chromium.org> - 2016-03-01 08:00 +0100
      Re: [RFCv7 PATCH 04/10] sched/fair: add triggers for OPP change  requests Steve Muckle <steve.muckle@linaro.org> - 2016-03-03 05:00 +0100
  [RFCv7 PATCH 03/10] sched: scheduler-driven cpu frequency selection Steve Muckle <steve.muckle@linaro.org> - 2016-02-23 02:30 +0100
    Re: [RFCv7 PATCH 03/10] sched: scheduler-driven cpu frequency selection "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2016-02-25 05:00 +0100
      Re: [RFCv7 PATCH 03/10] sched: scheduler-driven cpu frequency  selection Peter Zijlstra <peterz@infradead.org> - 2016-02-25 10:30 +0100
        Re: [RFCv7 PATCH 03/10] sched: scheduler-driven cpu frequency selection "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2016-02-25 22:10 +0100
      Re: [RFCv7 PATCH 03/10] sched: scheduler-driven cpu frequency  selection Peter Zijlstra <peterz@infradead.org> - 2016-02-25 10:30 +0100
        Re: [RFCv7 PATCH 03/10] sched: scheduler-driven cpu frequency selection "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2016-02-25 22:10 +0100
          Re: [RFCv7 PATCH 03/10] sched: scheduler-driven cpu frequency  selection Peter Zijlstra <peterz@infradead.org> - 2016-02-26 10:20 +0100
            Re: [RFCv7 PATCH 03/10] sched: scheduler-driven cpu frequency selection "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2016-02-27 01:10 +0100
              Re: [RFCv7 PATCH 03/10] sched: scheduler-driven cpu frequency  selection Peter Zijlstra <peterz@infradead.org> - 2016-03-01 14:00 +0100
                Re: [RFCv7 PATCH 03/10] sched: scheduler-driven cpu frequency selection "Rafael J. Wysocki" <rafael@kernel.org> - 2016-03-01 20:50 +0100
      Re: [RFCv7 PATCH 03/10] sched: scheduler-driven cpu frequency selection "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2016-02-25 12:10 +0100
      Re: [RFCv7 PATCH 03/10] sched: scheduler-driven cpu frequency  selection Steve Muckle <steve.muckle@linaro.org> - 2016-02-26 01:40 +0100
        Re: [RFCv7 PATCH 03/10] sched: scheduler-driven cpu frequency selection "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2016-02-27 03:40 +0100
          Re: [RFCv7 PATCH 03/10] sched: scheduler-driven cpu frequency  selection Steve Muckle <steve.muckle@linaro.org> - 2016-02-27 05:20 +0100
            Re: [RFCv7 PATCH 03/10] sched: scheduler-driven cpu frequency selection "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2016-02-28 03:30 +0100
              Re: [RFCv7 PATCH 03/10] sched: scheduler-driven cpu frequency  selection Peter Zijlstra <peterz@infradead.org> - 2016-03-01 15:40 +0100
                Re: [RFCv7 PATCH 03/10] sched: scheduler-driven cpu frequency selection "Rafael J. Wysocki" <rafael@kernel.org> - 2016-03-01 21:40 +0100
            Re: [RFCv7 PATCH 03/10] sched: scheduler-driven cpu frequency  selection Peter Zijlstra <peterz@infradead.org> - 2016-03-01 14:30 +0100
        Re: [RFCv7 PATCH 03/10] sched: scheduler-driven cpu frequency  selection Peter Zijlstra <peterz@infradead.org> - 2016-03-01 14:20 +0100
        Re: [RFCv7 PATCH 03/10] sched: scheduler-driven cpu frequency selection Michael Turquette <mturquette@baylibre.com> - 2016-03-02 08:50 +0100
          Re: [RFCv7 PATCH 03/10] sched: scheduler-driven cpu frequency selection "Rafael J. Wysocki" <rafael@kernel.org> - 2016-03-03 03:50 +0100
            Re: [RFCv7 PATCH 03/10] sched: scheduler-driven cpu frequency  selection Steve Muckle <steve.muckle@linaro.org> - 2016-03-03 05:00 +0100
              Re: [RFCv7 PATCH 03/10] sched: scheduler-driven cpu frequency  selection Juri Lelli <Juri.Lelli@arm.com> - 2016-03-03 10:40 +0100
          Re: [RFCv7 PATCH 03/10] sched: scheduler-driven cpu frequency  selection Peter Zijlstra <peterz@infradead.org> - 2016-03-03 14:10 +0100
    Re: [RFCv7 PATCH 03/10] sched: scheduler-driven cpu frequency  selection Ingo Molnar <mingo@kernel.org> - 2016-03-03 15:30 +0100
  [RFCv7 PATCH 05/10] sched/{core,fair}: trigger OPP change request on fork() Steve Muckle <steve.muckle@linaro.org> - 2016-02-23 02:30 +0100
  [RFCv7 PATCH 01/10] sched: Compute cpu capacity available at current frequency Steve Muckle <steve.muckle@linaro.org> - 2016-02-23 02:30 +0100
    Re: [RFCv7 PATCH 01/10] sched: Compute cpu capacity available at  current frequency "Rafael J. Wysocki" <rafael@kernel.org> - 2016-02-23 02:50 +0100
      Re: [RFCv7 PATCH 01/10] sched: Compute cpu capacity available at  current frequency Peter Zijlstra <peterz@infradead.org> - 2016-02-23 10:20 +0100
        Re: [RFCv7 PATCH 01/10] sched: Compute cpu capacity available at current frequency "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2016-02-26 02:40 +0100
          Re: [RFCv7 PATCH 01/10] sched: Compute cpu capacity available at  current frequency Peter Zijlstra <peterz@infradead.org> - 2016-02-26 10:20 +0100
  Re: [RFCv7 PATCH 00/10] sched: scheduler-driven CPU frequency  selection Steve Muckle <steve.muckle@linaro.org> - 2016-02-23 02:40 +0100

csiph-web