1. 20 9月, 2020 2 次提交
  2. 18 9月, 2020 2 次提交
    • L
      mm: allow a controlled amount of unfairness in the page lock · 5ef64cc8
      Linus Torvalds 提交于
      Commit 2a9127fc ("mm: rewrite wait_on_page_bit_common() logic") made
      the page locking entirely fair, in that if a waiter came in while the
      lock was held, the lock would be transferred to the lockers strictly in
      order.
      
      That was intended to finally get rid of the long-reported watchdog
      failures that involved the page lock under extreme load, where a process
      could end up waiting essentially forever, as other page lockers stole
      the lock from under it.
      
      It also improved some benchmarks, but it ended up causing huge
      performance regressions on others, simply because fair lock behavior
      doesn't end up giving out the lock as aggressively, causing better
      worst-case latency, but potentially much worse average latencies and
      throughput.
      
      Instead of reverting that change entirely, this introduces a controlled
      amount of unfairness, with a sysctl knob to tune it if somebody needs
      to.  But the default value should hopefully be good for any normal load,
      allowing a few rounds of lock stealing, but enforcing the strict
      ordering before the lock has been stolen too many times.
      
      There is also a hint from Matthieu Baerts that the fair page coloring
      may end up exposing an ABBA deadlock that is hidden by the usual
      optimistic lock stealing, and while the unfairness doesn't fix the
      fundamental issue (and I'm still looking at that), it avoids it in
      practice.
      
      The amount of unfairness can be modified by writing a new value to the
      'sysctl_page_lock_unfairness' variable (default value of 5, exposed
      through /proc/sys/vm/page_lock_unfairness), but that is hopefully
      something we'd use mainly for debugging rather than being necessary for
      any deep system tuning.
      
      This whole issue has exposed just how critical the page lock can be, and
      how contended it gets under certain locks.  And the main contention
      doesn't really seem to be anything related to IO (which was the origin
      of this lock), but for things like just verifying that the page file
      mapping is stable while faulting in the page into a page table.
      
      Link: https://lore.kernel.org/linux-fsdevel/ed8442fd-6f54-dd84-cd4a-941e8b7ee603@MichaelLarabel.com/
      Link: https://www.phoronix.com/scan.php?page=article&item=linux-50-59&num=1
      Link: https://lore.kernel.org/linux-fsdevel/c560a38d-8313-51fb-b1ec-e904bd8836bc@tessares.net/Reported-and-tested-by: NMichael Larabel <Michael@michaellarabel.com>
      Tested-by: NMatthieu Baerts <matthieu.baerts@tessares.net>
      Cc: Dave Chinner <david@fromorbit.com>
      Cc: Matthew Wilcox <willy@infradead.org>
      Cc: Chris Mason <clm@fb.com>
      Cc: Jan Kara <jack@suse.cz>
      Cc: Amir Goldstein <amir73il@gmail.com>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      5ef64cc8
    • A
      arm64: paravirt: Initialize steal time when cpu is online · 75df529b
      Andrew Jones 提交于
      Steal time initialization requires mapping a memory region which
      invokes a memory allocation. Doing this at CPU starting time results
      in the following trace when CONFIG_DEBUG_ATOMIC_SLEEP is enabled:
      
      BUG: sleeping function called from invalid context at mm/slab.h:498
      in_atomic(): 1, irqs_disabled(): 128, non_block: 0, pid: 0, name: swapper/1
      CPU: 1 PID: 0 Comm: swapper/1 Not tainted 5.9.0-rc5+ #1
      Call trace:
       dump_backtrace+0x0/0x208
       show_stack+0x1c/0x28
       dump_stack+0xc4/0x11c
       ___might_sleep+0xf8/0x130
       __might_sleep+0x58/0x90
       slab_pre_alloc_hook.constprop.101+0xd0/0x118
       kmem_cache_alloc_node_trace+0x84/0x270
       __get_vm_area_node+0x88/0x210
       get_vm_area_caller+0x38/0x40
       __ioremap_caller+0x70/0xf8
       ioremap_cache+0x78/0xb0
       memremap+0x9c/0x1a8
       init_stolen_time_cpu+0x54/0xf0
       cpuhp_invoke_callback+0xa8/0x720
       notify_cpu_starting+0xc8/0xd8
       secondary_start_kernel+0x114/0x180
      CPU1: Booted secondary processor 0x0000000001 [0x431f0a11]
      
      However we don't need to initialize steal time at CPU starting time.
      We can simply wait until CPU online time, just sacrificing a bit of
      accuracy by returning zero for steal time until we know better.
      
      While at it, add __init to the functions that are only called by
      pv_time_init() which is __init.
      Signed-off-by: NAndrew Jones <drjones@redhat.com>
      Fixes: e0685fa2 ("arm64: Retrieve stolen time as paravirtualized guest")
      Cc: stable@vger.kernel.org
      Reviewed-by: NSteven Price <steven.price@arm.com>
      Link: https://lore.kernel.org/r/20200916154530.40809-1-drjones@redhat.comSigned-off-by: NCatalin Marinas <catalin.marinas@arm.com>
      75df529b
  3. 17 9月, 2020 1 次提交
  4. 16 9月, 2020 1 次提交
    • J
      serial: core: fix console port-lock regression · e0830dbf
      Johan Hovold 提交于
      Fix the port-lock initialisation regression introduced by commit
      a3cb39d2 ("serial: core: Allow detach and attach serial device for
      console") by making sure that the lock is again initialised during
      console setup.
      
      The console may be registered before the serial controller has been
      probed in which case the port lock needs to be initialised during
      console setup by a call to uart_set_options(). The console-detach
      changes introduced a regression in several drivers by effectively
      removing that initialisation by not initialising the lock when the port
      is used as a console (which is always the case during console setup).
      
      Add back the early lock initialisation and instead use a new
      console-reinit flag to handle the case where a console is being
      re-attached through sysfs.
      
      The question whether the console-detach interface should have been added
      in the first place is left for another discussion.
      
      Note that the console-enabled check in uart_set_options() is not
      redundant because of kgdboc, which can end up reinitialising an already
      enabled console (see commit 42b6a1ba ("serial_core: Don't
      re-initialize a previously initialized spinlock.")).
      
      Fixes: a3cb39d2 ("serial: core: Allow detach and attach serial device for console")
      Cc: stable <stable@vger.kernel.org>     # 5.7
      Signed-off-by: NJohan Hovold <johan@kernel.org>
      Reviewed-by: NAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Link: https://lore.kernel.org/r/20200909143101.15389-3-johan@kernel.orgSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e0830dbf
  5. 12 9月, 2020 1 次提交
    • H
      KVM: MIPS: Change the definition of kvm type · 15e9e35c
      Huacai Chen 提交于
      MIPS defines two kvm types:
      
       #define KVM_VM_MIPS_TE          0
       #define KVM_VM_MIPS_VZ          1
      
      In Documentation/virt/kvm/api.rst it is said that "You probably want to
      use 0 as machine type", which implies that type 0 be the "automatic" or
      "default" type. And, in user-space libvirt use the null-machine (with
      type 0) to detect the kvm capability, which returns "KVM not supported"
      on a VZ platform.
      
      I try to fix it in QEMU but it is ugly:
      https://lists.nongnu.org/archive/html/qemu-devel/2020-08/msg05629.html
      
      And Thomas Huth suggests me to change the definition of kvm type:
      https://lists.nongnu.org/archive/html/qemu-devel/2020-09/msg03281.html
      
      So I define like this:
      
       #define KVM_VM_MIPS_AUTO        0
       #define KVM_VM_MIPS_VZ          1
       #define KVM_VM_MIPS_TE          2
      
      Since VZ and TE cannot co-exists, using type 0 on a TE platform will
      still return success (so old user-space tools have no problems on new
      kernels); the advantage is that using type 0 on a VZ platform will not
      return failure. So, the only problem is "new user-space tools use type
      2 on old kernels", but if we treat this as a kernel bug, we can backport
      this patch to old stable kernels.
      Signed-off-by: NHuacai Chen <chenhc@lemote.com>
      Message-Id: <1599734031-28746-1-git-send-email-chenhc@lemote.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      15e9e35c
  6. 11 9月, 2020 3 次提交
  7. 09 9月, 2020 1 次提交
  8. 07 9月, 2020 2 次提交
  9. 06 9月, 2020 1 次提交
  10. 05 9月, 2020 2 次提交
  11. 04 9月, 2020 5 次提交
  12. 03 9月, 2020 2 次提交
  13. 02 9月, 2020 1 次提交
    • S
      drm/i915: Fix sha_text population code · 9ab57658
      Sean Paul 提交于
      This patch fixes a few bugs:
      
      1- We weren't taking into account sha_leftovers when adding multiple
         ksvs to sha_text. As such, we were or'ing the end of ksv[j - 1] with
         the beginning of ksv[j]
      
      2- In the sha_leftovers == 2 and sha_leftovers == 3 case, bstatus was
         being placed on the wrong half of sha_text, overlapping the leftover
         ksv value
      
      3- In the sha_leftovers == 2 case, we need to manually terminate the
         byte stream with 0x80 since the hardware doesn't have enough room to
         add it after writing M0
      
      The upside is that all of the HDCP supported HDMI repeaters I could
      find on Amazon just strip HDCP anyways, so it turns out to be _really_
      hard to hit any of these cases without an MST hub, which is not (yet)
      supported. Oh, and the sha_leftovers == 1 case works perfectly!
      
      Fixes: ee5e5e7a ("drm/i915: Add HDCP framework + base implementation")
      Cc: Chris Wilson <chris@chris-wilson.co.uk>
      Cc: Ramalingam C <ramalingam.c@intel.com>
      Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
      Cc: Sean Paul <seanpaul@chromium.org>
      Cc: Jani Nikula <jani.nikula@linux.intel.com>
      Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
      Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
      Cc: intel-gfx@lists.freedesktop.org
      Cc: <stable@vger.kernel.org> # v4.17+
      Reviewed-by: NRamalingam C <ramalingam.c@intel.com>
      Signed-off-by: NSean Paul <seanpaul@chromium.org>
      Signed-off-by: NRamalingam C <ramalingam.c@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20200818153910.27894-2-sean@poorly.run
      (cherry picked from commit 1f088221)
      Signed-off-by: NJani Nikula <jani.nikula@intel.com>
      9ab57658
  14. 01 9月, 2020 1 次提交
    • M
      HID: core: Sanitize event code and type when mapping input · 35556bed
      Marc Zyngier 提交于
      When calling into hid_map_usage(), the passed event code is
      blindly stored as is, even if it doesn't fit in the associated bitmap.
      
      This event code can come from a variety of sources, including devices
      masquerading as input devices, only a bit more "programmable".
      
      Instead of taking the event code at face value, check that it actually
      fits the corresponding bitmap, and if it doesn't:
      - spit out a warning so that we know which device is acting up
      - NULLify the bitmap pointer so that we catch unexpected uses
      
      Code paths that can make use of untrusted inputs can now check
      that the mapping was indeed correct and bail out if not.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: NMarc Zyngier <maz@kernel.org>
      Signed-off-by: NBenjamin Tissoires <benjamin.tissoires@gmail.com>
      35556bed
  15. 29 8月, 2020 3 次提交
  16. 28 8月, 2020 2 次提交
    • K
      ASoC: soc-core: add snd_soc_find_dai_with_mutex() · 20d9fdee
      Kuninori Morimoto 提交于
      commit 25612477 ("ASoC: soc-dai: set dai_link dpcm_ flags with a helper")
      added snd_soc_dai_link_set_capabilities().
      But it is using snd_soc_find_dai() (A) which is required client_mutex (B).
      And client_mutex is soc-core.c local.
      
      	struct snd_soc_dai *snd_soc_find_dai(xxx)
      	{
      		...
      (B)		lockdep_assert_held(&client_mutex);
      		...
      	}
      
      	void snd_soc_dai_link_set_capabilities(xxx)
      	{
      		...
      		for_each_pcm_streams(direction) {
      			...
      			for_each_link_cpus(dai_link, i, cpu) {
      (A)				dai = snd_soc_find_dai(cpu);
      				...
      			}
      			...
      			for_each_link_codecs(dai_link, i, codec) {
      (A)				dai = snd_soc_find_dai(codec);
      				...
      			}
      		}
      		...
      	}
      
      Because of these background, we will get WARNING if .config has CONFIG_LOCKDEP.
      
      	WARNING: CPU: 2 PID: 53 at sound/soc/soc-core.c:814 snd_soc_find_dai+0xf8/0x100
      	CPU: 2 PID: 53 Comm: kworker/2:1 Not tainted 5.7.0-rc1+ #328
      	Hardware name: Renesas H3ULCB Kingfisher board based on r8a77951 (DT)
      	Workqueue: events deferred_probe_work_func
      	pstate: 60000005 (nZCv daif -PAN -UAO)
      	pc : snd_soc_find_dai+0xf8/0x100
      	lr : snd_soc_find_dai+0xf4/0x100
      	...
      	Call trace:
      	 snd_soc_find_dai+0xf8/0x100
      	 snd_soc_dai_link_set_capabilities+0xa0/0x16c
      	 graph_dai_link_of_dpcm+0x390/0x3c0
      	 graph_for_each_link+0x134/0x200
      	 graph_probe+0x144/0x230
      	 platform_drv_probe+0x5c/0xb0
      	 really_probe+0xe4/0x430
      	 driver_probe_device+0x60/0xf4
      
      snd_soc_find_dai() will be used from (X) CPU/Codec/Platform driver with
      mutex lock, and (Y) Card driver without mutex lock.
      This snd_soc_dai_link_set_capabilities() is for Card driver,
      this means called without mutex.
      This patch adds snd_soc_find_dai_with_mutex() to solve it.
      
      Fixes: 25612477 ("ASoC: soc-dai: set dai_link dpcm_ flags with a helper")
      Signed-off-by: NKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
      Link: https://lore.kernel.org/r/87blixvuab.wl-kuninori.morimoto.gx@renesas.comSigned-off-by: NMark Brown <broonie@kernel.org>
      20d9fdee
    • V
      irqchip/eznps: Fix build error for !ARC700 builds · 89d29997
      Vineet Gupta 提交于
      eznps driver is supposed to be platform independent however it ends up
      including stuff from inside arch/arc headers leading to rand config
      build errors.
      
      The quick hack to fix this (proper fix is too much chrun for non active
      user-base) is to add following to nps platform agnostic header.
       - copy AUX_IENABLE from arch/arc header
       - move CTOP_AUX_IACK from arch/arc/plat-eznps/*/**
      Reported-by: Nkernel test robot <lkp@intel.com>
      Reported-by: NSebastian Andrzej Siewior <bigeasy@linutronix.de>
      Link: https://lkml.kernel.org/r/20200824095831.5lpkmkafelnvlpi2@linutronix.deSigned-off-by: NVineet Gupta <vgupta@synopsys.com>
      89d29997
  17. 27 8月, 2020 5 次提交
  18. 26 8月, 2020 5 次提交