1. 06 Jul, 2020 15 commits
    • Dave Chinner's avatar
      xfs: Don't allow logging of XFS_ISTALE inodes · 96355d5a
      Dave Chinner authored
      In tracking down a problem in this patchset, I discovered we are
      reclaiming dirty stale inodes. This wasn't discovered until inodes
      were always attached to the cluster buffer and then the rcu callback
      that freed inodes was assert failing because the inode still had an
      active pointer to the cluster buffer after it had been reclaimed.
      
      Debugging the issue indicated that this was a pre-existing issue
      resulting from the way the inodes are handled in xfs_inactive_ifree.
      When we free a cluster buffer from xfs_ifree_cluster, all the inodes
      in cache are marked XFS_ISTALE. Those that are clean have nothing
      else done to them and so eventually get cleaned up by background
      reclaim. i.e. it is assumed we'll never dirty/relog an inode marked
      XFS_ISTALE.
      
      On journal commit dirty stale inodes as are handled by both
      buffer and inode log items to run though xfs_istale_done() and
      removed from the AIL (buffer log item commit) or the log item will
      simply unpin it because the buffer log item will clean it. What happens
      to any specific inode is entirely dependent on which log item wins
      the commit race, but the result is the same - stale inodes are
      clean, not attached to the cluster buffer, and not in the AIL. Hence
      inode reclaim can just free these inodes without further care.
      
      However, if the stale inode is relogged, it gets dirtied again and
      relogged into the CIL. Most of the time this isn't an issue, because
      relogging simply changes the inode's location in the current
      checkpoint. Problems arise, however, when the CIL checkpoints
      between two transactions in the xfs_inactive_ifree() deferops
      processing. This results in the XFS_ISTALE inode being redirtied
      and inserted into the CIL without any of the other stale cluster
      buffer infrastructure being in place.
      
      Hence on journal commit, it simply gets unpinned, so it remains
      dirty in memory. Everything in inode writeback avoids XFS_ISTALE
      inodes so it can't be written back, and it is not tracked in the AIL
      so there's not even a trigger to attempt to clean the inode. Hence
      the inode just sits dirty in memory until inode reclaim comes along,
      sees that it is XFS_ISTALE, and goes to reclaim it. This reclaiming
      of a dirty inode caused use after free, list corruptions and other
      nasty issues later in this patchset.
      
      Hence this patch addresses a violation of the "never log XFS_ISTALE
      inodes" caused by the deferops processing rolling a transaction
      and relogging a stale inode in xfs_inactive_free. It also adds a
      bunch of asserts to catch this problem in debug kernels so that
      we don't reintroduce this problem in future.
      
      Reproducer for this issue was generic/558 on a v4 filesystem.
      Signed-off-by: default avatarDave Chinner <dchinner@redhat.com>
      Reviewed-by: default avatarBrian Foster <bfoster@redhat.com>
      Reviewed-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
      Signed-off-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
      96355d5a
    • Yafang Shao's avatar
      xfs: remove useless definitions in xfs_linux.h · 0d5a5714
      Yafang Shao authored
      Remove current_pid(), current_test_flags() and
      current_clear_flags_nested(), because they are useless.
      Signed-off-by: default avatarYafang Shao <laoar.shao@gmail.com>
      Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
      Reviewed-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
      Signed-off-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
      0d5a5714
    • Dave Chinner's avatar
      xfs: use MMAPLOCK around filemap_map_pages() · cd647d56
      Dave Chinner authored
      The page faultround path ->map_pages is implemented in XFS via
      filemap_map_pages(). This function checks that pages found in page
      cache lookups have not raced with truncate based invalidation by
      checking page->mapping is correct and page->index is within EOF.
      
      However, we've known for a long time that this is not sufficient to
      protect against races with invalidations done by operations that do
      not change EOF. e.g. hole punching and other fallocate() based
      direct extent manipulations. The way we protect against these
      races is we wrap the page fault operations in a XFS_MMAPLOCK_SHARED
      lock so they serialise against fallocate and truncate before calling
      into the filemap function that processes the fault.
      
      Do the same for XFS's ->map_pages implementation to close this
      potential data corruption issue.
      Signed-off-by: default avatarDave Chinner <dchinner@redhat.com>
      Reviewed-by: default avatarAmir Goldstein <amir73il@gmail.com>
      Reviewed-by: default avatarBrian Foster <bfoster@redhat.com>
      Reviewed-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
      Signed-off-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
      cd647d56
    • Darrick J. Wong's avatar
      xfs: move helpers that lock and unlock two inodes against userspace IO · e2aaee9c
      Darrick J. Wong authored
      Move the double-inode locking helpers to xfs_inode.c since they're not
      specific to reflink.
      Signed-off-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
      Reviewed-by: default avatarBrian Foster <bfoster@redhat.com>
      e2aaee9c
    • Darrick J. Wong's avatar
      xfs: refactor locking and unlocking two inodes against userspace IO · 10b4bd6c
      Darrick J. Wong authored
      Refactor the two functions that we use to lock and unlock two inodes to
      block userspace from initiating IO against a file, whether via system
      calls or mmap activity.
      Signed-off-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
      Reviewed-by: default avatarBrian Foster <bfoster@redhat.com>
      10b4bd6c
    • Darrick J. Wong's avatar
      xfs: fix xfs_reflink_remap_prep calling conventions · 451d34ee
      Darrick J. Wong authored
      Fix the return value of xfs_reflink_remap_prep so that its return value
      conventions match the rest of xfs.
      Signed-off-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
      Reviewed-by: default avatarBrian Foster <bfoster@redhat.com>
      451d34ee
    • Darrick J. Wong's avatar
      xfs: reflink can skip remap existing mappings · 168eae80
      Darrick J. Wong authored
      If the source and destination map are identical, we can skip the remap
      step to save some time.
      Signed-off-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
      Reviewed-by: default avatarBrian Foster <bfoster@redhat.com>
      168eae80
    • Darrick J. Wong's avatar
      xfs: only reserve quota blocks if we're mapping into a hole · 94b941fd
      Darrick J. Wong authored
      When logging quota block count updates during a reflink operation, we
      only log the /delta/ of the block count changes to the dquot.  Since we
      now know ahead of time the extent type of both dmap and smap (and that
      they have the same length), we know that we only need to reserve quota
      blocks for dmap's blockcount if we're mapping it into a hole.
      Signed-off-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
      Reviewed-by: default avatarBrian Foster <bfoster@redhat.com>
      94b941fd
    • Darrick J. Wong's avatar
      xfs: only reserve quota blocks for bmbt changes if we're changing the data fork · aa5d0ba0
      Darrick J. Wong authored
      Now that we've reworked xfs_reflink_remap_extent to remap only one
      extent per transaction, we actually know if the extent being removed is
      an allocated mapping.  This means that we now know ahead of time if
      we're going to be touching the data fork.
      
      Since we only need blocks for a bmbt split if we're going to update the
      data fork, we only need to get quota reservation if we know we're going
      to touch the data fork.
      Signed-off-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
      Reviewed-by: default avatarBrian Foster <bfoster@redhat.com>
      aa5d0ba0
    • Darrick J. Wong's avatar
      xfs: redesign the reflink remap loop to fix blkres depletion crash · 00fd1d56
      Darrick J. Wong authored
      The existing reflink remapping loop has some structural problems that
      need addressing:
      
      The biggest problem is that we create one transaction for each extent in
      the source file without accounting for the number of mappings there are
      for the same range in the destination file.  In other words, we don't
      know the number of remap operations that will be necessary and we
      therefore cannot guess the block reservation required.  On highly
      fragmented filesystems (e.g. ones with active dedupe) we guess wrong,
      run out of block reservation, and fail.
      
      The second problem is that we don't actually use the bmap intents to
      their full potential -- instead of calling bunmapi directly and having
      to deal with its backwards operation, we could call the deferred ops
      xfs_bmap_unmap_extent and xfs_refcount_decrease_extent instead.  This
      makes the frontend loop much simpler.
      
      Solve all of these problems by refactoring the remapping loops so that
      we only perform one remapping operation per transaction, and each
      operation only tries to remap a single extent from source to dest.
      Signed-off-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
      Reviewed-by: default avatarBrian Foster <bfoster@redhat.com>
      Reported-by: default avatarEdwin Török <edwin@etorok.net>
      Tested-by: default avatarEdwin Török <edwin@etorok.net>
      00fd1d56
    • Darrick J. Wong's avatar
      xfs: rename xfs_bmap_is_real_extent to is_written_extent · 877f58f5
      Darrick J. Wong authored
      The name of this predicate is a little misleading -- it decides if the
      extent mapping is allocated and written.  Change the name to be more
      direct, as we're going to add a new predicate in the next patch.
      Signed-off-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
      Reviewed-by: default avatarBrian Foster <bfoster@redhat.com>
      877f58f5
    • Darrick J. Wong's avatar
      xfs: fix reflink quota reservation accounting error · 83895227
      Darrick J. Wong authored
      Quota reservations are supposed to account for the blocks that might be
      allocated due to a bmap btree split.  Reflink doesn't do this, so fix
      this to make the quota accounting more accurate before we start
      rearranging things.
      
      Fixes: 862bb360 ("xfs: reflink extents from one file to another")
      Signed-off-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
      Reviewed-by: default avatarBrian Foster <bfoster@redhat.com>
      83895227
    • Darrick J. Wong's avatar
      xfs: don't eat an EIO/ENOSPC writeback error when scrubbing data fork · eb0efe50
      Darrick J. Wong authored
      The data fork scrubber calls filemap_write_and_wait to flush dirty pages
      and delalloc reservations out to disk prior to checking the data fork's
      extent mappings.  Unfortunately, this means that scrub can consume the
      EIO/ENOSPC errors that would otherwise have stayed around in the address
      space until (we hope) the writer application calls fsync to persist data
      and collect errors.  The end result is that programs that wrote to a
      file might never see the error code and proceed as if nothing were
      wrong.
      
      xfs_scrub is not in a position to notify file writers about the
      writeback failure, and it's only here to check metadata, not file
      contents.  Therefore, if writeback fails, we should stuff the error code
      back into the address space so that an fsync by the writer application
      can pick that up.
      
      Fixes: 99d9d8d0 ("xfs: scrub inode block mappings")
      Signed-off-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
      Reviewed-by: default avatarBrian Foster <bfoster@redhat.com>
      Reviewed-by: default avatarDave Chinner <dchinner@redhat.com>
      eb0efe50
    • Brian Foster's avatar
      xfs: preserve rmapbt swapext block reservation from freed blocks · f74681ba
      Brian Foster authored
      The rmapbt extent swap algorithm remaps individual extents between
      the source inode and the target to trigger reverse mapping metadata
      updates. If either inode straddles a format or other bmap allocation
      boundary, the individual unmap and map cycles can trigger repeated
      bmap block allocations and frees as the extent count bounces back
      and forth across the boundary. While net block usage is bound across
      the swap operation, this behavior can prematurely exhaust the
      transaction block reservation because it continuously drains as the
      transaction rolls. Each allocation accounts against the reservation
      and each free returns to global free space on transaction roll.
      
      The previous workaround to this problem attempted to detect this
      boundary condition and provide surplus block reservation to
      acommodate it. This is insufficient because more remaps can occur
      than implied by the extent counts; if start offset boundaries are
      not aligned between the two inodes, for example.
      
      To address this problem more generically and dynamically, add a
      transaction accounting mode that returns freed blocks to the
      transaction reservation instead of the superblock counters on
      transaction roll and use it when the rmapbt based algorithm is
      active. This allows the chain of remap transactions to preserve the
      block reservation based own its own frees and prevent premature
      exhaustion regardless of the remap pattern. Note that this is only
      safe for superblocks with lazy sb accounting, but the latter is
      required for v5 supers and the rmap feature depends on v5.
      
      Fixes: b3fed434 ("xfs: account format bouncing into rmapbt swapext tx reservation")
      Root-caused-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
      Signed-off-by: default avatarBrian Foster <bfoster@redhat.com>
      Reviewed-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
      Signed-off-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
      f74681ba
    • Keyur Patel's avatar
      xfs: Couple of typo fixes in comments · 06734e3c
      Keyur Patel authored
      ./xfs/libxfs/xfs_inode_buf.c:56: unnecssary ==> unnecessary
      ./xfs/libxfs/xfs_inode_buf.c:59: behavour ==> behaviour
      ./xfs/libxfs/xfs_inode_buf.c:206: unitialized ==> uninitialized
      Signed-off-by: default avatarKeyur Patel <iamkeyur96@gmail.com>
      Reviewed-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
      Signed-off-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
      06734e3c
  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 11 commits