1. 25 6月, 2015 9 次提交
  2. 23 6月, 2015 1 次提交
    • S
      HSI: cmt_speech: fix timestamp interface · 5023a5ca
      Sebastian Reichel 提交于
      The user interface for timestamps in the new cmt_speech
      driver is broken in multiple ways:
      
      - The layout is incompatible between 32-bit and 64-bit user
        space, because of the size differences in 'struct timespec'.
        This means that the driver can not work when used with 32-bit
        user space on a 64-bit kernel.
      
      - As there are plans to change 32-bit user space to use
        a 64-bit time_t type in the future, it will also be
        incompatible with new 32-bit user space.
      
      - It is using ktime_get_ts under it's deprecated alias
        (do_posix_clock_monotonic_gettime).
      
      To keep support for the user space tools written for this driver (which
      have lived many years out-of-tree), the interface has been hardened to
      unsigned 32-bit values.
      Reported-by: NArnd Bergmann <arnd@arndb.de>
      Signed-off-by: NSebastian Reichel <sre@kernel.org>
      5023a5ca
  3. 22 6月, 2015 11 次提交
  4. 20 6月, 2015 1 次提交
  5. 19 6月, 2015 18 次提交
    • T
      timer: Minimize nohz off overhead · 683be13a
      Thomas Gleixner 提交于
      If nohz is disabled on the kernel command line the [hr]timer code
      still calls wake_up_nohz_cpu() and tick_nohz_full_cpu(), a pretty
      pointless exercise. Cache nohz_active in [hr]timer per cpu bases and
      avoid the overhead.
      
      Before:
        48.10%  hog       [.] main
        15.25%  [kernel]  [k] _raw_spin_lock_irqsave
         9.76%  [kernel]  [k] _raw_spin_unlock_irqrestore
         6.50%  [kernel]  [k] mod_timer
         6.44%  [kernel]  [k] lock_timer_base.isra.38
         3.87%  [kernel]  [k] detach_if_pending
         3.80%  [kernel]  [k] del_timer
         2.67%  [kernel]  [k] internal_add_timer
         1.33%  [kernel]  [k] __internal_add_timer
         0.73%  [kernel]  [k] timerfn
         0.54%  [kernel]  [k] wake_up_nohz_cpu
      
      After:
        48.73%  hog       [.] main
        15.36%  [kernel]  [k] _raw_spin_lock_irqsave
         9.77%  [kernel]  [k] _raw_spin_unlock_irqrestore
         6.61%  [kernel]  [k] lock_timer_base.isra.38
         6.42%  [kernel]  [k] mod_timer
         3.90%  [kernel]  [k] detach_if_pending
         3.76%  [kernel]  [k] del_timer
         2.41%  [kernel]  [k] internal_add_timer
         1.39%  [kernel]  [k] __internal_add_timer
         0.76%  [kernel]  [k] timerfn
      
      We probably should have a cached value for nohz full in the per cpu
      bases as well to avoid the cpumask check. The base cache line is hot
      already, the cpumask not necessarily.
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Paul McKenney <paulmck@linux.vnet.ibm.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Eric Dumazet <edumazet@google.com>
      Cc: Viresh Kumar <viresh.kumar@linaro.org>
      Cc: John Stultz <john.stultz@linaro.org>
      Cc: Joonwoo Park <joonwoop@codeaurora.org>
      Cc: Wenbo Wang <wenbo.wang@memblaze.com>
      Link: http://lkml.kernel.org/r/20150526224512.207378134@linutronix.deSigned-off-by: NThomas Gleixner <tglx@linutronix.de>
      683be13a
    • T
      timer: Reduce timer migration overhead if disabled · bc7a34b8
      Thomas Gleixner 提交于
      Eric reported that the timer_migration sysctl is not really nice
      performance wise as it needs to check at every timer insertion whether
      the feature is enabled or not. Further the check does not live in the
      timer code, so we have an extra function call which checks an extra
      cache line to figure out that it is disabled.
      
      We can do better and store that information in the per cpu (hr)timer
      bases. I pondered to use a static key, but that's a nightmare to
      update from the nohz code and the timer base cache line is hot anyway
      when we select a timer base.
      
      The old logic enabled the timer migration unconditionally if
      CONFIG_NO_HZ was set even if nohz was disabled on the kernel command
      line.
      
      With this modification, we start off with migration disabled. The user
      visible sysctl is still set to enabled. If the kernel switches to NOHZ
      migration is enabled, if the user did not disable it via the sysctl
      prior to the switch. If nohz=off is on the kernel command line,
      migration stays disabled no matter what.
      
      Before:
        47.76%  hog       [.] main
        14.84%  [kernel]  [k] _raw_spin_lock_irqsave
         9.55%  [kernel]  [k] _raw_spin_unlock_irqrestore
         6.71%  [kernel]  [k] mod_timer
         6.24%  [kernel]  [k] lock_timer_base.isra.38
         3.76%  [kernel]  [k] detach_if_pending
         3.71%  [kernel]  [k] del_timer
         2.50%  [kernel]  [k] internal_add_timer
         1.51%  [kernel]  [k] get_nohz_timer_target
         1.28%  [kernel]  [k] __internal_add_timer
         0.78%  [kernel]  [k] timerfn
         0.48%  [kernel]  [k] wake_up_nohz_cpu
      
      After:
        48.10%  hog       [.] main
        15.25%  [kernel]  [k] _raw_spin_lock_irqsave
         9.76%  [kernel]  [k] _raw_spin_unlock_irqrestore
         6.50%  [kernel]  [k] mod_timer
         6.44%  [kernel]  [k] lock_timer_base.isra.38
         3.87%  [kernel]  [k] detach_if_pending
         3.80%  [kernel]  [k] del_timer
         2.67%  [kernel]  [k] internal_add_timer
         1.33%  [kernel]  [k] __internal_add_timer
         0.73%  [kernel]  [k] timerfn
         0.54%  [kernel]  [k] wake_up_nohz_cpu
      Reported-by: NEric Dumazet <edumazet@google.com>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Paul McKenney <paulmck@linux.vnet.ibm.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Viresh Kumar <viresh.kumar@linaro.org>
      Cc: John Stultz <john.stultz@linaro.org>
      Cc: Joonwoo Park <joonwoop@codeaurora.org>
      Cc: Wenbo Wang <wenbo.wang@memblaze.com>
      Link: http://lkml.kernel.org/r/20150526224512.127050787@linutronix.deSigned-off-by: NThomas Gleixner <tglx@linutronix.de>
      bc7a34b8
    • T
      timer: Stats: Simplify the flags handling · c74441a1
      Thomas Gleixner 提交于
      Simplify the handling of the flag storage for the timer statistics. No
      intermediate storage anymore. Just hand over the flags field.
      
      I left the printout of 'deferrable' for now because changing this
      would be an ABI update and I have no idea how strong people feel about
      that. OTOH, I wonder whether we should kill the whole timer stats
      stuff because all of that information can be retrieved via ftrace/perf
      as well.
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Paul McKenney <paulmck@linux.vnet.ibm.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Eric Dumazet <edumazet@google.com>
      Cc: Viresh Kumar <viresh.kumar@linaro.org>
      Cc: John Stultz <john.stultz@linaro.org>
      Cc: Joonwoo Park <joonwoop@codeaurora.org>
      Cc: Wenbo Wang <wenbo.wang@memblaze.com>
      Link: http://lkml.kernel.org/r/20150526224512.046626248@linutronix.deSigned-off-by: NThomas Gleixner <tglx@linutronix.de>
      c74441a1
    • T
      timer: Replace timer base by a cpu index · 0eeda71b
      Thomas Gleixner 提交于
      Instead of storing a pointer to the per cpu tvec_base we can simply
      cache a CPU index in the timer_list and use that to get hold of the
      correct per cpu tvec_base. This is only used in lock_timer_base() and
      the slightly larger code is peanuts versus the spinlock operation and
      the d-cache foot print of the timer wheel.
      
      Aside of that this allows to get rid of following nuisances:
      
       - boot_tvec_base
      
         That statically allocated 4k bss data is just kept around so the
         timer has a home when it gets statically initialized. It serves no
         other purpose.
      
         With the CPU index we assign the timer to CPU0 at static
         initialization time and therefor can avoid the whole boot_tvec_base
         dance.  That also simplifies the init code, which just can use the
         per cpu base.
      
         Before:
           text	   data	    bss	    dec	    hex	filename
          17491	   9201	   4160	  30852	   7884	../build/kernel/time/timer.o
         After:
           text	   data	    bss	    dec	    hex	filename
          17440	   9193	      0	  26633	   6809	../build/kernel/time/timer.o
      
       - Overloading the base pointer with various flags
      
         The CPU index has enough space to hold the flags (deferrable,
         irqsafe) so we can get rid of the extra masking and bit fiddling
         with the base pointer.
      
      As a benefit we reduce the size of struct timer_list on 64 bit
      machines. 4 - 8 bytes, a size reduction up to 15% per struct timer_list,
      which is a real win as we have tons of them embedded in other structs.
      
      This changes also the newly added deferrable printout of the timer
      start trace point to capture and print all timer->flags, which allows
      us to decode the target cpu of the timer as well.
      
      We might have used bitfields for this, but that would change the
      static initializers and the init function for no value to accomodate
      big endian bitfields.
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Paul McKenney <paulmck@linux.vnet.ibm.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Eric Dumazet <edumazet@google.com>
      Cc: Viresh Kumar <viresh.kumar@linaro.org>
      Cc: John Stultz <john.stultz@linaro.org>
      Cc: Joonwoo Park <joonwoop@codeaurora.org>
      Cc: Wenbo Wang <wenbo.wang@memblaze.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Badhri Jagan Sridharan <Badhri@google.com>
      Link: http://lkml.kernel.org/r/20150526224511.950084301@linutronix.deSigned-off-by: NThomas Gleixner <tglx@linutronix.de>
      0eeda71b
    • T
      timer: Use hlist for the timer wheel hash buckets · 1dabbcec
      Thomas Gleixner 提交于
      This reduces the size of struct tvec_base by 50% and results in
      slightly smaller code as well.
      
      Before:
         struct tvec_base: size: 8256, cachelines: 129
      
         text	   data	    bss	    dec	    hex	filename
        17698	  13297	   8256	  39251	   9953	../build/kernel/time/timer.o
      
      After:
        struct tvec_base: 4160, cachelines: 65
      
         text	   data	    bss	    dec	    hex	filename
        17491	   9201	   4160	  30852	   7884	../build/kernel/time/timer.o
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Reviewed-by: NViresh Kumar <viresh.kumar@linaro.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Paul McKenney <paulmck@linux.vnet.ibm.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Eric Dumazet <edumazet@google.com>
      Cc: John Stultz <john.stultz@linaro.org>
      Cc: Joonwoo Park <joonwoop@codeaurora.org>
      Cc: Wenbo Wang <wenbo.wang@memblaze.com>
      Link: http://lkml.kernel.org/r/20150526224511.854731214@linutronix.deSigned-off-by: NThomas Gleixner <tglx@linutronix.de>
      1dabbcec
    • P
      sched/stop_machine: Fix deadlock between multiple stop_two_cpus() · b17718d0
      Peter Zijlstra 提交于
      Jiri reported a machine stuck in multi_cpu_stop() with
      migrate_swap_stop() as function and with the following src,dst cpu
      pairs: {11,  4} {13, 11} { 4, 13}
      
                              4       11      13
      
      cpuM: queue(4 ,13)
                              *Ma
      cpuN: queue(13,11)
                                      *N      Na
                              *M              Mb
      cpuO: queue(11, 4)
                              *O      Oa
                                      *Nb
                              *Ob
      
      Where *X denotes the cpu running the queueing of cpu-X and X[ab] denotes
      the first/second queued work.
      
      You'll observe the top of the workqueue for each cpu: 4,11,13 to be work
      from cpus: M, O, N resp. IOW. deadlock.
      
      Do away with the queueing trickery and introduce lg_double_lock() to
      lock both CPUs and fully serialize the stop_two_cpus() callers instead
      of the partial (and buggy) serialization we have now.
      Reported-by: NJiri Olsa <jolsa@redhat.com>
      Signed-off-by: NPeter Zijlstra (Intel) <peterz@infradead.org>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Oleg Nesterov <oleg@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Rik van Riel <riel@redhat.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Link: http://lkml.kernel.org/r/20150605153023.GH19282@twins.programming.kicks-ass.netSigned-off-by: NIngo Molnar <mingo@kernel.org>
      b17718d0
    • G
      locking/lockdep: Remove hard coded array size dependency · 68722101
      George Beshers 提交于
      An apparent oversight left a hardcoded '4' in place when
      LOCKSTAT_POINTS was introduced.
      
      The contention_point[] and contending_point[] arrays in the
      structs lock_class and lock_class_stats need to be the same
      size for the loops in lock_stats() to be correct.
      
      This patch allows LOCKSTAT_POINTS to be changed without
      affecting the correctness of the code.
      Signed-off-by: NGeorge Beshers <gbeshers@sgi.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: linux-kernel@vger.kernel.org
      Signed-off-by: NIngo Molnar <mingo@kernel.org>
      68722101
    • H
      crypto: aead - Fix aead_instance struct size · f5d8660a
      Herbert Xu 提交于
      The struct aead_instance is meant to extend struct crypto_instance
      by incorporating the extra members of struct aead_alg.  However,
      the current layout which is copied from shash/ahash does not specify
      the struct fully.  In particular only aead_alg is present.
      
      For shash/ahash this works because users there add extra headroom
      to sizeof(struct crypto_instance) when allocating the instance.
      Unfortunately for aead, this bit was lost when the new aead_instance
      was added.
      
      Rather than fixing it like shash/ahash, this patch simply expands
      struct aead_instance to contain what is supposed to be there, i.e.,
      adding struct crypto_instance.
      
      In order to not break existing AEAD users, this is done through an
      anonymous union.
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      f5d8660a
    • H
      crypto: api - Add CRYPTO_MINALIGN_ATTR to struct crypto_alg · edf18b91
      Herbert Xu 提交于
      The struct crypto_alg is embedded into various type-specific structs
      such as aead_alg.  This is then used as part of instances such as
      struct aead_instance.  It is also embedded into the generic struct
      crypto_instance.  In order to ensure that struct aead_instance can
      be converted to struct crypto_instance when necessary, we need to
      ensure that crypto_alg is aligned properly.
      
      This patch adds an alignment attribute to struct crypto_alg to
      ensure this.
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      edf18b91
    • H
      ACPI / video: Make acpi_video_unregister_backlight() private · e7d024c0
      Hans de Goede 提交于
      acpi_video_unregister_backlight() is now only used by video_detect.c
      which is part of the same acpi_video module as video.c, make
      acpi_video_unregister_backlight() private to this module.
      Signed-off-by: NHans de Goede <hdegoede@redhat.com>
      Acked-by: NDarren Hart <dvhart@linux.intel.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      e7d024c0
    • H
      acpi-video-detect: Remove old API · d0a530ba
      Hans de Goede 提交于
      Remove the old backlight interface selection API now that all drivers
      have been ported to the new API.
      Signed-off-by: NHans de Goede <hdegoede@redhat.com>
      Acked-by: NDarren Hart <dvhart@linux.intel.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      d0a530ba
    • H
      ACPI / video: Port to new backlight interface selection API · 3bd6bce3
      Hans de Goede 提交于
      Most of the patch is moving the dmi quirks for forcing use of the
      acpi-video / the native backlight interface to video_detect.c.
      
      What remains is a nice cleanup.
      Signed-off-by: NHans de Goede <hdegoede@redhat.com>
      Acked-by: NDarren Hart <dvhart@linux.intel.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      3bd6bce3
    • H
      acpi-video-detect: Rewrite backlight interface selection logic · 87521e16
      Hans de Goede 提交于
      Currently we have 2 kernel commandline options + dmi-quirks in 3 places all
      interacting (in interesting ways) to select which which backlight interface
      to use. On the commandline we've acpi_backlight=[video|vendor] and
      video.use_native_backlight=[0|1]. DMI quirks we have in
      acpi/video-detect.c, acpi/video.c and drivers/platform/x86/*.c .
      
      This commit is the first step to cleaning this up, replacing the 2 cmdline
      options with just acpi_backlight=[video|vendor|native|none], and adds a
      new API to video_detect.c to reflect this.
      
      Follow up commits will also move other related code, like unregistering the
      acpi_video backlight interface if it was registered before other drivers
      which take priority over it are loaded, to video_detect.c where this
      logic really belongs.
      Signed-off-by: NHans de Goede <hdegoede@redhat.com>
      Acked-by: NDarren Hart <dvhart@linux.intel.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      87521e16
    • H
      acpi-video-detect: video: Make video_detect code part of the video module · 14ca7a47
      Hans de Goede 提交于
      This is a preparation patch for the backlight interface selection logic
      cleanup, there are 2 reasons to not always build the video_detect code
      into the kernel:
      
      1) In order for the video_detect.c to also deal with / select native
      backlight interfaces on win8 systems, instead of doing this in video.c
      where it does not belong, video_detect.c needs to call into the backlight
      class code. Which cannot be done if it is builtin and the blacklight class
      is not.
      
      2) Currently all the platform/x86 drivers which have quirks to prefer
      the vendor driver over acpi-video call acpi_video_unregister_backlight()
      to remove the acpi-video backlight interface, this logic really belongs
      in video_detect.c, which will cause video_detect.c to depend on symbols of
      video.c and video.c already depends on video_detect.c symbols, so they
      really need to be a single module.
      
      Note that this commits make 2 changes so as to maintain 100% kernel
      commandline compatibility:
      
      1) The __setup call for the acpi_backlight= handling is moved to
         acpi/util.c as __setup may only be used by code which is alwasy builtin
      2) video.c is renamed to acpi_video.c so that it can be combined with
         video_detect.c into video.ko
      
      This commit also makes changes to drivers/platform/x86/Kconfig to ensure
      that drivers which use acpi_video_backlight_support() from video_detect.c,
      will not be built-in when acpi_video is not built in. This also changes
      some "select" uses to "depends on" to avoid dependency loops.
      Signed-off-by: NHans de Goede <hdegoede@redhat.com>
      Acked-by: NDarren Hart <dvhart@linux.intel.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      14ca7a47
    • H
      acpi-video-detect: Move acpi_osi_is_win8 to osl.c · a87878ba
      Hans de Goede 提交于
      acpi_osi_is_win8 needs access to acpi_gbl_osi_data which is not exported,
      so move it to osl.c. Alternatively we could export acpi_gbl_osi_data but
      that seems undesirable.
      
      This allows video_detect.c to be build as a module, besides that
      acpi_osi_is_win8() is something which does not really belong in
      video_detect.c in the first place.
      Signed-off-by: NHans de Goede <hdegoede@redhat.com>
      Acked-by: NDarren Hart <dvhart@linux.intel.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      a87878ba
    • H
      acpi-video-detect: Move acpi_is_video_device() to acpi/scan.c · adc8bb8e
      Hans de Goede 提交于
      This allows video_detect.c to be build as a module, this is a preparation
      patch for the backlight interface selection logic cleanup.
      
      Note this commit also causes acpi_is_video_device() to always be build
      indepedent of CONFIG_ACPI_VIDEO, as there is no reason to make its
      building depend on CONFIG_ACPI_VIDEO.
      Signed-off-by: NHans de Goede <hdegoede@redhat.com>
      Acked-by: NDarren Hart <dvhart@linux.intel.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      adc8bb8e
    • H
      acpi-video-detect: Make acpi_video_get_capabilities a private function · fb105d96
      Hans de Goede 提交于
      acpi_video_get_capabilities() is only used inside video_detect.c so make
      it static. While at it also remove the prototype for the non existent
      acpi_video_display_switch_support function from acpi.h
      Signed-off-by: NHans de Goede <hdegoede@redhat.com>
      Acked-by: NDarren Hart <dvhart@linux.intel.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      fb105d96
    • H
      acpi-video-detect: Remove the unused acpi_video_dmi_demote_vendor() function · 7f3b62cf
      Hans de Goede 提交于
      Remove the now unused acpi_video_dmi_demote_vendor() function, this was
      never a proper counter part of acpi_video_dmi_promote_vendor() since
      the calls to acpi_video_dmi_promote_vendor() are not counted.
      Signed-off-by: NHans de Goede <hdegoede@redhat.com>
      Acked-by: NDarren Hart <dvhart@linux.intel.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      7f3b62cf