1. 16 Jul, 2020 1 commit
  2. 15 Jul, 2020 12 commits
    • Wei Yongjun's avatar
      cpufreq: powernv: Make some symbols static · 133c6c84
      Wei Yongjun authored
      The sparse tool complains as follows:
      
      drivers/cpufreq/powernv-cpufreq.c:88:1: warning:
       symbol 'pstate_revmap' was not declared. Should it be static?
      drivers/cpufreq/powernv-cpufreq.c:383:18: warning:
       symbol 'cpufreq_freq_attr_cpuinfo_nominal_freq' was not declared. Should it be static?
      drivers/cpufreq/powernv-cpufreq.c:669:6: warning:
       symbol 'gpstate_timer_handler' was not declared. Should it be static?
      drivers/cpufreq/powernv-cpufreq.c:902:6: warning:
       symbol 'powernv_cpufreq_work_fn' was not declared. Should it be static?
      
      Those symbols are not used outside of this file, so mark
      them static.
      Reported-by: default avatarHulk Robot <hulkci@huawei.com>
      Signed-off-by: default avatarWei Yongjun <weiyongjun1@huawei.com>
      Acked-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
      Reviewed-by: default avatarLee Jones <lee.jones@linaro.org>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      133c6c84
    • Lee Jones's avatar
      cpufreq: amd_freq_sensitivity: Mark sometimes used ID structs as __maybe_unused · 52fe0b16
      Lee Jones authored
      ot used when MODULE is not defined.
      
      Fixes the following W=1 kernel build warning(s):
      
       drivers/cpufreq/amd_freq_sensitivity.c:147:32: warning: ‘amd_freq_sensitivity_ids’ defined but not used [-Wunused-const-variable=]
       147 | static const struct x86_cpu_id amd_freq_sensitivity_ids[] = {
       | ^~~~~~~~~~~~~~~~~~~~~~~~
      Signed-off-by: default avatarLee Jones <lee.jones@linaro.org>
      Acked-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      52fe0b16
    • Lee Jones's avatar
      cpufreq: intel_pstate: Supply struct attribute description for get_aperf_mperf_shift() · 8f23d1f1
      Lee Jones authored
      Fixes the following W=1 kernel build warning(s):
      
       drivers/cpufreq/intel_pstate.c:293: warning: Function parameter or member 'get_aperf_mperf_shift' not described in 'pstate_funcs'
      Suggested-by: default avatar"Rafael J. Wysocki" <rafael@kernel.org>
      Signed-off-by: default avatarLee Jones <lee.jones@linaro.org>
      Acked-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
      [ rjw: Remove line break ]
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      8f23d1f1
    • Lee Jones's avatar
      cpufreq: pcc-cpufreq: Mark sometimes used ID structs as __maybe_unused · 30981749
      Lee Jones authored
      Not used when MODULE is not defined.
      
      Fixes the following W=1 kernel build warning(s):
      
       drivers/cpufreq/pcc-cpufreq.c:619:36: warning: ‘processor_device_ids’ defined but not used [-Wunused-const-variable=]
       619 | static const struct acpi_device_id processor_device_ids[] = {
       | ^~~~~~~~~~~~~~~~~~~~
      Signed-off-by: default avatarLee Jones <lee.jones@linaro.org>
      Acked-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      30981749
    • Lee Jones's avatar
      cpufreq: powernow-k8: Mark 'hi' and 'lo' dummy variables as __always_unused · 638b5097
      Lee Jones authored
      if we fail to use a variable, even a dummy ones, then the compiler
      complains that it is set but not used.  We know this is fine, so we
      set them as __always_unused here to let the compiler know.
      
      Fixes the following W=1 kernel build warning(s):
      
       drivers/cpufreq/powernow-k8.c: In function ‘pending_bit_stuck’:
       drivers/cpufreq/powernow-k8.c:89:10: warning: variable ‘hi’ set but not used [-Wunused-but-set-variable]
       89 | u32 lo, hi;
       | ^~
       drivers/cpufreq/powernow-k8.c: In function ‘core_voltage_pre_transition’:
       drivers/cpufreq/powernow-k8.c:285:14: warning: variable ‘lo’ set but not used [-Wunused-but-set-variable]
       285 | u32 maxvid, lo, rvomult = 1;
       | ^~
      Signed-off-by: default avatarLee Jones <lee.jones@linaro.org>
      Acked-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      638b5097
    • Lee Jones's avatar
      cpufreq: acpi-cpufreq: Mark sometimes used ID structs as __maybe_unused · a7b90937
      Lee Jones authored
      Not used when MODULE is not defined.
      
      Fixes the following W=1 kernel build warning(s):
      
       drivers/cpufreq/acpi-cpufreq.c:1004:36: warning: ‘processor_device_ids’ defined but not used [-Wunused-const-variable=]
       997 | static const struct x86_cpu_id acpi_cpufreq_ids[] = {
       | ^~~~~~~~~~~~~~~~
       drivers/cpufreq/acpi-cpufreq.c:997:32: warning: ‘acpi_cpufreq_ids’ defined but not used [-Wunused-const-variable=]
       619 | static const struct acpi_device_id processor_device_ids[] = {
       | ^~~~~~~~~~~~~~~~~~~~
      Signed-off-by: default avatarLee Jones <lee.jones@linaro.org>
      Acked-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      a7b90937
    • Lee Jones's avatar
      cpufreq: acpi-cpufreq: Mark 'dummy' variable as __always_unused · e1711f29
      Lee Jones authored
      If we fail to use a variable, even a 'dummy' one, then the compiler
      complains that it is set but not used.  We know this is fine, so we
      set it as __always_unused to let the compiler know.
      
      Fixes the following W=1 kernel build warning(s):
      
       drivers/cpufreq/acpi-cpufreq.c: In function ‘cpu_freq_read_intel’:
       drivers/cpufreq/acpi-cpufreq.c:247:11: warning: variable ‘dummy’ set but not used [-Wunused-but-set-variable]
       drivers/cpufreq/acpi-cpufreq.c: In function ‘cpu_freq_read_amd’:
       drivers/cpufreq/acpi-cpufreq.c:265:11: warning: variable ‘dummy’ set but not used [-Wunused-but-set-variable]
      Signed-off-by: default avatarLee Jones <lee.jones@linaro.org>
      Acked-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      e1711f29
    • Lee Jones's avatar
      cpufreq: powernv-cpufreq: Fix a bunch of kerneldoc related issues · 44bd9a30
      Lee Jones authored
      Repair problems with formatting and missing attributes/parameters, and
      demote header comments which do not meet the required standards
      applicable to kerneldoc.
      
      Fixes the following W=1 kernel build warning(s):
      
       drivers/cpufreq/powernv-cpufreq.c:84: warning: Function parameter or member 'last_lpstate_idx' not described in 'global_pstate_info'
       drivers/cpufreq/powernv-cpufreq.c:84: warning: Function parameter or member 'last_gpstate_idx' not described in 'global_pstate_info'
       drivers/cpufreq/powernv-cpufreq.c:84: warning: Function parameter or member 'policy' not described in 'global_pstate_info'
       drivers/cpufreq/powernv-cpufreq.c:182: warning: Function parameter or member 'i' not described in 'idx_to_pstate'
       drivers/cpufreq/powernv-cpufreq.c:201: warning: Function parameter or member 'pstate' not described in 'pstate_to_idx'
       drivers/cpufreq/powernv-cpufreq.c:670: warning: Function parameter or member 't' not described in 'gpstate_timer_handler'
       drivers/cpufreq/powernv-cpufreq.c:670: warning: Excess function parameter 'data' description in 'gpstate_timer_handler'
      Signed-off-by: default avatarLee Jones <lee.jones@linaro.org>
      Acked-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      44bd9a30
    • Lee Jones's avatar
      cpufreq: pasemi: Include header file for {check,restore}_astate prototypes · 4a27aa9c
      Lee Jones authored
      If function callers and providers do not share the same prototypes the
      compiler complains of missing prototypes.  Fix this by including the
      correct platforms header file.
      
      Fixes the following W=1 kernel build warning(s):
      
       drivers/cpufreq/pasemi-cpufreq.c:109:5: warning: no previous prototype for ‘check_astate’ [-Wmissing-prototypes]
       109 | int check_astate(void)
       | ^~~~~~~~~~~~
       drivers/cpufreq/pasemi-cpufreq.c:114:6: warning: no previous prototype for ‘restore_astate’ [-Wmissing-prototypes]
       114 | void restore_astate(int cpu)
       | ^~~~~~~~~~~~~~
      Suggested-by: default avatarOlof Johansson <olof@lixom.net>
      Signed-off-by: default avatarLee Jones <lee.jones@linaro.org>
      Acked-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      4a27aa9c
    • Lee Jones's avatar
      cpufreq: cpufreq_governor: Demote store_sampling_rate() header to standard comment block · dd2e65f2
      Lee Jones authored
      There is no need for this to be denoted as kerneldoc.
      
      Fixes the following W=1 kernel build warning(s):
      
       drivers/cpufreq/cpufreq_governor.c:46: warning: Function parameter or member 'attr_set' not described in 'store_sampling_rate'
       drivers/cpufreq/cpufreq_governor.c:46: warning: Function parameter or member 'buf' not described in 'store_sampling_rate'
       drivers/cpufreq/cpufreq_governor.c:46: warning: Function parameter or member 'count' not described in 'store_sampling_rate'
      Signed-off-by: default avatarLee Jones <lee.jones@linaro.org>
      Acked-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      dd2e65f2
    • Lee Jones's avatar
      cpufreq: cpufreq: Demote lots of function headers unworthy of kerneldoc status · a9909c21
      Lee Jones authored
      Also provide missing function parameter description for 'cpu' and 'policy'.
      
      Fixes the following W=1 kernel build warning(s):
      
       drivers/cpufreq/cpufreq.c:60: warning: cannot understand function prototype: 'struct cpufreq_driver *cpufreq_driver; '
       drivers/cpufreq/cpufreq.c:90: warning: Function parameter or member 'cpufreq_policy_notifier_list' not described in 'BLOCKING_NOTIFIER_HEAD'
       drivers/cpufreq/cpufreq.c:312: warning: Function parameter or member 'val' not described in 'adjust_jiffies'
       drivers/cpufreq/cpufreq.c:312: warning: Function parameter or member 'ci' not described in 'adjust_jiffies'
       drivers/cpufreq/cpufreq.c:538: warning: Function parameter or member 'policy' not described in 'cpufreq_driver_resolve_freq'
       drivers/cpufreq/cpufreq.c:686: warning: Function parameter or member 'file_name' not described in 'show_one'
       drivers/cpufreq/cpufreq.c:686: warning: Function parameter or member 'object' not described in 'show_one'
       drivers/cpufreq/cpufreq.c:731: warning: Function parameter or member 'file_name' not described in 'store_one'
       drivers/cpufreq/cpufreq.c:731: warning: Function parameter or member 'object' not described in 'store_one'
       drivers/cpufreq/cpufreq.c:741: warning: Function parameter or member 'policy' not described in 'show_cpuinfo_cur_freq'
       drivers/cpufreq/cpufreq.c:741: warning: Function parameter or member 'buf' not described in 'show_cpuinfo_cur_freq'
       drivers/cpufreq/cpufreq.c:754: warning: Function parameter or member 'policy' not described in 'show_scaling_governor'
       drivers/cpufreq/cpufreq.c:754: warning: Function parameter or member 'buf' not described in 'show_scaling_governor'
       drivers/cpufreq/cpufreq.c:770: warning: Function parameter or member 'policy' not described in 'store_scaling_governor'
       drivers/cpufreq/cpufreq.c:770: warning: Function parameter or member 'buf' not described in 'store_scaling_governor'
       drivers/cpufreq/cpufreq.c:770: warning: Function parameter or member 'count' not described in 'store_scaling_governor'
       drivers/cpufreq/cpufreq.c:806: warning: Function parameter or member 'policy' not described in 'show_scaling_driver'
       drivers/cpufreq/cpufreq.c:806: warning: Function parameter or member 'buf' not described in 'show_scaling_driver'
       drivers/cpufreq/cpufreq.c:815: warning: Function parameter or member 'policy' not described in 'show_scaling_available_governors'
       drivers/cpufreq/cpufreq.c:815: warning: Function parameter or member 'buf' not described in 'show_scaling_available_governors'
       drivers/cpufreq/cpufreq.c:859: warning: Function parameter or member 'policy' not described in 'show_related_cpus'
       drivers/cpufreq/cpufreq.c:859: warning: Function parameter or member 'buf' not described in 'show_related_cpus'
       drivers/cpufreq/cpufreq.c:867: warning: Function parameter or member 'policy' not described in 'show_affected_cpus'
       drivers/cpufreq/cpufreq.c:867: warning: Function parameter or member 'buf' not described in 'show_affected_cpus'
       drivers/cpufreq/cpufreq.c:901: warning: Function parameter or member 'policy' not described in 'show_bios_limit'
       drivers/cpufreq/cpufreq.c:901: warning: Function parameter or member 'buf' not described in 'show_bios_limit'
       drivers/cpufreq/cpufreq.c:1625: warning: Function parameter or member 'dev' not described in 'cpufreq_remove_dev'
       drivers/cpufreq/cpufreq.c:1625: warning: Function parameter or member 'sif' not described in 'cpufreq_remove_dev'
       drivers/cpufreq/cpufreq.c:2380: warning: Function parameter or member 'cpu' not described in 'cpufreq_get_policy'
       drivers/cpufreq/cpufreq.c:2771: warning: Function parameter or member 'driver' not described in 'cpufreq_unregister_driver'
      Signed-off-by: default avatarLee Jones <lee.jones@linaro.org>
      Acked-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      a9909c21
    • Lee Jones's avatar
      cpufreq: freq_table: Demote obvious misuse of kerneldoc to standard comment blocks · 19231a87
      Lee Jones authored
      No attempt has been made to document any of the demoted functions here.
      
      Fixes the following W=1 kernel build warning(s):
      
       drivers/cpufreq/freq_table.c:229: warning: Function parameter or member 'policy' not described in 'show_available_freqs'
       drivers/cpufreq/freq_table.c:229: warning: Function parameter or member 'buf' not described in 'show_available_freqs'
       drivers/cpufreq/freq_table.c:229: warning: Function parameter or member 'show_boost' not described in 'show_available_freqs'
       drivers/cpufreq/freq_table.c:269: warning: Function parameter or member 'policy' not described in 'scaling_available_frequencies_show'
       drivers/cpufreq/freq_table.c:269: warning: Function parameter or member 'buf' not described in 'scaling_available_frequencies_show'
       drivers/cpufreq/freq_table.c:281: warning: Function parameter or member 'policy' not described in 'scaling_boost_frequencies_show'
       drivers/cpufreq/freq_table.c:281: warning: Function parameter or member 'buf' not described in 'scaling_boost_frequencies_show'
      Signed-off-by: default avatarLee Jones <lee.jones@linaro.org>
      Acked-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      19231a87
  3. 13 Jul, 2020 2 commits
  4. 02 Jul, 2020 6 commits
    • Viresh Kumar's avatar
      cpufreq: Remove the weakly defined cpufreq_default_governor() · 3a7e4fbb
      Viresh Kumar authored
      The default cpufreq governor is chosen with the help of a "choice"
      option in the Kconfig which will always end up selecting one of
      the governors and so the weakly defined definition of
      cpufreq_default_governor() will never get called.
      
      Moreover, this makes us skip the checking of the return value of
      that routine as it will always be non NULL.
      
      If the Kconfig option changes in future, then we will start getting
      a link error instead (and it won't go unnoticed as in the case of the
      weak definition).
      Suggested-by: default avatarQuentin Perret <qperret@google.com>
      Signed-off-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      3a7e4fbb
    • Quentin Perret's avatar
      cpufreq: Specify default governor on command line · 8412b456
      Quentin Perret authored
      Currently, the only way to specify the default CPUfreq governor is
      via Kconfig options, which suits users who can build the kernel
      themselves perfectly.
      
      However, for those who use a distro-like kernel (such as Android,
      with the Generic Kernel Image project), the only way to use a
      non-default governor is to boot to userspace, and to then switch
      using the sysfs interface. Being able to specify the default governor
      on the command line, like is the case for cpuidle, would allow those
      users to specify their governor of choice earlier on, and to simplify
      the userspace boot procedure slighlty.
      
      To support this use-case, add a kernel command line parameter
      allowing the default governor for CPUfreq to be specified, which
      takes precedence over the built-in default.
      
      This implementation has one notable limitation: the default governor
      must be registered before the driver. This is solved for builtin
      governors and drivers using appropriate *_initcall() functions. And
      in the modular case, this must be reflected as a constraint on the
      module loading order.
      Signed-off-by: default avatarQuentin Perret <qperret@google.com>
      [ Viresh: Converted 'default_governor' to a string and parsing it only
      	  at initcall level, and several updates to
      	  cpufreq_init_policy(). ]
      Signed-off-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
      [ rjw: Changelog ]
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      8412b456
    • Quentin Perret's avatar
      cpufreq: Register governors at core_initcall · 10dd8573
      Quentin Perret authored
      Currently, most CPUFreq governors are registered at the core_initcall
      time when the given governor is the default one, and the module_init
      time otherwise.
      
      In preparation for letting users specify the default governor on the
      kernel command line, change all of them to be registered at the
      core_initcall unconditionally, as it is already the case for the
      schedutil and performance governors. This will allow us to assume
      that builtin governors have been registered before the built-in
      CPUFreq drivers probe.
      
      And since all governors have similar init/exit patterns now, introduce
      two new macros, cpufreq_governor_{init,exit}(), to factorize the code.
      Acked-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
      Signed-off-by: default avatarQuentin Perret <qperret@google.com>
      Signed-off-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
      [ rjw: Changelog ]
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      10dd8573
    • Viresh Kumar's avatar
      cpufreq: Fix locking issues with governors · 8cc46ae5
      Viresh Kumar authored
      The locking around governors handling isn't adequate currently.
      
      The list of governors should never be traversed without the locking
      in place. Also governor modules must not be removed while the code
      in them is still in use.
      Reported-by: default avatarQuentin Perret <qperret@google.com>
      Signed-off-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
      Cc: All applicable <stable@vger.kernel.org>
      [ rjw: Changelog ]
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      8cc46ae5
    • Srinivas Pandruvada's avatar
      cpufreq: intel_pstate: Allow raw energy performance preference value · f473bf39
      Srinivas Pandruvada authored
      Currently using attribute "energy_performance_preference", user space can
      write one of the four per-defined preference string. These preference
      strings gets mapped to a hard-coded Energy-Performance Preference (EPP) or
      Energy-Performance Bias (EPB) knob.
      
      These four values are supposed to cover broad spectrum of use cases, but
      are not uniformly distributed in the range. There are number of cases,
      where this is not enough. For example:
      
      Suppose user wants more performance when connected to AC. Instead of using
      default "balance performance", the "performance" setting can be used. This
      changes EPP value from 0x80 to 0x00. But setting EPP to 0, results in
      electrical and thermal issues on some platforms. This results in
      aggressive throttling, which causes a drop in performance. But some value
      between 0x80 and 0x00 results in better performance. But that value can't
      be fixed as the power curve is not linear. In some cases just changing EPP
      from 0x80 to 0x75 is enough to get significant performance gain.
      
      Similarly on battery the default "balance_performance" mode can be
      aggressive in power consumption. But picking up the next choice
      "balance power" results in too much loss of performance, which results in
      bad user experience in use cases like "Google Hangout". It was observed
      that some value between these two EPP is optimal.
      
      This change allows fine grain EPP tuning for platform like Chromebook or
      for users who wants to fine tune power and performance.
      Here based on the product and use cases, different EPP values can be set.
      This change is similar to the change done for:
      /sys/devices/system/cpu/cpu*/power/energy_perf_bias
      where user has choice to write a predefined string or raw value.
      
      The change itself is trivial. When user preference doesn't match
      predefined string preferences and value is an unsigned integer and in
      range, use that value for EPP. When the EPP feature is not present
      writing raw value is not supported.
      Suggested-by: default avatarLen Brown <lenb@kernel.org>
      Signed-off-by: default avatarSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      f473bf39
    • Srinivas Pandruvada's avatar
      cpufreq: intel_pstate: Allow enable/disable energy efficiency · ed7bde7a
      Srinivas Pandruvada authored
      By default intel_pstate the driver disables energy efficiency by setting
      MSR_IA32_POWER_CTL bit 19 for Kaby Lake desktop CPU model in HWP mode.
      This CPU model is also shared by Coffee Lake desktop CPUs. This allows
      these systems to reach maximum possible frequency. But this adds power
      penalty, which some customers don't want. They want some way to enable/
      disable dynamically.
      
      So, add an additional attribute "energy_efficiency" under
      /sys/devices/system/cpu/intel_pstate/ for these CPU models. This allows
      to read and write bit 19 ("Disable Energy Efficiency Optimization") in
      the MSR IA32_POWER_CTL.
      
      This attribute is present in both HWP and non-HWP mode as this has an
      effect in both modes. Refer to Intel Software Developer's manual for
      details.
      
      The scope of this bit is package wide. Also these systems are single
      package systems. So read/write MSR on the current CPU is enough.
      
      The energy efficiency (EE) bit setting needs to be preserved during
      suspend/resume and CPU offline/online operation. To do this:
      - Restoring the EE setting from the cpufreq resume() callback, if there
      is change from the system default.
      - By default, don't disable EE from cpufreq init() callback for matching
      CPU models. Since the scope is package wide and is a single package
      system, move the disable EE calls from init() callback to
      intel_pstate_init() function, which is called only once.
      Suggested-by: default avatarLen Brown <lenb@kernel.org>
      Signed-off-by: default avatarSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      ed7bde7a
  5. 28 Jun, 2020 19 commits
    • Linus Torvalds's avatar
      Linux 5.8-rc3 · 9ebcfadb
      Linus Torvalds authored
      9ebcfadb
    • Linus Torvalds's avatar
      Merge tag 'arm-omap-fixes-5.8-1' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc · f7db192b
      Linus Torvalds authored
      Pull ARM OMAP fixes from Arnd Bergmann:
       "The OMAP developers are particularly active at hunting down
        regressions, so this is a separate branch with OMAP specific
        fixes for v5.8:
      
        As Tony explains
          "The recent display subsystem (DSS) related platform data changes
           caused display related regressions for suspend and resume. Looks
           like I only tested suspend and resume before dropping the legacy
           platform data, and forgot to test it after dropping it. Turns out
           the main issue was that we no longer have platform code calling
           pm_runtime_suspend for DSS like we did for the legacy platform data
           case, and that fix is still being discussed on the dri-devel list
           and will get merged separately. The DSS related testing exposed a
           pile other other display related issues that also need fixing
           though":
      
         - Fix ti-sysc optional clock handling and reset status checks for
           devices that reset automatically in idle like DSS
      
         - Ignore ti-sysc clockactivity bit unless separately requested to
           avoid unexpected performance issues
      
         - Init ti-sysc framedonetv_irq to true and disable for am4
      
         - Avoid duplicate DSS reset for legacy mode with dts data
      
         - Remove LCD timings for am4 as they cause warnings now that we're
           using generic panels
      
        Other OMAP changes from Tony include:
      
         - Fix omap_prm reset deassert as we still have drivers setting the
           pm_runtime_irq_safe() flag
      
         - Flush posted write for ti-sysc enable and disable
      
         - Fix droid4 spi related errors with spi flags
      
         - Fix am335x USB range and a typo for softreset
      
         - Fix dra7 timer nodes for clocks for IPU and DSP
      
         - Drop duplicate mailboxes after mismerge for dra7
      
         - Prevent pocketgeagle header line signal from accidentally setting
           micro-SD write protection signal by removing the default mux
      
         - Fix NFSroot flakeyness after resume for duover by switching the
           smsc911x gpio interrupt to back to level sensitive
      
         - Fix regression for omap4 clockevent source after recent system
           timer changes
      
         - Yet another ethernet regression fix for the "rgmii" vs "rgmii-rxid"
           phy-mode
      
         - One patch to convert am3/am4 DT files to use the regular sdhci-omap
           driver instead of the old hsmmc driver, this was meant for the
           merge window but got lost in the process"
      
      * tag 'arm-omap-fixes-5.8-1' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc: (21 commits)
        ARM: dts: am5729: beaglebone-ai: fix rgmii phy-mode
        ARM: dts: Fix omap4 system timer source clocks
        ARM: dts: Fix duovero smsc interrupt for suspend
        ARM: dts: am335x-pocketbeagle: Fix mmc0 Write Protect
        Revert "bus: ti-sysc: Increase max softreset wait"
        ARM: dts: am437x-epos-evm: remove lcd timings
        ARM: dts: am437x-gp-evm: remove lcd timings
        ARM: dts: am437x-sk-evm: remove lcd timings
        ARM: dts: dra7-evm-common: Fix duplicate mailbox nodes
        ARM: dts: dra7: Fix timer nodes properly for timer_sys_ck clocks
        ARM: dts: Fix am33xx.dtsi ti,sysc-mask wrong softreset flag
        ARM: dts: Fix am33xx.dtsi USB ranges length
        bus: ti-sysc: Increase max softreset wait
        ARM: OMAP2+: Fix legacy mode dss_reset
        bus: ti-sysc: Fix uninitialized framedonetv_irq
        bus: ti-sysc: Ignore clockactivity unless specified as a quirk
        bus: ti-sysc: Use optional clocks on for enable and wait for softreset bit
        ARM: dts: omap4-droid4: Fix spi configuration and increase rate
        bus: ti-sysc: Flush posted write on enable and disable
        soc: ti: omap-prm: use atomic iopoll instead of sleeping one
        ...
      f7db192b
    • Linus Torvalds's avatar
      Merge tag 'arm-fixes-5.8-1' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc · e44b59cd
      Linus Torvalds authored
      Pull ARM SoC fixes from Arnd Bergmann:
       "Here are a couple of bug fixes, mostly for devicetree files
      
        NXP i.MX:
         - Use correct voltage on some i.MX8M board device trees to avoid
           hardware damage
         - Code fixes for a compiler warning and incorrect reference counting,
           both harmless.
         - Fix the i.MX8M SoC driver to correctly identify imx8mp
         - Fix watchdog configuration in imx6ul-kontron device tree.
      
        Broadcom:
         - A small regression fix for the Raspberry-Pi firmware driver
         - A Kconfig change to use the correct timer driver on Northstar
         - A DT fix for the Luxul XWC-2000 machine
         - Two more DT fixes for NSP SoCs
      
        STmicroelectronics STI
         - Revert one broken patch for L2 cache configuration
      
        ARM Versatile Express:
         - Fix a regression by reverting a broken DT cleanup
      
        TEE drivers:
         - MAINTAINERS: change tee mailing list"
      
      * tag 'arm-fixes-5.8-1' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc:
        Revert "ARM: sti: Implement dummy L2 cache's write_sec"
        soc: imx8m: fix build warning
        ARM: imx6: add missing put_device() call in imx6q_suspend_init()
        ARM: imx5: add missing put_device() call in imx_suspend_alloc_ocram()
        soc: imx8m: Correct i.MX8MP UID fuse offset
        ARM: dts: imx6ul-kontron: Change WDOG_ANY signal from push-pull to open-drain
        ARM: dts: imx6ul-kontron: Move watchdog from Kontron i.MX6UL/ULL board to SoM
        arm64: dts: imx8mm-beacon: Fix voltages on LDO1 and LDO2
        arm64: dts: imx8mn-ddr4-evk: correct ldo1/ldo2 voltage range
        arm64: dts: imx8mm-evk: correct ldo1/ldo2 voltage range
        ARM: dts: NSP: Correct FA2 mailbox node
        ARM: bcm2835: Fix integer overflow in rpi_firmware_print_firmware_revision()
        MAINTAINERS: change tee mailing list
        ARM: dts: NSP: Disable PL330 by default, add dma-coherent property
        ARM: bcm: Select ARM_TIMER_SP804 for ARCH_BCM_NSP
        ARM: dts: BCM5301X: Add missing memory "device_type" for Luxul XWC-2000
        arm: dts: vexpress: Move mcc node back into motherboard node
      e44b59cd
    • Linus Torvalds's avatar
      Merge tag 'timers-urgent-2020-06-28' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 668f532d
      Linus Torvalds authored
      Pull timer fix from Ingo Molnar:
       "A single DocBook fix"
      
      * tag 'timers-urgent-2020-06-28' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        timekeeping: Fix kerneldoc system_device_crosststamp & al
      668f532d
    • Linus Torvalds's avatar
      Merge tag 'perf-urgent-2020-06-28' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · ae71d4bf
      Linus Torvalds authored
      Pull perf fix from Ingo Molnar:
       "A single Kbuild dependency fix"
      
      * tag 'perf-urgent-2020-06-28' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        perf/x86/rapl: Fix RAPL config variable bug
      ae71d4bf
    • Linus Torvalds's avatar
      Merge tag 'efi-urgent-2020-06-28' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · bc53f67d
      Linus Torvalds authored
      Pull EFI fixes from Ingo Molnar:
      
       - Fix build regression on v4.8 and older
      
       - Robustness fix for TPM log parsing code
      
       - kobject refcount fix for the ESRT parsing code
      
       - Two efivarfs fixes to make it behave more like an ordinary file
         system
      
       - Style fixup for zero length arrays
      
       - Fix a regression in path separator handling in the initrd loader
      
       - Fix a missing prototype warning
      
       - Add some kerneldoc headers for newly introduced stub routines
      
       - Allow support for SSDT overrides via EFI variables to be disabled
      
       - Report CPU mode and MMU state upon entry for 32-bit ARM
      
       - Use the correct stack pointer alignment when entering from mixed mode
      
      * tag 'efi-urgent-2020-06-28' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        efi/libstub: arm: Print CPU boot mode and MMU state at boot
        efi/libstub: arm: Omit arch specific config table matching array on arm64
        efi/x86: Setup stack correctly for efi_pe_entry
        efi: Make it possible to disable efivar_ssdt entirely
        efi/libstub: Descriptions for stub helper functions
        efi/libstub: Fix path separator regression
        efi/libstub: Fix missing-prototype warning for skip_spaces()
        efi: Replace zero-length array and use struct_size() helper
        efivarfs: Don't return -EINTR when rate-limiting reads
        efivarfs: Update inode modification time for successful writes
        efi/esrt: Fix reference count leak in esre_create_sysfs_entry.
        efi/tpm: Verify event log header before parsing
        efi/x86: Fix build with gcc 4
      bc53f67d
    • Linus Torvalds's avatar
      Merge tag 'sched_urgent_for_5.8_rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 91a9a90d
      Linus Torvalds authored
      Pull scheduler fixes from Borislav Petkov:
       "The most anticipated fix in this pull request is probably the horrible
        build fix for the RANDSTRUCT fail that didn't make -rc2. Also included
        is the cleanup that removes those BUILD_BUG_ON()s and replaces it with
        ugly unions.
      
        Also included is the try_to_wake_up() race fix that was first
        triggered by Paul's RCU-torture runs, but was independently hit by
        Dave Chinner's fstest runs as well"
      
      * tag 'sched_urgent_for_5.8_rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        sched/cfs: change initial value of runnable_avg
        smp, irq_work: Continue smp_call_function*() and irq_work*() integration
        sched/core: s/WF_ON_RQ/WQ_ON_CPU/
        sched/core: Fix ttwu() race
        sched/core: Fix PI boosting between RT and DEADLINE tasks
        sched/deadline: Initialize ->dl_boosted
        sched/core: Check cpus_mask, not cpus_ptr in __set_cpus_allowed_ptr(), to fix mask corruption
        sched/core: Fix CONFIG_GCC_PLUGIN_RANDSTRUCT build fail
      91a9a90d
    • Linus Torvalds's avatar
      Merge tag 'x86_urgent_for_5.8_rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 098c7938
      Linus Torvalds authored
      Pull x86 fixes from Borislav Petkov:
      
       - AMD Memory bandwidth counter width fix, by Babu Moger.
      
       - Use the proper length type in the 32-bit truncate() syscall variant,
         by Jiri Slaby.
      
       - Reinit IA32_FEAT_CTL during wakeup to fix the case where after
         resume, VMXON would #GP due to VMX not being properly enabled, by
         Sean Christopherson.
      
       - Fix a static checker warning in the resctrl code, by Dan Carpenter.
      
       - Add a CR4 pinning mask for bits which cannot change after boot, by
         Kees Cook.
      
       - Align the start of the loop of __clear_user() to 16 bytes, to improve
         performance on AMD zen1 and zen2 microarchitectures, by Matt Fleming.
      
      * tag 'x86_urgent_for_5.8_rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        x86/asm/64: Align start of __clear_user() loop to 16-bytes
        x86/cpu: Use pinning mask for CR4 bits needing to be 0
        x86/resctrl: Fix a NULL vs IS_ERR() static checker warning in rdt_cdp_peer_get()
        x86/cpu: Reinitialize IA32_FEAT_CTL MSR on BSP during wakeup
        syscalls: Fix offset type of ksys_ftruncate()
        x86/resctrl: Fix memory bandwidth counter width for AMD
      098c7938
    • Linus Torvalds's avatar
      Merge tag 'rcu_urgent_for_5.8_rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · c141b30e
      Linus Torvalds authored
      Pull RCU-vs-KCSAN fixes from Borislav Petkov:
       "A single commit that uses "arch_" atomic operations to avoid the
        instrumentation that comes with the non-"arch_" versions.
      
        In preparation for that commit, it also has another commit that makes
        these "arch_" atomic operations available to generic code.
      
        Without these commits, KCSAN uses can see pointless errors"
      
      * tag 'rcu_urgent_for_5.8_rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        rcu: Fixup noinstr warnings
        locking/atomics: Provide the arch_atomic_ interface to generic code
      c141b30e
    • Linus Torvalds's avatar
      Merge tag 'objtool_urgent_for_5.8_rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 7ecb59a5
      Linus Torvalds authored
      Pull objtool fixes from Borislav Petkov:
       "Three fixes from Peter Zijlstra suppressing KCOV instrumentation in
        noinstr sections.
      
        Peter Zijlstra says:
          "Address KCOV vs noinstr. There is no function attribute to
           selectively suppress KCOV instrumentation, instead teach objtool
           to NOP out the calls in noinstr functions"
      
        This cures a bunch of KCOV crashes (as used by syzcaller)"
      
      * tag 'objtool_urgent_for_5.8_rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        objtool: Fix noinstr vs KCOV
        objtool: Provide elf_write_{insn,reloc}()
        objtool: Clean up elf_write() condition
      7ecb59a5
    • Linus Torvalds's avatar
      Merge tag 'x86_entry_for_5.8' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · a358505d
      Linus Torvalds authored
      Pull x86 entry fixes from Borislav Petkov:
       "This is the x86/entry urgent pile which has accumulated since the
        merge window.
      
        It is not the smallest but considering the almost complete entry core
        rewrite, the amount of fixes to follow is somewhat higher than usual,
        which is to be expected.
      
        Peter Zijlstra says:
         'These patches address a number of instrumentation issues that were
          found after the x86/entry overhaul. When combined with rcu/urgent
          and objtool/urgent, these patches make UBSAN/KASAN/KCSAN happy
          again.
      
          Part of making this all work is bumping the minimum GCC version for
          KASAN builds to gcc-8.3, the reason for this is that the
          __no_sanitize_address function attribute is broken in GCC releases
          before that.
      
          No known GCC version has a working __no_sanitize_undefined, however
          because the only noinstr violation that results from this happens
          when an UB is found, we treat it like WARN. That is, we allow it to
          violate the noinstr rules in order to get the warning out'"
      
      * tag 'x86_entry_for_5.8' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        x86/entry: Fix #UD vs WARN more
        x86/entry: Increase entry_stack size to a full page
        x86/entry: Fixup bad_iret vs noinstr
        objtool: Don't consider vmlinux a C-file
        kasan: Fix required compiler version
        compiler_attributes.h: Support no_sanitize_undefined check with GCC 4
        x86/entry, bug: Comment the instrumentation_begin() usage for WARN()
        x86/entry, ubsan, objtool: Whitelist __ubsan_handle_*()
        x86/entry, cpumask: Provide non-instrumented variant of cpu_is_offline()
        compiler_types.h: Add __no_sanitize_{address,undefined} to noinstr
        kasan: Bump required compiler version
        x86, kcsan: Add __no_kcsan to noinstr
        kcsan: Remove __no_kcsan_or_inline
        x86, kcsan: Remove __no_kcsan_or_inline usage
      a358505d
    • Vincent Guittot's avatar
      sched/cfs: change initial value of runnable_avg · e21cf434
      Vincent Guittot authored
      Some performance regression on reaim benchmark have been raised with
        commit 070f5e86 ("sched/fair: Take into account runnable_avg to classify group")
      
      The problem comes from the init value of runnable_avg which is initialized
      with max value. This can be a problem if the newly forked task is finally
      a short task because the group of CPUs is wrongly set to overloaded and
      tasks are pulled less agressively.
      
      Set initial value of runnable_avg equals to util_avg to reflect that there
      is no waiting time so far.
      
      Fixes: 070f5e86 ("sched/fair: Take into account runnable_avg to classify group")
      Reported-by: default avatarkernel test robot <rong.a.chen@intel.com>
      Signed-off-by: default avatarVincent Guittot <vincent.guittot@linaro.org>
      Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Link: https://lkml.kernel.org/r/20200624154422.29166-1-vincent.guittot@linaro.org
      e21cf434
    • Peter Zijlstra's avatar
      smp, irq_work: Continue smp_call_function*() and irq_work*() integration · 8c4890d1
      Peter Zijlstra authored
      Instead of relying on BUG_ON() to ensure the various data structures
      line up, use a bunch of horrible unions to make it all automatic.
      
      Much of the union magic is to ensure irq_work and smp_call_function do
      not (yet) see the members of their respective data structures change
      name.
      Suggested-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      Reviewed-by: default avatarFrederic Weisbecker <frederic@kernel.org>
      Link: https://lkml.kernel.org/r/20200622100825.844455025@infradead.org
      8c4890d1
    • Peter Zijlstra's avatar
      sched/core: s/WF_ON_RQ/WQ_ON_CPU/ · 739f70b4
      Peter Zijlstra authored
      Use a better name for this poorly named flag, to avoid confusion...
      Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      Acked-by: default avatarMel Gorman <mgorman@suse.de>
      Link: https://lkml.kernel.org/r/20200622100825.785115830@infradead.org
      739f70b4
    • Peter Zijlstra's avatar
      sched/core: Fix ttwu() race · b6e13e85
      Peter Zijlstra authored
      Paul reported rcutorture occasionally hitting a NULL deref:
      
        sched_ttwu_pending()
          ttwu_do_wakeup()
            check_preempt_curr() := check_preempt_wakeup()
              find_matching_se()
                is_same_group()
                  if (se->cfs_rq == pse->cfs_rq) <-- *BOOM*
      
      Debugging showed that this only appears to happen when we take the new
      code-path from commit:
      
        2ebb1771 ("sched/core: Offload wakee task activation if it the wakee is descheduling")
      
      and only when @cpu == smp_processor_id(). Something which should not
      be possible, because p->on_cpu can only be true for remote tasks.
      Similarly, without the new code-path from commit:
      
        c6e7bd7a ("sched/core: Optimize ttwu() spinning on p->on_cpu")
      
      this would've unconditionally hit:
      
        smp_cond_load_acquire(&p->on_cpu, !VAL);
      
      and if: 'cpu == smp_processor_id() && p->on_cpu' is possible, this
      would result in an instant live-lock (with IRQs disabled), something
      that hasn't been reported.
      
      The NULL deref can be explained however if the task_cpu(p) load at the
      beginning of try_to_wake_up() returns an old value, and this old value
      happens to be smp_processor_id(). Further assume that the p->on_cpu
      load accurately returns 1, it really is still running, just not here.
      
      Then, when we enqueue the task locally, we can crash in exactly the
      observed manner because p->se.cfs_rq != rq->cfs_rq, because p's cfs_rq
      is from the wrong CPU, therefore we'll iterate into the non-existant
      parents and NULL deref.
      
      The closest semi-plausible scenario I've managed to contrive is
      somewhat elaborate (then again, actual reproduction takes many CPU
      hours of rcutorture, so it can't be anything obvious):
      
      					X->cpu = 1
      					rq(1)->curr = X
      
      	CPU0				CPU1				CPU2
      
      					// switch away from X
      					LOCK rq(1)->lock
      					smp_mb__after_spinlock
      					dequeue_task(X)
      					  X->on_rq = 9
      					switch_to(Z)
      					  X->on_cpu = 0
      					UNLOCK rq(1)->lock
      
      									// migrate X to cpu 0
      									LOCK rq(1)->lock
      									dequeue_task(X)
      									set_task_cpu(X, 0)
      									  X->cpu = 0
      									UNLOCK rq(1)->lock
      
      									LOCK rq(0)->lock
      									enqueue_task(X)
      									  X->on_rq = 1
      									UNLOCK rq(0)->lock
      
      	// switch to X
      	LOCK rq(0)->lock
      	smp_mb__after_spinlock
      	switch_to(X)
      	  X->on_cpu = 1
      	UNLOCK rq(0)->lock
      
      	// X goes sleep
      	X->state = TASK_UNINTERRUPTIBLE
      	smp_mb();			// wake X
      					ttwu()
      					  LOCK X->pi_lock
      					  smp_mb__after_spinlock
      
      					  if (p->state)
      
      					  cpu = X->cpu; // =? 1
      
      					  smp_rmb()
      
      	// X calls schedule()
      	LOCK rq(0)->lock
      	smp_mb__after_spinlock
      	dequeue_task(X)
      	  X->on_rq = 0
      
      					  if (p->on_rq)
      
      					  smp_rmb();
      
      					  if (p->on_cpu && ttwu_queue_wakelist(..)) [*]
      
      					  smp_cond_load_acquire(&p->on_cpu, !VAL)
      
      					  cpu = select_task_rq(X, X->wake_cpu, ...)
      					  if (X->cpu != cpu)
      	switch_to(Y)
      	  X->on_cpu = 0
      	UNLOCK rq(0)->lock
      
      However I'm having trouble convincing myself that's actually possible
      on x86_64 -- after all, every LOCK implies an smp_mb() there, so if ttwu
      observes ->state != RUNNING, it must also observe ->cpu != 1.
      
      (Most of the previous ttwu() races were found on very large PowerPC)
      
      Nevertheless, this fully explains the observed failure case.
      
      Fix it by ordering the task_cpu(p) load after the p->on_cpu load,
      which is easy since nothing actually uses @cpu before this.
      
      Fixes: c6e7bd7a ("sched/core: Optimize ttwu() spinning on p->on_cpu")
      Reported-by: default avatarPaul E. McKenney <paulmck@kernel.org>
      Tested-by: default avatarPaul E. McKenney <paulmck@kernel.org>
      Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      Link: https://lkml.kernel.org/r/20200622125649.GC576871@hirez.programming.kicks-ass.net
      b6e13e85
    • Juri Lelli's avatar
      sched/core: Fix PI boosting between RT and DEADLINE tasks · 740797ce
      Juri Lelli authored
      syzbot reported the following warning:
      
       WARNING: CPU: 1 PID: 6351 at kernel/sched/deadline.c:628
       enqueue_task_dl+0x22da/0x38a0 kernel/sched/deadline.c:1504
      
      At deadline.c:628 we have:
      
       623 static inline void setup_new_dl_entity(struct sched_dl_entity *dl_se)
       624 {
       625 	struct dl_rq *dl_rq = dl_rq_of_se(dl_se);
       626 	struct rq *rq = rq_of_dl_rq(dl_rq);
       627
       628 	WARN_ON(dl_se->dl_boosted);
       629 	WARN_ON(dl_time_before(rq_clock(rq), dl_se->deadline));
              [...]
           }
      
      Which means that setup_new_dl_entity() has been called on a task
      currently boosted. This shouldn't happen though, as setup_new_dl_entity()
      is only called when the 'dynamic' deadline of the new entity
      is in the past w.r.t. rq_clock and boosted tasks shouldn't verify this
      condition.
      
      Digging through the PI code I noticed that what above might in fact happen
      if an RT tasks blocks on an rt_mutex hold by a DEADLINE task. In the
      first branch of boosting conditions we check only if a pi_task 'dynamic'
      deadline is earlier than mutex holder's and in this case we set mutex
      holder to be dl_boosted. However, since RT 'dynamic' deadlines are only
      initialized if such tasks get boosted at some point (or if they become
      DEADLINE of course), in general RT 'dynamic' deadlines are usually equal
      to 0 and this verifies the aforementioned condition.
      
      Fix it by checking that the potential donor task is actually (even if
      temporary because in turn boosted) running at DEADLINE priority before
      using its 'dynamic' deadline value.
      
      Fixes: 2d3d891d ("sched/deadline: Add SCHED_DEADLINE inheritance logic")
      Reported-by: syzbot+119ba87189432ead09b4@syzkaller.appspotmail.com
      Signed-off-by: default avatarJuri Lelli <juri.lelli@redhat.com>
      Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      Reviewed-by: default avatarDaniel Bristot de Oliveira <bristot@redhat.com>
      Tested-by: default avatarDaniel Wagner <dwagner@suse.de>
      Link: https://lkml.kernel.org/r/20181119153201.GB2119@localhost.localdomain
      740797ce
    • Juri Lelli's avatar
      sched/deadline: Initialize ->dl_boosted · ce9bc3b2
      Juri Lelli authored
      syzbot reported the following warning triggered via SYSC_sched_setattr():
      
        WARNING: CPU: 0 PID: 6973 at kernel/sched/deadline.c:593 setup_new_dl_entity /kernel/sched/deadline.c:594 [inline]
        WARNING: CPU: 0 PID: 6973 at kernel/sched/deadline.c:593 enqueue_dl_entity /kernel/sched/deadline.c:1370 [inline]
        WARNING: CPU: 0 PID: 6973 at kernel/sched/deadline.c:593 enqueue_task_dl+0x1c17/0x2ba0 /kernel/sched/deadline.c:1441
      
      This happens because the ->dl_boosted flag is currently not initialized by
      __dl_clear_params() (unlike the other flags) and setup_new_dl_entity()
      rightfully complains about it.
      
      Initialize dl_boosted to 0.
      
      Fixes: 2d3d891d ("sched/deadline: Add SCHED_DEADLINE inheritance logic")
      Reported-by: syzbot+5ac8bac25f95e8b221e7@syzkaller.appspotmail.com
      Signed-off-by: default avatarJuri Lelli <juri.lelli@redhat.com>
      Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      Tested-by: default avatarDaniel Wagner <dwagner@suse.de>
      Link: https://lkml.kernel.org/r/20200617072919.818409-1-juri.lelli@redhat.com
      ce9bc3b2
    • Scott Wood's avatar
      sched/core: Check cpus_mask, not cpus_ptr in __set_cpus_allowed_ptr(), to fix mask corruption · fd844ba9
      Scott Wood authored
      This function is concerned with the long-term CPU mask, not the
      transitory mask the task might have while migrate disabled.  Before
      this patch, if a task was migrate-disabled at the time
      __set_cpus_allowed_ptr() was called, and the new mask happened to be
      equal to the CPU that the task was running on, then the mask update
      would be lost.
      Signed-off-by: default avatarScott Wood <swood@redhat.com>
      Signed-off-by: default avatarSebastian Andrzej Siewior <bigeasy@linutronix.de>
      Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      Link: https://lkml.kernel.org/r/20200617121742.cpxppyi7twxmpin7@linutronix.de
      fd844ba9
    • Peter Zijlstra's avatar
      sched/core: Fix CONFIG_GCC_PLUGIN_RANDSTRUCT build fail · 4f311afc
      Peter Zijlstra authored
      As a temporary build fix, the proper cleanup needs more work.
      Reported-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Reported-by: default avatarEric Biggers <ebiggers@kernel.org>
      Suggested-by: default avatarEric Biggers <ebiggers@kernel.org>
      Suggested-by: default avatarKees Cook <keescook@chromium.org>
      Fixes: a1488664 ("sched: Replace rq::wake_list")
      Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      4f311afc