Skip to content
  1. Oct 08, 2021
    • Nathan Lynch's avatar
      powerpc/cpuhp: BUG -> WARN conversion in offline path · 983f9101
      Nathan Lynch authored
      
      
      If, due to bugs elsewhere, we get into unregister_cpu_online() with a CPU
      that isn't marked hotpluggable, we can emit a warning and return an
      appropriate error instead of crashing.
      
      Signed-off-by: default avatarNathan Lynch <nathanl@linux.ibm.com>
      Reviewed-by: default avatarDaniel Henrique Barboza <danielhb413@gmail.com>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Link: https://lore.kernel.org/r/20210927201933.76786-3-nathanl@linux.ibm.com
      983f9101
    • Nathan Lynch's avatar
      powerpc/pseries/cpuhp: cache node corrections · 7edd5c9a
      Nathan Lynch authored
      On pseries, cache nodes in the device tree can be added and removed by the
      CPU DLPAR code as well as the partition migration (mobility) code. PowerVM
      partitions in dedicated processor mode typically have L2 and L3 cache
      nodes.
      
      The CPU DLPAR code has the following shortcomings:
      
      * Cache nodes returned as siblings of a new CPU node by
        ibm,configure-connector are silently discarded; only the CPU node is
        added to the device tree.
      
      * Cache nodes which become unreferenced in the processor removal path are
        not removed from the device tree. This can lead to duplicate nodes when
        the post-migration device tree update code replaces cache nodes.
      
      This is long-standing behavior. Presumably it has gone mostly unnoticed
      because the two bugs have the property of obscuring each other in common
      simple scenarios (e.g. remove a CPU and add it back). Likely you'd notice
      only if you cared to inspect the device tree or the sysfs cacheinfo
      information.
      
      Booted with two processors:
      
        $ pwd
        /sys/firmware/devicetree/base/cpus
        $ ls -1d */
        l2-cache@2010/
        l2-cache@2011/
        l3-cache@3110/
        l3-cache@3111/
        PowerPC,POWER9@0/
        PowerPC,POWER9@8/
        $ lsprop */l2-cache
        l2-cache@2010/l2-cache
                       00003110 (12560)
        l2-cache@2011/l2-cache
                       00003111 (12561)
        PowerPC,POWER9@0/l2-cache
                       00002010 (8208)
        PowerPC,POWER9@8/l2-cache
                       00002011 (8209)
        $ ls /sys/devices/system/cpu/cpu0/cache/
        index0  index1  index2  index3
      
      After DLPAR-adding PowerPC,POWER9@10, we see that its associated cache
      nodes are absent, its threads' L2+L3 cacheinfo is unpopulated, and it is
      missing a cache level in its sched domain hierarchy:
      
        $ ls -1d */
        l2-cache@2010/
        l2-cache@2011/
        l3-cache@3110/
        l3-cache@3111/
        PowerPC,POWER9@0/
        PowerPC,POWER9@10/
        PowerPC,POWER9@8/
        $ lsprop PowerPC\,POWER9@10/l2-cache
        PowerPC,POWER9@10/l2-cache
                       00002012 (8210)
        $ ls /sys/devices/system/cpu/cpu16/cache/
        index0  index1
        $ grep . /sys/kernel/debug/sched/domains/cpu{0,8,16}/domain*/name
        /sys/kernel/debug/sched/domains/cpu0/domain0/name:SMT
        /sys/kernel/debug/sched/domains/cpu0/domain1/name:CACHE
        /sys/kernel/debug/sched/domains/cpu0/domain2/name:DIE
        /sys/kernel/debug/sched/domains/cpu8/domain0/name:SMT
        /sys/kernel/debug/sched/domains/cpu8/domain1/name:CACHE
        /sys/kernel/debug/sched/domains/cpu8/domain2/name:DIE
        /sys/kernel/debug/sched/domains/cpu16/domain0/name:SMT
        /sys/kernel/debug/sched/domains/cpu16/domain1/name:DIE
      
      When removing PowerPC,POWER9@8, we see that its cache nodes are left
      behind:
      
        $ ls -1d */
        l2-cache@2010/
        l2-cache@2011/
        l3-cache@3110/
        l3-cache@3111/
        PowerPC,POWER9@0/
      
      When DLPAR is combined with VM migration, we can get duplicate nodes. E.g.
      removing one processor, then migrating, adding a processor, and then
      migrating again can result in warnings from the OF core during
      post-migration device tree updates:
      
        Duplicate name in cpus, renamed to "l2-cache@2011#1"
        Duplicate name in cpus, renamed to "l3-cache@3111#1"
      
      and nodes with duplicated phandles in the tree, making lookup behavior
      unpredictable:
      
        $ lsprop l[23]-cache@*/ibm,phandle
        l2-cache@2010/ibm,phandle
                         00002010 (8208)
        l2-cache@2011#1/ibm,phandle
                         00002011 (8209)
        l2-cache@2011/ibm,phandle
                         00002011 (8209)
        l3-cache@3110/ibm,phandle
                         00003110 (12560)
        l3-cache@3111#1/ibm,phandle
                         00003111 (12561)
        l3-cache@3111/ibm,phandle
                         00003111 (12561)
      
      Address these issues by:
      
      * Correctly processing siblings of the node returned from
        dlpar_configure_connector().
      * Removing cache nodes in the CPU remove path when it can be determined
        that they are not associated with other CPUs or caches.
      
      Use the of_changeset API in both cases, which allows us to keep the error
      handling in this code from becoming more complex while ensuring that the
      device tree cannot become inconsistent.
      
      Fixes: ac713800 ("powerpc/pseries: Add CPU dlpar remove functionality")
      Fixes: 90edf184
      
       ("powerpc/pseries: Add CPU dlpar add functionality")
      Signed-off-by: default avatarNathan Lynch <nathanl@linux.ibm.com>
      Tested-by: default avatarDaniel Henrique Barboza <danielhb413@gmail.com>
      Reviewed-by: default avatarDaniel Henrique Barboza <danielhb413@gmail.com>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Link: https://lore.kernel.org/r/20210927201933.76786-2-nathanl@linux.ibm.com
      7edd5c9a
    • Nathan Lynch's avatar
      powerpc/paravirt: correct preempt debug splat in vcpu_is_preempted() · fda0eb22
      Nathan Lynch authored
      vcpu_is_preempted() can be used outside of preempt-disabled critical
      sections, yielding warnings such as:
      
      BUG: using smp_processor_id() in preemptible [00000000] code: systemd-udevd/185
      caller is rwsem_spin_on_owner+0x1cc/0x2d0
      CPU: 1 PID: 185 Comm: systemd-udevd Not tainted 5.15.0-rc2+ #33
      Call Trace:
      [c000000012907ac0] [c000000000aa30a8] dump_stack_lvl+0xac/0x108 (unreliable)
      [c000000012907b00] [c000000001371f70] check_preemption_disabled+0x150/0x160
      [c000000012907b90] [c0000000001e0e8c] rwsem_spin_on_owner+0x1cc/0x2d0
      [c000000012907be0] [c0000000001e1408] rwsem_down_write_slowpath+0x478/0x9a0
      [c000000012907ca0] [c000000000576cf4] filename_create+0x94/0x1e0
      [c000000012907d10] [c00000000057ac08] do_symlinkat+0x68/0x1a0
      [c000000012907d70] [c00000000057ae18] sys_symlink+0x58/0x70
      [c000000012907da0] [c00000000002e448] system_call_exception+0x198/0x3c0
      [c000000012907e10] [c00000000000c54c] system_call_common+0xec/0x250
      
      The result of vcpu_is_preempted() is always used speculatively, and the
      function does not access per-cpu resources in a (Linux) preempt-unsafe way.
      Use raw_smp_processor_id() to avoid such warnings, adding explanatory
      comments.
      
      Fixes: ca3f969d
      
       ("powerpc/paravirt: Use is_kvm_guest() in vcpu_is_preempted()")
      Signed-off-by: default avatarNathan Lynch <nathanl@linux.ibm.com>
      Reviewed-by: default avatarSrikar Dronamraju <srikar@linux.vnet.ibm.com>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Link: https://lore.kernel.org/r/20210928214147.312412-3-nathanl@linux.ibm.com
      fda0eb22
    • Nathan Lynch's avatar
      powerpc/paravirt: vcpu_is_preempted() commentary · 799f9b51
      Nathan Lynch authored
      
      
      Add comments more clearly documenting that this function determines whether
      hypervisor-level preemption of the VM has occurred.
      
      Signed-off-by: default avatarNathan Lynch <nathanl@linux.ibm.com>
      Reviewed-by: default avatarSrikar Dronamraju <srikar@linux.vnet.ibm.com>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Link: https://lore.kernel.org/r/20210928214147.312412-2-nathanl@linux.ibm.com
      799f9b51
    • Nathan Lynch's avatar
      powerpc: fix unbalanced node refcount in check_kvm_guest() · 56537faf
      Nathan Lynch authored
      When check_kvm_guest() succeeds in looking up a /hypervisor OF node, it
      returns without performing a matching put for the lookup, leaving the
      node's reference count elevated.
      
      Add the necessary call to of_node_put(), rearranging the code slightly to
      avoid repetition or goto.
      
      Fixes: 107c5500
      
       ("powerpc/pseries: Add KVM guest doorbell restrictions")
      Signed-off-by: default avatarNathan Lynch <nathanl@linux.ibm.com>
      Reviewed-by: default avatarSrikar Dronamraju <srikar@linux.vnet.ibm.com>
      Reviewed-by: default avatarTyrel Datwyler <tyreld@linux.ibm.com>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Link: https://lore.kernel.org/r/20210928124550.132020-1-nathanl@linux.ibm.com
      56537faf
    • Christophe Leroy's avatar
      video: fbdev: chipsfb: use memset_io() instead of memset() · f2719b26
      Christophe Leroy authored
      While investigating a lockup at startup on Powerbook 3400C, it was
      identified that the fbdev driver generates alignment exception at
      startup:
      
        --- interrupt: 600 at memset+0x60/0xc0
        NIP:  c0021414 LR: c03fc49c CTR: 00007fff
        REGS: ca021c10 TRAP: 0600   Tainted: G        W          (5.14.2-pmac-00727-g12a41fa69492)
        MSR:  00009032 <EE,ME,IR,DR,RI>  CR: 44008442  XER: 20000100
        DAR: cab80020 DSISR: 00017c07
        GPR00: 00000007 ca021cd0 c14412e0 cab80000 00000000 00100000 cab8001c 00000004
        GPR08: 00100000 00007fff 00000000 00000000 84008442 00000000 c0006fb4 00000000
        GPR16: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00100000
        GPR24: 00000000 81800000 00000320 c15fa400 c14d1878 00000000 c14d1800 c094e19c
        NIP [c0021414] memset+0x60/0xc0
        LR [c03fc49c] chipsfb_pci_init+0x160/0x580
        --- interrupt: 600
        [ca021cd0] [c03fc46c] chipsfb_pci_init+0x130/0x580 (unreliable)
        [ca021d20] [c03a3a70] pci_device_probe+0xf8/0x1b8
        [ca021d50] [c043d584] really_probe.part.0+0xac/0x388
        [ca021d70] [c043d914] __driver_probe_device+0xb4/0x170
        [ca021d90] [c043da18] driver_probe_device+0x48/0x144
        [ca021dc0] [c043e318] __driver_attach+0x11c/0x1c4
        [ca021de0] [c043ad30] bus_for_each_dev+0x88/0xf0
        [ca021e10] [c043c724] bus_add_driver+0x190/0x22c
        [ca021e40] [c043ee94] driver_register+0x9c/0x170
        [ca021e60] [c0006c28] do_one_initcall+0x54/0x1ec
        [ca021ed0] [c08246e4] kernel_init_freeable+0x1c0/0x270
        [ca021f10] [c0006fdc] kernel_init+0x28/0x11c
        [ca021f30] [c0017148] ret_from_kernel_thread+0x14/0x1c
        Instruction dump:
        7d4601a4 39490777 7d4701a4 39490888 7d4801a4 39490999 7d4901a4 39290aaa
        7d2a01a4 4c00012c 4bfffe88 0fe00000 <4bfffe80> 9421fff0 38210010 48001970
      
      This is due to 'dcbz' instruction being used on non-cached memory.
      'dcbz' instruction is used by memset() to zeroize a complete
      cacheline at once, and memset() is not expected to be used on non
      cached memory.
      
      When performing a 'sparse' check on fbdev driver, it also appears
      that the use of memset() is unexpected:
      
        drivers/video/fbdev/chipsfb.c:334:17: warning: incorrect type in argument 1 (different address spaces)
        drivers/video/fbdev/chipsfb.c:334:17:    expected void *
        drivers/video/fbdev/chipsfb.c:334:17:    got char [noderef] __iomem *screen_base
        drivers/video/fbdev/chipsfb.c:334:15: warning: memset with byte count of 1048576
      
      Use fb_memset() instead of memset(). fb_memset() is defined as
      memset_io() for powerpc.
      
      Fixes: 8c870933
      
       ("[PATCH] ppc32: Remove CONFIG_PMAC_PBOOK")
      Reported-by: default avatarStan Johnson <userm57@yahoo.com>
      Signed-off-by: default avatarChristophe Leroy <christophe.leroy@csgroup.eu>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Link: https://lore.kernel.org/r/884a54f1e5cb774c1d9b4db780209bee5d4f6718.1631712563.git.christophe.leroy@csgroup.eu
      f2719b26
    • Vasant Hegde's avatar
      powerpc/powernv/dump: Fix typo in comment · ee878437
      Vasant Hegde authored
      
      
      Signed-off-by: default avatarVasant Hegde <hegdevasant@linux.vnet.ibm.com>
      Reviewed-by: default avatarJoel Stanley <joel@jms.id.au>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Link: https://lore.kernel.org/r/20210914143802.54325-1-hegdevasant@linux.vnet.ibm.com
      ee878437
    • Nick Desaulniers's avatar
      powerpc/asm: Remove UPD_CONSTR after GCC 4.9 removal · 2a24d80f
      Nick Desaulniers authored
      UPD_CONSTR was previously a preprocessor define for an old GCC 4.9
      inline asm bug with m<> constraints.
      
      Fixes: 6563139d
      
       ("powerpc: remove GCC version check for UPD_CONSTR")
      Suggested-by: default avatarNathan Chancellor <nathan@kernel.org>
      Suggested-by: default avatarChristophe Leroy <christophe.leroy@csgroup.eu>
      Suggested-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Signed-off-by: default avatarNick Desaulniers <ndesaulniers@google.com>
      Reviewed-by: default avatarNathan Chancellor <nathan@kernel.org>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Link: https://lore.kernel.org/r/20210914161712.2463458-1-ndesaulniers@google.com
      2a24d80f
    • Christophe Leroy's avatar
      powerpc/mem: Fix arch/powerpc/mm/mem.c:53:12: error: no previous prototype for... · 7eff9bc0
      Christophe Leroy authored
      powerpc/mem: Fix arch/powerpc/mm/mem.c:53:12: error: no previous prototype for 'create_section_mapping'
      
      Commit 8e11d62e ("powerpc/mem: Add back missing header to fix 'no
      previous prototype' error") was supposed to fix the problem, but in
      the meantime commit a927bd6b ("mm: fix phys_to_target_node() and*
      memory_add_physaddr_to_nid() exports") moved create_section_mapping()
      prototype from asm/sparsemem.h to asm/mmzone.h
      
      Fixes: 8e11d62e
      
       ("powerpc/mem: Add back missing header to fix 'no previous prototype' error")
      Reported-by: default avatarkernel test robot <lkp@intel.com>
      Signed-off-by: default avatarChristophe Leroy <christophe.leroy@csgroup.eu>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Link: https://lore.kernel.org/r/025754fde3d027904ae9d0191f395890bec93369.1631541649.git.christophe.leroy@csgroup.eu
      
      7eff9bc0
    • Niklas Schnelle's avatar
      powerpc: Drop superfluous pci_dev_is_added() calls · 452f145e
      Niklas Schnelle authored
      
      
      On powerpc, pci_dev_is_added() is called as part of SR-IOV fixups
      that are done under pcibios_add_device() which in turn is only called in
      pci_device_add() whih is called when a PCI device is scanned.
      
      pci_dev_assign_added() is called in pci_bus_add_device() which is only
      called after scanning the device. Thus pci_dev_is_added() is always
      false and can be dropped.
      
      Signed-off-by: default avatarNiklas Schnelle <schnelle@linux.ibm.com>
      Reviewed-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      Reviewed-by: default avatarOliver O'Halloran <oohall@gmail.com>
      [mpe: Tweak change log slightly to reflect Oliver's comments]
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Link: https://lore.kernel.org/r/20210910141940.2598035-2-schnelle@linux.ibm.com
      452f145e
    • Christophe Leroy's avatar
      powerpc/powermac: Remove stale declaration of pmac_md · 9d7fb064
      Christophe Leroy authored
      pmac_md doesn't exist anymore, remove stall declaration.
      
      Fixes: e8222502
      
       ("[PATCH] powerpc: Kill _machine and hard-coded platform numbers")
      Signed-off-by: default avatarChristophe Leroy <christophe.leroy@csgroup.eu>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Link: https://lore.kernel.org/r/b2e52934e5a500f149e6d94db3cfa0569bc35081.1630657402.git.christophe.leroy@csgroup.eu
      9d7fb064
    • Daniel Axtens's avatar
      powerpc: Remove unused prototype for of_show_percpuinfo · 93fa8e9d
      Daniel Axtens authored
      commit 6d7f58b0 ("[PATCH] powerpc: Some minor cleanups to setup_32.c")
      removed of_show_percpuinfo but didn't remove the prototype.
      
      Remove it.
      
      Fixes: 6d7f58b0
      
       ("[PATCH] powerpc: Some minor cleanups to setup_32.c")
      Signed-off-by: default avatarDaniel Axtens <dja@axtens.net>
      Reviewed-by: default avatarAndrew Donnellan <ajd@linux.ibm.com>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Link: https://lore.kernel.org/r/20210903063246.70691-1-dja@axtens.net
      93fa8e9d
    • Christophe Leroy's avatar
      powerpc/476: Fix sparse report · 494f238a
      Christophe Leroy authored
      Fix sparse errors:
        arch/powerpc/platforms/44x/ppc476.c:236:17: warning: cast removes address space '__iomem' of expression
        arch/powerpc/platforms/44x/ppc476.c:241:34: warning: incorrect type in argument 1 (different address spaces)
        arch/powerpc/platforms/44x/ppc476.c:241:34:    expected void const volatile [noderef] __iomem *addr
        arch/powerpc/platforms/44x/ppc476.c:241:34:    got unsigned char [usertype] *
        arch/powerpc/platforms/44x/ppc476.c:243:17: warning: incorrect type in argument 1 (different address spaces)
        arch/powerpc/platforms/44x/ppc476.c:243:17:    expected void volatile [noderef] __iomem *addr
        arch/powerpc/platforms/44x/ppc476.c:243:17:    got unsigned char [usertype] *[assigned] fpga
      
      Mark 'fpga' pointer as __iomem.
      
      Fixes: ab9a4183
      
       ("powerpc: Update currituck pci/usb fixup for new board revision")
      Reported-by: default avatarkernel test robot <lkp@intel.com>
      Signed-off-by: default avatarChristophe Leroy <christophe.leroy@csgroup.eu>
      Reviewed-by: default avatarAlistair Popple <alistair@popple.id.au>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Link: https://lore.kernel.org/r/aa6055769b92a5d8685b8d0adab99c48a0b0ef4b.1631956926.git.christophe.leroy@csgroup.eu
      494f238a
    • Xiaoming Ni's avatar
      powerpc/85xx: fix timebase sync issue when CONFIG_HOTPLUG_CPU=n · c45361ab
      Xiaoming Ni authored
      When CONFIG_SMP=y, timebase synchronization is required when the second
      kernel is started.
      
      arch/powerpc/kernel/smp.c:
        int __cpu_up(unsigned int cpu, struct task_struct *tidle)
        {
        	...
        	if (smp_ops->give_timebase)
        		smp_ops->give_timebase();
        	...
        }
      
        void start_secondary(void *unused)
        {
        	...
        	if (smp_ops->take_timebase)
        		smp_ops->take_timebase();
        	...
        }
      
      When CONFIG_HOTPLUG_CPU=n and CONFIG_KEXEC_CORE=n,
       smp_85xx_ops.give_timebase is NULL,
       smp_85xx_ops.take_timebase is NULL,
      As a result, the timebase is not synchronized.
      
      Timebase  synchronization does not depend on CONFIG_HOTPLUG_CPU.
      
      Fixes: 56f1ba28
      
       ("powerpc/mpc85xx: refactor the PM operations")
      Cc: stable@vger.kernel.org # v4.6+
      Signed-off-by: default avatarXiaoming Ni <nixiaoming@huawei.com>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Link: https://lore.kernel.org/r/20210929033646.39630-3-nixiaoming@huawei.com
      c45361ab
    • Xiaoming Ni's avatar
      powerpc/85xx: Fix oops when mpc85xx_smp_guts_ids node cannot be found · 3c2172c1
      Xiaoming Ni authored
      When the field described in mpc85xx_smp_guts_ids[] is not configured in
      dtb, the mpc85xx_setup_pmc() does not assign a value to the "guts"
      variable. As a result, the oops is triggered when
      mpc85xx_freeze_time_base() is executed.
      
      Fixes: 56f1ba28
      
       ("powerpc/mpc85xx: refactor the PM operations")
      Cc: stable@vger.kernel.org # v4.6+
      Signed-off-by: default avatarXiaoming Ni <nixiaoming@huawei.com>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Link: https://lore.kernel.org/r/20210929033646.39630-2-nixiaoming@huawei.com
      3c2172c1
    • Alexey Kardashevskiy's avatar
      powerps/pseries/dma: Add support for 2M IOMMU page size · 38727311
      Alexey Kardashevskiy authored
      
      
      The upcoming PAPR spec adds a 2M page size, bit 23 right after 16G page
      size in the "ibm,query-pe-dma-window" call.
      
      This adds support for the new page size. Since the new page size is out
      of sorted order, this changes the loop to not assume that shift[] is
      sorted.
      
      This has now been tested and is known to work on a pre-release version
      of phyp.
      
      Signed-off-by: default avatarAlexey Kardashevskiy <aik@ozlabs.ru>
      Reviewed-by: default avatarLeonardo Bras <leobras.c@gmail.com>
      Reviewed-by: default avatarFrederic Barrat <fbarrat@linux.ibm.com>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Link: https://lore.kernel.org/r/20211006044735.1114669-1-aik@ozlabs.ru
      38727311
  2. Sep 20, 2021
    • Linus Torvalds's avatar
      Linux 5.15-rc2 · e4e737bb
      Linus Torvalds authored
      e4e737bb
    • Linus Torvalds's avatar
      pci_iounmap'2: Electric Boogaloo: try to make sense of it all · 316e8d79
      Linus Torvalds authored
      Nathan Chancellor reports that the recent change to pci_iounmap in
      commit 9caea000 ("parisc: Declare pci_iounmap() parisc version only
      when CONFIG_PCI enabled") causes build errors on arm64.
      
      It took me about two hours to convince myself that I think I know what
      the logic of that mess of #ifdef's in the <asm-generic/io.h> header file
      really aim to do, and rewrite it to be easier to follow.
      
      Famous last words.
      
      Anyway, the code has now been lifted from that grotty header file into
      lib/pci_iomap.c, and has fairly extensive comments about what the logic
      is.  It also avoids indirecting through another confusing (and badly
      named) helper function that has other preprocessor config conditionals.
      
      Let's see what odd architecture did something else strange in this area
      to break things.  But my arm64 cross build is clean.
      
      Fixes: 9caea000
      
       ("parisc: Declare pci_iounmap() parisc version only when CONFIG_PCI enabled")
      Reported-by: default avatarNathan Chancellor <nathan@kernel.org>
      Cc: Helge Deller <deller@gmx.de>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Guenter Roeck <linux@roeck-us.net>
      Cc: Ulrich Teichert <krypton@ulrich-teichert.org>
      Cc: James Bottomley <James.Bottomley@hansenpartnership.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      316e8d79
    • Linus Torvalds's avatar
      Merge tag 'x86_urgent_for_v5.15_rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 20621d2f
      Linus Torvalds authored
      Pull x86 fixes from Borislav Petkov:
      
       - Prevent a infinite loop in the MCE recovery on return to user space,
         which was caused by a second MCE queueing work for the same page and
         thereby creating a circular work list.
      
       - Make kern_addr_valid() handle existing PMD entries, which are marked
         not present in the higher level page table, correctly instead of
         blindly dereferencing them.
      
       - Pass a valid address to sanitize_phys(). This was caused by the
         mixture of inclusive and exclusive ranges. memtype_reserve() expect
         'end' being exclusive, but sanitize_phys() wants it inclusive. This
         worked so far, but with end being the end of the physical address
         space the fail is exposed.
      
       - Increase the maximum supported GPIO numbers for 64bit. Newer SoCs
         exceed the previous maximum.
      
      * tag 'x86_urgent_for_v5.15_rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        x86/mce: Avoid infinite loop for copy from user recovery
        x86/mm: Fix kern_addr_valid() to cope with existing but not present entries
        x86/platform: Increase maximum GPIO number for X86_64
        x86/pat: Pass valid address to sanitize_phys()
      20621d2f
    • Linus Torvalds's avatar
      Merge tag 'perf-urgent-2021-09-19' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · fec30362
      Linus Torvalds authored
      Pull perf event fix from Thomas Gleixner:
       "A single fix for the perf core where a value read with READ_ONCE() was
        checked and then reread which makes all the checks invalid. Reuse the
        already read value instead"
      
      * tag 'perf-urgent-2021-09-19' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        events: Reuse value read using READ_ONCE instead of re-reading it
      fec30362
    • Linus Torvalds's avatar
      Merge tag 'locking-urgent-2021-09-19' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · f5e29a26
      Linus Torvalds authored
      Pull locking fixes from Thomas Gleixner:
       "A set of updates for the RT specific reader/writer locking base code:
      
         - Make the fast path reader ordering guarantees correct.
      
         - Code reshuffling to make the fix simpler"
      
      [ This plays ugly games with atomic_add_return_release() because we
        don't have a plain atomic_add_release(), and should really be cleaned
        up, I think    - Linus ]
      
      * tag 'locking-urgent-2021-09-19' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        locking/rwbase: Take care of ordering guarantee for fastpath reader
        locking/rwbase: Extract __rwbase_write_trylock()
        locking/rwbase: Properly match set_and_save_state() to restore_state()
      f5e29a26
    • Linus Torvalds's avatar
      Merge tag 'powerpc-5.15-2' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux · 62453a46
      Linus Torvalds authored
      Pull powerpc fixes from Michael Ellerman:
      
       - Fix crashes when scv (System Call Vectored) is used to make a syscall
         when a transaction is active, on Power9 or later.
      
       - Fix bad interactions between rfscv (Return-from scv) and Power9
         fake-suspend mode.
      
       - Fix crashes when handling machine checks in LPARs using the Hash MMU.
      
       - Partly revert a recent change to our XICS interrupt controller code,
         which broke the recently added Microwatt support.
      
      Thanks to Cédric Le Goater, Eirik Fuller, Ganesh Goudar, Gustavo Romero,
      Joel Stanley, Nicholas Piggin.
      
      * tag 'powerpc-5.15-2' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux:
        powerpc/xics: Set the IRQ chip data for the ICS native backend
        powerpc/mce: Fix access error in mce handler
        KVM: PPC: Book3S HV: Tolerate treclaim. in fake-suspend mode changing registers
        powerpc/64s: system call rfscv workaround for TM bugs
        selftests/powerpc: Add scv versions of the basic TM syscall tests
        powerpc/64s: system call scv tabort fix for corrupt irq soft-mask state
      62453a46
    • Linus Torvalds's avatar
      Merge tag 'kbuild-fixes-v5.15' of... · 2f629969
      Linus Torvalds authored
      Merge tag 'kbuild-fixes-v5.15' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild
      
      Pull Kbuild fixes from Masahiro Yamada:
      
       - Fix bugs in checkkconfigsymbols.py
      
       - Fix missing sys import in gen_compile_commands.py
      
       - Fix missing FORCE warning for ARCH=sh builds
      
       - Fix -Wignored-optimization-argument warnings for Clang builds
      
       - Turn -Wignored-optimization-argument into an error in order to stop
         building instead of sprinkling warnings
      
      * tag 'kbuild-fixes-v5.15' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild:
        kbuild: Add -Werror=ignored-optimization-argument to CLANG_FLAGS
        x86/build: Do not add -falign flags unconditionally for clang
        kbuild: Fix comment typo in scripts/Makefile.modpost
        sh: Add missing FORCE prerequisites in Makefile
        gen_compile_commands: fix missing 'sys' package
        checkkconfigsymbols.py: Remove skipping of help lines in parse_kconfig_file
        checkkconfigsymbols.py: Forbid passing 'HEAD' to --commit
      2f629969
    • Linus Torvalds's avatar
      Merge tag 'perf-tools-fixes-for-v5.15-2021-09-18' of... · d94f3957
      Linus Torvalds authored
      Merge tag 'perf-tools-fixes-for-v5.15-2021-09-18' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux
      
      Pull perf tools fixes from Arnaldo Carvalho de Melo:
      
       - Fix ip display in 'perf script' when output type != attr->type.
      
       - Ignore deprecation warning when using libbpf'sg btf__get_from_id(),
         fixing the build with libbpf v0.6+.
      
       - Make use of FD() robust in libperf, fixing a segfault with 'perf stat
         --iostat list'.
      
       - Initialize addr_location:srcline pointer to NULL when resolving
         callchain addresses.
      
       - Fix fused instruction logic for assembly functions in 'perf
         annotate'.
      
      * tag 'perf-tools-fixes-for-v5.15-2021-09-18' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux:
        perf bpf: Ignore deprecation warning when using libbpf's btf__get_from_id()
        libperf evsel: Make use of FD robust.
        perf machine: Initialize srcline string member in add_location struct
        perf script: Fix ip display when type != attr->type
        perf annotate: Fix fused instr logic for assembly functions
      d94f3957
    • Linus Torvalds's avatar
      dmascc: use proper 'virt_to_bus()' rather than casting to 'int' · bc1abb9e
      Linus Torvalds authored
      
      
      The old dmascc driver depends on the legacy ISA_DMA_API, and blindly
      just casts the kernel virtual address to 'int' for set_dma_addr().
      
      That works only incidentally, and because the high bits of the address
      will be ignored anyway. And on 64-bit architectures it causes warnings.
      
      Admittedly, 64-bit architectures with ISA are basically dead - I think
      the only example of this is alpha, and nobody would ever use the dmascc
      driver there.  But hey, the fix is easy enough, the end result is
      cleaner, and it's yet another configuration that now builds without
      warnings.
      
      If somebody actually uses this driver on an alpha and this fixes it for
      you, please email me.  Because that is just incredibly bizarre.
      
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      bc1abb9e
    • Linus Torvalds's avatar
      alpha: enable GENERIC_PCI_IOMAP unconditionally · 4fef6115
      Linus Torvalds authored
      With the previous commit (9caea000
      
      : "parisc: Declare pci_iounmap()
      parisc version only when CONFIG_PCI enabled") we can now enable
      GENERIC_PCI_IOMAP unconditionally on alpha, and if PCI is not enabled we
      will just get the nice empty helper functions that allow mixed-bus
      drivers to build.
      
      Example driver: the old 3com/3c59x.c driver works with either the PCI or
      the EISA version of the 3x59x card, but wouldn't build in an EISA-only
      configuration because of missing pci_iomap() and pci_iounmap() dummy
      wrappers.
      
      Most of the other PCI infrastructure just becomes empty wrappers even
      without GENERIC_PCI_IOMAP, and it's not obvious that the pci_iomap
      functionality shouldn't do the same, but this works.
      
      Cc: Ulrich Teichert <krypton@ulrich-teichert.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      4fef6115
    • Helge Deller's avatar
      parisc: Declare pci_iounmap() parisc version only when CONFIG_PCI enabled · 9caea000
      Helge Deller authored
      
      
      Linus noticed odd declaration rules for pci_iounmap() in iomap.h and
      pci_iomap.h, where it dependend on either NO_GENERIC_PCI_IOPORT_MAP or
      GENERIC_IOMAP when CONFIG_PCI was disabled.
      
      Testing on parisc seems to indicate that we need pci_iounmap() only when
      CONFIG_PCI is enabled, so the declaration of pci_iounmap() can be moved
      cleanly into pci_iomap.h in sync with the declarations of pci_iomap().
      
      Link: https://lore.kernel.org/all/CAHk-=wjRrh98pZoQ+AzfWmsTZacWxTJKXZ9eKU2X_0+jM=O8nw@mail.gmail.com/
      Signed-off-by: default avatarHelge Deller <deller@gmx.de>
      Suggested-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Fixes: 97a29d59
      
       ("[PARISC] fix compile break caused by iomap: make IOPORT/PCI mapping functions conditional")
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Guenter Roeck <linux@roeck-us.net>
      Cc: Ulrich Teichert <krypton@ulrich-teichert.org>
      Cc: James Bottomley <James.Bottomley@hansenpartnership.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@...>
      9caea000
    • Linus Torvalds's avatar
      Revert "drm/vc4: hdmi: Remove drm_encoder->crtc usage" · 31ad37bd
      Linus Torvalds authored
      This reverts commit 27da370e
      
      .
      
      Sudip Mukherjee reports that this broke pulseaudio with a NULL pointer
      dereference in vc4_hdmi_audio_prepare(), bisected it to this commit, and
      confirmed that a revert fixed the problem.
      
      Revert the problematic commit until fixed.
      
      Link: https://lore.kernel.org/all/CADVatmPB9-oKd=ypvj25UYysVo6EZhQ6bCM7EvztQBMyiZfAyw@mail.gmail.com/
      Link: https://lore.kernel.org/all/CADVatmN5EpRshGEPS_JozbFQRXg5w_8LFB3OMP1Ai-ghxd3w4g@mail.gmail.com/
      Reported-and-tested-by: default avatarSudip Mukherjee <sudipm.mukherjee@gmail.com>
      Cc: Maxime Ripard <maxime@cerno.tech>
      Cc: Emma Anholt <emma@anholt.net>
      Cc: Dave Airlie <airlied@gmail.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      31ad37bd
    • Linus Torvalds's avatar
      Revert drm/vc4 hdmi runtime PM changes · b1044a9b
      Linus Torvalds authored
      This reverts commits
      
        9984d666 ("drm/vc4: hdmi: Make sure the controller is powered in detect")
        411efa18 ("drm/vc4: hdmi: Move the HSM clock enable to runtime_pm")
      
      as Michael Stapelberg reports that the new runtime PM changes cause his
      Raspberry Pi 3 to hang on boot, probably due to interactions with other
      changes in the DRM tree (because a bisect points to the merge in commit
      e058a84b
      
      : "Merge tag 'drm-next-2021-07-01' of git://.../drm").
      
      Revert these two commits until it's been resolved.
      
      Link: https://lore.kernel.org/all/871r5mp7h2.fsf@midna.i-did-not-set--mail-host-address--so-tickle-me/
      Reported-and-tested-by: default avatarMichael Stapelberg <michael@stapelberg.ch>
      Cc: Maxime Ripard <maxime@cerno.tech>
      Cc: Dave Stevenson <dave.stevenson@raspberrypi.com>
      Cc: Dave Airlie <airlied@gmail.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      b1044a9b
  3. Sep 19, 2021
    • Nathan Chancellor's avatar
      kbuild: Add -Werror=ignored-optimization-argument to CLANG_FLAGS · 0664684e
      Nathan Chancellor authored
      Similar to commit 589834b3
      
       ("kbuild: Add
      -Werror=unknown-warning-option to CLANG_FLAGS").
      
      Clang ignores certain GCC flags that it has not implemented, only
      emitting a warning:
      
      $ echo | clang -fsyntax-only -falign-jumps -x c -
      clang-14: warning: optimization flag '-falign-jumps' is not supported
      [-Wignored-optimization-argument]
      
      When one of these flags gets added to KBUILD_CFLAGS unconditionally, all
      subsequent cc-{disable-warning,option} calls fail because -Werror was
      added to these invocations to turn the above warning and the equivalent
      -W flag warning into errors.
      
      To catch the presence of these flags earlier, turn
      -Wignored-optimization-argument into an error so that the flags can
      either be implemented or ignored via cc-option and there are no more
      weird errors.
      
      Reviewed-by: default avatarNick Desaulniers <ndesaulniers@google.com>
      Signed-off-by: default avatarNathan Chancellor <nathan@kernel.org>
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      0664684e
    • Nathan Chancellor's avatar
      x86/build: Do not add -falign flags unconditionally for clang · 7fa6a274
      Nathan Chancellor authored
      
      
      clang does not support -falign-jumps and only recently gained support
      for -falign-loops. When one of the configuration options that adds these
      flags is enabled, clang warns and all cc-{disable-warning,option} that
      follow fail because -Werror gets added to test for the presence of this
      warning:
      
      clang-14: warning: optimization flag '-falign-jumps=0' is not supported
      [-Wignored-optimization-argument]
      
      To resolve this, add a couple of cc-option calls when building with
      clang; gcc has supported these options since 3.2 so there is no point in
      testing for their support. -falign-functions was implemented in clang-7,
      -falign-loops was implemented in clang-14, and -falign-jumps has not
      been implemented yet.
      
      Link: https://lore.kernel.org/r/YSQE2f5teuvKLkON@Ryzen-9-3900X.localdomain/
      Link: https://lore.kernel.org/r/20210824022640.2170859-2-nathan@kernel.org/
      Reported-by: default avatarkernel test robot <lkp@intel.com>
      Reviewed-by: default avatarNick Desaulniers <ndesaulniers@google.com>
      Acked-by: default avatarBorislav Petkov <bp@suse.de>
      Signed-off-by: default avatarNathan Chancellor <nathan@kernel.org>
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      7fa6a274
    • Ramji Jiyani's avatar
      kbuild: Fix comment typo in scripts/Makefile.modpost · 7c801446
      Ramji Jiyani authored
      
      
      Change comment "create one <module>.mod.c file pr. module"
      to "create one <module>.mod.c file per module"
      
      Signed-off-by: default avatarRamji Jiyani <ramjiyani@google.com>
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      7c801446
    • Geert Uytterhoeven's avatar
      sh: Add missing FORCE prerequisites in Makefile · 4e70b646
      Geert Uytterhoeven authored
      make:
      
          arch/sh/boot/Makefile:87: FORCE prerequisite is missing
      
      Add the missing FORCE prerequisites for all build targets identified by
      "make help".
      
      Fixes: e1f86d7b
      
       ("kbuild: warn if FORCE is missing for if_changed(_dep,_rule) and filechk")
      Signed-off-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      4e70b646
    • Kortan's avatar
      gen_compile_commands: fix missing 'sys' package · ec783c7c
      Kortan authored
      We need to import the 'sys' package since the script has called
      sys.exit() method.
      
      Fixes: 6ad7cbc0
      
       ("Makefile: Add clang-tidy and static analyzer support to makefile")
      Signed-off-by: default avatarKortan <kortanzh@gmail.com>
      Reviewed-by: default avatarNathan Chancellor <nathan@kernel.org>
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      ec783c7c
    • Ariel Marcovitch's avatar
      checkkconfigsymbols.py: Remove skipping of help lines in parse_kconfig_file · aa0f5ea1
      Ariel Marcovitch authored
      
      
      When parsing Kconfig files to find symbol definitions and references,
      lines after a 'help' line are skipped until a new config definition
      starts.
      
      However, Kconfig statements can actually be after a help section, as
      long as these have shallower indentation. These are skipped by the
      parser.
      
      This means that symbols referenced in this kind of statements are
      ignored by this function and thus are not considered undefined
      references in case the symbol is not defined.
      
      Remove the 'skip' logic entirely, as it is not needed if we just use the
      STMT regex to find the end of help lines.
      
      However, this means that keywords that appear as part of the help
      message (i.e. with the same indentation as the help lines) it will be
      considered as a reference/definition. This can happen now as well, but
      only with REGEX_KCONFIG_DEF lines. Also, the keyword must have a SYMBOL
      after it, which probably means that someone referenced a config in the
      help so it seems like a bonus :)
      
      The real solution is to keep track of the indentation when a the first
      help line in encountered and then handle DEF and STMT lines only if the
      indentation is shallower.
      
      Signed-off-by: default avatarAriel Marcovitch <arielmarcovitch@gmail.com>
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      aa0f5ea1
    • Ariel Marcovitch's avatar
      checkkconfigsymbols.py: Forbid passing 'HEAD' to --commit · d62d5aed
      Ariel Marcovitch authored
      
      
      As opposed to the --diff option, --commit can get ref names instead of
      commit hashes.
      
      When using the --commit option, the script resets the working directory
      to the commit before the given ref, by adding '~' to the end of the ref.
      
      However, the 'HEAD' ref is relative, and so when the working directory
      is reset to 'HEAD~', 'HEAD' points to what was 'HEAD~'. Then when the
      script resets to 'HEAD' it actually stays in the same commit. In this
      case, the script won't report any cases because there is no diff between
      the cases of the two refs.
      
      Prevent the user from using HEAD refs.
      
      A better solution might be to resolve the refs before doing the
      reset, but for now just disallow such refs.
      
      Signed-off-by: default avatarAriel Marcovitch <arielmarcovitch@gmail.com>
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      d62d5aed
    • Linus Torvalds's avatar
      alpha: move __udiv_qrnnd library function to arch/alpha/lib/ · d4d016ca
      Linus Torvalds authored
      
      
      We already had the implementation for __udiv_qrnnd (unsigned divide for
      multi-precision arithmetic) as part of the alpha math emulation code.
      
      But you can disable the math emulation code - even if you shouldn't -
      and then the MPI code that actually wants this functionality (and is
      needed by various crypto functions) will fail to build.
      
      So move the extended-precision divide code to be a regular library
      function, just like all the regular division code is.  That way ie is
      available regardless of math-emulation.
      
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      d4d016ca
    • Linus Torvalds's avatar
      alpha: mark 'Jensen' platform as no longer broken · ab41f75e
      Linus Torvalds authored
      Ok, it almost certainly is still broken on actual hardware, but the
      immediate reason for it having been marked BROKEN was a build error that
      is fixed by just making sure the low-level IO header file is included
      sufficiently early that the __EXTERN_INLINE hackery takes effect.
      
      This was marked broken back in 2017 by commit 1883c9f4
      
       ("alpha: mark
      jensen as broken"), but Ulrich Teichert made me look at it as part of my
      cross-build work to make sure -Werror actually does the right thing.
      
      There are lots of alpha configurations that do not build cleanly, but
      now it's no longer because Jensen wouldn't be buildable.  That said,
      because the Jensen platform doesn't force PCI to be enabled (Jensen only
      had EISA), it ends up being somewhat interesting as a source of odd
      configs.
      
      Reported-by: default avatarUlrich Teichert <krypton@ulrich-teichert.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      ab41f75e
    • Andrii Nakryiko's avatar
      perf bpf: Ignore deprecation warning when using libbpf's btf__get_from_id() · 219d720e
      Andrii Nakryiko authored
      
      
      Perf code re-implements libbpf's btf__load_from_kernel_by_id() API as
      a weak function, presumably to dynamically link against old version of
      libbpf shared library. Unfortunately this causes compilation warning
      when perf is compiled against libbpf v0.6+.
      
      For now, just ignore deprecation warning, but there might be a better
      solution, depending on perf's needs.
      
      Signed-off-by: default avatarAndrii Nakryiko <andrii@kernel.org>
      Cc: Alexei Starovoitov <ast@kernel.org>
      Cc: Daniel Borkmann <daniel@iogearbox.net>
      Cc: kernel-team@fb.com
      LPU-Reference: 20210914170004.4185659-1-andrii@kernel.org
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      219d720e
    • Ian Rogers's avatar
      libperf evsel: Make use of FD robust. · aba5daeb
      Ian Rogers authored
      
      
      FD uses xyarray__entry that may return NULL if an index is out of
      bounds. If NULL is returned then a segv happens as FD unconditionally
      dereferences the pointer. This was happening in a case of with perf
      iostat as shown below. The fix is to make FD an "int*" rather than an
      int and handle the NULL case as either invalid input or a closed fd.
      
        $ sudo gdb --args perf stat --iostat  list
        ...
        Breakpoint 1, perf_evsel__alloc_fd (evsel=0x5555560951a0, ncpus=1, nthreads=1) at evsel.c:50
        50      {
        (gdb) bt
         #0  perf_evsel__alloc_fd (evsel=0x5555560951a0, ncpus=1, nthreads=1) at evsel.c:50
         #1  0x000055555585c188 in evsel__open_cpu (evsel=0x5555560951a0, cpus=0x555556093410,
            threads=0x555556086fb0, start_cpu=0, end_cpu=1) at util/evsel.c:1792
         #2  0x000055555585cfb2 in evsel__open (evsel=0x5555560951a0, cpus=0x0, threads=0x555556086fb0)
            at util/evsel.c:2045
         #3  0x000055555585d0db in evsel__open_per_thread (evsel=0x5555560951a0, threads=0x555556086fb0)
            at util/evsel.c:2065
         #4  0x00005555558ece64 in create_perf_stat_counter (evsel=0x5555560951a0,
            config=0x555555c34700 <stat_config>, target=0x555555c2f1c0 <target>, cpu=0) at util/stat.c:590
         #5  0x000055555578e927 in __run_perf_stat (argc=1, argv=0x7fffffffe4a0, run_idx=0)
            at builtin-stat.c:833
         #6  0x000055555578f3c6 in run_perf_stat (argc=1, argv=0x7fffffffe4a0, run_idx=0)
            at builtin-stat.c:1048
         #7  0x0000555555792ee5 in cmd_stat (argc=1, argv=0x7fffffffe4a0) at builtin-stat.c:2534
         #8  0x0000555555835ed3 in run_builtin (p=0x555555c3f540 <commands+288>, argc=3,
            argv=0x7fffffffe4a0) at perf.c:313
         #9  0x0000555555836154 in handle_internal_command (argc=3, argv=0x7fffffffe4a0) at perf.c:365
         #10 0x000055555583629f in run_argv (argcp=0x7fffffffe2ec, argv=0x7fffffffe2e0) at perf.c:409
         #11 0x0000555555836692 in main (argc=3, argv=0x7fffffffe4a0) at perf.c:539
        ...
        (gdb) c
        Continuing.
        Error:
        The sys_perf_event_open() syscall returned with 22 (Invalid argument) for event (uncore_iio_0/event=0x83,umask=0x04,ch_mask=0xF,fc_mask=0x07/).
        /bin/dmesg | grep -i perf may provide additional information.
      
        Program received signal SIGSEGV, Segmentation fault.
        0x00005555559b03ea in perf_evsel__close_fd_cpu (evsel=0x5555560951a0, cpu=1) at evsel.c:166
        166                     if (FD(evsel, cpu, thread) >= 0)
      
      v3. fixes a bug in perf_evsel__run_ioctl where the sense of a branch was
          backward.
      
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Acked-by: default avatarJiri Olsa <jolsa@redhat.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lore.kernel.org/lkml/20210918054440.2350466-1-irogers@google.com
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      aba5daeb