1. 13 Oct, 2018 38 commits
    • Gautham R. Shenoy's avatar
      powerpc/rtas: Fix a potential race between CPU-Offline & Migration · dfd718a2
      Gautham R. Shenoy authored
      Live Partition Migrations require all the present CPUs to execute the
      H_JOIN call, and hence rtas_ibm_suspend_me() onlines any offline CPUs
      before initiating the migration for this purpose.
      
      The commit 85a88cab
      ("powerpc/pseries: Disable CPU hotplug across migrations")
      disables any CPU-hotplug operations once all the offline CPUs are
      brought online to prevent any further state change. Once the
      CPU-Hotplug operation is disabled, the code assumes that all the CPUs
      are online.
      
      However, there is a minor window in rtas_ibm_suspend_me() between
      onlining the offline CPUs and disabling CPU-Hotplug when a concurrent
      CPU-offline operations initiated by the userspace can succeed thereby
      nullifying the the aformentioned assumption. In this unlikely case
      these offlined CPUs will not call H_JOIN, resulting in a system hang.
      
      Fix this by verifying that all the present CPUs are actually online
      after CPU-Hotplug has been disabled, failing which we restore the
      state of the offline CPUs in rtas_ibm_suspend_me() and return an
      -EBUSY.
      
      Cc: Nathan Fontenot <nfont@linux.vnet.ibm.com>
      Cc: Tyrel Datwyler <tyreld@linux.vnet.ibm.com>
      Suggested-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Signed-off-by: default avatarGautham R. Shenoy <ego@linux.vnet.ibm.com>
      Reviewed-by: default avatarNathan Fontenot <nfont@linux.vnet.ibm.com>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      dfd718a2
    • Gautham R. Shenoy's avatar
      powerpc/cacheinfo: Report the correct shared_cpu_map on big-cores · 500fe5f5
      Gautham R. Shenoy authored
      Currently on POWER9 SMT8 cores systems, in sysfs, we report the
      shared_cache_map for L1 caches (both data and instruction) to be the
      cpu-ids of the threads in SMT8 cores. This is incorrect since on
      POWER9 SMT8 cores there are two groups of threads, each of which
      shares its own L1 cache.
      
      This patch addresses this by reporting the shared_cpu_map correctly in
      sysfs for L1 caches.
      
      Before the patch
         /sys/devices/system/cpu/cpu0/cache/index0/shared_cpu_map : 000000ff
         /sys/devices/system/cpu/cpu0/cache/index1/shared_cpu_map : 000000ff
         /sys/devices/system/cpu/cpu1/cache/index0/shared_cpu_map : 000000ff
         /sys/devices/system/cpu/cpu1/cache/index1/shared_cpu_map : 000000ff
      
      After the patch
         /sys/devices/system/cpu/cpu0/cache/index0/shared_cpu_map : 00000055
         /sys/devices/system/cpu/cpu0/cache/index1/shared_cpu_map : 00000055
         /sys/devices/system/cpu/cpu1/cache/index0/shared_cpu_map : 000000aa
         /sys/devices/system/cpu/cpu1/cache/index1/shared_cpu_map : 000000aa
      Signed-off-by: default avatarGautham R. Shenoy <ego@linux.vnet.ibm.com>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      500fe5f5
    • Gautham R. Shenoy's avatar
      powerpc: Use cpu_smallcore_sibling_mask at SMT level on bigcores · 8e8a31d7
      Gautham R. Shenoy authored
      POWER9 SMT8 cores consist of two groups of threads, where threads in
      each group shares L1-cache. The scheduler is not aware of this
      distinction as the current sched-domain hierarchy has all the threads
      of the core defined at the SMT domain.
      
      	SMT  [Thread siblings of the SMT8 core]
      	DIE  [CPUs in the same die]
      	NUMA [All the CPUs in the system]
      
      Due to this, we can observe run-to-run variance when we run a
      multi-threaded benchmark bound to a single core based on how the
      scheduler spreads the software threads across the two groups in the
      core.
      
      We fix this in this patch by defining each group of threads which
      share L1-cache to be the SMT level. The group of threads in the SMT8
      core is defined to be the CACHE level. The sched-domain hierarchy
      after this patch will be :
      
      	SMT	[Thread siblings in the core that share L1 cache]
      	CACHE 	[Thread siblings that are in the SMT8 core]
      	DIE  	[CPUs in the same die]
      	NUMA 	[All the CPUs in the system]
      Signed-off-by: default avatarGautham R. Shenoy <ego@linux.vnet.ibm.com>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      8e8a31d7
    • Gautham R. Shenoy's avatar
      powerpc: Detect the presence of big-cores via "ibm, thread-groups" · 425752c6
      Gautham R. Shenoy authored
      On IBM POWER9, the device tree exposes a property array identifed by
      "ibm,thread-groups" which will indicate which groups of threads share
      a particular set of resources.
      
      As of today we only have one form of grouping identifying the group of
      threads in the core that share the L1 cache, translation cache and
      instruction data flow.
      
      This patch adds helper functions to parse the contents of
      "ibm,thread-groups" and populate a per-cpu variable to cache
      information about siblings of each CPU that share the L1, traslation
      cache and instruction data-flow.
      
      It also defines a new global variable named "has_big_cores" which
      indicates if the cores on this configuration have multiple groups of
      threads that share L1 cache.
      
      For each online CPU, it maintains a cpu_smallcore_mask, which
      indicates the online siblings which share the L1-cache with it.
      Signed-off-by: default avatarGautham R. Shenoy <ego@linux.vnet.ibm.com>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      425752c6
    • Michael Ellerman's avatar
      powerpc: Fix stackprotector detection for non-glibc toolchains · bf6cbd0c
      Michael Ellerman authored
      If GCC is not built with glibc support then we must explicitly tell it
      which register to use for TLS mode stack protector, otherwise it will
      error out and the cc-option check will fail.
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      bf6cbd0c
    • Michael Ellerman's avatar
      powerpc/xmon: Show the stack protector canary in xmon · 50530f5e
      Michael Ellerman authored
      This is helpful for debugging stack protector crashes.
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      50530f5e
    • Joel Stanley's avatar
      powerpc: Use SWITCH_FRAME_SIZE for prom and rtas entry · ed9e84a4
      Joel Stanley authored
      Commit 6c171994 ("powerpc/of: Remove useless register save/restore
      when calling OF back") removed the saving of srr0 and srr1 when calling
      into OpenFirmware. Commit e31aa453 ("powerpc: Use LOAD_REG_IMMEDIATE
      only for constants on 64-bit") did the same for rtas.
      
      This means we don't need to save the extra stack space and can use
      the common SWITCH_FRAME_SIZE.
      
      There were already no users of _SRR0 and _SRR1 so we can remove them
      too.
      
      Link: https://github.com/linuxppc/linux/issues/83Signed-off-by: default avatarJoel Stanley <joel@jms.id.au>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      ed9e84a4
    • Michael Bringmann's avatar
      powerpc/pseries/mobility: Extend start/stop topology update scope · 65b9fdad
      Michael Bringmann authored
      The powerpc mobility code may receive RTAS requests to perform PRRN
      (Platform Resource Reassignment Notification) topology changes at any
      time, including during LPAR migration operations.
      
      In some configurations where the affinity of CPUs or memory is being
      changed on that platform, the PRRN requests may apply or refer to
      outdated information prior to the complete update of the device-tree.
      
      This patch changes the duration for which topology updates are
      suppressed during LPAR migrations from just the rtas_ibm_suspend_me()
      / 'ibm,suspend-me' call(s) to cover the entire migration_store()
      operation to allow all changes to the device-tree to be applied prior
      to accepting and applying any PRRN requests.
      
      For tracking purposes, pr_info notices are added to the functions
      start_topology_update() and stop_topology_update() of 'numa.c'.
      Signed-off-by: default avatarMichael Bringmann <mwb@linux.vnet.ibm.com>
      Reviewed-by: default avatarNathan Fontenot <nfont@linux.vnet.ibm.com>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      65b9fdad
    • Joel Stanley's avatar
      powerpc/Makefile: Fix PPC_BOOK3S_64 ASFLAGS · 960e3002
      Joel Stanley authored
      Ever since commit 15a3204d ("powerpc/64s: Set assembler machine type
      to POWER4") we force -mpower4 to be passed to the assembler
      irrespective of the CFLAGS used (for Book3s 64).
      
      When building a powerpc64 kernel with clang, clang will not add -many
      to the assembler flags, so any instructions that the compiler has
      generated that are not available on power4 will cause an error:
      
        /usr/bin/as -a64 -mppc64 -mlittle-endian -mpower8 \
         -I ./arch/powerpc/include -I ./arch/powerpc/include/generated \
         -I ./include -I ./arch/powerpc/include/uapi \
         -I ./arch/powerpc/include/generated/uapi -I ./include/uapi \
         -I ./include/generated/uapi -I arch/powerpc -I arch/powerpc \
         -maltivec -mpower4 -o init/do_mounts.o /tmp/do_mounts-3b0a3d.s
        /tmp/do_mounts-51ce54.s:748: Error: unrecognized opcode: `isel'
      
      GCC does include -many, so the GCC driven gas call will succeed:
      
        as -v -I ./arch/powerpc/include -I ./arch/powerpc/include/generated -I
        ./include -I ./arch/powerpc/include/uapi
        -I ./arch/powerpc/include/generated/uapi -I ./include/uapi
        -I ./include/generated/uapi -I arch/powerpc -I arch/powerpc
         -a64 -mpower8 -many -mlittle -maltivec -mpower4 -o init/do_mounts.o
      
      Note that isel is power7 and above for IBM CPUs. GCC only generates it
      for Power9 and above, but the above test was run against the clang
      generated assembly.
      
      Peter Bergner explains:
      
        When using -many -mpower4, gas will first try and find a matching
        power4 mnemonic and failing that, it will then allow any valid
        mnemonic that gas knows about. GCC's use of -many predates me
        though.
      
        IIRC, Alan looked at trying to remove it, but I forget why he
        didn't. Could be either a gcc or gas issue at the time. I'm not sure
        whether issue still exists or not. He and I have modified how gas
        works internally a fair amount since he tried removing gcc use of
        -many.
      
        I will also note that when using -many, gas will choose the first
        mnemonic that matches in the mnemonic table and we have (mostly)
        sorted the table so that server mnemonics show up earlier in the
        table than other mnemonics, so they'll be seen/chosen first.
      
      By explicitly setting -many we can build with Clang and GCC while
      retaining the -mpower4 option.
      Signed-off-by: default avatarJoel Stanley <joel@jms.id.au>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      960e3002
    • YueHaibing's avatar
      powerpc/pseries/memory-hotplug: Fix return value type of find_aa_index · b45e9d76
      YueHaibing authored
      The variable 'aa_index' is defined as an unsigned value in
      update_lmb_associativity_index(), but find_aa_index() may return -1
      when dlpar_clone_property() fails. So change find_aa_index() to return
      a bool, which indicates whether 'aa_index' was found or not.
      
      Fixes: c05a5a40 ("powerpc/pseries: Dynamic add entires to associativity lookup array")
      Signed-off-by: default avatarYueHaibing <yuehaibing@huawei.com>
      Reviewed-by: Nathan Fontenot nfont@linux.vnet.ibm.com>
      [mpe: Tweak changelog, rename is_found to just found]
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      b45e9d76
    • Sam Bobroff's avatar
      powerpc/eeh: Cleanup control flow in eeh_handle_normal_event() · b90484ec
      Sam Bobroff authored
      Rather than mixing "if (state)" blocks and gotos, convert entirely to
      "if (state)" blocks to make the state machine behaviour clearer.
      Signed-off-by: default avatarSam Bobroff <sbobroff@linux.ibm.com>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      b90484ec
    • Sam Bobroff's avatar
      powerpc/eeh: Cleanup eeh_ops.wait_state() · fef7f905
      Sam Bobroff authored
      The wait_state member of eeh_ops does not need to be platform
      dependent; it's just logic around eeh_ops.get_state(). Therefore,
      merge the two (slightly different!) platform versions into a new
      function, eeh_wait_state() and remove the eeh_ops member.
      
      While doing this, also correct:
      * The wait logic, so that it never waits longer than max_wait.
      * The wait logic, so that it never waits less than
        EEH_STATE_MIN_WAIT_TIME.
      * One call site where the result is treated like a bit field before
        it's checked for negative error values.
      * In pseries_eeh_get_state(), rename the "state" parameter to "delay"
        because that's what it is.
      Signed-off-by: default avatarSam Bobroff <sbobroff@linux.ibm.com>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      fef7f905
    • Sam Bobroff's avatar
      powerpc/eeh: Cleanup eeh_pe_state_mark() · e762bb89
      Sam Bobroff authored
      Currently, eeh_pe_state_mark() marks a PE (and it's children) with a
      state and then performs additional processing if that state included
      EEH_PE_ISOLATED.
      
      The state parameter is always a constant at the call site, so
      rearrange eeh_pe_state_mark() into two functions and just call the
      appropriate one at each site.
      Signed-off-by: default avatarSam Bobroff <sbobroff@linux.ibm.com>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      e762bb89
    • Sam Bobroff's avatar
      powerpc/eeh: Cleanup unnecessary eeh_pe_state_mark_with_cfg() · eed4bdbe
      Sam Bobroff authored
      The function eeh_pe_state_mark_with_cfg() just performs the work of
      eeh_pe_state_mark() and then, conditionally, the work of
      eeh_pe_state_clear(). However it is only ever called with a constant
      state such that the condition is always true, so replace it by direct
      calls.
      Signed-off-by: default avatarSam Bobroff <sbobroff@linux.ibm.com>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      eed4bdbe
    • Sam Bobroff's avatar
      powerpc/eeh: Cleanup eeh_enabled() · 54644927
      Sam Bobroff authored
      Signed-off-by: default avatarSam Bobroff <sbobroff@linux.ibm.com>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      54644927
    • Sam Bobroff's avatar
      powerpc/eeh: Cleanup logic in eeh_rmv_from_parent_pe() · 9a3eda26
      Sam Bobroff authored
      Move the call to eeh_dev_to_pe() up, so that later it's clear that
      "pe" isn't NULL.
      Signed-off-by: default avatarSam Bobroff <sbobroff@linux.ibm.com>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      9a3eda26
    • Sam Bobroff's avatar
      powerpc/eeh: Cleanup field names in eeh_rmv_data · 1c5c533b
      Sam Bobroff authored
      Change the name of the fields in eeh_rmv_data to clarify their usage.
      
      Change "edev_list" to "removed_vf_list" because it does not contain
      generic edevs, but rather only edevs that contain virtual functions
      (which need to be removed during recovery).
      
      Similarly, change "removed" to "removed_dev_count" because it is a
      count of any removed devices, not just those in the above list.
      Signed-off-by: default avatarSam Bobroff <sbobroff@linux.ibm.com>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      1c5c533b
    • Sam Bobroff's avatar
      powerpc/eeh: Cleanup list_head field names · 80e65b00
      Sam Bobroff authored
      Instances of struct eeh_pe are placed in a tree structure using the
      fields "child_list" and "child", so place these next to each other
      in the definition.
      
      The field "child" is a list entry, so remove the unnecessary and
      misleading use of the list initializer, LIST_HEAD(), on it.
      
      The eeh_dev struct contains two list entry fields, called "list" and
      "rmv_list". Rename them to "entry" and "rmv_entry" and, as above, stop
      initializing them with LIST_HEAD().
      Signed-off-by: default avatarSam Bobroff <sbobroff@linux.ibm.com>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      80e65b00
    • Sam Bobroff's avatar
      powerpc/eeh: Cleanup eeh_add_virt_device() · bf773df9
      Sam Bobroff authored
      Remove the unnecessary cast through void * on the first parameter and
      remove the unused second parameter (always NULL).
      Signed-off-by: default avatarSam Bobroff <sbobroff@linux.ibm.com>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      bf773df9
    • Sam Bobroff's avatar
      powerpc/eeh: Cleanup unused field in eeh_dev · b95a4606
      Sam Bobroff authored
      The 'bus' member of struct eeh_dev is assigned to once but never used,
      so remove it.
      Signed-off-by: default avatarSam Bobroff <sbobroff@linux.ibm.com>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      b95a4606
    • Sam Bobroff's avatar
      powerpc/eeh: Cleanup EEH_POSTPONED_PROBE · bffc0176
      Sam Bobroff authored
      Currently a flag, EEH_POSTPONED_PROBE, is used to prevent an incorrect
      message "EEH: No capable adapters found" from being displayed during
      the boot of powernv systems.
      
      It is necessary because, on powernv, the call to eeh_probe_devices()
      made from eeh_init() is too early and EEH can't yet be enabled. A
      second call is made later from eeh_pnv_post_init(), which succeeds.
      
      (On pseries, the first call succeeds because PCI devices are set up
      early enough and no second call is made.)
      
      This can be simplified by moving the early call to eeh_probe_devices()
      from eeh_init() (where it's seen by both platforms) to
      pSeries_final_fixup(), so that each platform only calls
      eeh_probe_devices() once, at a point where it can succeed.
      This is slightly later in the boot sequence, but but still early
      enough and it is now in the same place in the sequence for both
      platforms (the pcibios_fixup hook).
      
      The display of the message can be cleaned up as well, by moving it
      into eeh_probe_devices().
      Signed-off-by: default avatarSam Bobroff <sbobroff@linux.ibm.com>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      bffc0176
    • Sam Bobroff's avatar
      powerpc/eeh: Fix use of EEH_PE_KEEP on wrong field · 473af09b
      Sam Bobroff authored
      eeh_add_to_parent_pe() sometimes removes the EEH_PE_KEEP flag, but it
      incorrectly removes it from pe->type, instead of pe->state.
      
      However, rather than clearing it from the correct field, remove it.
      Inspection of the code shows that it can't ever have had any effect
      (even if it had been cleared from the correct field), because the
      field is never tested after it is cleared by the statement in
      question.
      
      The clear statement was added by commit 807a827d ("powerpc/eeh:
      Keep PE during hotplug"), but it didn't explain why it was necessary.
      Signed-off-by: default avatarSam Bobroff <sbobroff@linux.ibm.com>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      473af09b
    • Sam Bobroff's avatar
      powerpc/eeh: Fix null deref for devices removed during EEH · bcbe3730
      Sam Bobroff authored
      If a device is removed during EEH processing (either by a driver's
      handler or as part of recovery), it can lead to a null dereference
      in eeh_pe_report_edev().
      
      To handle this, skip devices that have been removed.
      Signed-off-by: default avatarSam Bobroff <sbobroff@linux.ibm.com>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      bcbe3730
    • Sam Bobroff's avatar
      powerpc/eeh: Fix possible null deref in eeh_dump_dev_log() · f9bc28ae
      Sam Bobroff authored
      If an error occurs during an unplug operation, it's possible for
      eeh_dump_dev_log() to be called when edev->pdn is null, which
      currently leads to dereferencing a null pointer.
      
      Handle this by skipping the error log for those devices.
      Signed-off-by: default avatarSam Bobroff <sbobroff@linux.ibm.com>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      f9bc28ae
    • Joel Stanley's avatar
      powerpc/boot: Build boot wrapper with optimisations · 747b2176
      Joel Stanley authored
      The boot wrapper is currently built with -Os. By building with O2 we
      can meaningfully reduce the time decompressing the kernel.
      
      I tested by comparing 10 runs of each option in Qemu and on hardware.
      The kernel is compressed with KERNEL_XZ built with GCC 8.2.0-7ubuntu1.
      The values are counts of the timebase.
      
      Qemu TCG powernv Power8:
      
                    Os            O2            O3
       median       10221123889   6201518438    6568186825
       stddev        1361267211    429090641     657930076
       improvement                    39.33%        35.74%
      
      Palmetto Power8:
      
                    Os            O2            O3
       median           50279         50599          35790
       stddev       992144533     627130655      623721078
       improvement                   36.79%         37.13%
      
      Romulus Power9:
      
                    Os            O2            O3
       median       670312391     454733720      448881398
       stddev          157569        107276         108760
       improvement                   32.16%         33.03%
      
      TCG was quite noisy, with every few runs producing an outlier. Even so,
      O2 is faster than O3. On hardware the numbers were less noisy and O3 is
      slightly faster than O2.
      
      The wrapper size increases when moving from Os. Comparing zImage.epapr
      to the existing Os build using bloat-o-meter:
      
        Before=43401, After=56837 (13KB), chg +30.96%
        Before=43401, After=64305 (20KB), chg +48.16%
      
      I chose O2 for a balance between Qemu and hardware speed up.
      Signed-off-by: default avatarJoel Stanley <joel@jms.id.au>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      747b2176
    • Joel Stanley's avatar
      powerpc/boot: Disable vector instructions · e8e132e6
      Joel Stanley authored
      This will avoid auto-vectorisation when building with higher
      optimisation levels.
      
      We don't know if the machine can support VSX and even if it's present
      it's probably not going to be enabled at this point in boot.
      
      These flag were both added prior to GCC 4.6 which is the minimum
      compiler version supported by upstream, thanks to Segher for the
      details.
      Signed-off-by: default avatarJoel Stanley <joel@jms.id.au>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      e8e132e6
    • Joel Stanley's avatar
      powerpc/boot: Fix opal console in boot wrapper · 1a855eac
      Joel Stanley authored
      As of commit 10c77dba ("powerpc/boot: Fix build failure in 32-bit
      boot wrapper") the opal code is hidden behind CONFIG_PPC64_BOOT_WRAPPER,
      but the boot wrapper avoids include/linux, so it does not get the normal
      Kconfig flags.
      
      We can drop the guard entirely as in commit f8e8e69c ("powerpc/boot:
      Only build OPAL code when necessary") the makefile only includes opal.c
      in the build if CONFIG_PPC64_BOOT_WRAPPER is set.
      
      Fixes: 10c77dba ("powerpc/boot: Fix build failure in 32-bit boot wrapper")
      Signed-off-by: default avatarJoel Stanley <joel@jms.id.au>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      1a855eac
    • Joel Stanley's avatar
      powerpc/boot: Expose Kconfig symbols to wrapper · 5e9dcb61
      Joel Stanley authored
      Currently the wrapper is built without including anything in
      $(src)/include/, which means there are no CONFIG_ symbols defined.
      This means the platform specific serial drivers were never enabled.
      
      We now copy the definitions into the boot directory, so any C file can
      now include autoconf.h to depend on configuration options.
      
      Fixes: 866bfc75 ("powerpc: conditionally compile platform-specific serial drivers")
      Signed-off-by: default avatarJoel Stanley <joel@jms.id.au>
      [mpe: Fix to use $(objtree) to find autoconf.h]
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      5e9dcb61
    • Bartlomiej Zolnierkiewicz's avatar
      powerpc: remove redundant 'default n' from Kconfig-s · 719736e1
      Bartlomiej Zolnierkiewicz authored
      'default n' is the default value for any bool or tristate Kconfig
      setting so there is no need to write it explicitly.
      
      Also since commit f467c564 ("kconfig: only write '# CONFIG_FOO
      is not set' for visible symbols") the Kconfig behavior is the same
      regardless of 'default n' being present or not:
      
          ...
          One side effect of (and the main motivation for) this change is making
          the following two definitions behave exactly the same:
      
              config FOO
                      bool
      
              config FOO
                      bool
                      default n
      
          With this change, neither of these will generate a
          '# CONFIG_FOO is not set' line (assuming FOO isn't selected/implied).
          That might make it clearer to people that a bare 'default n' is
          redundant.
          ...
      Signed-off-by: default avatarBartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      719736e1
    • Oliver O'Halloran's avatar
      powerpc/rtasd: Improve unknown error logging · b27e5f93
      Oliver O'Halloran authored
      Currently when we get an unknown RTAS event it prints the type as
      "Unknown" and no other useful information. Add the raw type code to the
      log message so that we have something to work off.
      Signed-off-by: default avatarOliver O'Halloran <oohall@gmail.com>
      Reviewed-by: default avatarVasant Hegde <hegdevasant@linux.vnet.ibm.com>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      b27e5f93
    • Joel Stanley's avatar
      powerpc: Disable -Wbuiltin-requires-header when setjmp is used · aea44714
      Joel Stanley authored
      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: default avatarJoel Stanley <joel@jms.id.au>
      Reviewed-by: default avatarNick Desaulniers <ndesaulniers@google.com>
      [mpe: Move subdir-ccflags in xmon/Makefile to not clobber -Werror]
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      aea44714
    • Dan Carpenter's avatar
      powerpc: Fix signedness bug in update_flash_db() · 014704e6
      Dan Carpenter authored
      The "count < sizeof(struct os_area_db)" comparison is type promoted to
      size_t so negative values of "count" are treated as very high values
      and we accidentally return success instead of a negative error code.
      
      This doesn't really change runtime much but it fixes a static checker
      warning.
      Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Acked-by: default avatarGeoff Levand <geoff@infradead.org>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      014704e6
    • Joel Stanley's avatar
      powerpc/perf: Quiet IMC PMU registration message · 6233b6da
      Joel Stanley authored
      On a Power9 box we get a few screens full of these on boot. Drop
      them to pr_debug.
      
        [    5.993645] nest_centaur6_imc performance monitor hardware support registered
        [    5.993728] nest_centaur7_imc performance monitor hardware support registered
        [    5.996510] core_imc performance monitor hardware support registered
        [    5.996569] nest_mba0_imc performance monitor hardware support registered
        [    5.996631] nest_mba1_imc performance monitor hardware support registered
        [    5.996685] nest_mba2_imc performance monitor hardware support registered
      Signed-off-by: default avatarJoel Stanley <joel@jms.id.au>
      Reviewed-by: default avatarMadhavan Srinivasan <maddy@linux.vnet.ibm.com>
      Reviewed-by: default avatarStewart Smith <stewart@linux.ibm.com>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      6233b6da
    • Christophe Leroy's avatar
      powerpc/process: Constify the number of insns printed by show instructions functions. · df13102f
      Christophe Leroy authored
      instructions_to_print var is assigned value 16 and there is no
      way to change it.
      
      This patch replaces it by a constant.
      Reviewed-by: default avatarMurilo Opsfelder Araujo <muriloo@linux.ibm.com>
      Signed-off-by: default avatarChristophe Leroy <christophe.leroy@c-s.fr>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      df13102f
    • Christophe Leroy's avatar
      powerpc/process: Fix interleaved output in show_user_instructions() · fb2d9505
      Christophe Leroy authored
      When two processes crash at the same time, we sometimes encounter
      interleaving in the middle of a line:
      
        init[1]: segfault (11) at 0 nip 0 lr 0 code 1
        init[1]: code: XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX
        init[74]: segfault (11) at 10a74 nip 1000c198 lr 100078c8 code 1 in sh[10000000+14000]
        XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX
        init[1]: code: XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX
        init[74]: code: 90010024 bf61000c 91490a7c 3fa01002 3be00000 7d3e4b78 3bbd0c20 3b600000
        init[74]: code: 3b9d0040 7c7fe02e 2f830000 419e0028 <89230000> 2f890000 41be001c 4b7f6e79
      
      This patch fixes it by preparing complete lines in a buffer and
      printing it at once.
      
      Fixes: 88b0fe17 ("powerpc: Add show_user_instructions()")
      Reviewed-by: default avatarMurilo Opsfelder Araujo <muriloo@linux.ibm.com>
      Signed-off-by: default avatarChristophe Leroy <christophe.leroy@c-s.fr>
      [mpe: Use seq_buf_printf() not seq_buf_puts() which doesn't NULL terminate]
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      fb2d9505
    • Christophe Leroy's avatar
      powerpc/process: Add missing include of stacktrace.h · c9386bfd
      Christophe Leroy authored
      As spotted by sparse:
      
        arch/powerpc/kernel/process.c:1302:6: warning: symbol 'show_user_instructions' was not declared. Should it be static?
      
      Fixes: 88b0fe17 ("powerpc: Add show_user_instructions()")
      Reviewed-by: default avatarMurilo Opsfelder Araujo <muriloo@linux.ibm.com>
      Signed-off-by: default avatarChristophe Leroy <christophe.leroy@c-s.fr>
      [mpe: Split out of larger patch]
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      c9386bfd
    • Christophe Leroy's avatar
      powerpc/process: Fix sparse address space warnings · 3b35bd48
      Christophe Leroy authored
      This patch fixes the following warnings, which are leftovers
      from when __get_user() was replaced by probe_kernel_address().
      
      arch/powerpc/kernel/process.c:1287:22: warning: incorrect type in argument 2 (different address spaces)
      arch/powerpc/kernel/process.c:1287:22:    expected void const *src
      arch/powerpc/kernel/process.c:1287:22:    got unsigned int [noderef] <asn:1>*<noident>
      arch/powerpc/kernel/process.c:1319:21: warning: incorrect type in argument 2 (different address spaces)
      arch/powerpc/kernel/process.c:1319:21:    expected void const *src
      arch/powerpc/kernel/process.c:1319:21:    got unsigned int [noderef] <asn:1>*<noident>
      
      Fixes: 7b051f66 ("powerpc: Use probe_kernel_address in show_instructions")
      Reviewed-by: default avatarMurilo Opsfelder Araujo <muriloo@linux.ibm.com>
      Signed-off-by: default avatarChristophe Leroy <christophe.leroy@c-s.fr>
      [mpe: Split out of larger patch]
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      3b35bd48
    • Christophe Leroy's avatar
      powerpc/64: properly initialise the stackprotector canary on SMP. · 7241d26e
      Christophe Leroy authored
      commit 06ec27ae ("powerpc/64: add stack protector support")
      doesn't initialise the stack canary on SMP secondary CPU's paca,
      leading to the following false positive report from the
      stack protector.
      
      smp: Bringing up secondary CPUs ...
      Kernel panic - not syncing: stack-protector: Kernel stack is corrupted in: __schedule+0x978/0xa80
      CPU: 1 PID: 0 Comm: swapper/1 Not tainted 4.19.0-rc7-next-20181010-autotest-autotest #1
      Call Trace:
      [c000001fed5b3bf0] [c000000000a0ef3c] dump_stack+0xb0/0xf4 (unreliable)
      [c000001fed5b3c30] [c0000000000f9d68] panic+0x140/0x308
      [c000001fed5b3cc0] [c0000000000f9844] __stack_chk_fail+0x24/0x30
      [c000001fed5b3d20] [c000000000a2c3a8] __schedule+0x978/0xa80
      [c000001fed5b3e00] [c000000000a2c9b4] schedule_idle+0x34/0x60
      [c000001fed5b3e30] [c00000000013d344] do_idle+0x224/0x3d0
      [c000001fed5b3ec0] [c00000000013d6e0] cpu_startup_entry+0x30/0x50
      [c000001fed5b3ef0] [c000000000047f34] start_secondary+0x4d4/0x520
      [c000001fed5b3f90] [c00000000000b370] start_secondary_prolog+0x10/0x14
      
      This patch properly initialises the stack_canary of the secondary
      idle tasks.
      Reported-by: default avatarAbdul Haleem <abdhalee@linux.vnet.ibm.com>
      Fixes: 06ec27ae ("powerpc/64: add stack protector support")
      Signed-off-by: default avatarChristophe Leroy <christophe.leroy@c-s.fr>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      7241d26e
  2. 09 Oct, 2018 1 commit
    • Michael Ellerman's avatar
      Merge branch 'fixes' into next · 9b7e4d60
      Michael Ellerman authored
      Merge our fixes branch. It has a few important fixes that are needed for
      futher testing and also some commits that will conflict with content in
      next.
      9b7e4d60
  3. 08 Oct, 2018 1 commit