1. 07 Jul, 2020 3 commits
    • Chris Wilson's avatar
      drm/i915: Drop vm.ref for duplicate vma on construction · 42723673
      Chris Wilson authored
      As we allow for parallel threads to create the same vma instance
      concurrently, and we only filter out the duplicates upon reacquiring the
      spinlock for the rbtree, we have to free the loser of the constructors'
      race. When freeing, we should also drop any resource references acquired
      for the redundant vma.
      
      Fixes: 2850748e ("drm/i915: Pull i915_vma_pin under the vm->mutex")
      Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
      Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
      Cc: <stable@vger.kernel.org> # v5.5+
      Reviewed-by: default avatarTvrtko Ursulin <tvrtko.ursulin@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20200702083225.20044-1-chris@chris-wilson.co.uk
      (cherry picked from commit 2377427c)
      Signed-off-by: default avatarRodrigo Vivi <rodrigo.vivi@intel.com>
      42723673
    • Ville Syrjälä's avatar
      drm/i915/fbc: Fix fence_y_offset handling · 9eb0463c
      Ville Syrjälä authored
      The current fence_y_offset calculation is broken. I think it more or
      less used to do the right thing, but then I changed the plane code
      to put the final x/y source offsets back into the src rectangle so
      now it's just subtraacting the same value from itself. The code would
      never have worked if we allowed the framebuffer to have a non-zero
      offset.
      
      Let's do this in a better way by just calculating the fence_y_offset
      from the final plane surface offset. Note that we don't align the
      plane surface address to fence rows so with horizontal panning there's
      often a horizontal offset from the fence start to the surface address
      as well. We have no way to tell the hardware about that so we just
      ignore it. Based on some quick tests the invlidation still happens
      correctly. I presume due to the invalidation nuking at least the full
      line (or a segment of multiple lines).
      
      Fixes: 54d4d719 ("drm/i915: Overcome display engine stride limits via GTT remapping")
      Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20200429101034.8208-4-ville.syrjala@linux.intel.comReviewed-by: default avatarMatt Roper <matthew.d.roper@intel.com>
      (cherry picked from commit 5331889b)
      Signed-off-by: default avatarRodrigo Vivi <rodrigo.vivi@intel.com>
      9eb0463c
    • Chris Wilson's avatar
      drm/i915: Skip stale object handle for debugfs per-file-stats · 7dfbf8a0
      Chris Wilson authored
      As we close a handle GEM object, we update the drm_file's idr with an
      error^W NULL pointer to indicate the in-progress closure, and finally
      removing it. If we read the idr directly, we may then see an invalid
      object pointer, and in our debugfs per_file_stats() we therefore need
      to protect against the entry being invalid.
      
      [ 1016.651637] RIP: 0010:per_file_stats+0xe/0x16e
      [ 1016.651646] Code: d2 41 0f b6 8e 69 8c 00 00 48 89 df 48 c7 c6 7b 74 8c be 31 c0 e8 0c 89 cf ff eb d2 0f 1f 44 00 00 55 48 89 e5 41
      57 41 56 53 <8b> 06 85 c0 0f 84 4d 01 00 00 49 89 d6 48 89 f3 3d ff ff ff 7f 73
      [ 1016.651651] RSP: 0018:ffffad3a01337ba0 EFLAGS: 00010293
      [ 1016.651656] RAX: 0000000000000018 RBX: ffff96fe040d65e0 RCX: 0000000000000002
      [ 1016.651660] RDX: ffffad3a01337c50 RSI: 0000000000000000 RDI: 00000000000001e8
      [ 1016.651663] RBP: ffffad3a01337bb8 R08: 0000000000000000 R09: 00000000000001c0
      [ 1016.651667] R10: 0000000000000000 R11: ffffffffbdbe5fce R12: 0000000000000000
      [ 1016.651671] R13: ffffffffbdbe5fce R14: ffffad3a01337c50 R15: 0000000000000001
      [ 1016.651676] FS:  00007a597e2d7480(0000) GS:ffff96ff3bb00000(0000) knlGS:0000000000000000
      [ 1016.651680] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [ 1016.651683] CR2: 0000000000000000 CR3: 0000000171fc2001 CR4: 00000000003606e0
      [ 1016.651687] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      [ 1016.651690] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
      [ 1016.651693] Call Trace:
      [ 1016.651693] Call Trace:
      [ 1016.651703]  idr_for_each+0x8a/0xe8
      [ 1016.651711]  i915_gem_object_info+0x2a3/0x3eb
      [ 1016.651720]  seq_read+0x162/0x3ca
      [ 1016.651727]  full_proxy_read+0x5b/0x8d
      [ 1016.651733]  __vfs_read+0x45/0x1bb
      [ 1016.651741]  vfs_read+0xc9/0x15e
      [ 1016.651746]  ksys_read+0x7e/0xde
      [ 1016.651752]  do_syscall_64+0x54/0x68
      [ 1016.651758]  entry_SYSCALL_64_after_hwframe+0x44/0xa9
      Reported-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Fixes: a8c15954 ("drm/i915: Protect debugfs per_file_stats with RCU lock")
      Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
      Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
      Cc: Guenter Roeck <linux@roeck-us.net>
      Cc: stable@vger.kernel.org
      Reviewed-by: default avatarMika Kuoppala <mika.kuoppala@linux.intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20200630152724.3734-1-chris@chris-wilson.co.uk
      (cherry picked from commit c1b9fd3d)
      Signed-off-by: default avatarRodrigo Vivi <rodrigo.vivi@intel.com>
      7dfbf8a0
  2. 05 Jul, 2020 14 commits
    • Linus Torvalds's avatar
      Linux 5.8-rc4 · dcb7fd82
      Linus Torvalds authored
      dcb7fd82
    • Linus Torvalds's avatar
      x86/ldt: use "pr_info_once()" instead of open-coding it badly · bb5a93aa
      Linus Torvalds authored
      Using a mutex for "print this warning only once" is so overdesigned as
      to be actively offensive to my sensitive stomach.
      
      Just use "pr_info_once()" that already does this, although in a
      (harmlessly) racy manner that can in theory cause the message to be
      printed twice if more than one CPU races on that "is this the first
      time" test.
      
      [ If somebody really cares about that harmless data race (which sounds
        very unlikely indeed), that person can trivially fix printk_once() by
        using a simple atomic access, preferably with an optimistic non-atomic
        test first before even bothering to treat the pointless "make sure it
        is _really_ just once" case.
      
        A mutex is most definitely never the right primitive to use for
        something like this. ]
      
      Yes, this is a small and meaningless detail in a code path that hardly
      matters.  But let's keep some code quality standards here, and not
      accept outrageously bad code.
      
      Link: https://lore.kernel.org/lkml/CAHk-=wgV9toS7GU3KmNpj8hCS9SeF+A0voHS8F275_mgLhL4Lw@mail.gmail.com/
      Cc: Andy Lutomirski <luto@kernel.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Peter Zijlstra (Intel) <peterz@infradead.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      bb5a93aa
    • Linus Torvalds's avatar
      Merge tag 'x86-urgent-2020-07-05' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 72674d48
      Linus Torvalds authored
      Pull x86 fixes from Thomas Gleixner:
       "A series of fixes for x86:
      
         - Reset MXCSR in kernel_fpu_begin() to prevent using a stale user
           space value.
      
         - Prevent writing MSR_TEST_CTRL on CPUs which are not explicitly
           whitelisted for split lock detection. Some CPUs which do not
           support it crash even when the MSR is written to 0 which is the
           default value.
      
         - Fix the XEN PV fallout of the entry code rework
      
         - Fix the 32bit fallout of the entry code rework
      
         - Add more selftests to ensure that these entry problems don't come
           back.
      
         - Disable 16 bit segments on XEN PV. It's not supported because XEN
           PV does not implement ESPFIX64"
      
      * tag 'x86-urgent-2020-07-05' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        x86/ldt: Disable 16-bit segments on Xen PV
        x86/entry/32: Fix #MC and #DB wiring on x86_32
        x86/entry/xen: Route #DB correctly on Xen PV
        x86/entry, selftests: Further improve user entry sanity checks
        x86/entry/compat: Clear RAX high bits on Xen PV SYSENTER
        selftests/x86: Consolidate and fix get/set_eflags() helpers
        selftests/x86/syscall_nt: Clear weird flags after each test
        selftests/x86/syscall_nt: Add more flag combinations
        x86/entry/64/compat: Fix Xen PV SYSENTER frame setup
        x86/entry: Move SYSENTER's regs->sp and regs->flags fixups into C
        x86/entry: Assert that syscalls are on the right stack
        x86/split_lock: Don't write MSR_TEST_CTRL on CPUs that aren't whitelisted
        x86/fpu: Reset MXCSR to default in kernel_fpu_begin()
      72674d48
    • Linus Torvalds's avatar
      Merge tag 'irq-urgent-2020-07-05' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · f23dbe18
      Linus Torvalds authored
      Pull irq fixes from Thomas Gleixner:
       "A set of interrupt chip driver fixes:
      
         - Ensure the atomicity of affinity updates in the GIC driver
      
         - Don't try to sleep in atomic context when waiting for the GICv4.1
           to respond. Use polling instead.
      
         - Typo fixes in Kconfig and warnings"
      
      * tag 'irq-urgent-2020-07-05' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        irqchip/gic: Atomically update affinity
        irqchip/riscv-intc: Fix a typo in a pr_warn()
        irqchip/gic-v4.1: Use readx_poll_timeout_atomic() to fix sleep in atomic
        irqchip/loongson-pci-msi: Fix a typo in Kconfig
      f23dbe18
    • Linus Torvalds's avatar
      Merge tag 'core-urgent-2020-07-05' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 5465a324
      Linus Torvalds authored
      Pull rcu fixlet from Thomas Gleixner:
       "A single fix for a printk format warning in RCU"
      
      * tag 'core-urgent-2020-07-05' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        rcuperf: Fix printk format warning
      5465a324
    • Linus Torvalds's avatar
      Merge tag 'kbuild-fixes-v5.8-2' of... · 4bc92736
      Linus Torvalds authored
      Merge tag 'kbuild-fixes-v5.8-2' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild
      
      Pull Kbuild fixes frin Masahiro Yamada:
      
       - fix various bugs in xconfig
      
       - fix some issues in cross-compilation using Clang
      
       - fix documentation
      
      * tag 'kbuild-fixes-v5.8-2' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild:
        .gitignore: Do not track `defconfig` from `make savedefconfig`
        kbuild: make Clang build userprogs for target architecture
        kbuild: fix CONFIG_CC_CAN_LINK(_STATIC) for cross-compilation with Clang
        kconfig: qconf: parse newer types at debug info
        kconfig: qconf: navigate menus on hyperlinks
        kconfig: qconf: don't show goback button on splitMode
        kconfig: qconf: simplify the goBack() logic
        kconfig: qconf: re-implement setSelected()
        kconfig: qconf: make debug links work again
        kconfig: qconf: make search fully work again on split mode
        kconfig: qconf: cleanup includes
        docs: kbuild: fix ReST formatting
        gcc-plugins: fix gcc-plugins directory path in documentation
      4bc92736
    • Linus Torvalds's avatar
      Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi · 19a61a75
      Linus Torvalds authored
      Pull SCSI fixes from James Bottomley:
       "Four small fixes in three drivers.
      
        The mptfusion one has actually caused user visible issues in certain
        kernel configurations"
      
      * tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
        scsi: mptfusion: Don't use GFP_ATOMIC for larger DMA allocations
        scsi: libfc: Skip additional kref updating work event
        scsi: libfc: Handling of extra kref
        scsi: qla2xxx: Fix a condition in qla2x00_find_all_fabric_devs()
      19a61a75
    • Linus Torvalds's avatar
      Merge tag 'block-5.8-2020-07-05' of git://git.kernel.dk/linux-block · 29206c63
      Linus Torvalds authored
      Pull block fixes from Jens Axboe:
      
       - NVMe fixes from Christoph:
          - Fix crash in multi-path disk add (Christoph)
          - Fix ignore of identify error (Sagi)
      
       - Fix a compiler complaint that a function should be static (Wei)
      
      * tag 'block-5.8-2020-07-05' of git://git.kernel.dk/linux-block:
        block: make function __bio_integrity_free() static
        nvme: fix a crash in nvme_mpath_add_disk
        nvme: fix identify error status silent ignore
      29206c63
    • Linus Torvalds's avatar
      Merge tag 'io_uring-5.8-2020-07-05' of git://git.kernel.dk/linux-block · 9fbe565c
      Linus Torvalds authored
      Pull io_uring fix from Jens Axboe:
       "Andres reported a regression with the fix that was merged earlier this
        week, where his setup of using signals to interrupt io_uring CQ waits
        no longer worked correctly.
      
        Fix this, and also limit our use of TWA_SIGNAL to the case where we
        need it, and continue using TWA_RESUME for task_work as before.
      
        Since the original is marked for 5.7 stable, let's flush this one out
        early"
      
      * tag 'io_uring-5.8-2020-07-05' of git://git.kernel.dk/linux-block:
        io_uring: fix regression with always ignoring signals in io_cqring_wait()
      9fbe565c
    • Linus Torvalds's avatar
      Merge branch 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux · 77834854
      Linus Torvalds authored
      Pull i2c fixes from Wolfram Sang:
       "The usual driver fixes and documentation updates"
      
      * 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux:
        i2c: mlxcpld: check correct size of maximum RECV_LEN packet
        i2c: add Kconfig help text for slave mode
        i2c: slave-eeprom: update documentation
        i2c: eg20t: Load module automatically if ID matches
        i2c: designware: platdrv: Set class based on DMI
        i2c: algo-pca: Add 0x78 as SCL stuck low status for PCA9665
      77834854
    • Linus Torvalds's avatar
      Merge tag 'mips_fixes_5.8_1' of git://git.kernel.org/pub/scm/linux/kernel/git/mips/linux · 45a5ac7a
      Linus Torvalds authored
      Pull MIPS fixes from Thomas Bogendoerfer:
      
       - fix for missing hazard barrier
      
       - DT fix for ingenic
      
       - DT fix of GPHY names for lantiq
      
       - fix usage of smp_processor_id() while preemption is enabled
      
      * tag 'mips_fixes_5.8_1' of git://git.kernel.org/pub/scm/linux/kernel/git/mips/linux:
        MIPS: Do not use smp_processor_id() in preemptible code
        MIPS: Add missing EHB in mtc0 -> mfc0 sequence for DSPen
        MIPS: ingenic: gcw0: Fix HP detection GPIO.
        MIPS: lantiq: xway: sysctrl: fix the GPHY clock alias names
      45a5ac7a
    • Xingxing Su's avatar
      MIPS: Do not use smp_processor_id() in preemptible code · 5868347a
      Xingxing Su authored
      Use preempt_disable() to fix the following bug under CONFIG_DEBUG_PREEMPT.
      
      [   21.915305] BUG: using smp_processor_id() in preemptible [00000000] code: qemu-system-mip/1056
      [   21.923996] caller is do_ri+0x1d4/0x690
      [   21.927921] CPU: 0 PID: 1056 Comm: qemu-system-mip Not tainted 5.8.0-rc2 #3
      [   21.934913] Stack : 0000000000000001 ffffffff81370000 ffffffff8071cd60 a80f926d5ac95694
      [   21.942984]         a80f926d5ac95694 0000000000000000 98000007f0043c88 ffffffff80f2fe40
      [   21.951054]         0000000000000000 0000000000000000 0000000000000001 0000000000000000
      [   21.959123]         ffffffff802d60cc 98000007f0043dd8 ffffffff81f4b1e8 ffffffff81f60000
      [   21.967192]         ffffffff81f60000 ffffffff80fe0000 ffff000000000000 0000000000000000
      [   21.975261]         fffffffff500cce1 0000000000000001 0000000000000002 0000000000000000
      [   21.983331]         ffffffff80fe1a40 0000000000000006 ffffffff8077f940 0000000000000000
      [   21.991401]         ffffffff81460000 98000007f0040000 98000007f0043c80 000000fffba8cf20
      [   21.999471]         ffffffff8071cd60 0000000000000000 0000000000000000 0000000000000000
      [   22.007541]         0000000000000000 0000000000000000 ffffffff80212ab4 a80f926d5ac95694
      [   22.015610]         ...
      [   22.018086] Call Trace:
      [   22.020562] [<ffffffff80212ab4>] show_stack+0xa4/0x138
      [   22.025732] [<ffffffff8071cd60>] dump_stack+0xf0/0x150
      [   22.030903] [<ffffffff80c73f5c>] check_preemption_disabled+0xf4/0x100
      [   22.037375] [<ffffffff80213b84>] do_ri+0x1d4/0x690
      [   22.042198] [<ffffffff8020b828>] handle_ri_int+0x44/0x5c
      [   24.359386] BUG: using smp_processor_id() in preemptible [00000000] code: qemu-system-mip/1072
      [   24.368204] caller is do_ri+0x1a8/0x690
      [   24.372169] CPU: 4 PID: 1072 Comm: qemu-system-mip Not tainted 5.8.0-rc2 #3
      [   24.379170] Stack : 0000000000000001 ffffffff81370000 ffffffff8071cd60 a80f926d5ac95694
      [   24.387246]         a80f926d5ac95694 0000000000000000 98001007ef06bc88 ffffffff80f2fe40
      [   24.395318]         0000000000000000 0000000000000000 0000000000000001 0000000000000000
      [   24.403389]         ffffffff802d60cc 98001007ef06bdd8 ffffffff81f4b818 ffffffff81f60000
      [   24.411461]         ffffffff81f60000 ffffffff80fe0000 ffff000000000000 0000000000000000
      [   24.419533]         fffffffff500cce1 0000000000000001 0000000000000002 0000000000000000
      [   24.427603]         ffffffff80fe0000 0000000000000006 ffffffff8077f940 0000000000000020
      [   24.435673]         ffffffff81460020 98001007ef068000 98001007ef06bc80 000000fffbbbb370
      [   24.443745]         ffffffff8071cd60 0000000000000000 0000000000000000 0000000000000000
      [   24.451816]         0000000000000000 0000000000000000 ffffffff80212ab4 a80f926d5ac95694
      [   24.459887]         ...
      [   24.462367] Call Trace:
      [   24.464846] [<ffffffff80212ab4>] show_stack+0xa4/0x138
      [   24.470029] [<ffffffff8071cd60>] dump_stack+0xf0/0x150
      [   24.475208] [<ffffffff80c73f5c>] check_preemption_disabled+0xf4/0x100
      [   24.481682] [<ffffffff80213b58>] do_ri+0x1a8/0x690
      [   24.486509] [<ffffffff8020b828>] handle_ri_int+0x44/0x5c
      Signed-off-by: default avatarXingxing Su <suxingxing@loongson.cn>
      Signed-off-by: default avatarThomas Bogendoerfer <tsbogend@alpha.franken.de>
      5868347a
    • Hauke Mehrtens's avatar
      MIPS: Add missing EHB in mtc0 -> mfc0 sequence for DSPen · fcec538e
      Hauke Mehrtens authored
      This resolves the hazard between the mtc0 in the change_c0_status() and
      the mfc0 in configure_exception_vector(). Without resolving this hazard
      configure_exception_vector() could read an old value and would restore
      this old value again. This would revert the changes change_c0_status()
      did. I checked this by printing out the read_c0_status() at the end of
      per_cpu_trap_init() and the ST0_MX is not set without this patch.
      
      The hazard is documented in the MIPS Architecture Reference Manual Vol.
      III: MIPS32/microMIPS32 Privileged Resource Architecture (MD00088), rev
      6.03 table 8.1 which includes:
      
         Producer | Consumer | Hazard
        ----------|----------|----------------------------
         mtc0     | mfc0     | any coprocessor 0 register
      
      I saw this hazard on an Atheros AR9344 rev 2 SoC with a MIPS 74Kc CPU.
      There the change_c0_status() function would activate the DSPen by
      setting ST0_MX in the c0_status register. This was reverted and then the
      system got a DSP exception when the DSP registers were saved in
      save_dsp() in the first process switch. The crash looks like this:
      
      [    0.089999] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
      [    0.097796] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
      [    0.107070] Kernel panic - not syncing: Unexpected DSP exception
      [    0.113470] Rebooting in 1 seconds..
      
      We saw this problem in OpenWrt only on the MIPS 74Kc based Atheros SoCs,
      not on the 24Kc based SoCs. We only saw it with kernel 5.4 not with
      kernel 4.19, in addition we had to use GCC 8.4 or 9.X, with GCC 8.3 it
      did not happen.
      
      In the kernel I bisected this problem to commit 9012d011 ("compiler:
      allow all arches to enable CONFIG_OPTIMIZE_INLINING"), but when this was
      reverted it also happened after commit 172dcd93 ("MIPS: Always
      allocate exception vector for MIPSr2+").
      
      Commit 0b24cae4 ("MIPS: Add missing EHB in mtc0 -> mfc0 sequence.")
      does similar changes to a different file. I am not sure if there are
      more places affected by this problem.
      Signed-off-by: default avatarHauke Mehrtens <hauke@hauke-m.de>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarThomas Bogendoerfer <tsbogend@alpha.franken.de>
      fcec538e
    • Paul Menzel's avatar
      .gitignore: Do not track `defconfig` from `make savedefconfig` · ba77dca5
      Paul Menzel authored
      Running `make savedefconfig` creates by default `defconfig`, which is,
      currently, on git’s radar, for example, `git status` lists this file as
      untracked.
      
      So, add the file to `.gitignore`, so it’s ignored by git.
      Signed-off-by: default avatarPaul Menzel <pmenzel@molgen.mpg.de>
      Acked-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      ba77dca5
  3. 04 Jul, 2020 19 commits
  4. 03 Jul, 2020 4 commits
    • Joel Savitz's avatar
      mm/page_alloc: fix documentation error · 8beeae86
      Joel Savitz authored
      When I increased the upper bound of the min_free_kbytes value in
      ee8eb9a5 ("mm/page_alloc: increase default min_free_kbytes bound") I
      forgot to tweak the above comment to reflect the new value.  This patch
      fixes that mistake.
      Signed-off-by: default avatarJoel Savitz <jsavitz@redhat.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Cc: Matthew Wilcox <willy@infradead.org>
      Cc: Rafael Aquini <aquini@redhat.com>
      Cc: Fabrizio D'Angelo <fdangelo@redhat.com>
      Link: http://lkml.kernel.org/r/20200624221236.29560-1-jsavitz@redhat.comSigned-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      8beeae86
    • Christoph Hellwig's avatar
      vmalloc: fix the owner argument for the new __vmalloc_node_range callers · a3a66c38
      Christoph Hellwig authored
      Fix the recently added new __vmalloc_node_range callers to pass the
      correct values as the owner for display in /proc/vmallocinfo.
      
      Fixes: 800e26b8 ("x86/hyperv: allocate the hypercall page with only read and execute bits")
      Fixes: 10d5e97c ("arm64: use PAGE_KERNEL_ROX directly in alloc_insn_page")
      Fixes: 7a0e27b2 ("mm: remove vmalloc_exec")
      Reported-by: default avatarArd Biesheuvel <ardb@kernel.org>
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Link: http://lkml.kernel.org/r/20200627075649.2455097-1-hch@lst.deSigned-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      a3a66c38
    • Barry Song's avatar
      mm/cma.c: use exact_nid true to fix possible per-numa cma leak · 40366bd7
      Barry Song authored
      Calling cma_declare_contiguous_nid() with false exact_nid for per-numa
      reservation can easily cause cma leak and various confusion.  For example,
      mm/hugetlb.c is trying to reserve per-numa cma for gigantic pages.  But it
      can easily leak cma and make users confused when system has memoryless
      nodes.
      
      In case the system has 4 numa nodes, and only numa node0 has memory.  if
      we set hugetlb_cma=4G in bootargs, mm/hugetlb.c will get 4 cma areas for 4
      different numa nodes.  since exact_nid=false in current code, all 4 numa
      nodes will get cma successfully from node0, but hugetlb_cma[1 to 3] will
      never be available to hugepage will only allocate memory from
      hugetlb_cma[0].
      
      In case the system has 4 numa nodes, both numa node0&2 has memory, other
      nodes have no memory.  if we set hugetlb_cma=4G in bootargs, mm/hugetlb.c
      will get 4 cma areas for 4 different numa nodes.  since exact_nid=false in
      current code, all 4 numa nodes will get cma successfully from node0 or 2,
      but hugetlb_cma[1] and [3] will never be available to hugepage as
      mm/hugetlb.c will only allocate memory from hugetlb_cma[0] and
      hugetlb_cma[2].  This causes permanent leak of the cma areas which are
      supposed to be used by memoryless node.
      
      Of cource we can workaround the issue by letting mm/hugetlb.c scan all cma
      areas in alloc_gigantic_page() even node_mask includes node0 only.  that
      means when node_mask includes node0 only, we can get page from
      hugetlb_cma[1] to hugetlb_cma[3].  But this will cause kernel crash in
      free_gigantic_page() while it wants to free page by:
      cma_release(hugetlb_cma[page_to_nid(page)], page, 1 << order)
      
      On the other hand, exact_nid=false won't consider numa distance, it might
      be not that useful to leverage cma areas on remote nodes.  I feel it is
      much simpler to make exact_nid true to make everything clear.  After that,
      memoryless nodes won't be able to reserve per-numa CMA from other nodes
      which have memory.
      
      Fixes: cf11e85f ("mm: hugetlb: optionally allocate gigantic hugepages using cma")
      Signed-off-by: default avatarBarry Song <song.bao.hua@hisilicon.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Acked-by: default avatarRoman Gushchin <guro@fb.com>
      Cc: Jonathan Cameron <Jonathan.Cameron@huawei.com>
      Cc: Aslan Bakirov <aslan@fb.com>
      Cc: Michal Hocko <mhocko@kernel.org>
      Cc: Andreas Schaufler <andreas.schaufler@gmx.de>
      Cc: Mike Kravetz <mike.kravetz@oracle.com>
      Cc: Rik van Riel <riel@surriel.com>
      Cc: Joonsoo Kim <js1304@gmail.com>
      Cc: Robin Murphy <robin.murphy@arm.com>
      Cc: <stable@vger.kernel.org>
      Link: http://lkml.kernel.org/r/20200628074345.27228-1-song.bao.hua@hisilicon.comSigned-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      40366bd7
    • Kees Cook's avatar
      samples/vfs: avoid warning in statx override · c3eeaae9
      Kees Cook authored
      Something changed recently to uncover this warning:
      
        samples/vfs/test-statx.c:24:15: warning: `struct foo' declared inside parameter list will not be visible outside of this definition or declaration
           24 | #define statx foo
              |               ^~~
      
      Which is due the use of "struct statx" (here, "struct foo") in a function
      prototype argument list before it has been defined:
      
       int
       # 56 "/usr/include/x86_64-linux-gnu/bits/statx-generic.h"
          foo
       # 56 "/usr/include/x86_64-linux-gnu/bits/statx-generic.h" 3 4
                (int __dirfd, const char *__restrict __path, int __flags,
                  unsigned int __mask, struct
       # 57 "/usr/include/x86_64-linux-gnu/bits/statx-generic.h"
                                             foo
       # 57 "/usr/include/x86_64-linux-gnu/bits/statx-generic.h" 3 4
                                                   *__restrict __buf)
         __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 5)));
      
      Add explicit struct before #include to avoid warning.
      
      Fixes: f1b5618e ("vfs: Add a sample program for the new mount API")
      Signed-off-by: default avatarKees Cook <keescook@chromium.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Cc: Miklos Szeredi <mszeredi@redhat.com>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Cc: David Howells <dhowells@redhat.com>
      Link: http://lkml.kernel.org/r/202006282213.C516EA6@keescookSigned-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      c3eeaae9