1. 23 1月, 2019 3 次提交
  2. 17 1月, 2019 2 次提交
  3. 13 1月, 2019 20 次提交
    • B
      powerpc/tm: Set MSR[TS] just prior to recheckpoint · a854ab8f
      Breno Leitao 提交于
      commit e1c3743e1a20647c53b719dbf28b48f45d23f2cd upstream.
      
      On a signal handler return, the user could set a context with MSR[TS] bits
      set, and these bits would be copied to task regs->msr.
      
      At restore_tm_sigcontexts(), after current task regs->msr[TS] bits are set,
      several __get_user() are called and then a recheckpoint is executed.
      
      This is a problem since a page fault (in kernel space) could happen when
      calling __get_user(). If it happens, the process MSR[TS] bits were
      already set, but recheckpoint was not executed, and SPRs are still invalid.
      
      The page fault can cause the current process to be de-scheduled, with
      MSR[TS] active and without tm_recheckpoint() being called.  More
      importantly, without TEXASR[FS] bit set also.
      
      Since TEXASR might not have the FS bit set, and when the process is
      scheduled back, it will try to reclaim, which will be aborted because of
      the CPU is not in the suspended state, and, then, recheckpoint. This
      recheckpoint will restore thread->texasr into TEXASR SPR, which might be
      zero, hitting a BUG_ON().
      
      	kernel BUG at /build/linux-sf3Co9/linux-4.9.30/arch/powerpc/kernel/tm.S:434!
      	cpu 0xb: Vector: 700 (Program Check) at [c00000041f1576d0]
      	    pc: c000000000054550: restore_gprs+0xb0/0x180
      	    lr: 0000000000000000
      	    sp: c00000041f157950
      	   msr: 8000000100021033
      	  current = 0xc00000041f143000
      	  paca    = 0xc00000000fb86300	 softe: 0	 irq_happened: 0x01
      	    pid   = 1021, comm = kworker/11:1
      	kernel BUG at /build/linux-sf3Co9/linux-4.9.30/arch/powerpc/kernel/tm.S:434!
      	Linux version 4.9.0-3-powerpc64le (debian-kernel@lists.debian.org) (gcc version 6.3.0 20170516 (Debian 6.3.0-18) ) #1 SMP Debian 4.9.30-2+deb9u2 (2017-06-26)
      	enter ? for help
      	[c00000041f157b30] c00000000001bc3c tm_recheckpoint.part.11+0x6c/0xa0
      	[c00000041f157b70] c00000000001d184 __switch_to+0x1e4/0x4c0
      	[c00000041f157bd0] c00000000082eeb8 __schedule+0x2f8/0x990
      	[c00000041f157cb0] c00000000082f598 schedule+0x48/0xc0
      	[c00000041f157ce0] c0000000000f0d28 worker_thread+0x148/0x610
      	[c00000041f157d80] c0000000000f96b0 kthread+0x120/0x140
      	[c00000041f157e30] c00000000000c0e0 ret_from_kernel_thread+0x5c/0x7c
      
      This patch simply delays the MSR[TS] set, so, if there is any page fault in
      the __get_user() section, it does not have regs->msr[TS] set, since the TM
      structures are still invalid, thus avoiding doing TM operations for
      in-kernel exceptions and possible process reschedule.
      
      With this patch, the MSR[TS] will only be set just before recheckpointing
      and setting TEXASR[FS] = 1, thus avoiding an interrupt with TM registers in
      invalid state.
      
      Other than that, if CONFIG_PREEMPT is set, there might be a preemption just
      after setting MSR[TS] and before tm_recheckpoint(), thus, this block must
      be atomic from a preemption perspective, thus, calling
      preempt_disable/enable() on this code.
      
      It is not possible to move tm_recheckpoint to happen earlier, because it is
      required to get the checkpointed registers from userspace, with
      __get_user(), thus, the only way to avoid this undesired behavior is
      delaying the MSR[TS] set.
      
      The 32-bits signal handler seems to be safe this current issue, but, it
      might be exposed to the preemption issue, thus, disabling preemption in
      this chunk of code.
      
      Changes from v2:
       * Run the critical section with preempt_disable.
      
      Fixes: 87b4e539 ("powerpc/tm: Fix return of active 64bit signals")
      Cc: stable@vger.kernel.org (v3.9+)
      Signed-off-by: NBreno Leitao <leitao@debian.org>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a854ab8f
    • G
      Revert "powerpc/tm: Unset MSR[TS] if not recheckpointing" · 6d9e96f3
      Greg Kroah-Hartman 提交于
      This reverts commit a9935a12 which is
      commit 6f5b9f018f4c7686fd944d920209d1382d320e4e upstream.
      
      It breaks the powerpc build, so drop it from the tree until a fix goes
      upstream.
      Reported-by: NGuenter Roeck <linux@roeck-us.net>
      Cc: Breno Leitao <leitao@debian.org>
      Cc: Michal Suchánek <msuchanek@suse.de>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Christoph Biedl <linux-kernel.bfrz@manchmal.in-ulm.de>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      6d9e96f3
    • A
      arm64: relocatable: fix inconsistencies in linker script and options · ae5c75e6
      Ard Biesheuvel 提交于
      commit 3bbd3db86470c701091fb1d67f1fab6621debf50 upstream.
      
      readelf complains about the section layout of vmlinux when building
      with CONFIG_RELOCATABLE=y (for KASLR):
      
        readelf: Warning: [21]: Link field (0) should index a symtab section.
        readelf: Warning: [21]: Info field (0) should index a relocatable section.
      
      Also, it seems that our use of '-pie -shared' is contradictory, and
      thus ambiguous. In general, the way KASLR is wired up at the moment
      is highly tailored to how ld.bfd happens to implement (and conflate)
      PIE executables and shared libraries, so given the current effort to
      support other toolchains, let's fix some of these issues as well.
      
      - Drop the -pie linker argument and just leave -shared. In ld.bfd,
        the differences between them are unclear (except for the ELF type
        of the produced image [0]) but lld chokes on seeing both at the
        same time.
      
      - Rename the .rela output section to .rela.dyn, as is customary for
        shared libraries and PIE executables, so that it is not misidentified
        by readelf as a static relocation section (producing the warnings
        above).
      
      - Pass the -z notext and -z norelro options to explicitly instruct the
        linker to permit text relocations, and to omit the RELRO program
        header (which requires a certain section layout that we don't adhere
        to in the kernel). These are the defaults for current versions of
        ld.bfd.
      
      - Discard .eh_frame and .gnu.hash sections to avoid them from being
        emitted between .head.text and .text, screwing up the section layout.
      
      These changes only affect the ELF image, and produce the same binary
      image.
      
      [0] b9dce7f1 ("arm64: kernel: force ET_DYN ELF type for ...")
      
      Cc: Nick Desaulniers <ndesaulniers@google.com>
      Cc: Peter Smith <peter.smith@linaro.org>
      Tested-by: NNick Desaulniers <ndesaulniers@google.com>
      Signed-off-by: NArd Biesheuvel <ard.biesheuvel@linaro.org>
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ae5c75e6
    • A
      arm64: drop linker script hack to hide __efistub_ symbols · 9873efe7
      Ard Biesheuvel 提交于
      commit dd6846d774693bfa27d7db4dae5ea67dfe373fa1 upstream.
      
      Commit 1212f7a1 ("scripts/kallsyms: filter arm64's __efistub_
      symbols") updated the kallsyms code to filter out symbols with
      the __efistub_ prefix explicitly, so we no longer require the
      hack in our linker script to emit them as absolute symbols.
      
      Cc: Nick Desaulniers <ndesaulniers@google.com>
      Signed-off-by: NArd Biesheuvel <ard.biesheuvel@linaro.org>
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      Signed-off-by: NNick Desaulniers <ndesaulniers@google.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9873efe7
    • J
      powerpc/boot: Set target when cross-compiling for clang · 7dfb22b5
      Joel Stanley 提交于
      commit 813af51f5d30a2da6a2523c08465f9726e51772e upstream.
      
      Clang needs to be told which target it is building for when cross
      compiling.
      
      Link: https://github.com/ClangBuiltLinux/linux/issues/259Signed-off-by: NJoel Stanley <joel@jms.id.au>
      Tested-by: Daniel Axtens <dja@axtens.net> # powerpc 64-bit BE
      Acked-by: NMichael Ellerman <mpe@ellerman.id.au>
      Reviewed-by: NNick Desaulniers <ndesaulniers@google.com>
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      Signed-off-by: NNathan Chancellor <natechancellor@gmail.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7dfb22b5
    • J
      powerpc: Disable -Wbuiltin-requires-header when setjmp is used · 28e1d143
      Joel Stanley 提交于
      commit aea447141c7e7824b81b49acd1bc785506fba46e upstream.
      
      The powerpc kernel uses setjmp which causes a warning when building
      with clang:
      
        In file included from arch/powerpc/xmon/xmon.c:51:
        ./arch/powerpc/include/asm/setjmp.h:15:13: error: declaration of
        built-in function 'setjmp' requires inclusion of the header <setjmp.h>
              [-Werror,-Wbuiltin-requires-header]
        extern long setjmp(long *);
                    ^
        ./arch/powerpc/include/asm/setjmp.h:16:13: error: declaration of
        built-in function 'longjmp' requires inclusion of the header <setjmp.h>
              [-Werror,-Wbuiltin-requires-header]
        extern void longjmp(long *, long);
                    ^
      
      This *is* the header and we're not using the built-in setjump but
      rather the one in arch/powerpc/kernel/misc.S. As the compiler warning
      does not make sense, it for the files where setjmp is used.
      Signed-off-by: NJoel Stanley <joel@jms.id.au>
      Reviewed-by: NNick Desaulniers <ndesaulniers@google.com>
      [mpe: Move subdir-ccflags in xmon/Makefile to not clobber -Werror]
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      Signed-off-by: NNathan Chancellor <natechancellor@gmail.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      28e1d143
    • N
      powerpc: avoid -mno-sched-epilog on GCC 4.9 and newer · ba1fe90b
      Nicholas Piggin 提交于
      commit 6977f95e63b9b3fb4a5973481a800dd9f48a1338 upstream.
      Signed-off-by: NNicholas Piggin <npiggin@gmail.com>
      Reviewed-by: NJoel Stanley <joel@jms.id.au>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      Signed-off-by: NNathan Chancellor <natechancellor@gmail.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ba1fe90b
    • N
      powerpc: consolidate -mno-sched-epilog into FTRACE flags · 24e26062
      Nicholas Piggin 提交于
      commit 2a056f58fd33ccc6a0261b552b0f17e7fa4a12f3 upstream.
      Signed-off-by: NNicholas Piggin <npiggin@gmail.com>
      Reviewed-by: NJoel Stanley <joel@jms.id.au>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      Signed-off-by: NNathan Chancellor <natechancellor@gmail.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      24e26062
    • N
      powerpc: remove old GCC version checks · 5b59eeba
      Nicholas Piggin 提交于
      commit f2910f0e6835339e6ce82cef22fa15718b7e3bfa upstream.
      
      GCC 4.6 is the minimum supported now.
      Signed-off-by: NNicholas Piggin <npiggin@gmail.com>
      Reviewed-by: NJoel Stanley <joel@jms.id.au>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      [nc: Applied to minimize unnecessary conflicts]
      Signed-off-by: NNathan Chancellor <natechancellor@gmail.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      5b59eeba
    • G
      m68k: Fix memblock-related crashes · e46d5bd8
      Geert Uytterhoeven 提交于
      [ Upstream commit bed1369f51901b17108a4bb4f7210aab183bea42 ]
      
      When running the kernel in Fast RAM on Atari:
      
          Ignoring memory chunk at 0x0:0xe00000 before the first chunk
          ...
          Unable to handle kernel NULL pointer dereference at virtual address (ptrval)
          Oops: 00000000
          Modules linked in:
          PC: [<0069dbac>] free_all_bootmem+0x12c/0x186
          SR: 2714  SP: (ptrval)  a2: 005e3314
          d0: 00000000    d1: 0000000a    d2: 00000e00    d3: 00000000
          d4: 005e1fc0    d5: 0000001a    a0: 01000000    a1: 00000000
          Process swapper (pid: 0, task=(ptrval))
          Frame format=7 eff addr=00000736 ssw=0505 faddr=00000736
          wb 1 stat/addr/data: 0000 00000000 00000000
          wb 2 stat/addr/data: 0000 00000000 00000000
          wb 3 stat/addr/data: 0000 00000736 00000000
          push data: 00000000 00000000 00000000 00000000
          Stack from 005e1f84:
                  00000000 0000000a 027d3260 006b5006 00000000 00000000 00000000 00000000
                  0004f062 0003a220 0069e272 005e1ff8 0000054c 00000000 00e00000 00000000
                  00000001 00693cd8 027d3260 0004f062 0003a220 00691be6 00000000 00000000
                  00000000 00000000 00000000 00000000 006b5006 00000000 00690872
          Call Trace: [<0004f062>] printk+0x0/0x18
           [<0003a220>] parse_args+0x0/0x2d4
           [<0069e272>] memblock_virt_alloc_try_nid+0x0/0xa4
           [<00693cd8>] mem_init+0xa/0x5c
           [<0004f062>] printk+0x0/0x18
           [<0003a220>] parse_args+0x0/0x2d4
           [<00691be6>] start_kernel+0x1ca/0x462
           [<00690872>] _sinittext+0x872/0x11f8
          Code: 7a1a eaae 2270 6db0 0061 ef14 2f01 2f03 <96a9> 0736 2203 e589 d681 e78b d6a9 0732 2f03 2f40 0034 4eb9 0069 b8d0 260e 4fef
          Disabling lock debugging due to kernel taint
          Kernel panic - not syncing: Attempted to kill the idle task!
      
      As the kernel must run in the memory chunk with the lowest address,
      ST-RAM is ignored, and removed from the m68k_memory[] array.
      However, it is not removed from memblock, causing a crash later.
      
      More investigation shows that there are 3 places where memory chunks are
      ignored, all after the calls to memblock_add() in m68k_parse_bootinfo(),
      and thus causing crashes:
        1. On classic m68k CPUs with a MMU, paging_init() ignores all memory
           chunks below the first chunk, cfr. above,
        2. On Amigas equipped with a Zorro III bus, config_amiga() ignores all
           Zorro II memory,
        3. If CONFIG_SINGLE_MEMORY_CHUNK=y, m68k_parse_bootinfo() ignores all
           but the first memory chunk.
      
      Fix this by moving the calls to memblock_add() from
      m68k_parse_bootinfo() to paging_init(), after all ignored memory chunks
      have been removed from m68k_memory[].
      Reported-by: NAndreas Schwab <schwab@linux-m68k.org>
      Fixes: 1008a115 ("m68k: switch to MEMBLOCK + NO_BOOTMEM")
      Signed-off-by: NGeert Uytterhoeven <geert@linux-m68k.org>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      e46d5bd8
    • K
      x86/dump_pagetables: Fix LDT remap address marker · 56769ef9
      Kirill A. Shutemov 提交于
      [ Upstream commit 254eb5505ca0ca749d3a491fc6668b6c16647a99 ]
      
      The LDT remap placement has been changed. It's now placed before the direct
      mapping in the kernel virtual address space for both paging modes.
      
      Change address markers order accordingly.
      
      Fixes: d52888aa2753 ("x86/mm: Move LDT remap out of KASLR region on 5-level paging")
      Signed-off-by: NKirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Cc: bp@alien8.de
      Cc: hpa@zytor.com
      Cc: dave.hansen@linux.intel.com
      Cc: luto@kernel.org
      Cc: peterz@infradead.org
      Cc: boris.ostrovsky@oracle.com
      Cc: jgross@suse.com
      Cc: bhe@redhat.com
      Cc: hans.van.kranenburg@mendix.com
      Cc: linux-mm@kvack.org
      Cc: xen-devel@lists.xenproject.org
      Link: https://lkml.kernel.org/r/20181130202328.65359-3-kirill.shutemov@linux.intel.comSigned-off-by: NSasha Levin <sashal@kernel.org>
      56769ef9
    • K
      x86/mm: Fix guard hole handling · 62075c98
      Kirill A. Shutemov 提交于
      [ Upstream commit 16877a5570e0c5f4270d5b17f9bab427bcae9514 ]
      
      There is a guard hole at the beginning of the kernel address space, also
      used by hypervisors. It occupies 16 PGD entries.
      
      This reserved range is not defined explicitely, it is calculated relative
      to other entities: direct mapping and user space ranges.
      
      The calculation got broken by recent changes of the kernel memory layout:
      LDT remap range is now mapped before direct mapping and makes the
      calculation invalid.
      
      The breakage leads to crash on Xen dom0 boot[1].
      
      Define the reserved range explicitely. It's part of kernel ABI (hypervisors
      expect it to be stable) and must not depend on changes in the rest of
      kernel memory layout.
      
      [1] https://lists.xenproject.org/archives/html/xen-devel/2018-11/msg03313.html
      
      Fixes: d52888aa2753 ("x86/mm: Move LDT remap out of KASLR region on 5-level paging")
      Reported-by: NHans van Kranenburg <hans.van.kranenburg@mendix.com>
      Signed-off-by: NKirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Tested-by: NHans van Kranenburg <hans.van.kranenburg@mendix.com>
      Reviewed-by: NJuergen Gross <jgross@suse.com>
      Cc: bp@alien8.de
      Cc: hpa@zytor.com
      Cc: dave.hansen@linux.intel.com
      Cc: luto@kernel.org
      Cc: peterz@infradead.org
      Cc: boris.ostrovsky@oracle.com
      Cc: bhe@redhat.com
      Cc: linux-mm@kvack.org
      Cc: xen-devel@lists.xenproject.org
      Link: https://lkml.kernel.org/r/20181130202328.65359-2-kirill.shutemov@linux.intel.comSigned-off-by: NSasha Levin <sashal@kernel.org>
      62075c98
    • O
      powerpc/mm: Fallback to RAM if the altmap is unusable · 54568ab2
      Oliver O'Halloran 提交于
      [ Upstream commit 9ef34630a4614ee1cd478f9859ebea55d55f10ec ]
      
      The "altmap" is used to provide a pool of memory that is reserved for
      the vmemmap backing of hot-plugged memory. This is useful when adding
      large amount of ZONE_DEVICE memory to a system with a limited amount of
      normal memory.
      
      On ppc64 we use huge pages to map the vmemmap which requires the backing
      storage to be contigious and aligned to the hugepage size. The altmap
      implementation allows for the altmap provider to reserve a few PFNs at
      the start of the range for it's own uses and when this occurs the
      first chunk of the altmap is not usable for hugepage mappings. On hash
      there is no sane way to fall back to a normal sized page mapping so we
      fail the allocation. This results in memory hotplug failing with
      ENOMEM when the new range doesn't fall into an existing vmemmap block.
      
      This patch handles this case by falling back to using system memory
      rather than failing if we cannot allocate from the altmap. This
      fallback should only ever be used for the first vmemmap block so it
      should not cause excess memory consumption.
      
      Fixes: 7b73d978 ("mm: pass the vmem_altmap to vmemmap_populate")
      Signed-off-by: NOliver O'Halloran <oohall@gmail.com>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      54568ab2
    • F
      ARM: dts: imx7d-nitrogen7: Fix the description of the Wifi clock · aad142a6
      Fabio Estevam 提交于
      [ Upstream commit f15096f12a4e9340168df5fdd9201aa8ed60d59e ]
      
      According to bindings/regulator/fixed-regulator.txt the 'clocks' and
      'clock-names' properties are not valid ones.
      
      In order to turn on the Wifi clock the correct location for describing
      the CLKO2 clock is via a mmc-pwrseq handle, so do it accordingly.
      
      Fixes: 56354959 ("ARM: dts: imx: add Boundary Devices Nitrogen7 board")
      Signed-off-by: NFabio Estevam <festevam@gmail.com>
      Acked-by: NTroy Kisky <troy.kisky@boundarydevices.com>
      Signed-off-by: NShawn Guo <shawnguo@kernel.org>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      aad142a6
    • A
      ARM: imx: update the cpu power up timing setting on i.mx6sx · eab3109e
      Anson Huang 提交于
      [ Upstream commit 1e434b703248580b7aaaf8a115d93e682f57d29f ]
      
      The sw2iso count should cover ARM LDO ramp-up time,
      the MAX ARM LDO ramp-up time may be up to more than
      100us on some boards, this patch sets sw2iso to 0xf
      (~384us) which is the reset value, and it is much
      more safe to cover different boards, since we have
      observed that some customer boards failed with current
      setting of 0x2.
      
      Fixes: 05136f08 ("ARM: imx: support arm power off in cpuidle for i.mx6sx")
      Signed-off-by: NAnson Huang <Anson.Huang@nxp.com>
      Reviewed-by: NFabio Estevam <festevam@gmail.com>
      Signed-off-by: NShawn Guo <shawnguo@kernel.org>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      eab3109e
    • F
      ARM: dts: imx7d-pico: Describe the Wifi clock · 94541b59
      Fabio Estevam 提交于
      [ Upstream commit c3b9ab5db11d8098ca7674175f12ab21cdce1bbb ]
      
      The Wifi chip should be clocked by a 32kHz clock coming from i.MX7D
      CLKO2 output pin, so describe the pinmux and clock hierarchy in the
      device tree to allow the Wifi chip to be properly clocked.
      
      Managed to successfully test Wifi with such change. Used the standard
      nvram.txt file provided by TechNexion, which selects an external 32kHz
      clock for the Wifi chip by default.
      
      Fixes: 99a52450 ("ARM: dts: imx7d-pico: Add Wifi support")
      Suggested-by: NArend van Spriel <arend.vanspriel@broadcom.com>
      Tested-by: NOtavio Salvador <otavio@ossystems.com.br>
      Signed-off-by: NFabio Estevam <festevam@gmail.com>
      Signed-off-by: NShawn Guo <shawnguo@kernel.org>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      94541b59
    • M
      powerpc/mm: Fix linux page tables build with some configs · d4fdc5e8
      Michael Ellerman 提交于
      [ Upstream commit 462951cd32e1496dc64b00051dfb777efc8ae5d8 ]
      
      For some configs the build fails with:
      
        arch/powerpc/mm/dump_linuxpagetables.c: In function 'populate_markers':
        arch/powerpc/mm/dump_linuxpagetables.c:306:39: error: 'PKMAP_BASE' undeclared (first use in this function)
        arch/powerpc/mm/dump_linuxpagetables.c:314:50: error: 'LAST_PKMAP' undeclared (first use in this function)
      
      These come from highmem.h, including that fixes the build.
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      d4fdc5e8
    • P
      powerpc: Fix COFF zImage booting on old powermacs · 4642a5c5
      Paul Mackerras 提交于
      [ Upstream commit 5564597d51c8ff5b88d95c76255e18b13b760879 ]
      
      Commit 6975a783 ("powerpc/boot: Allow building the zImage wrapper
      as a relocatable ET_DYN", 2011-04-12) changed the procedure descriptor
      at the start of crt0.S to have a hard-coded start address of 0x500000
      rather than a reference to _zimage_start, presumably because having
      a reference to a symbol introduced a relocation which is awkward to
      handle in a position-independent executable.  Unfortunately, what is
      at 0x500000 in the COFF image is not the first instruction, but the
      procedure descriptor itself, that is, a word containing 0x500000,
      which is not a valid instruction.  Hence, booting a COFF zImage
      results in a "DEFAULT CATCH!, code=FFF00700" message from Open
      Firmware.
      
      This fixes the problem by (a) putting the procedure descriptor in the
      data section and (b) adding a branch to _zimage_start as the first
      instruction in the program.
      
      Fixes: 6975a783 ("powerpc/boot: Allow building the zImage wrapper as a relocatable ET_DYN")
      Signed-off-by: NPaul Mackerras <paulus@ozlabs.org>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      4642a5c5
    • R
      arm64: dts: mt7622: fix no more console output on rfb1 · a294de73
      Ryder Lee 提交于
      [ Upstream commit 6c05946e349d92f527d98644fbc9c41f06312c00 ]
      
      No default serial console on boot.
      Fix this by using a 'stdout-path' property that points to the device.
      
      Fixes: c0d9f9ad ("arm64: dts: mt7622: add earlycon to mt7622-rfb1 board")
      Signed-off-by: NRyder Lee <ryder.lee@mediatek.com>
      Tested-by: NKevin Hilman <khilman@baylibre.com>
      [mb: Fix commit message]
      Signed-off-by: NMatthias Brugger <matthias.bgg@gmail.com>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      a294de73
    • C
      ARM: dts: sun8i: a83t: bananapi-m3: increase vcc-pd voltage to 3.3V · 0dc2ffac
      Corentin Labbe 提交于
      [ Upstream commit 5f8208f557065163f9a8089ea2ea7888f9d96922 ]
      
      Since commit d7c5f686 ("ARM: dts: sun8i: a83t: bananapi-m3: Add
      AXP813 regulator nodes") my BPIM3 no longer works at gigabit speed.
      
      With the default setting, dldo3 is regulated at 2.9v which seems
      sufficient for the PHY but the aforementioned commit drops it to 2.5V
      which is insufficient. Note that this behaviour is random for all BPIM3.
      Some work with 2.5V, but some don't.
      
      Finnaly, someone from Bananapi confirmed that this regulator must be set
      to 3.3V.
      
      Fixes: d7c5f686 ("ARM: dts: sun8i: a83t: bananapi-m3: Add AXP813
      		      regulator nodes")
      Signed-off-by: NCorentin Labbe <clabbe@baylibre.com>
      [wens@csie.org: Reworked commit message]
      Signed-off-by: NChen-Yu Tsai <wens@csie.org>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      0dc2ffac
  4. 10 1月, 2019 15 次提交
    • P
      MIPS: Only include mmzone.h when CONFIG_NEED_MULTIPLE_NODES=y · a4a929aa
      Paul Burton 提交于
      commit 66a4059ba72c23ae74a7c702894ff76c4b7eac1f upstream.
      
      MIPS' asm/mmzone.h includes the machine/platform mmzone.h
      unconditionally, but since commit bb53fdf395ee ("MIPS: c-r4k: Add
      r4k_blast_scache_node for Loongson-3") is included by asm/rk4cache.h for
      all r4k-style configs regardless of CONFIG_NEED_MULTIPLE_NODES.
      
      This is problematic when CONFIG_NEED_MULTIPLE_NODES=n because both the
      loongson3 & ip27 mmzone.h headers unconditionally define the NODE_DATA
      preprocessor macro which is aready defined by linux/mmzone.h, resulting
      in the following build error:
      
        In file included from ./arch/mips/include/asm/mmzone.h:10,
                         from ./arch/mips/include/asm/r4kcache.h:23,
                         from arch/mips/mm/c-r4k.c:33:
        ./arch/mips/include/asm/mach-loongson64/mmzone.h:48: error: "NODE_DATA" redefined [-Werror]
         #define NODE_DATA(n)  (&__node_data[(n)]->pglist)
      
        In file included from ./include/linux/topology.h:32,
                         from ./include/linux/irq.h:19,
                         from ./include/asm-generic/hardirq.h:13,
                         from ./arch/mips/include/asm/hardirq.h:16,
                         from ./include/linux/hardirq.h:9,
                         from arch/mips/mm/c-r4k.c:11:
        ./include/linux/mmzone.h:907: note: this is the location of the previous definition
         #define NODE_DATA(nid)  (&contig_page_data)
      
      Resolve this by only including the machine mmzone.h when
      CONFIG_NEED_MULTIPLE_NODES=y, which also removes the need for the empty
      mach-generic version of the header which we delete.
      Signed-off-by: NPaul Burton <paul.burton@mips.com>
      Fixes: bb53fdf395ee ("MIPS: c-r4k: Add r4k_blast_scache_node for Loongson-3")
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a4a929aa
    • W
      arm64: compat: Avoid sending SIGILL for unallocated syscall numbers · 920735c6
      Will Deacon 提交于
      commit 169113ece0f29ebe884a6cfcf57c1ace04d8a36a upstream.
      
      The ARM Linux kernel handles the EABI syscall numbers as follows:
      
        0           - NR_SYSCALLS-1	: Invoke syscall via syscall table
        NR_SYSCALLS - 0xeffff		: -ENOSYS (to be allocated in future)
        0xf0000     - 0xf07ff		: Private syscall or -ENOSYS if not allocated
        > 0xf07ff			: SIGILL
      
      Our compat code gets this wrong and ends up sending SIGILL in response
      to all syscalls greater than NR_SYSCALLS which have a value greater
      than 0x7ff in the bottom 16 bits.
      
      Fix this by defining the end of the ARM private syscall region and
      checking the syscall number against that directly. Update the comment
      while we're at it.
      
      Cc: <stable@vger.kernel.org>
      Cc: Dave Martin <Dave.Martin@arm.com>
      Reported-by: NPi-Hsun Shih <pihsun@chromium.org>
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      920735c6
    • S
      ARM: dts: exynos: Specify I2S assigned clocks in proper node · badd5690
      Sylwester Nawrocki 提交于
      commit 8ac686d7dfed721102860ff2571e6b9f529ae81a upstream.
      
      The assigned parent clocks should be normally specified in the consumer
      device's DT node, this ensures respective driver always sees correct clock
      settings when required.
      
      This patch fixes regression in audio subsystem on Odroid XU3/XU4 boards
      that appeared after commits:
      
      commit 647d04f8 ("ASoC: samsung: i2s: Ensure the RCLK rate is properly determined")
      commit 995e73e5 ("ASoC: samsung: i2s: Fix rclk_srcrate handling")
      commit 48279c53 ("ASoC: samsung: i2s: Prevent external abort on exynos5433 I2S1 access")
      
      Without this patch the driver gets wrong clock as the I2S function clock
      (op_clk) in probe() and effectively the clock which is finally assigned
      from DT is not being enabled/disabled in the runtime resume/suspend ops.
      
      Without the above listed commits the EXYNOS_I2S_BUS clock was always set
      as parent of CLK_I2S_RCLK_SRC regardless of DT settings so there was no issue
      with not enabled EXYNOS_SCLK_I2S.
      
      Cc: <stable@vger.kernel.org> # 4.17.x
      Signed-off-by: NSylwester Nawrocki <s.nawrocki@samsung.com>
      Signed-off-by: NKrzysztof Kozlowski <krzk@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      badd5690
    • W
      arm64: KVM: Avoid setting the upper 32 bits of VTCR_EL2 to 1 · 7ec9ea67
      Will Deacon 提交于
      commit df655b75c43fba0f2621680ab261083297fd6d16 upstream.
      
      Although bit 31 of VTCR_EL2 is RES1, we inadvertently end up setting all
      of the upper 32 bits to 1 as well because we define VTCR_EL2_RES1 as
      signed, which is sign-extended when assigning to kvm->arch.vtcr.
      
      Lucky for us, the architecture currently treats these upper bits as RES0
      so, whilst we've been naughty, we haven't set fire to anything yet.
      
      Cc: <stable@vger.kernel.org>
      Cc: Marc Zyngier <marc.zyngier@arm.com>
      Cc: Christoffer Dall <christoffer.dall@arm.com>
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      Signed-off-by: NMarc Zyngier <marc.zyngier@arm.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7ec9ea67
    • H
      MIPS: Fix a R10000_LLSC_WAR logic in atomic.h · db825a79
      Huacai Chen 提交于
      commit db1ce3f5d01d2d6d5714aefba0159d2cb5167a0b upstream.
      
      Commit 4936084c ("MIPS: Cleanup R10000_LLSC_WAR logic in atomic.h")
      introduce a mistake in atomic64_fetch_##op##_relaxed(), because it
      forget to delete R10000_LLSC_WAR in the if-condition. So fix it.
      
      Fixes: 4936084c ("MIPS: Cleanup R10000_LLSC_WAR logic in atomic.h")
      Signed-off-by: NHuacai Chen <chenhc@lemote.com>
      Signed-off-by: NPaul Burton <paul.burton@mips.com>
      Cc: Joshua Kinard <kumba@gentoo.org>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: Steven J . Hill <Steven.Hill@cavium.com>
      Cc: Fuxin Zhang <zhangfx@lemote.com>
      Cc: Zhangjin Wu <wuzhangjin@gmail.com>
      Cc: linux-mips@linux-mips.org
      Cc: stable@vger.kernel.org # 4.19+
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      db825a79
    • A
      MIPS: OCTEON: mark RGMII interface disabled on OCTEON III · 34c512d8
      Aaro Koskinen 提交于
      commit edefae94b7b9f10d5efe32dece5a36e9d9ecc29e upstream.
      
      Commit 885872b7 ("MIPS: Octeon: Add Octeon III CN7xxx
      interface detection") added RGMII interface detection for OCTEON III,
      but it results in the following logs:
      
      [    7.165984] ERROR: Unsupported Octeon model in __cvmx_helper_rgmii_probe
      [    7.173017] ERROR: Unsupported Octeon model in __cvmx_helper_rgmii_probe
      
      The current RGMII routines are valid only for older OCTEONS that
      use GMX/ASX hardware blocks. On later chips AGL should be used,
      but support for that is missing in the mainline. Until that is added,
      mark the interface as disabled.
      
      Fixes: 885872b7 ("MIPS: Octeon: Add Octeon III CN7xxx interface detection")
      Signed-off-by: NAaro Koskinen <aaro.koskinen@iki.fi>
      Signed-off-by: NPaul Burton <paul.burton@mips.com>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: James Hogan <jhogan@kernel.org>
      Cc: linux-mips@vger.kernel.org
      Cc: stable@vger.kernel.org # 4.7+
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      34c512d8
    • P
      MIPS: Expand MIPS32 ASIDs to 64 bits · fb38b12e
      Paul Burton 提交于
      commit ff4dd232ec45a0e45ea69f28f069f2ab22b4908a upstream.
      
      ASIDs have always been stored as unsigned longs, ie. 32 bits on MIPS32
      kernels. This is problematic because it is feasible for the ASID version
      to overflow & wrap around to zero.
      
      We currently attempt to handle this overflow by simply setting the ASID
      version to 1, using asid_first_version(), but we make no attempt to
      account for the fact that there may be mm_structs with stale ASIDs that
      have versions which we now reuse due to the overflow & wrap around.
      
      Encountering this requires that:
      
        1) A struct mm_struct X is active on CPU A using ASID (V,n).
      
        2) That mm is not used on CPU A for the length of time that it takes
           for CPU A's asid_cache to overflow & wrap around to the same
           version V that the mm had in step 1. During this time tasks using
           the mm could either be sleeping or only scheduled on other CPUs.
      
        3) Some other mm Y becomes active on CPU A and is allocated the same
           ASID (V,n).
      
        4) mm X now becomes active on CPU A again, and now incorrectly has the
           same ASID as mm Y.
      
      Where struct mm_struct ASIDs are represented above in the format
      (version, EntryHi.ASID), and on a typical MIPS32 system version will be
      24 bits wide & EntryHi.ASID will be 8 bits wide.
      
      The length of time required in step 2 is highly dependent upon the CPU &
      workload, but for a hypothetical 2GHz CPU running a workload which
      generates a new ASID every 10000 cycles this period is around 248 days.
      Due to this long period of time & the fact that tasks need to be
      scheduled in just the right (or wrong, depending upon your inclination)
      way, this is obviously a difficult bug to encounter but it's entirely
      possible as evidenced by reports.
      
      In order to fix this, simply extend ASIDs to 64 bits even on MIPS32
      builds. This will extend the period of time required for the
      hypothetical system above to encounter the problem from 28 days to
      around 3 trillion years, which feels safely outside of the realms of
      possibility.
      
      The cost of this is slightly more generated code in some commonly
      executed paths, but this is pretty minimal:
      
                               | Code Size Gain | Percentage
        -----------------------|----------------|-------------
          decstation_defconfig |           +270 | +0.00%
              32r2el_defconfig |           +652 | +0.01%
              32r6el_defconfig |          +1000 | +0.01%
      
      I have been unable to measure any change in performance of the LMbench
      lat_ctx or lat_proc tests resulting from the 64b ASIDs on either
      32r2el_defconfig+interAptiv or 32r6el_defconfig+I6500 systems.
      Signed-off-by: NPaul Burton <paul.burton@mips.com>
      Suggested-by: NJames Hogan <jhogan@kernel.org>
      References: https://lore.kernel.org/linux-mips/80B78A8B8FEE6145A87579E8435D78C30205D5F3@fzex.ruijie.com.cn/
      References: https://lore.kernel.org/linux-mips/1488684260-18867-1-git-send-email-jiwei.sun@windriver.com/
      Cc: Jiwei Sun <jiwei.sun@windriver.com>
      Cc: Yu Huabing <yhb@ruijie.com.cn>
      Cc: stable@vger.kernel.org # 2.6.12+
      Cc: linux-mips@vger.kernel.org
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      fb38b12e
    • H
      MIPS: Align kernel load address to 64KB · 88c61f5c
      Huacai Chen 提交于
      commit bec0de4cfad21bd284dbddee016ed1767a5d2823 upstream.
      
      KEXEC needs the new kernel's load address to be aligned on a page
      boundary (see sanity_check_segment_list()), but on MIPS the default
      vmlinuz load address is only explicitly aligned to 16 bytes.
      
      Since the largest PAGE_SIZE supported by MIPS kernels is 64KB, increase
      the alignment calculated by calc_vmlinuz_load_addr to 64KB.
      Signed-off-by: NHuacai Chen <chenhc@lemote.com>
      Signed-off-by: NPaul Burton <paul.burton@mips.com>
      Patchwork: https://patchwork.linux-mips.org/patch/21131/
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: James Hogan <james.hogan@mips.com>
      Cc: Steven J . Hill <Steven.Hill@cavium.com>
      Cc: linux-mips@linux-mips.org
      Cc: Fuxin Zhang <zhangfx@lemote.com>
      Cc: Zhangjin Wu <wuzhangjin@gmail.com>
      Cc: <stable@vger.kernel.org> # 2.6.36+
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      88c61f5c
    • H
      MIPS: Ensure pmd_present() returns false after pmd_mknotpresent() · 76a9f7b4
      Huacai Chen 提交于
      commit 92aa0718c9fa5160ad2f0e7b5bffb52f1ea1e51a upstream.
      
      This patch is borrowed from ARM64 to ensure pmd_present() returns false
      after pmd_mknotpresent(). This is needed for THP.
      
      References: 5bb1cc0f ("arm64: Ensure pmd_present() returns false after pmd_mknotpresent()")
      Reviewed-by: NJames Hogan <jhogan@kernel.org>
      Signed-off-by: NHuacai Chen <chenhc@lemote.com>
      Signed-off-by: NPaul Burton <paul.burton@mips.com>
      Patchwork: https://patchwork.linux-mips.org/patch/21135/
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: James Hogan <james.hogan@mips.com>
      Cc: Steven J . Hill <Steven.Hill@cavium.com>
      Cc: linux-mips@linux-mips.org
      Cc: Fuxin Zhang <zhangfx@lemote.com>
      Cc: Zhangjin Wu <wuzhangjin@gmail.com>
      Cc: <stable@vger.kernel.org> # 3.8+
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      76a9f7b4
    • H
      MIPS: c-r4k: Add r4k_blast_scache_node for Loongson-3 · e8ae2ae2
      Huacai Chen 提交于
      commit bb53fdf395eed103f85061bfff3b116cee123895 upstream.
      
      For multi-node Loongson-3 (NUMA configuration), r4k_blast_scache() can
      only flush Node-0's scache. So we add r4k_blast_scache_node() by using
      (CAC_BASE | (node_id << NODE_ADDRSPACE_SHIFT)) instead of CKSEG0 as the
      start address.
      Signed-off-by: NHuacai Chen <chenhc@lemote.com>
      [paul.burton@mips.com: Include asm/mmzone.h from asm/r4kcache.h for
      		       nid_to_addrbase(). Add asm/mach-generic/mmzone.h
      		       to allow inclusion for all platforms.]
      Signed-off-by: NPaul Burton <paul.burton@mips.com>
      Patchwork: https://patchwork.linux-mips.org/patch/21129/
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: James Hogan <james.hogan@mips.com>
      Cc: Steven J . Hill <Steven.Hill@cavium.com>
      Cc: linux-mips@linux-mips.org
      Cc: Fuxin Zhang <zhangfx@lemote.com>
      Cc: Zhangjin Wu <wuzhangjin@gmail.com>
      Cc: <stable@vger.kernel.org> # 3.15+
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e8ae2ae2
    • P
      MIPS: math-emu: Write-protect delay slot emulation pages · 62452b35
      Paul Burton 提交于
      commit adcc81f148d733b7e8e641300c5590a2cdc13bf3 upstream.
      
      Mapping the delay slot emulation page as both writeable & executable
      presents a security risk, in that if an exploit can write to & jump into
      the page then it can be used as an easy way to execute arbitrary code.
      
      Prevent this by mapping the page read-only for userland, and using
      access_process_vm() with the FOLL_FORCE flag to write to it from
      mips_dsemul().
      
      This will likely be less efficient due to copy_to_user_page() performing
      cache maintenance on a whole page, rather than a single line as in the
      previous use of flush_cache_sigtramp(). However this delay slot
      emulation code ought not to be running in any performance critical paths
      anyway so this isn't really a problem, and we can probably do better in
      copy_to_user_page() anyway in future.
      
      A major advantage of this approach is that the fix is small & simple to
      backport to stable kernels.
      Reported-by: NAndy Lutomirski <luto@kernel.org>
      Signed-off-by: NPaul Burton <paul.burton@mips.com>
      Fixes: 432c6bac ("MIPS: Use per-mm page to execute branch delay slot instructions")
      Cc: stable@vger.kernel.org # v4.8+
      Cc: linux-mips@vger.kernel.org
      Cc: linux-kernel@vger.kernel.org
      Cc: Rich Felker <dalias@libc.org>
      Cc: David Daney <david.daney@cavium.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      62452b35
    • B
      powerpc/tm: Unset MSR[TS] if not recheckpointing · a9935a12
      Breno Leitao 提交于
      commit 6f5b9f018f4c7686fd944d920209d1382d320e4e upstream.
      
      There is a TM Bad Thing bug that can be caused when you return from a
      signal context in a suspended transaction but with ucontext MSR[TS] unset.
      
      This forces regs->msr[TS] to be set at syscall entrance (since the CPU
      state is transactional). It also calls treclaim() to flush the transaction
      state, which is done based on the live (mfmsr) MSR state.
      
      Since user context MSR[TS] is not set, then restore_tm_sigcontexts() is not
      called, thus, not executing recheckpoint, keeping the CPU state as not
      transactional. When calling rfid, SRR1 will have MSR[TS] set, but the CPU
      state is non transactional, causing the TM Bad Thing with the following
      stack:
      
      	[   33.862316] Bad kernel stack pointer 3fffd9dce3e0 at c00000000000c47c
      	cpu 0x8: Vector: 700 (Program Check) at [c00000003ff7fd40]
      	    pc: c00000000000c47c: fast_exception_return+0xac/0xb4
      	    lr: 00003fff865f442c
      	    sp: 3fffd9dce3e0
      	   msr: 8000000102a03031
      	  current = 0xc00000041f68b700
      	  paca    = 0xc00000000fb84800   softe: 0        irq_happened: 0x01
      	    pid   = 1721, comm = tm-signal-sigre
      	Linux version 4.9.0-3-powerpc64le (debian-kernel@lists.debian.org) (gcc version 6.3.0 20170516 (Debian 6.3.0-18) ) #1 SMP Debian 4.9.30-2+deb9u2 (2017-06-26)
      	WARNING: exception is not recoverable, can't continue
      
      The same problem happens on 32-bits signal handler, and the fix is very
      similar, if tm_recheckpoint() is not executed, then regs->msr[TS] should be
      zeroed.
      
      This patch also fixes a sparse warning related to lack of indentation when
      CONFIG_PPC_TRANSACTIONAL_MEM is set.
      
      Fixes: 2b0a576d ("powerpc: Add new transactional memory state to the signal context")
      CC: Stable <stable@vger.kernel.org>	# 3.10+
      Signed-off-by: NBreno Leitao <leitao@debian.org>
      Tested-by: NMichal Suchánek <msuchanek@suse.de>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a9935a12
    • A
      clocksource/drivers/arc_timer: Utilize generic sched_clock · bf75d938
      Alexey Brodkin 提交于
      commit bf287607c80f24387fedb431a346dc67f25be12c upstream.
      
      It turned out we used to use default implementation of sched_clock()
      from kernel/sched/clock.c which was as precise as 1/HZ, i.e.
      by default we had 10 msec granularity of time measurement.
      
      Now given ARC built-in timers are clocked with the same frequency as
      CPU cores we may get much higher precision of time tracking.
      
      Thus we switch to generic sched_clock which really reads ARC hardware
      counters.
      
      This is especially helpful for measuring short events.
      That's what we used to have:
      ------------------------------>8------------------------
      $ perf stat /bin/sh -c /root/lmbench-master/bin/arc/hello > /dev/null
      
       Performance counter stats for '/bin/sh -c /root/lmbench-master/bin/arc/hello':
      
               10.000000      task-clock (msec)         #    2.832 CPUs utilized
                       1      context-switches          #    0.100 K/sec
                       1      cpu-migrations            #    0.100 K/sec
                      63      page-faults               #    0.006 M/sec
                 3049480      cycles                    #    0.305 GHz
                 1091259      instructions              #    0.36  insn per cycle
                  256828      branches                  #   25.683 M/sec
                   27026      branch-misses             #   10.52% of all branches
      
             0.003530687 seconds time elapsed
      
             0.000000000 seconds user
             0.010000000 seconds sys
      ------------------------------>8------------------------
      
      And now we'll see:
      ------------------------------>8------------------------
      $ perf stat /bin/sh -c /root/lmbench-master/bin/arc/hello > /dev/null
      
       Performance counter stats for '/bin/sh -c /root/lmbench-master/bin/arc/hello':
      
                3.004322      task-clock (msec)         #    0.865 CPUs utilized
                       1      context-switches          #    0.333 K/sec
                       1      cpu-migrations            #    0.333 K/sec
                      63      page-faults               #    0.021 M/sec
                 2986734      cycles                    #    0.994 GHz
                 1087466      instructions              #    0.36  insn per cycle
                  255209      branches                  #   84.947 M/sec
                   26002      branch-misses             #   10.19% of all branches
      
             0.003474829 seconds time elapsed
      
             0.003519000 seconds user
             0.000000000 seconds sys
      ------------------------------>8------------------------
      
      Note how much more meaningful is the second output - time spent for
      execution pretty much matches number of cycles spent (we're runnign
      @ 1GHz here).
      Signed-off-by: NAlexey Brodkin <abrodkin@synopsys.com>
      Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
      Cc: Vineet Gupta <vgupta@synopsys.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: stable@vger.kernel.org
      Acked-by: NVineet Gupta <vgupta@synopsys.com>
      Signed-off-by: NDaniel Lezcano <daniel.lezcano@linaro.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      bf75d938
    • S
      KVM: nVMX: Free the VMREAD/VMWRITE bitmaps if alloc_kvm_area() fails · c9dae887
      Sean Christopherson 提交于
      commit 1b3ab5ad1b8ad99bae76ec583809c5f5a31c707c upstream.
      
      Fixes: 34a1cd60 ("kvm: x86: vmx: move some vmx setting from vmx_init() to hardware_setup()")
      Cc: stable@vger.kernel.org
      Signed-off-by: NSean Christopherson <sean.j.christopherson@intel.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c9dae887
    • M
      arm64: KVM: Make VHE Stage-2 TLB invalidation operations non-interruptible · 07cbcfc3
      Marc Zyngier 提交于
      commit c987876a80e7bcb98a839f10dca9ce7fda4feced upstream.
      
      Contrary to the non-VHE version of the TLB invalidation helpers, the VHE
      code  has interrupts enabled, meaning that we can take an interrupt in
      the middle of such a sequence, and start running something else with
      HCR_EL2.TGE cleared.
      
      That's really not a good idea.
      
      Take the heavy-handed option and disable interrupts in
      __tlb_switch_to_guest_vhe, restoring them in __tlb_switch_to_host_vhe.
      The latter also gain an ISB in order to make sure that TGE really has
      taken effect.
      
      Cc: stable@vger.kernel.org
      Acked-by: NChristoffer Dall <christoffer.dall@arm.com>
      Reviewed-by: NJames Morse <james.morse@arm.com>
      Signed-off-by: NMarc Zyngier <marc.zyngier@arm.com>
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      07cbcfc3