1. 20 Oct, 2018 2 commits
    • John David Anglin's avatar
      parisc: Optimze cache flush algorithms · 4c5fe5db
      John David Anglin authored
      The attached patch implements three optimizations:
      
      1) Loops in flush_user_dcache_range_asm, flush_kernel_dcache_range_asm,
      purge_kernel_dcache_range_asm, flush_user_icache_range_asm, and
      flush_kernel_icache_range_asm are unrolled to reduce branch overhead.
      
      2) The static branch prediction for cmpb instructions in pacache.S have
      been reviewed and the operand order adjusted where necessary.
      
      3) For flush routines in cache.c, we purge rather flush when we have no
      context.  The pdc instruction at level 0 is not required to write back
      dirty lines to memory. This provides a performance improvement over the
      fdc instruction if the feature is implemented.
      
      Version 2 adds alternative patching.
      
      The patch provides an average improvement of about 2%.
      Signed-off-by: default avatarJohn David Anglin <dave.anglin@bell.net>
      Signed-off-by: default avatarHelge Deller <deller@gmx.de>
      4c5fe5db
    • John David Anglin's avatar
      parisc: Remove pte_inserted define · 5a23237f
      John David Anglin authored
      The attached change removes the pte_inserted from pgtable.h.  As a
      result, we always flush the TLB entry when the associated page table
      entry is changed.
      
      This change doesn't impact performance signifcantly and it may catch
      some cases where the TLB needs flushing but wasn't.
      Signed-off-by: default avatarJohn David Anglin <dave.anglin@bell.net>
      Signed-off-by: default avatarHelge Deller <deller@gmx.de>
      5a23237f
  2. 19 Oct, 2018 3 commits
  3. 17 Oct, 2018 17 commits
    • Helge Deller's avatar
      parisc: Add alternative coding infrastructure · 3847dab7
      Helge Deller authored
      This patch adds the necessary code to patch a running kernel at runtime
      to improve performance.
      
      The current implementation offers a few optimizations variants:
      
      - When running a SMP kernel on a single UP processor, unwanted assembler
        statements like locking functions are overwritten with NOPs. When
        multiple instructions shall be skipped, one branch instruction is used
        instead of multiple nop instructions.
      
      - In the UP case, some pdtlb and pitlb instructions are patched to
        become pdtlb,l and pitlb,l which only flushes the CPU-local tlb
        entries instead of broadcasting the flush to other CPUs in the system
        and thus may improve performance.
      
      - fic and fdc instructions are skipped if no I- or D-caches are
        installed.  This should speed up qemu emulation and cacheless systems.
      
      - If no cache coherence is needed for IO operations, the relevant fdc
        and sync instructions in the sba and ccio drivers are replaced by
        nops.
      
      - On systems which share I- and D-TLBs and thus don't have a seperate
        instruction TLB, the pitlb instruction is replaced by a nop.
      
      Live-patching is done early in the boot process, just after having run
      the system inventory. No drivers are running and thus no external
      interrupts should arrive. So the hope is that no TLB exceptions will
      occur during the patching. If this turns out to be wrong we will
      probably need to do the patching in real-mode.
      Signed-off-by: default avatarHelge Deller <deller@gmx.de>
      3847dab7
    • Helge Deller's avatar
      parisc: Include compressed vmlinux file in vmlinuz boot kernel · 34c201ae
      Helge Deller authored
      Change the parisc vmlinuz boot code to include and process the real
      compressed vmlinux.gz ELF file instead of a compressed memory dump.
      This brings parisc in sync on how it's done on x86_64.
      
      The benefit of this change is that, e.g. for debugging purposes, one can
      then extract the vmlinux file out of the vmlinuz which was booted which
      wasn't possible before. This can be archieved with the existing
      scripts/extract-vmlinux script, which just needs a small tweak to prefer
      to extract a compressed file before trying the existing given binary.
      
      The downside of this approach is that due to the extra round of
      decompression/ELF processing we need more physical memory installed to
      be able to boot a kernel.
      Signed-off-by: default avatarHelge Deller <deller@gmx.de>
      34c201ae
    • Helge Deller's avatar
      extract-vmlinux: Check for uncompressed image as fallback · db139d71
      Helge Deller authored
      As on x86-64 and other architectures, the boot kernel on parisc (vmlinuz
      and bzImage) contains a full compressed copy of the final kernel
      executable (vmlinux.bin.gz), which one should be able to extract with
      the extract-vmlinux script.
      
      But on parisc extracting the kernel with extract-vmlinux fails.
      Currently the script first checks if the given file is an ELF file
      (which is true on parisc) and if so returns it.  Thus on parisc we
      unexpectedly get back the vmlinuz boot file instead of the uncompressed
      vmlinux image.
      
      This patch fixes this issue by reverting the logic. It now first tries
      to find a compression signature in the given file and if that fails it
      checks the file itself as fallback.
      Signed-off-by: default avatarHelge Deller <deller@gmx.de>
      db139d71
    • John David Anglin's avatar
      parisc: Fix address in HPMC IVA · 1138b671
      John David Anglin authored
      Helge noticed that the address of the os_hpmc handler was not being
      correctly calculated in the hpmc macro.  As a result, PDCE_CHECK would
      fail to call os_hpmc:
      
      <Cpu2> e800009802e00000  0000000000000000  CC_ERR_CHECK_HPMC
      <Cpu2> 37000f7302e00000  8040004000000000  CC_ERR_CPU_CHECK_SUMMARY
      <Cpu2> f600105e02e00000  fffffff0f0c00000  CC_MC_HPMC_MONARCH_SELECTED
      <Cpu2> 140003b202e00000  000000000000000b  CC_ERR_HPMC_STATE_ENTRY
      <Cpu2> 5600100b02e00000  00000000000001a0  CC_MC_OS_HPMC_LEN_ERR
      <Cpu2> 5600106402e00000  fffffff0f0438e70  CC_MC_BR_TO_OS_HPMC_FAILED
      <Cpu2> e800009802e00000  0000000000000000  CC_ERR_CHECK_HPMC
      <Cpu2> 37000f7302e00000  8040004000000000  CC_ERR_CPU_CHECK_SUMMARY
      <Cpu2> 4000109f02e00000  0000000000000000  CC_MC_HPMC_INITIATED
      <Cpu2> 4000101902e00000  0000000000000000  CC_MC_MULTIPLE_HPMCS
      <Cpu2> 030010d502e00000  0000000000000000  CC_CPU_STOP
      
      The address problem can be seen by dumping the fault vector:
      
      0000000040159000 <fault_vector_20>:
          40159000:   63 6f 77 73     stb r15,-2447(dp)
          40159004:   20 63 61 6e     ldil L%b747000,r3
          40159008:   20 66 6c 79     ldil L%-1c3b3000,r3
              ...
          40159020:   08 00 02 40     nop
          40159024:   20 6e 60 02     ldil L%15d000,r3
          40159028:   34 63 00 00     ldo 0(r3),r3
          4015902c:   e8 60 c0 02     bv,n r0(r3)
          40159030:   08 00 02 40     nop
          40159034:   00 00 00 00     break 0,0
          40159038:   c0 00 70 00     bb,*< r0,sar,40159840 <fault_vector_20+0x840>
          4015903c:   00 00 00 00     break 0,0
      
      Location 40159038 should contain the physical address of os_hpmc:
      
      000000004015d000 <os_hpmc>:
          4015d000:   08 1a 02 43     copy r26,r3
          4015d004:   01 c0 08 a4     mfctl iva,r4
          4015d008:   48 85 00 68     ldw 34(r4),r5
      
      This patch moves the address setup into initialize_ivt to resolve the
      above problem.  I tested the change by dumping the HPMC entry after setup:
      
      0000000040209020:  8000240
      0000000040209024: 206a2004
      0000000040209028: 34630ac0
      000000004020902c: e860c002
      0000000040209030:  8000240
      0000000040209034: 1bdddce6
      0000000040209038:   15d000
      000000004020903c:      1a0
      Signed-off-by: default avatarJohn David Anglin <dave.anglin@bell.net>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarHelge Deller <deller@gmx.de>
      1138b671
    • Helge Deller's avatar
      parisc: Fix exported address of os_hpmc handler · 99a3ae51
      Helge Deller authored
      In the C-code we need to put the physical address of the hpmc handler in
      the interrupt vector table (IVA) in order to get HPMCs working.  Since
      on parisc64 function pointers are indirect (in fact they are function
      descriptors) we instead export the address as variable and not as
      function.
      
      This reverts a small part of commit f39cce65 ("parisc: Add
      cfi_startproc and cfi_endproc to assembly code").
      Signed-off-by: default avatarHelge Deller <deller@gmx.de>
      Cc: <stable@vger.kernel.org>    [4.9+]
      99a3ae51
    • Helge Deller's avatar
      parisc: Fix map_pages() to not overwrite existing pte entries · 3c229b3f
      Helge Deller authored
      Fix a long-existing small nasty bug in the map_pages() implementation which
      leads to overwriting already written pte entries with zero, *if* map_pages() is
      called a second time with an end address which isn't aligned on a pmd boundry.
      This happens for example if we want to remap only the text segment read/write
      in order to run alternative patching on the code. Exiting the loop when we
      reach the end address fixes this.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarHelge Deller <deller@gmx.de>
      3c229b3f
    • John David Anglin's avatar
      parisc: Purge TLB entries after updating page table entry and set page accessed flag in TLB handler · 4dd5b673
      John David Anglin authored
      This patch may resolve some races in TLB handling.  Hopefully, TLB
      inserts are accesses and protected by spin lock.
      
      If not, we may need to IPI calls and do local purges on PA 2.0.
      Signed-off-by: default avatarJohn David Anglin <dave.anglin@bell.net>
      Signed-off-by: default avatarHelge Deller <deller@gmx.de>
      4dd5b673
    • John David Anglin's avatar
      parisc: Release spinlocks using ordered store · d27dfa13
      John David Anglin authored
      This patch updates the spin unlock code to use an ordered store with
      release semanatics.  All prior accesses are guaranteed to be performed
      before an ordered store is performed.
      
      Using an ordered store is significantly faster than using the sync
      memory barrier.
      Signed-off-by: default avatarJohn David Anglin <dave.anglin@bell.net>
      Signed-off-by: default avatarHelge Deller <deller@gmx.de>
      d27dfa13
    • Helge Deller's avatar
      parisc: Ratelimit dino stuck interrupt warnings · 2e37787d
      Helge Deller authored
      While playing with qemu with an emulated RT8139cp NIC, I faced lots of
      the following warnings:
      Dino 0x00810000: stuck interrupt 2
      
      This patch ratelimits this warning and reports back that the IRQ was
      handled.
      Signed-off-by: default avatarHelge Deller <deller@gmx.de>
      2e37787d
    • Helge Deller's avatar
      parisc: dino: Utilize DINO_MASK_IRQ() macro · 35d8be9c
      Helge Deller authored
      Signed-off-by: default avatarHelge Deller <deller@gmx.de>
      35d8be9c
    • Helge Deller's avatar
      parisc: Clean up crash header output · e98bc5ee
      Helge Deller authored
      On kernel crash, this is the current output:
      Kernel Fault: Code=26 (Data memory access rights trap) regs=(ptrval) (Addr=00000004)
      
      Drop the address of regs, it's of no use for debugging, and show the
      faulty address without parenthesis.
      Signed-off-by: default avatarHelge Deller <deller@gmx.de>
      e98bc5ee
    • Helge Deller's avatar
      8dbac774
    • John David Anglin's avatar
      parisc: Remove PTE load and fault check from L2_ptep macro · 32a7901f
      John David Anglin authored
      This change removes the PTE load and present check from the L2_ptep
      macro.  The load and check for kernel pages is now done in the tlb_lock
      macro.  This avoids a double load and check for user pages.  The load
      and check for user pages is now done inside the lock so the fault
      handler can't be called while the entry is being updated.  This version
      uses an ordered store to release the lock when the page table entry
      isn't present.  It also corrects the check in the non SMP case.
      Signed-off-by: default avatarJohn David Anglin <dave.anglin@bell.net>
      Signed-off-by: default avatarHelge Deller <deller@gmx.de>
      32a7901f
    • John David Anglin's avatar
      parisc: Reorder TLB flush timing calculation · a886c979
      John David Anglin authored
      On boot (mostly reboot), my c8000 sometimes crashes after it prints the
      TLB flush threshold.  The lockup is hard.  The front LED flashes red and
      the box must be unplugged to reset the error.
      
      I noticed that when the crash occurs the TLB flush threshold is about
      one quarter what it is on a successful boot.  If I disabled the
      calculation, the crash didn't occur.  There also seemed to be a timing
      dependency affecting the crash.  I finally realized that the
      flush_tlb_all() timing test runs just after the secondary CPUs are
      started.  There seems to be a problem with running flush_tlb_all() too
      soon after the CPUs are started.
      
      The timing for the range test always seemed okay.  So, I reversed the
      order of the two timing tests and I haven't had a crash at this point so
      far.
      
      I added a couple of information messages which I have left to help with
      diagnosis if the problem should appear on another machine.
      
      This version reduces the minimum TLB flush threshold to 16 KiB.
      Signed-off-by: default avatarJohn David Anglin <dave.anglin@bell.net>
      Signed-off-by: default avatarHelge Deller <deller@gmx.de>
      a886c979
    • Christoph Hellwig's avatar
      parisc: remove the dead ccio-rm-dma driver · 7c4ba3d3
      Christoph Hellwig authored
      This driver has never been wired up due to the life of the Linux
      git tree, and has severely bitrotted.
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      Signed-off-by: default avatarHelge Deller <deller@gmx.de>
      7c4ba3d3
    • Masahiro Yamada's avatar
      parisc: remove check for minimum required GCC version · c9dfa0c7
      Masahiro Yamada authored
      Commit cafa0010 ("Raise the minimum required gcc version to 4.6")
      bumped the minimum GCC version to 4.6 for all architectures.
      
      The version check in arch/parisc/Makefile is obsolete now.
      Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      Signed-off-by: default avatarHelge Deller <deller@gmx.de>
      c9dfa0c7
    • Helge Deller's avatar
      parisc: Use PARISC_ITLB_TRAP constant in entry.S · cd2b8520
      Helge Deller authored
      Fixes: 5b00ca0b ("parisc: Restore possibility to execute 64-bit applications")
      Signed-off-by: default avatarHelge Deller <deller@gmx.de>
      cd2b8520
  4. 07 Oct, 2018 7 commits
  5. 06 Oct, 2018 1 commit
    • Greg Kroah-Hartman's avatar
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net · c1d84a1b
      Greg Kroah-Hartman authored
      Dave writes:
        "Networking fixes:
      
        1) Fix truncation of 32-bit right shift in bpf, from Jann Horn.
      
        2) Fix memory leak in wireless wext compat, from Stefan Seyfried.
      
        3) Use after free in cfg80211's reg_process_hint(), from Yu Zhao.
      
        4) Need to cancel pending work when unbinding in smsc75xx otherwise
           we oops, also from Yu Zhao.
      
        5) Don't allow enslaving a team device to itself, from Ido Schimmel.
      
        6) Fix backwards compat with older userspace for rtnetlink FDB dumps.
           From Mauricio Faria.
      
        7) Add validation of tc policy netlink attributes, from David Ahern.
      
        8) Fix RCU locking in rawv6_send_hdrinc(), from Wei Wang."
      
      * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (26 commits)
        net: mvpp2: Extract the correct ethtype from the skb for tx csum offload
        ipv6: take rcu lock in rawv6_send_hdrinc()
        net: sched: Add policy validation for tc attributes
        rtnetlink: fix rtnl_fdb_dump() for ndmsg header
        yam: fix a missing-check bug
        net: bpfilter: Fix type cast and pointer warnings
        net: cxgb3_main: fix a missing-check bug
        bpf: 32-bit RSH verification must truncate input before the ALU op
        net: phy: phylink: fix SFP interface autodetection
        be2net: don't flip hw_features when VXLANs are added/deleted
        net/packet: fix packet drop as of virtio gso
        net: dsa: b53: Keep CPU port as tagged in all VLANs
        openvswitch: load NAT helper
        bnxt_en: get the reduced max_irqs by the ones used by RDMA
        bnxt_en: free hwrm resources, if driver probe fails.
        bnxt_en: Fix enables field in HWRM_QUEUE_COS2BW_CFG request
        bnxt_en: Fix VNIC reservations on the PF.
        team: Forbid enslaving team device to itself
        net/usb: cancel pending work when unbinding smsc75xx
        mlxsw: spectrum: Delete RIF when VLAN device is removed
        ...
      c1d84a1b
  6. 05 Oct, 2018 10 commits