LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* RE: [PATCH] usb: gadget: fsl: fix null pointer checking
From: Peter Chen @ 2020-10-16  6:11 UTC (permalink / raw)
  To: Ran Wang, Leo Li, Felipe Balbi, Greg Kroah-Hartman
  Cc: linux-usb@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
	linux-kernel@vger.kernel.org, Ran Wang
In-Reply-To: <20201016043326.40442-1-ran.wang_1@nxp.com>

 
> 
> Fixes: 75eaa498c99e (“usb: gadget: Correct NULL pointer checking in fsl
> gadget”)
> Signed-off-by: Ran Wang <ran.wang_1@nxp.com>
> ---
>  drivers/usb/gadget/udc/fsl_udc_core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/gadget/udc/fsl_udc_core.c
> b/drivers/usb/gadget/udc/fsl_udc_core.c
> index de528e3..ad6ff9c 100644
> --- a/drivers/usb/gadget/udc/fsl_udc_core.c
> +++ b/drivers/usb/gadget/udc/fsl_udc_core.c
> @@ -1051,7 +1051,7 @@ static int fsl_ep_fifo_status(struct usb_ep *_ep)
>  	u32 bitmask;
>  	struct ep_queue_head *qh;
> 
> -	if (!_ep || _ep->desc || !(_ep->desc->bEndpointAddress&0xF))
> +	if (!_ep || !_ep->desc || !(_ep->desc->bEndpointAddress&0xF))
>  		return -ENODEV;
> 

Reviewed-by: Peter Chen <peter.chen@nxp.com>

Peter


^ permalink raw reply

* [PATCH] usb: gadget: fsl: fix null pointer checking
From: Ran Wang @ 2020-10-16  4:33 UTC (permalink / raw)
  To: Li Yang, Felipe Balbi, Greg Kroah-Hartman
  Cc: Peter Chen, linux-usb, linuxppc-dev, linux-kernel, Ran Wang

fsl_ep_fifo_status() should return error if _ep->desc is null.

Fixes: 75eaa498c99e (“usb: gadget: Correct NULL pointer checking in fsl gadget”)
Signed-off-by: Ran Wang <ran.wang_1@nxp.com>
---
 drivers/usb/gadget/udc/fsl_udc_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/udc/fsl_udc_core.c b/drivers/usb/gadget/udc/fsl_udc_core.c
index de528e3..ad6ff9c 100644
--- a/drivers/usb/gadget/udc/fsl_udc_core.c
+++ b/drivers/usb/gadget/udc/fsl_udc_core.c
@@ -1051,7 +1051,7 @@ static int fsl_ep_fifo_status(struct usb_ep *_ep)
 	u32 bitmask;
 	struct ep_queue_head *qh;
 
-	if (!_ep || _ep->desc || !(_ep->desc->bEndpointAddress&0xF))
+	if (!_ep || !_ep->desc || !(_ep->desc->bEndpointAddress&0xF))
 		return -ENODEV;
 
 	ep = container_of(_ep, struct fsl_ep, ep);
-- 
2.7.4


^ permalink raw reply related

* Re: [PATCH v6 02/11] mm/gup: Use functions to track lockless pgtbl walks on gup_pgd_range
From: Aneesh Kumar K.V @ 2020-10-16  3:27 UTC (permalink / raw)
  To: Michal Suchánek, Leonardo Bras
  Cc: Christophe Leroy, linux-arch, linux-kernel, Arnd Bergmann,
	Greg Kroah-Hartman, kvm-ppc, linuxppc-dev, Nicholas Piggin,
	Steven Price, Mahesh Salgaonkar, linux-mm, Paul Mackerras,
	Allison Randal, Andrew Morton, Mike Rapoport, Robin Murphy,
	Thomas Gleixner, Reza Arbab
In-Reply-To: <20201015144641.GE29778@kitsune.suse.cz>

Hi Michal,

On 10/15/20 8:16 PM, Michal Suchánek wrote:
> Hello,
> 
> On Thu, Feb 06, 2020 at 12:25:18AM -0300, Leonardo Bras wrote:
>> On Thu, 2020-02-06 at 00:08 -0300, Leonardo Bras wrote:
>>>                  gup_pgd_range(addr, end, gup_flags, pages, &nr);
>>> -               local_irq_enable();
>>> +               end_lockless_pgtbl_walk(IRQS_ENABLED);
>>>                  ret = nr;
>>>          }
>>>   
>>
>> Just noticed IRQS_ENABLED is not available on other archs than ppc64.
>> I will fix this for v7.
> 
> Has threre been v7?
> 
> I cannot find it.
> 
> Thanks
> 
> Michal
> 

https://lore.kernel.org/linuxppc-dev/20200505071729.54912-1-aneesh.kumar@linux.ibm.com

This series should help here.

-aneesh

^ permalink raw reply

* [GIT PULL] Please pull powerpc/linux.git powerpc-5.10-1 tag
From: Michael Ellerman @ 2020-10-16  3:24 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: ego, steve, srikar, ravi.bangoria, peterz, jniethe5, mahesh,
	liushixin2, oohall, fthain, hofrat, hch, leobras.c, aneesh.kumar,
	wangwensheng4, joel, yangyingliang, naveen.n.rao, mrochs,
	zhengbin13, nathanl, biwen.li, ajd, sfr, kjain, npiggin, cai, clg,
	vaibhav, dja, atrajeev, gromero, cheloha, yanaijie, linux-kernel,
	leoyang.li, wsa, miaoqinglang, fbarrat, colin.king, linuxppc-dev,
	davem, bauerman

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Hi Linus,

Please pull powerpc updates for 5.10.

Just two minor conflicts I'm aware of. The only slight subtlety is the conflict
in kasan_init() where "int ret" needs to move out of the for_each_mem_range()
and up to the function scope.

Notable out of area changes:
  arch/sparc/kernel/smp_64.c	# bafb056ce279 sparc64: remove mm_cpumask clearing to fix kthread_use_mm race
  fs/exec.c			# d53c3dfb23c4 mm: fix exec activate_mm vs TLB shootdown and lazy tlb switching race
  include/uapi/linux/mman.h	# e47168f3d1b1 powerpc/8xx: Support 16k hugepages with 4k pages
  include/uapi/asm-generic/hugetlb_encode.h	# as above

cheers


The following changes since commit d012a7190fc1fd72ed48911e77ca97ba4521bccd:

  Linux 5.9-rc2 (2020-08-23 14:08:43 -0700)

are available in the git repository at:

  https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git tags/powerpc-5.10-1

for you to fetch changes up to ffd0b25ca049a477cb757e5bcf2d5e1664d12e5d:

  Revert "powerpc/pci: unmap legacy INTx interrupts when a PHB is removed" (2020-10-15 13:42:49 +1100)


- ------------------------------------------------------------------
powerpc updates for 5.10

 - A series from Nick adding ARCH_WANT_IRQS_OFF_ACTIVATE_MM & selecting it for
   powerpc, as well as a related fix for sparc.

 - Remove support for PowerPC 601.

 - Some fixes for watchpoints & addition of a new ptrace flag for detecting ISA
   v3.1 (Power10) watchpoint features.

 - A fix for kernels using 4K pages and the hash MMU on bare metal Power9
   systems with > 16TB of RAM, or RAM on the 2nd node.

 - A basic idle driver for shallow stop states on Power10.

 - Tweaks to our sched domains code to better inform the scheduler about the
   hardware topology on Power9/10, where two SMT4 cores can be presented by
   firmware as an SMT8 core.

 - A series doing further reworks & cleanups of our EEH code.

 - Addition of a filter for RTAS (firmware) calls done via sys_rtas(), to
   prevent root from overwriting kernel memory.

 - Other smaller features, fixes & cleanups.

Thanks to:
  Alexey Kardashevskiy, Andrew Donnellan, Aneesh Kumar K.V, Athira Rajeev, Biwen
  Li, Cameron Berkenpas, Cédric Le Goater, Christophe Leroy, Christoph Hellwig,
  Colin Ian King, Daniel Axtens, David Dai, Finn Thain, Frederic Barrat, Gautham
  R. Shenoy, Greg Kurz, Gustavo Romero, Ira Weiny, Jason Yan, Joel Stanley,
  Jordan Niethe, Kajol Jain, Konrad Rzeszutek Wilk, Laurent Dufour, Leonardo
  Bras, Liu Shixin, Luca Ceresoli, Madhavan Srinivasan, Mahesh Salgaonkar,
  Nathan Lynch, Nicholas Mc Guire, Nicholas Piggin, Nick Desaulniers, Oliver
  O'Halloran, Pedro Miraglia Franco de Carvalho, Pratik Rajesh Sampat, Qian Cai,
  Qinglang Miao, Ravi Bangoria, Russell Currey, Satheesh Rajendran, Scott
  Cheloha, Segher Boessenkool, Srikar Dronamraju, Stan Johnson, Stephen Kitt,
  Stephen Rothwell, Thiago Jung Bauermann, Tyrel Datwyler, Vaibhav Jain,
  Vaidyanathan Srinivasan, Vasant Hegde, Wang Wensheng, Wolfram Sang, Yang
  Yingliang, zhengbin.

- ------------------------------------------------------------------
Andrew Donnellan (2):
      powerpc/rtas: Restrict RTAS requests from userspace
      selftests/powerpc: Add a rtas_filter selftest

Aneesh Kumar K.V (11):
      powerpc/vmemmap: Fix memory leak with vmemmap list allocation failures.
      powerpc/vmemmap: Don't warn if we don't find a mapping vmemmap list entry
      powerpc/percpu: Update percpu bootmem allocator
      powerpc/64/mm: implement page mapping percpu first chunk allocator
      powerpc/book3s64/hash/4k: Support large linear mapping range with 4K
      powerpc/mm/book3s: Split radix and hash MAX_PHYSMEM limit
      powerepc/book3s64/hash: Align start/end address correctly with bolt mapping
      powerpc/drmem: Make lmb_size 64 bit
      powerpc/memhotplug: Make lmb size 64bit
      powerpc/book3s64/radix: Make radix_mem_block_size 64bit
      powerpc/lmb-size: Use addr #size-cells value when fetching lmb-size

Athira Rajeev (1):
      powerpc/perf: Exclude pmc5/6 from the irrelevant PMU group constraints

Biwen Li (2):
      powerpc/dts/t4240rdb: remove interrupts property
      powerc/dtc/t1024rdb: remove interrupts property

Christoph Hellwig (1):
      powerpc: switch 85xx defconfigs from legacy ide to libata

Christophe Leroy (52):
      powerpc/32s: Fix assembler warning about r0
      powerpc/hwirq: Remove stale forward irq_chip declaration
      powerpc/irq: Drop forward declaration of struct irqaction
      powerpc/fpu: Drop cvt_fd() and cvt_df()
      powerpc: drop hard_reset_now() and poweroff_now() declaration
      powerpc: Drop _nmask_and_or_msr()
      powerpc: Remove flush_instruction_cache for book3s/32
      powerpc: Move flush_instruction_cache() prototype in asm/cacheflush.h
      powerpc: Rewrite 4xx flush_cache_instruction() in C
      powerpc: Rewrite FSL_BOOKE flush_cache_instruction() in C
      powerpc: Remove flush_instruction_cache() on 8xx
      powerpc/uaccess: Use flexible addressing with __put_user()/__get_user()
      powerpc/uaccess: Add pre-update addressing to __get_user_asm() and __put_user_asm()
      powerpc/process: Remove unnecessary #ifdef CONFIG_FUNCTION_GRAPH_TRACER
      powerpc: Fix random segfault when freeing hugetlb range
      powerpc/8xx: Refactor calculation of number of entries per PTE in page tables
      powerpc/8xx: Support 16k hugepages with 4k pages
      powerpc/uaccess: Add pre-update addressing to __put_user_asm_goto()
      powerpc/uaccess: Switch __put_user_size_allowed() to __put_user_asm_goto()
      powerpc/uaccess: Switch __patch_instruction() to __put_user_asm_goto()
      powerpc/uaccess: Remove __put_user_asm() and __put_user_asm2()
      powerpc/32: Fix vmap stack - Do not activate MMU before reading task struct
      powerpc/32: Fix vmap stack - Properly set r1 before activating MMU
      powerpc/process: Replace an #ifdef CONFIG_PPC_47x by IS_ENABLED()
      powerpc/process: Replace an #ifdef CONFIG_PPC_BOOK3S_64 by IS_ENABLED()
      powerpc/process: Replace an #if defined(CONFIG_4xx) || defined(CONFIG_BOOKE) by IS_ENABLED()
      powerpc/process: Replace #ifdef CONFIG_KALLSYMS by IS_ENABLED()
      powerpc/process: Tag an #endif to help locate the matching #ifdef.
      powerpc/process: Remove useless #ifdef CONFIG_VSX
      powerpc/process: Remove useless #ifdef CONFIG_ALTIVEC
      powerpc/process: Remove useless #ifdef CONFIG_SPE
      powerpc/process: Remove useless #ifdef CONFIG_PPC_FPU
      powerpc/powermac: Fix low_sleep_handler with KUAP and KUEP
      powerpc/kasan: Fix CONFIG_KASAN_VMALLOC for 8xx
      powerpc: Remove SYNC on non 6xx
      powerpc: Remove CONFIG_PPC601_SYNC_FIX
      powerpc: Drop SYNC_601() ISYNC_601() and SYNC()
      powerpc: Remove PowerPC 601
      powerpc: Remove support for PowerPC 601
      powerpc: Tidy up a bit after removal of PowerPC 601.
      powerpc: Remove __USE_RTC()
      powerpc: Remove get_tb_or_rtc()
      powerpc/time: Remove ifdef in get_dec() and set_dec()
      powerpc/32s: Setup the early hash table at all time.
      powerpc/32s: Rename head_32.S to head_book3s_32.S
      powerpc/32s: Remove #ifdef CONFIG_PPC_BOOK3S_32 in head_book3s_32.S
      powerpc/time: Rename mftbl() to mftb()
      powerpc/time: Make mftb() common to PPC32 and PPC64
      powerpc/time: Avoid using get_tbl() and get_tbu() internally
      powerpc/time: Remove get_tbu()
      powerpc/time: Make get_tbl() common to PPC32 and PPC64
      powerpc/time: Make get_tb() common to PPC32 and PPC64

Colin Ian King (2):
      powerpc/oprofile: fix spelling mistake "contex" -> "context"
      macintosh: windfarm: remove detatch debug containing spelling mistakes

Cédric Le Goater (5):
      powerpc/pci: unmap legacy INTx interrupts when a PHB is removed
      powerpc/sysfs: Remove unused 'err' variable in sysfs_create_dscr_default()
      powerpc/sstep: Remove empty if statement checking for invalid form
      powerpc/xive: Make debug routines static
      powerpc/32: Declare stack_overflow_exception() prototype

Daniel Axtens (1):
      powerpc: PPC_SECURE_BOOT should not require PowerNV

Finn Thain (5):
      powerpc/tau: Use appropriate temperature sample interval
      powerpc/tau: Convert from timer to workqueue
      powerpc/tau: Remove duplicated set_thresholds() call
      powerpc/tau: Check processor type before enabling TAU interrupt
      powerpc/tau: Disable TAU between measurements

Frederic Barrat (5):
      scsi: cxlflash: Access interrupt trigger page from xive directly
      ocxl: Access interrupt trigger page from xive directly
      ocxl: Don't return trigger page when allocating an interrupt
      ocxl: Remove custom service to allocate interrupts
      cxl: Rework error message for incompatible slots

Gustavo Romero (1):
      powerpc/tm: Save and restore AMR on treclaim and trechkpt

Jason Yan (1):
      powerpc/ps3: make two symbols static

Joel Stanley (2):
      powerpc/powernv: Print helpful message when cores guarded
      powerpc: Warn about use of smt_snooze_delay

Jordan Niethe (3):
      powerpc/boot: Update Makefile comment for 64bit wrapper
      selftests/powerpc: Fix prefixes in alignment_handler signal handler
      powerpc: Update documentation of ISA versions for Power10

Kajol Jain (5):
      powerpc/perf/hv-gpci: Fix starting index value
      Documentation/ABI: Add ABI documentation for hv-24x7 format
      Documentation/ABI: Add ABI documentation for hv-gpci format
      powerpc/perf/hv-gpci: Add cpu hotplug support
      powerpc/hv-gpci: Add sysfs files inside hv-gpci device to show cpumask

Leonardo Bras (4):
      powerpc/pseries/iommu: Create defines for operations in ibm, ddw-applicable
      powerpc/pseries/iommu: Update call to ibm, query-pe-dma-windows
      powerpc/pseries/iommu: Move window-removing part of remove_ddw into remove_dma_window
      powerpc/pseries/iommu: Allow bigger 64bit window by removing default DMA window

Liu Shixin (1):
      powerpc/pseries: convert to use DEFINE_SEQ_ATTRIBUTE macro

Mahesh Salgaonkar (1):
      powerpc/powernv/elog: Fix race while processing OPAL error log event.

Michael Ellerman (24):
      selftests/powerpc: Fix TM tests when CPU 0 is offline
      selftests/powerpc: Don't use setaffinity in tm-tmspr
      selftests/powerpc: Run tm-tmspr test for longer
      selftests/powerpc: Make using_hash_mmu() work on Cell & PowerMac
      selftests/powerpc: Give the bad_accesses test longer to run
      selftests/powerpc: Move set_dscr() into rfi_flush.c
      selftests/powerpc: Include asm/cputable.h from utils.h
      selftests/powerpc: Don't run DSCR tests on old systems
      selftests/powerpc: Skip security tests on older CPUs
      selftests/powerpc: Skip L3 bank test on older CPUs
      selftests/powerpc: Don't touch VMX/VSX on older CPUs
      selftests/powerpc: Properly handle failure in switch_endian_test
      powerpc/64: Remove unused generic_secondary_thread_init()
      Merge branch 'fixes' into next
      powerpc/64: Make VDSO32 track COMPAT on 64-bit
      Merge coregroup support into next
      powerpc/process: Fix uninitialised variable error
      Merge branch 'topic/irqs-off-activate-mm' into next
      powerpc/mm/64s: Fix slb_setup_new_exec() sparse warning
      powerpc/perf: Add declarations to fix sparse warnings
      powerpc: Move arch_cpu_idle_dead() into smp.c
      powerpc/smp: Fold cpu_die() into its only caller
      powerpc/smp: Move ppc_md.cpu_die() to smp_ops.cpu_offline_self()
      powerpc/prom_init: Check display props exist before enabling btext

Nathan Lynch (1):
      powerpc/pseries: explicitly reschedule during drmem_lmb list traversal

Nicholas Mc Guire (2):
      powerpc/pseries: Fix missing of_node_put() in rng_init()
      powerpc/icp-hv: Fix missing of_node_put() in success path

Nicholas Piggin (15):
      powerpc/64s: handle ISA v3.1 local copy-paste context switches
      powerpc/powernv/idle: add a basic stop 0-3 driver for POWER10
      mm: fix exec activate_mm vs TLB shootdown and lazy tlb switching race
      powerpc: select ARCH_WANT_IRQS_OFF_ACTIVATE_MM
      sparc64: remove mm_cpumask clearing to fix kthread_use_mm race
      powerpc/64s/radix: Fix mm_cpumask trimming race vs kthread_use_mm
      powerpc: untangle cputable mce include
      powerpc/64s: Add cp_abort after tlbiel to invalidate copy-buffer address
      powerpc/pseries: add new branch prediction security bits for link stack
      powerpc/64: fix irq replay missing preempt
      powerpc/64: fix irq replay pt_regs->softe value
      powerpc/64e: remove PACA_IRQ_EE_EDGE
      powerpc/64e: remove 64s specific interrupt soft-mask code
      powerpc/64: make restore_interrupts 64e only
      powerpc/security: Fix link stack flush instruction

Oliver O'Halloran (18):
      powerpc/powernv/smp: Fix spurious DBG() warning
      powerpc/powernv: Include asm/powernv.h from the local powernv.h
      powerpc/powernv: Staticify functions without prototypes
      powerpc/powernv: Fix spurious kerneldoc warnings in opal-prd.c
      powerpc/nx: Don't pack struct coprocessor_request_block
      powerpc/pseries/eeh: Fix dumb linebreaks
      powerpc/eeh: Rework EEH initialisation
      powerpc/powernv: Stop using eeh_ops->init()
      powerpc/pseries: Stop using eeh_ops->init()
      powerpc/eeh: Delete eeh_ops->init
      powerpc/eeh: Move EEH initialisation to an arch initcall
      powerpc/pseries/eeh: Clean up pe_config_addr lookups
      powerpc/pseries/eeh: Rework device EEH PE determination
      powerpc/pseries/eeh: Allow zero to be a valid PE configuration address
      powerpc/eeh: Clean up PE addressing
      powerpc/eeh: Delete eeh_pe->config_addr
      powerpc/pseries/eeh: Fix use of uninitialised variable
      selftests/powerpc: Fix eeh-basic.sh exit codes

Qian Cai (1):
      Revert "powerpc/pci: unmap legacy INTx interrupts when a PHB is removed"

Qinglang Miao (5):
      macintosh: windfarm: use for_each_child_of_node() macro
      drivers/macintosh/smu.c: use for_each_child_of_node() macro
      macintosh: smu_sensors: use for_each_child_of_node() macro
      serial: pmac_zilog: use for_each_child_of_node() macro
      powerpc/powernv: fix wrong warning message in opalcore_config_init()

Ravi Bangoria (8):
      powerpc/watchpoint: Fix quadword instruction handling on p10 predecessors
      powerpc/watchpoint: Fix handling of vector instructions
      powerpc/watchpoint/ptrace: Fix SETHWDEBUG when CONFIG_HAVE_HW_BREAKPOINT=N
      powerpc/watchpoint: Move DAWR detection logic outside of hw_breakpoint.c
      powerpc/watchpoint: Fix exception handling for CONFIG_HAVE_HW_BREAKPOINT=N
      powerpc/watchpoint: Add hw_len wherever missing
      powerpc/watchpoint/ptrace: Introduce PPC_DEBUG_FEATURE_DATA_BP_ARCH_31
      selftests/powerpc: Tests for kernel accessing user memory

Russell Currey (1):
      powerpc/tools: Remove 90 line limit in checkpatch script

Scott Cheloha (4):
      powerpc/perf: consolidate GPCI hcall structs into asm/hvcall.h
      powerpc/pseries: new lparcfg key/value pair: partition_affinity_score
      pseries/drmem: don't cache node id in drmem_lmb struct
      pseries/hotplug-memory: hot-add: skip redundant LMB lookup

Srikar Dronamraju (28):
      sched/topology: Allow archs to override cpu_smt_mask
      powerpc/topology: Override cpu_smt_mask
      powerpc/numa: Restrict possible nodes based on platform
      powerpc/numa: Set numa_node for all possible cpus
      powerpc/numa: Prefer node id queried from vphn
      powerpc/numa: Offline memoryless cpuless node 0
      powerpc/smp: Fix a warning under !NEED_MULTIPLE_NODES
      powerpc/smp: Merge Power9 topology with Power topology
      powerpc/smp: Move powerpc_topology above
      powerpc/smp: Move topology fixups into a new function
      powerpc/smp: Dont assume l2-cache to be superset of sibling
      powerpc/smp: Optimize start_secondary
      powerpc/numa: Detect support for coregroup
      powerpc/smp: Allocate cpumask only after searching thread group
      powerpc/smp: Create coregroup domain
      powerpc/smp: Implement cpu_to_coregroup_id
      powerpc/topology: Update topology_core_cpumask
      powerpc/smp: Stop updating cpu_core_mask
      powerpc/smp: Remove get_physical_package_id
      powerpc/smp: Optimize remove_cpu_from_masks
      powerpc/smp: Limit CPUs traversed to within a node.
      powerpc/smp: Stop passing mask to update_mask_by_l2
      powerpc/smp: Depend on cpu_l1_cache_map when adding CPUs
      powerpc/smp: Check for duplicate topologies and consolidate
      powerpc/smp: Optimize update_mask_by_l2
      powerpc/smp: Move coregroup mask updation to a new function
      powerpc/smp: Optimize update_coregroup_mask
      cpufreq: powernv: Fix frame-size-overflow in powernv_cpufreq_reboot_notifier

Stephen Kitt (1):
      powerpc: Use simple i2c probe function

Stephen Rothwell (9):
      powerpc: unrel_branch_check.sh: fix shellcheck complaints
      powerpc: unrel_branch_check.sh: simplify and combine some executions
      powerpc: unrel_branch_check.sh: simplify objdump's asm output
      powerpc: unrel_branch_check.sh: convert grep | sed | awk to just sed
      powerpc: unrel_branch_check.sh: simplify and tidy up the final loop
      powerpc: unrel_branch_check.sh: fix up the file header
      powerpc: unrel_branch_check.sh: exit silently for early errors
      powerpc: unrel_branch_check.sh: use nm to find symbol value
      powerpc: unrel_branch_check.sh: enable the use of llvm-objdump v9, 10 or 11

Thiago Jung Bauermann (1):
      powerpc/pseries/svm: Allocate SWIOTLB buffer anywhere in memory

Vaibhav Jain (2):
      powerpc/papr_scm: Fix warning triggered by perf_stats_show()
      powerpc/papr_scm: Add PAPR command family to pass-through command-set

Wang Wensheng (2):
      drivers/macintosh/smu.c: Fix undeclared symbol warning
      powerpc/papr_scm: Fix warnings about undeclared variable

Yang Yingliang (1):
      powerpc/book3s64: fix link error with CONFIG_PPC_RADIX_MMU=n

zhengbin (3):
      powerpc/fadump: Remove set but not used variable 'elf'
      powerpc/perf: Remove set but not used variable 'target'
      powerpc/powernv: Remove set but not used variable 'parent'


 Documentation/ABI/testing/sysfs-bus-event_source-devices-hv_24x7   |  25 ++
 Documentation/ABI/testing/sysfs-bus-event_source-devices-hv_gpci   |  38 ++
 Documentation/powerpc/isa-versions.rst                             |   4 +
 Documentation/powerpc/ptrace.rst                                   |   1 +
 arch/Kconfig                                                       |   7 +
 arch/powerpc/Kconfig                                               |  21 +-
 arch/powerpc/Makefile                                              |   3 +-
 arch/powerpc/Makefile.postlink                                     |   2 +-
 arch/powerpc/boot/Makefile                                         |   2 +-
 arch/powerpc/boot/dts/fsl/t1024rdb.dts                             |   1 -
 arch/powerpc/boot/dts/fsl/t4240rdb.dts                             |   1 -
 arch/powerpc/boot/util.S                                           |  15 +-
 arch/powerpc/configs/85xx/mpc85xx_cds_defconfig                    |   6 +-
 arch/powerpc/configs/85xx/tqm8540_defconfig                        |   6 +-
 arch/powerpc/configs/85xx/tqm8541_defconfig                        |   6 +-
 arch/powerpc/configs/85xx/tqm8555_defconfig                        |   6 +-
 arch/powerpc/configs/85xx/tqm8560_defconfig                        |   6 +-
 arch/powerpc/include/asm/asm-prototypes.h                          |   5 +-
 arch/powerpc/include/asm/book3s/64/hash-4k.h                       |  18 +-
 arch/powerpc/include/asm/book3s/64/hash-64k.h                      |  13 +
 arch/powerpc/include/asm/book3s/64/mmu-hash.h                      |   4 +-
 arch/powerpc/include/asm/book3s/64/mmu.h                           |  17 +-
 arch/powerpc/include/asm/book3s/64/pgtable.h                       |   7 +
 arch/powerpc/include/asm/book3s/64/radix.h                         |  16 +
 arch/powerpc/include/asm/cacheflush.h                              |  10 +
 arch/powerpc/include/asm/cputable.h                                |  18 +-
 arch/powerpc/include/asm/cputhreads.h                              |   1 -
 arch/powerpc/include/asm/delay.h                                   |   2 +-
 arch/powerpc/include/asm/drmem.h                                   |  43 +--
 arch/powerpc/include/asm/eeh.h                                     |   9 +-
 arch/powerpc/include/asm/hvcall.h                                  |  38 ++
 arch/powerpc/include/asm/hw_breakpoint.h                           |  12 +
 arch/powerpc/include/asm/hw_irq.h                                  |  11 +-
 arch/powerpc/include/asm/icswx.h                                   |   6 +-
 arch/powerpc/include/asm/irq.h                                     |   1 -
 arch/powerpc/include/asm/machdep.h                                 |   3 -
 arch/powerpc/include/asm/mmu_context.h                             |   2 +-
 arch/powerpc/include/asm/nohash/32/hugetlb-8xx.h                   |  14 +
 arch/powerpc/include/asm/nohash/32/pgtable.h                       |  20 +-
 arch/powerpc/include/asm/pnv-ocxl.h                                |   3 -
 arch/powerpc/include/asm/ppc_asm.h                                 |  13 +-
 arch/powerpc/include/asm/processor.h                               |   9 +-
 arch/powerpc/include/asm/ptrace.h                                  |   4 -
 arch/powerpc/include/asm/reg.h                                     |  20 +-
 arch/powerpc/include/asm/reg_booke.h                               |   1 -
 arch/powerpc/include/asm/smp.h                                     |  24 +-
 arch/powerpc/include/asm/svm.h                                     |   4 +
 arch/powerpc/include/asm/synch.h                                   |  19 +-
 arch/powerpc/include/asm/time.h                                    |  86 +----
 arch/powerpc/include/asm/timex.h                                   |   3 -
 arch/powerpc/include/asm/tlb.h                                     |  13 -
 arch/powerpc/include/asm/topology.h                                |  20 +-
 arch/powerpc/include/asm/uaccess.h                                 |  75 ++--
 arch/powerpc/include/uapi/asm/ptrace.h                             |   1 +
 arch/powerpc/kernel/Makefile                                       |   6 +-
 arch/powerpc/kernel/asm-offsets.c                                  |   1 +
 arch/powerpc/kernel/btext.c                                        |  17 +-
 arch/powerpc/kernel/cputable.c                                     |  16 +-
 arch/powerpc/kernel/dt_cpu_ftrs.c                                  |   1 +
 arch/powerpc/kernel/eeh.c                                          | 145 +++-----
 arch/powerpc/kernel/eeh_pe.c                                       |  50 +--
 arch/powerpc/kernel/entry_32.S                                     |  35 +-
 arch/powerpc/kernel/entry_64.S                                     |   8 +-
 arch/powerpc/kernel/exceptions-64e.S                               |  11 -
 arch/powerpc/kernel/fadump.c                                       |   2 -
 arch/powerpc/kernel/fpu.S                                          |  16 -
 arch/powerpc/kernel/head_32.h                                      |  73 ++--
 arch/powerpc/kernel/head_40x.S                                     |   1 -
 arch/powerpc/kernel/head_64.S                                      |   7 +-
 arch/powerpc/kernel/{head_32.S => head_book3s_32.S}                |  93 +----
 arch/powerpc/kernel/head_booke.h                                   |   1 -
 arch/powerpc/kernel/hw_breakpoint.c                                | 149 +-------
 arch/powerpc/kernel/hw_breakpoint_constraints.c                    | 162 +++++++++
 arch/powerpc/kernel/idle.c                                         |   8 -
 arch/powerpc/kernel/irq.c                                          |  73 ++--
 arch/powerpc/kernel/l2cr_6xx.S                                     |   3 +-
 arch/powerpc/kernel/misc_32.S                                      |  48 ---
 arch/powerpc/kernel/misc_64.S                                      |   1 -
 arch/powerpc/kernel/process.c                                      | 149 ++++----
 arch/powerpc/kernel/prom.c                                         |   5 +
 arch/powerpc/kernel/prom_init.c                                    |  17 +-
 arch/powerpc/kernel/ptrace/ptrace-noadv.c                          |   9 +-
 arch/powerpc/kernel/rtas.c                                         | 153 ++++++++
 arch/powerpc/kernel/security.c                                     |  34 +-
 arch/powerpc/kernel/setup_32.c                                     |   2 +-
 arch/powerpc/kernel/setup_64.c                                     | 105 +++++-
 arch/powerpc/kernel/smp.c                                          | 374 ++++++++++++-------
 arch/powerpc/kernel/sysfs.c                                        |  49 ++-
 arch/powerpc/kernel/tau_6xx.c                                      | 147 +++-----
 arch/powerpc/kernel/time.c                                         |  62 +---
 arch/powerpc/kernel/tm.S                                           |  35 +-
 arch/powerpc/kernel/traps.c                                        |   4 -
 arch/powerpc/kernel/vdso32/datapage.S                              |   2 -
 arch/powerpc/kernel/vdso32/vdso32.lds.S                            |   2 -
 arch/powerpc/kvm/book3s_hv.c                                       |   7 +
 arch/powerpc/kvm/book3s_hv_rmhandlers.S                            |   8 +
 arch/powerpc/lib/code-patching.c                                   |  17 +-
 arch/powerpc/lib/sstep.c                                           |   9 +-
 arch/powerpc/mm/book3s32/hash_low.S                                |  21 +-
 arch/powerpc/mm/book3s32/mmu.c                                     |  94 ++---
 arch/powerpc/mm/book3s64/hash_native.c                             |   8 +-
 arch/powerpc/mm/book3s64/hash_utils.c                              |  12 +-
 arch/powerpc/mm/book3s64/internal.h                                |   2 +
 arch/powerpc/mm/book3s64/mmu_context.c                             |   4 +-
 arch/powerpc/mm/book3s64/radix_pgtable.c                           |  10 +-
 arch/powerpc/mm/book3s64/radix_tlb.c                               |  35 +-
 arch/powerpc/mm/book3s64/slb.c                                     |   4 +-
 arch/powerpc/mm/drmem.c                                            |   6 +-
 arch/powerpc/mm/hugetlbpage.c                                      |  20 +-
 arch/powerpc/mm/init_64.c                                          |  39 +-
 arch/powerpc/mm/kasan/kasan_init_32.c                              |  31 +-
 arch/powerpc/mm/mem.c                                              |   6 +-
 arch/powerpc/mm/nohash/8xx.c                                       |   7 -
 arch/powerpc/mm/nohash/fsl_booke.c                                 |  16 +
 arch/powerpc/mm/nohash/tlb.c                                       |   4 -
 arch/powerpc/mm/numa.c                                             | 101 +++++-
 arch/powerpc/mm/pgtable.c                                          |   6 +-
 arch/powerpc/mm/ptdump/8xx.c                                       |   5 +
 arch/powerpc/mm/ptdump/bats.c                                      |  59 ---
 arch/powerpc/oprofile/cell/spu_task_sync.c                         |   2 +-
 arch/powerpc/perf/hv-gpci-requests.h                               |   6 +-
 arch/powerpc/perf/hv-gpci.c                                        |  73 +++-
 arch/powerpc/perf/hv-gpci.h                                        |  27 --
 arch/powerpc/perf/imc-pmu.c                                        |   3 -
 arch/powerpc/perf/isa207-common.c                                  |  10 +
 arch/powerpc/perf/isa207-common.h                                  |   2 +
 arch/powerpc/perf/power10-pmu.c                                    |   1 -
 arch/powerpc/perf/power5+-pmu.c                                    |   2 +
 arch/powerpc/perf/power5-pmu.c                                     |   2 +
 arch/powerpc/perf/power6-pmu.c                                     |   2 +
 arch/powerpc/perf/power7-pmu.c                                     |   2 +
 arch/powerpc/perf/ppc970-pmu.c                                     |   2 +
 arch/powerpc/platforms/44x/machine_check.c                         |   1 +
 arch/powerpc/platforms/44x/ppc476.c                                |   5 +-
 arch/powerpc/platforms/83xx/mcu_mpc8349emitx.c                     |   4 +-
 arch/powerpc/platforms/85xx/smp.c                                  |   4 +-
 arch/powerpc/platforms/Kconfig                                     |  29 +-
 arch/powerpc/platforms/Kconfig.cputype                             |  18 +-
 arch/powerpc/platforms/embedded6xx/mpc7448_hpc2.c                  |   3 +-
 arch/powerpc/platforms/embedded6xx/storcenter.c                    |   3 +-
 arch/powerpc/platforms/powermac/pmac.h                             |   2 +-
 arch/powerpc/platforms/powermac/setup.c                            |   2 +-
 arch/powerpc/platforms/powermac/sleep.S                            |  15 +-
 arch/powerpc/platforms/powermac/smp.c                              |  12 +-
 arch/powerpc/platforms/powernv/eeh-powernv.c                       |  98 +++--
 arch/powerpc/platforms/powernv/idle.c                              | 302 +++++++++++-----
 arch/powerpc/platforms/powernv/ocxl.c                              |  30 --
 arch/powerpc/platforms/powernv/opal-core.c                         |   2 +-
 arch/powerpc/platforms/powernv/opal-elog.c                         |  33 +-
 arch/powerpc/platforms/powernv/opal-msglog.c                       |   2 +
 arch/powerpc/platforms/powernv/opal-prd.c                          |   2 +-
 arch/powerpc/platforms/powernv/pci-ioda.c                          |   8 -
 arch/powerpc/platforms/powernv/powernv.h                           |   7 +
 arch/powerpc/platforms/powernv/rng.c                               |   2 +-
 arch/powerpc/platforms/powernv/setup.c                             |  24 ++
 arch/powerpc/platforms/powernv/smp.c                               |   6 +-
 arch/powerpc/platforms/powernv/vas-window.c                        |   9 +-
 arch/powerpc/platforms/ps3/spu.c                                   |   4 +-
 arch/powerpc/platforms/pseries/eeh_pseries.c                       | 376 +++++++-------------
 arch/powerpc/platforms/pseries/hotplug-cpu.c                       |   6 +-
 arch/powerpc/platforms/pseries/hotplug-memory.c                    |  82 +++--
 arch/powerpc/platforms/pseries/hvCall_inst.c                       |  23 +-
 arch/powerpc/platforms/pseries/iommu.c                             | 242 ++++++++++---
 arch/powerpc/platforms/pseries/lpar.c                              |   2 +
 arch/powerpc/platforms/pseries/lparcfg.c                           |  35 ++
 arch/powerpc/platforms/pseries/papr_scm.c                          |  10 +-
 arch/powerpc/platforms/pseries/rng.c                               |   1 +
 arch/powerpc/platforms/pseries/setup.c                             |   6 +
 arch/powerpc/platforms/pseries/svm.c                               |  26 ++
 arch/powerpc/sysdev/xics/icp-hv.c                                  |   1 +
 arch/powerpc/sysdev/xive/common.c                                  |   4 +-
 arch/powerpc/tools/checkpatch.sh                                   |   1 -
 arch/powerpc/tools/unrel_branch_check.sh                           | 125 ++++---
 arch/powerpc/xmon/xmon.c                                           |   1 +
 arch/sparc/kernel/smp_64.c                                         |  65 +---
 drivers/cpufreq/powernv-cpufreq.c                                  |   9 +-
 drivers/cpuidle/cpuidle-powernv.c                                  |   2 +-
 drivers/macintosh/smu.c                                            |   4 +-
 drivers/macintosh/windfarm_lm75_sensor.c                           |   2 -
 drivers/macintosh/windfarm_lm87_sensor.c                           |   2 -
 drivers/macintosh/windfarm_smu_sat.c                               |   3 +-
 drivers/macintosh/windfarm_smu_sensors.c                           |   3 +-
 drivers/misc/cxl/pci.c                                             |   4 +-
 drivers/misc/ocxl/Kconfig                                          |   2 +-
 drivers/misc/ocxl/afu_irq.c                                        |  12 +-
 drivers/misc/ocxl/link.c                                           |  15 +-
 drivers/scsi/cxlflash/ocxl_hw.c                                    |  21 +-
 drivers/scsi/cxlflash/ocxl_hw.h                                    |   1 -
 fs/exec.c                                                          |  17 +-
 include/linux/cpuhotplug.h                                         |   1 +
 include/linux/topology.h                                           |   2 +-
 include/misc/ocxl.h                                                |  10 +-
 include/uapi/asm-generic/hugetlb_encode.h                          |   1 +
 include/uapi/linux/mman.h                                          |   1 +
 tools/testing/selftests/powerpc/alignment/alignment_handler.c      |  12 +-
 tools/testing/selftests/powerpc/benchmarks/context_switch.c        |   6 +
 tools/testing/selftests/powerpc/dscr/Makefile                      |   2 +-
 tools/testing/selftests/powerpc/dscr/dscr_default_test.c           |   2 +
 tools/testing/selftests/powerpc/dscr/dscr_explicit_test.c          |   2 +
 tools/testing/selftests/powerpc/dscr/dscr_inherit_exec_test.c      |   2 +
 tools/testing/selftests/powerpc/dscr/dscr_inherit_test.c           |   2 +
 tools/testing/selftests/powerpc/dscr/dscr_sysfs_test.c             |   2 +
 tools/testing/selftests/powerpc/dscr/dscr_sysfs_thread_test.c      |   2 +
 tools/testing/selftests/powerpc/dscr/dscr_user_test.c              |   2 +
 tools/testing/selftests/powerpc/eeh/eeh-basic.sh                   |   9 +-
 tools/testing/selftests/powerpc/include/utils.h                    |   2 +-
 tools/testing/selftests/powerpc/mm/bad_accesses.c                  |   1 +
 tools/testing/selftests/powerpc/pmu/count_stcx_fail.c              |   1 -
 tools/testing/selftests/powerpc/pmu/l3_bank_test.c                 |   3 +
 tools/testing/selftests/powerpc/pmu/per_event_excludes.c           |   2 -
 tools/testing/selftests/powerpc/ptrace/ptrace-hwbreak.c            |  48 ++-
 tools/testing/selftests/powerpc/security/rfi_flush.c               |  38 ++
 tools/testing/selftests/powerpc/security/spectre_v2.c              |   3 +
 tools/testing/selftests/powerpc/stringloops/memcmp.c               |   2 +-
 tools/testing/selftests/powerpc/switch_endian/switch_endian_test.S |  23 +-
 tools/testing/selftests/powerpc/syscalls/Makefile                  |   2 +-
 tools/testing/selftests/powerpc/syscalls/rtas_filter.c             | 285 +++++++++++++++
 tools/testing/selftests/powerpc/tm/tm-poison.c                     |  11 +-
 tools/testing/selftests/powerpc/tm/tm-tmspr.c                      |  10 +-
 tools/testing/selftests/powerpc/tm/tm-trap.c                       |  10 +-
 tools/testing/selftests/powerpc/tm/tm-unavailable.c                |   9 +-
 tools/testing/selftests/powerpc/tm/tm.h                            |   3 +-
 tools/testing/selftests/powerpc/utils.c                            |  39 +-
 223 files changed, 3245 insertions(+), 2491 deletions(-)
 rename arch/powerpc/kernel/{head_32.S => head_book3s_32.S} (94%)
 create mode 100644 arch/powerpc/kernel/hw_breakpoint_constraints.c
 create mode 100644 tools/testing/selftests/powerpc/syscalls/rtas_filter.c
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEEJFGtCPCthwEv2Y/bUevqPMjhpYAFAl+JEgwACgkQUevqPMjh
pYC+qw//UCrTOCAgxAIv4Dx2kmSYxIkrAdeRM0jo2gMOMCaKpeYkWrpW0QSHudik
ecZetcBIPNkXybvzBeBj6B1LNFiH+BdiL+LyUKcUWHQwmvfb7dh0hzjQJKQ+vPci
jDDLWe+jVNvJ30k6e5yczXDJWz/EhoT/u+7fBxfQDEvgXhZGL8l40aqKB5uYiMgl
9Yoq+ORh4BzE/0FF9ubLDlsRdX2AkeKcCgqSbx6nokIbbFokIktu/1stXtzrhSJt
qzf/drz2UZy5sqzT1PBH+1Zv9jkqsMAWniKy6OJWX0SzTk26U2sr86cf8DydI9Ug
MFFQdOxOEoOcPQrbi0vZUknoG9Cmz3MJWFcx427z0aDR5HuMg3S5CCCCfCEATxdN
HoVPRKmhtVfk3JGGANqOP/7KWvmP43Ya2OdOwtl7KIIKKOf14e7UJCahn9CQB+cI
BKTOvpgAv/RgcSEa3LGWLwjWrVyxmF3RLshPfQ0JA26HuLDe6gXHXsrVZaL7wMjV
/ubXq5V1PpiHHNHyU/O4tgV4qNVkqvwQzwZxwwzNqiV+Eh4pXSCINIxTw20JT+Eg
1YjniS1P/OAZgo6dTeMyLzsf7fuLPBlITSzSXWmYaVx9Aq1fMcgfgF0+1sVcgUwz
1fI5jsFxnY6iSEya/4lhlV/PoGwByeXnFv7Ho59ALhvl/Q6zAtU=
=Z++I
-----END PGP SIGNATURE-----

^ permalink raw reply

* Re: linux-next: manual merge of the char-misc tree with the powerpc tree
From: Stephen Rothwell @ 2020-10-15 23:12 UTC (permalink / raw)
  To: Michael Ellerman, PowerPC
  Cc: Arnd Bergmann, Greg KH, Necip Fazil Yildiran,
	Linux Kernel Mailing List, Linux Next Mailing List,
	Frederic Barrat
In-Reply-To: <20201006183506.186a3562@canb.auug.org.au>

[-- Attachment #1: Type: text/plain, Size: 1541 bytes --]

Hi all,

On Tue, 6 Oct 2020 18:35:06 +1100 Stephen Rothwell <sfr@canb.auug.org.au> wrote:
> 
> Today's linux-next merge of the char-misc tree got a conflict in:
> 
>   drivers/misc/ocxl/Kconfig
> 
> between commit:
> 
>   dde6f18a8779 ("ocxl: Don't return trigger page when allocating an interrupt")
> 
> from the powerpc tree and commit:
> 
>   4b53a3c72116 ("ocxl: fix kconfig dependency warning for OCXL")
> 
> from the char-misc tree.
> 
> I fixed it up (see below) and can carry the fix as necessary. This
> is now fixed as far as linux-next is concerned, but any non trivial
> conflicts should be mentioned to your upstream maintainer when your tree
> is submitted for merging.  You may also want to consider cooperating
> with the maintainer of the conflicting tree to minimise any particularly
> complex conflicts.
> 
> diff --cc drivers/misc/ocxl/Kconfig
> index 0d815b2a40b3,947294f6d7f4..000000000000
> --- a/drivers/misc/ocxl/Kconfig
> +++ b/drivers/misc/ocxl/Kconfig
> @@@ -9,9 -9,8 +9,9 @@@ config OCXL_BAS
>   
>   config OCXL
>   	tristate "OpenCAPI coherent accelerator support"
>  -	depends on PPC_POWERNV && PCI && EEH && HOTPLUG_PCI_POWERNV
>  +	depends on PPC_POWERNV && PCI && EEH && PPC_XIVE_NATIVE
> ++	depends on HOTPLUG_PCI_POWERNV
>   	select OCXL_BASE
> - 	select HOTPLUG_PCI_POWERNV
>   	default m
>   	help
>   	  Select this option to enable the ocxl driver for Open

This is now a conflict between the powerpc tree and Linus' tree.

-- 
Cheers,
Stephen Rothwell

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply

* Re: [PATCH 20/20] arch: dts: Fix DWC USB3 DT nodes name
From: Maxime Ripard @ 2020-10-15 14:04 UTC (permalink / raw)
  To: Felipe Balbi
  Cc: Andrew Lunn, linux-usb, Neil Armstrong, Tony Lindgren,
	Bjorn Andersson, Wei Xu, linux-samsung-soc, Kevin Hilman,
	Gregory Clement, Krzysztof Kozlowski, Chen-Yu Tsai, Kukjin Kim,
	Andy Gross, linux-arm-msm, linux-snps-arc, Sebastian Hesselbarth,
	devicetree, Jason Cooper, Mathias Nyman, linux-kernel,
	Lad Prabhakar, Alexey Malahov, Rob Herring, Santosh Shilimkar,
	linux-omap, linux-arm-kernel, Roger Quadros, linux-mips,
	Greg Kroah-Hartman, Yoshihiro Shimoda, linuxppc-dev,
	Patrice Chotard, Serge Semin, Li Yang, Serge Semin, Manu Gautam,
	Benoît Cousson, Shawn Guo, Pavel Parkhomenko
In-Reply-To: <875z7blrqu.fsf@kernel.org>

[-- Attachment #1: Type: text/plain, Size: 1398 bytes --]

On Thu, Oct 15, 2020 at 01:15:37PM +0300, Felipe Balbi wrote:
> Serge Semin <Sergey.Semin@baikalelectronics.ru> writes:
> 
> > On Wed, Oct 14, 2020 at 05:09:37PM +0300, Felipe Balbi wrote:
> >> 
> >> Hi Serge,
> >> 
> >> Serge Semin <Sergey.Semin@baikalelectronics.ru> writes:
> >> > In accordance with the DWC USB3 bindings the corresponding node name is
> >> > suppose to comply with Generic USB HCD DT schema, which requires the USB
> >> 
> >
> >> DWC3 is not a simple HDC, though.
> >
> > Yeah, strictly speaking it is equipped with a lot of vendor-specific stuff,
> > which are tuned by the DWC USB3 driver in the kernel. But after that the
> > controller is registered as xhci-hcd device so it's serviced by the xHCI driver,
> 
> in Dual-role or host-only builds, that's correct. We can also have
> peripheral-only builds (both SW or HW versions) which means xhci isn't
> even in the picture.

It doesn't really matter though, or at least it does for what the new
name might be, but the old one currently used is still pretty bad.

The DT spec says that the node name is the class of the device. "usb" as
the HCD binding mandates is one, but the current nodes currently have
completely different names from one DT to another - which is already an
issue - and most of them have dwc3 or some variant of it, which doesn't
really qualify for a class name.

Maxime

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply

* [Bug 195755] rcu_sched detected stalls on CPUs/tasks: (detected by 0, t=6302 jiffies, g=11405, c=11404, q=1880), ppc64, G5
From: bugzilla-daemon @ 2020-10-15 18:31 UTC (permalink / raw)
  To: linuxppc-dev
In-Reply-To: <bug-195755-206035@https.bugzilla.kernel.org/>

https://bugzilla.kernel.org/show_bug.cgi?id=195755

Marco Descher (marco@descher.at) changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |marco@descher.at

--- Comment #30 from Marco Descher (marco@descher.at) ---
I experienced this problem today, a freeze on an 

processor       : 3
vendor_id       : AuthenticAMD
cpu family      : 22
model           : 48
model name      : AMD GX-412TC SOC

on Debian 10  4.19.0-11-amd64 #1 SMP Debian 4.19.146-1 (2020-09-17) x86_64
GNU/Linux

with more and more sysrq messages coming up resulting in the following syslog
entry

Oct 15 11:43:45 gate kernel: [1545118.045973] rcu: INFO: rcu_sched detected
stalls on CPUs/tasks:

leading to the system becoming unreachable. Only after a reboot this works
again.

-- 
You are receiving this mail because:
You are watching the assignee of the bug.

^ permalink raw reply

* Re: [PATCH 07/20] dt-bindings: usb: xhci: Add Broadcom STB v2 compatible device
From: Florian Fainelli @ 2020-10-15 16:39 UTC (permalink / raw)
  To: Serge Semin, Mathias Nyman, Felipe Balbi, Greg Kroah-Hartman,
	Rob Herring
  Cc: linux-arm-kernel, devicetree, linuxppc-dev, Neil Armstrong,
	Kevin Hilman, Yoshihiro Shimoda, linux-usb, linux-mips,
	Serge Semin, linux-kernel, Manu Gautam, Andy Gross,
	Bjorn Andersson, Pavel Parkhomenko, linux-snps-arc, Lad Prabhakar,
	Alexey Malahov, Roger Quadros
In-Reply-To: <20201014101402.18271-8-Sergey.Semin@baikalelectronics.ru>

On 10/14/20 3:13 AM, Serge Semin wrote:
> For some reason the "brcm,xhci-brcm-v2" compatible string has been missing
> in the original bindings file. Add it to the Generic xHCI Controllers DT
> schema since the controller driver expects it to be supported.
> 
> Signed-off-by: Serge Semin <Sergey.Semin@baikalelectronics.ru>

Acked-by: Florian Fainelli <f.fainelli@gmail.com>
-- 
Florian

^ permalink raw reply

* Re: [PATCH 18/20] arch: dts: Fix EHCI/OHCI DT nodes name
From: Florian Fainelli @ 2020-10-15 16:37 UTC (permalink / raw)
  To: Serge Semin, Mathias Nyman, Felipe Balbi, Greg Kroah-Hartman,
	Rob Herring, Alexey Brodkin, Vineet Gupta, Hauke Mehrtens,
	Rafał Miłecki, bcm-kernel-feedback-list, Wei Xu,
	Vladimir Zapolskiy, Maxime Coquelin, Alexandre Torgue,
	Paul Cercueil, Thomas Bogendoerfer, Matthias Brugger,
	Michael Ellerman, Benjamin Herrenschmidt, Paul Mackerras
  Cc: linux-arm-kernel, devicetree, linuxppc-dev, Neil Armstrong,
	Kevin Hilman, Yoshihiro Shimoda, linux-usb, linux-mips,
	Serge Semin, linux-kernel, Manu Gautam, Andy Gross,
	Bjorn Andersson, Pavel Parkhomenko, linux-mediatek,
	linux-snps-arc, Lad Prabhakar, linux-stm32, Alexey Malahov,
	Roger Quadros
In-Reply-To: <20201014101402.18271-19-Sergey.Semin@baikalelectronics.ru>

On 10/14/20 3:14 AM, Serge Semin wrote:
> In accordance with the Generic EHCI/OHCI bindings the corresponding node
> name is suppose to comply with the Generic USB HCD DT schema, which
> requires the USB nodes to have the name acceptable by the regexp:
> "^usb(@.*)?" . Let's fix the DTS files, which have the nodes defined with
> incompatible names.
> 
> Signed-off-by: Serge Semin <Sergey.Semin@baikalelectronics.ru>
> 
> ---
> 
> Please, test the patch out to make sure it doesn't brake the dependent DTS
> files. I did only a manual grepping of the possible nodes dependencies.
> ---

>  arch/arm/boot/dts/bcm5301x.dtsi                | 4 ++--
>  arch/arm/boot/dts/bcm53573.dtsi                | 4 ++--
Acked-by: Florian Fainelli <f.fainelli@gmail.com>
-- 
Florian

^ permalink raw reply

* [PATCH 3/8] powerpc: Mark functions called inside uaccess blocks w/ 'notrace'
From: Christopher M. Riedl @ 2020-10-15 15:01 UTC (permalink / raw)
  To: linuxppc-dev
In-Reply-To: <20201015150159.28933-1-cmr@codefail.de>

Functions called between user_*_access_begin() and user_*_access_end()
should be either inlined or marked 'notrace' to prevent leaving
userspace access exposed. Mark any such functions relevant to signal
handling so that subsequent patches can call them inside uaccess blocks.

Signed-off-by: Christopher M. Riedl <cmr@codefail.de>
---
 arch/powerpc/kernel/process.c | 20 ++++++++++----------
 arch/powerpc/mm/mem.c         |  4 ++--
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index ba2c987b8403..bf5d9654bd2c 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -84,7 +84,7 @@ extern unsigned long _get_SP(void);
  */
 bool tm_suspend_disabled __ro_after_init = false;
 
-static void check_if_tm_restore_required(struct task_struct *tsk)
+static void notrace check_if_tm_restore_required(struct task_struct *tsk)
 {
 	/*
 	 * If we are saving the current thread's registers, and the
@@ -151,7 +151,7 @@ void notrace __msr_check_and_clear(unsigned long bits)
 EXPORT_SYMBOL(__msr_check_and_clear);
 
 #ifdef CONFIG_PPC_FPU
-static void __giveup_fpu(struct task_struct *tsk)
+static void notrace __giveup_fpu(struct task_struct *tsk)
 {
 	unsigned long msr;
 
@@ -163,7 +163,7 @@ static void __giveup_fpu(struct task_struct *tsk)
 	tsk->thread.regs->msr = msr;
 }
 
-void giveup_fpu(struct task_struct *tsk)
+void notrace giveup_fpu(struct task_struct *tsk)
 {
 	check_if_tm_restore_required(tsk);
 
@@ -177,7 +177,7 @@ EXPORT_SYMBOL(giveup_fpu);
  * Make sure the floating-point register state in the
  * the thread_struct is up to date for task tsk.
  */
-void flush_fp_to_thread(struct task_struct *tsk)
+void notrace flush_fp_to_thread(struct task_struct *tsk)
 {
 	if (tsk->thread.regs) {
 		/*
@@ -234,7 +234,7 @@ static inline void __giveup_fpu(struct task_struct *tsk) { }
 #endif /* CONFIG_PPC_FPU */
 
 #ifdef CONFIG_ALTIVEC
-static void __giveup_altivec(struct task_struct *tsk)
+static void notrace __giveup_altivec(struct task_struct *tsk)
 {
 	unsigned long msr;
 
@@ -246,7 +246,7 @@ static void __giveup_altivec(struct task_struct *tsk)
 	tsk->thread.regs->msr = msr;
 }
 
-void giveup_altivec(struct task_struct *tsk)
+void notrace giveup_altivec(struct task_struct *tsk)
 {
 	check_if_tm_restore_required(tsk);
 
@@ -285,7 +285,7 @@ EXPORT_SYMBOL(enable_kernel_altivec);
  * Make sure the VMX/Altivec register state in the
  * the thread_struct is up to date for task tsk.
  */
-void flush_altivec_to_thread(struct task_struct *tsk)
+void notrace flush_altivec_to_thread(struct task_struct *tsk)
 {
 	if (tsk->thread.regs) {
 		preempt_disable();
@@ -300,7 +300,7 @@ EXPORT_SYMBOL_GPL(flush_altivec_to_thread);
 #endif /* CONFIG_ALTIVEC */
 
 #ifdef CONFIG_VSX
-static void __giveup_vsx(struct task_struct *tsk)
+static void notrace __giveup_vsx(struct task_struct *tsk)
 {
 	unsigned long msr = tsk->thread.regs->msr;
 
@@ -317,7 +317,7 @@ static void __giveup_vsx(struct task_struct *tsk)
 		__giveup_altivec(tsk);
 }
 
-static void giveup_vsx(struct task_struct *tsk)
+static void notrace giveup_vsx(struct task_struct *tsk)
 {
 	check_if_tm_restore_required(tsk);
 
@@ -352,7 +352,7 @@ void enable_kernel_vsx(void)
 }
 EXPORT_SYMBOL(enable_kernel_vsx);
 
-void flush_vsx_to_thread(struct task_struct *tsk)
+void notrace flush_vsx_to_thread(struct task_struct *tsk)
 {
 	if (tsk->thread.regs) {
 		preempt_disable();
diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c
index ddc32cc1b6cf..da2345a2abc6 100644
--- a/arch/powerpc/mm/mem.c
+++ b/arch/powerpc/mm/mem.c
@@ -378,7 +378,7 @@ static inline bool flush_coherent_icache(unsigned long addr)
  * @start: the start address
  * @stop: the stop address (exclusive)
  */
-static void invalidate_icache_range(unsigned long start, unsigned long stop)
+static void notrace invalidate_icache_range(unsigned long start, unsigned long stop)
 {
 	unsigned long shift = l1_icache_shift();
 	unsigned long bytes = l1_icache_bytes();
@@ -402,7 +402,7 @@ static void invalidate_icache_range(unsigned long start, unsigned long stop)
  * @start: the start address
  * @stop: the stop address (exclusive)
  */
-void flush_icache_range(unsigned long start, unsigned long stop)
+void notrace flush_icache_range(unsigned long start, unsigned long stop)
 {
 	if (flush_coherent_icache(start))
 		return;
-- 
2.28.0


^ permalink raw reply related

* [PATCH 1/8] powerpc/uaccess: Add unsafe_copy_from_user
From: Christopher M. Riedl @ 2020-10-15 15:01 UTC (permalink / raw)
  To: linuxppc-dev
In-Reply-To: <20201015150159.28933-1-cmr@codefail.de>

Implement raw_copy_from_user_allowed() which assumes that userspace read
access is open. Use this new function to implement raw_copy_from_user().
Finally, wrap the new function to follow the usual "unsafe_" convention
of taking a label argument. The new raw_copy_from_user_allowed() calls
__copy_tofrom_user() internally, but this is still safe to call in user
access blocks formed with user_*_access_begin()/user_*_access_end()
since asm functions are not instrumented for tracing.

Signed-off-by: Christopher M. Riedl <cmr@codefail.de>
---
 arch/powerpc/include/asm/uaccess.h | 28 +++++++++++++++++++---------
 1 file changed, 19 insertions(+), 9 deletions(-)

diff --git a/arch/powerpc/include/asm/uaccess.h b/arch/powerpc/include/asm/uaccess.h
index 26781b044932..66940b4eb692 100644
--- a/arch/powerpc/include/asm/uaccess.h
+++ b/arch/powerpc/include/asm/uaccess.h
@@ -418,38 +418,45 @@ raw_copy_in_user(void __user *to, const void __user *from, unsigned long n)
 }
 #endif /* __powerpc64__ */
 
-static inline unsigned long raw_copy_from_user(void *to,
-		const void __user *from, unsigned long n)
+static inline unsigned long
+raw_copy_from_user_allowed(void *to, const void __user *from, unsigned long n)
 {
-	unsigned long ret;
 	if (__builtin_constant_p(n) && (n <= 8)) {
-		ret = 1;
+		unsigned long ret = 1;
 
 		switch (n) {
 		case 1:
 			barrier_nospec();
-			__get_user_size(*(u8 *)to, from, 1, ret);
+			__get_user_size_allowed(*(u8 *)to, from, 1, ret);
 			break;
 		case 2:
 			barrier_nospec();
-			__get_user_size(*(u16 *)to, from, 2, ret);
+			__get_user_size_allowed(*(u16 *)to, from, 2, ret);
 			break;
 		case 4:
 			barrier_nospec();
-			__get_user_size(*(u32 *)to, from, 4, ret);
+			__get_user_size_allowed(*(u32 *)to, from, 4, ret);
 			break;
 		case 8:
 			barrier_nospec();
-			__get_user_size(*(u64 *)to, from, 8, ret);
+			__get_user_size_allowed(*(u64 *)to, from, 8, ret);
 			break;
 		}
 		if (ret == 0)
 			return 0;
 	}
 
+	return __copy_tofrom_user((__force void __user *)to, from, n);
+}
+
+static inline unsigned long
+raw_copy_from_user(void *to, const void __user *from, unsigned long n)
+{
+	unsigned long ret;
+
 	barrier_nospec();
 	allow_read_from_user(from, n);
-	ret = __copy_tofrom_user((__force void __user *)to, from, n);
+	ret = raw_copy_from_user_allowed(to, from, n);
 	prevent_read_from_user(from, n);
 	return ret;
 }
@@ -571,6 +578,9 @@ user_write_access_begin(const void __user *ptr, size_t len)
 #define unsafe_get_user(x, p, e) unsafe_op_wrap(__get_user_allowed(x, p), e)
 #define unsafe_put_user(x, p, e) __put_user_goto(x, p, e)
 
+#define unsafe_copy_from_user(d, s, l, e) \
+	unsafe_op_wrap(raw_copy_from_user_allowed(d, s, l), e)
+
 #define unsafe_copy_to_user(d, s, l, e) \
 do {									\
 	u8 __user *_dst = (u8 __user *)(d);				\
-- 
2.28.0


^ permalink raw reply related

* [PATCH 7/8] powerpc/signal64: Rewrite handle_rt_signal64() to minimise uaccess switches
From: Christopher M. Riedl @ 2020-10-15 15:01 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Daniel Axtens
In-Reply-To: <20201015150159.28933-1-cmr@codefail.de>

From: Daniel Axtens <dja@axtens.net>

Add uaccess blocks and use the 'unsafe' versions of functions doing user
access where possible to reduce the number of times uaccess has to be
opened/closed.

There is no 'unsafe' version of copy_siginfo_to_user, so move it
slightly to allow for a "longer" uaccess block.

Signed-off-by: Daniel Axtens <dja@axtens.net>
Signed-off-by: Christopher M. Riedl <cmr@codefail.de>
---
 arch/powerpc/kernel/signal_64.c | 54 ++++++++++++++++-----------------
 1 file changed, 27 insertions(+), 27 deletions(-)

diff --git a/arch/powerpc/kernel/signal_64.c b/arch/powerpc/kernel/signal_64.c
index 6d4f7a5c4fbf..3b97e3681a8f 100644
--- a/arch/powerpc/kernel/signal_64.c
+++ b/arch/powerpc/kernel/signal_64.c
@@ -843,46 +843,42 @@ int handle_rt_signal64(struct ksignal *ksig, sigset_t *set,
 	/* Save the thread's msr before get_tm_stackpointer() changes it */
 	unsigned long msr = regs->msr;
 #endif
-
 	frame = get_sigframe(ksig, tsk, sizeof(*frame), 0);
-	if (!access_ok(frame, sizeof(*frame)))
+	if (!user_write_access_begin(frame, sizeof(*frame)))
 		goto badframe;
 
-	err |= __put_user(&frame->info, &frame->pinfo);
-	err |= __put_user(&frame->uc, &frame->puc);
-	err |= copy_siginfo_to_user(&frame->info, &ksig->info);
-	if (err)
-		goto badframe;
+	unsafe_put_user(&frame->info, &frame->pinfo, badframe_block);
+	unsafe_put_user(&frame->uc, &frame->puc, badframe_block);
 
 	/* Create the ucontext.  */
-	err |= __put_user(0, &frame->uc.uc_flags);
-	err |= __save_altstack(&frame->uc.uc_stack, regs->gpr[1]);
+	unsafe_put_user(0, &frame->uc.uc_flags, badframe_block);
+	unsafe_save_altstack(&frame->uc.uc_stack, regs->gpr[1], badframe_block);
+
 #ifdef CONFIG_PPC_TRANSACTIONAL_MEM
 	if (MSR_TM_ACTIVE(msr)) {
 		/* The ucontext_t passed to userland points to the second
 		 * ucontext_t (for transactional state) with its uc_link ptr.
 		 */
-		err |= __put_user(&frame->uc_transact, &frame->uc.uc_link);
+		unsafe_put_user(&frame->uc_transact, &frame->uc.uc_link, badframe_block);
+		user_write_access_end();
 		err |= setup_tm_sigcontexts(&frame->uc.uc_mcontext,
 					    &frame->uc_transact.uc_mcontext,
 					    tsk, ksig->sig, NULL,
 					    (unsigned long)ksig->ka.sa.sa_handler,
 					    msr);
+		if (!user_write_access_begin(frame, sizeof(struct rt_sigframe)))
+			goto badframe;
+
 	} else
 #endif
 	{
-		err |= __put_user(0, &frame->uc.uc_link);
-
-		if (!user_write_access_begin(frame, sizeof(struct rt_sigframe)))
-			return -EFAULT;
-		err |= __unsafe_setup_sigcontext(&frame->uc.uc_mcontext, tsk,
-						ksig->sig, NULL,
-						(unsigned long)ksig->ka.sa.sa_handler, 1);
-		user_write_access_end();
+		unsafe_put_user(0, &frame->uc.uc_link, badframe_block);
+		unsafe_setup_sigcontext(&frame->uc.uc_mcontext, tsk, ksig->sig,
+					NULL, (unsigned long)ksig->ka.sa.sa_handler,
+					1, badframe_block);
 	}
-	err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set));
-	if (err)
-		goto badframe;
+
+	unsafe_copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set), badframe_block);
 
 	/* Make sure signal handler doesn't get spurious FP exceptions */
 	tsk->thread.fp_state.fpscr = 0;
@@ -891,15 +887,17 @@ int handle_rt_signal64(struct ksignal *ksig, sigset_t *set,
 	if (vdso64_rt_sigtramp && tsk->mm->context.vdso_base) {
 		regs->nip = tsk->mm->context.vdso_base + vdso64_rt_sigtramp;
 	} else {
-		if (!user_write_access_begin(frame, sizeof(struct rt_sigframe)))
-			return -EFAULT;
-		err |= __unsafe_setup_trampoline(__NR_rt_sigreturn, &frame->tramp[0]);
-		user_write_access_end();
-		if (err)
-			goto badframe;
+		unsafe_setup_trampoline(__NR_rt_sigreturn, &frame->tramp[0],
+					badframe_block);
 		regs->nip = (unsigned long) &frame->tramp[0];
 	}
 
+	user_write_access_end();
+
+	/* Save the siginfo outside of the unsafe block. */
+	if (copy_siginfo_to_user(&frame->info, &ksig->info))
+		goto badframe;
+
 	/* Allocate a dummy caller frame for the signal handler. */
 	newsp = ((unsigned long)frame) - __SIGNAL_FRAMESIZE;
 	err |= put_user(regs->gpr[1], (unsigned long __user *)newsp);
@@ -939,6 +937,8 @@ int handle_rt_signal64(struct ksignal *ksig, sigset_t *set,
 
 	return 0;
 
+badframe_block:
+	user_write_access_end();
 badframe:
 	signal_fault(current, regs, "handle_rt_signal64", frame);
 
-- 
2.28.0


^ permalink raw reply related

* [PATCH 8/8] powerpc/signal64: Rewrite rt_sigreturn() to minimise uaccess switches
From: Christopher M. Riedl @ 2020-10-15 15:01 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Daniel Axtens
In-Reply-To: <20201015150159.28933-1-cmr@codefail.de>

From: Daniel Axtens <dja@axtens.net>

Add uaccess blocks and use the 'unsafe' versions of functions doing user
access where possible to reduce the number of times uaccess has to be
opened/closed.

Signed-off-by: Daniel Axtens <dja@axtens.net>
Signed-off-by: Christopher M. Riedl <cmr@codefail.de>
---
 arch/powerpc/kernel/signal_64.c | 23 +++++++++++++++--------
 1 file changed, 15 insertions(+), 8 deletions(-)

diff --git a/arch/powerpc/kernel/signal_64.c b/arch/powerpc/kernel/signal_64.c
index 3b97e3681a8f..0f4ff7a5bfc1 100644
--- a/arch/powerpc/kernel/signal_64.c
+++ b/arch/powerpc/kernel/signal_64.c
@@ -779,18 +779,22 @@ SYSCALL_DEFINE0(rt_sigreturn)
 	 */
 	regs->msr &= ~MSR_TS_MASK;
 
-	if (__get_user(msr, &uc->uc_mcontext.gp_regs[PT_MSR]))
+	if (!user_read_access_begin(uc, sizeof(*uc)))
 		goto badframe;
+
+	unsafe_get_user(msr, &uc->uc_mcontext.gp_regs[PT_MSR], badframe_block);
+
 	if (MSR_TM_ACTIVE(msr)) {
 		/* We recheckpoint on return. */
 		struct ucontext __user *uc_transact;
 
 		/* Trying to start TM on non TM system */
 		if (!cpu_has_feature(CPU_FTR_TM))
-			goto badframe;
+			goto badframe_block;
+
+		unsafe_get_user(uc_transact, &uc->uc_link, badframe_block);
+		user_read_access_end();
 
-		if (__get_user(uc_transact, &uc->uc_link))
-			goto badframe;
 		if (restore_tm_sigcontexts(current, &uc->uc_mcontext,
 					   &uc_transact->uc_mcontext))
 			goto badframe;
@@ -810,12 +814,13 @@ SYSCALL_DEFINE0(rt_sigreturn)
 		 * causing a TM bad thing.
 		 */
 		current->thread.regs->msr &= ~MSR_TS_MASK;
+
+#ifndef CONFIG_PPC_TRANSACTIONAL_MEM
 		if (!user_read_access_begin(uc, sizeof(*uc)))
-			return -EFAULT;
-		if (__unsafe_restore_sigcontext(current, NULL, 1, &uc->uc_mcontext)) {
-			user_read_access_end();
 			goto badframe;
-		}
+#endif
+		unsafe_restore_sigcontext(current, NULL, 1, &uc->uc_mcontext,
+					  badframe_block);
 		user_read_access_end();
 	}
 
@@ -825,6 +830,8 @@ SYSCALL_DEFINE0(rt_sigreturn)
 	set_thread_flag(TIF_RESTOREALL);
 	return 0;
 
+badframe_block:
+	user_read_access_end();
 badframe:
 	signal_fault(current, regs, "rt_sigreturn", uc);
 
-- 
2.28.0


^ permalink raw reply related

* [PATCH 2/8] powerpc/signal: Add unsafe_copy_{vsx,fpr}_from_user()
From: Christopher M. Riedl @ 2020-10-15 15:01 UTC (permalink / raw)
  To: linuxppc-dev
In-Reply-To: <20201015150159.28933-1-cmr@codefail.de>

Reuse the "safe" implementation from signal.c except for calling
unsafe_copy_from_user() to copy into a local buffer. Unlike the
unsafe_copy_{vsx,fpr}_to_user() functions the "copy from" functions
cannot use unsafe_get_user() directly to bypass the local buffer since
doing so significantly reduces signal handling performance.

Signed-off-by: Christopher M. Riedl <cmr@codefail.de>
---
 arch/powerpc/kernel/signal.h | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/arch/powerpc/kernel/signal.h b/arch/powerpc/kernel/signal.h
index 2559a681536e..e9aaeac0da37 100644
--- a/arch/powerpc/kernel/signal.h
+++ b/arch/powerpc/kernel/signal.h
@@ -53,6 +53,33 @@ unsigned long copy_ckfpr_from_user(struct task_struct *task, void __user *from);
 				&buf[i], label);\
 } while (0)
 
+#define unsafe_copy_fpr_from_user(task, from, label)	do {		\
+	struct task_struct *__t = task;					\
+	u64 __user *__f = (u64 __user *)from;				\
+	u64 buf[ELF_NFPREG];						\
+	int i;								\
+									\
+	unsafe_copy_from_user(buf, __f, ELF_NFPREG * sizeof(double),	\
+				label);					\
+	for (i = 0; i < ELF_NFPREG - 1; i++)				\
+		__t->thread.TS_FPR(i) = buf[i];				\
+	__t->thread.fp_state.fpscr = buf[i];				\
+} while (0)
+
+#define unsafe_copy_vsx_from_user(task, from, label)	do {		\
+	struct task_struct *__t = task;					\
+	u64 __user *__f = (u64 __user *)from;				\
+	u64 buf[ELF_NVSRHALFREG];					\
+	int i;								\
+									\
+	unsafe_copy_from_user(buf, __f,					\
+				ELF_NVSRHALFREG * sizeof(double),	\
+				label);					\
+	for (i = 0; i < ELF_NVSRHALFREG ; i++)				\
+		__t->thread.fp_state.fpr[i][TS_VSRLOWOFFSET] = buf[i];	\
+} while (0)
+
+
 #ifdef CONFIG_PPC_TRANSACTIONAL_MEM
 #define unsafe_copy_ckfpr_to_user(to, task, label)	do {		\
 	struct task_struct *__t = task;					\
@@ -80,6 +107,10 @@ unsigned long copy_ckfpr_from_user(struct task_struct *task, void __user *from);
 	unsafe_copy_to_user(to, (task)->thread.fp_state.fpr,	\
 			    ELF_NFPREG * sizeof(double), label)
 
+#define unsafe_copy_fpr_from_user(task, from, label)		\
+	unsafe_copy_from_user((task)->thread.fp_state.fpr, from	\
+			    ELF_NFPREG * sizeof(double), label)
+
 static inline unsigned long
 copy_fpr_to_user(void __user *to, struct task_struct *task)
 {
@@ -115,6 +146,8 @@ copy_ckfpr_from_user(struct task_struct *task, void __user *from)
 #else
 #define unsafe_copy_fpr_to_user(to, task, label) do { } while (0)
 
+#define unsafe_copy_fpr_from_user(task, from, label) do { } while (0)
+
 static inline unsigned long
 copy_fpr_to_user(void __user *to, struct task_struct *task)
 {
-- 
2.28.0


^ permalink raw reply related

* [PATCH 4/8] powerpc/signal64: Replace setup_sigcontext() w/ unsafe_setup_sigcontext()
From: Christopher M. Riedl @ 2020-10-15 15:01 UTC (permalink / raw)
  To: linuxppc-dev
In-Reply-To: <20201015150159.28933-1-cmr@codefail.de>

Previously setup_sigcontext() performed a costly KUAP switch on every
uaccess operation. These repeated uaccess switches cause a significant
drop in signal handling performance.

Rewrite setup_sigcontext() to assume that a userspace write access window
is open. Replace all uaccess functions with their 'unsafe' versions
which avoid the repeated uaccess switches.

Signed-off-by: Christopher M. Riedl <cmr@codefail.de>
---
 arch/powerpc/kernel/signal_64.c | 71 ++++++++++++++++++++-------------
 1 file changed, 44 insertions(+), 27 deletions(-)

diff --git a/arch/powerpc/kernel/signal_64.c b/arch/powerpc/kernel/signal_64.c
index 7df088b9ad0f..26934ceeb925 100644
--- a/arch/powerpc/kernel/signal_64.c
+++ b/arch/powerpc/kernel/signal_64.c
@@ -83,9 +83,13 @@ static elf_vrreg_t __user *sigcontext_vmx_regs(struct sigcontext __user *sc)
  * Set up the sigcontext for the signal frame.
  */
 
-static long setup_sigcontext(struct sigcontext __user *sc,
-		struct task_struct *tsk, int signr, sigset_t *set,
-		unsigned long handler, int ctx_has_vsx_region)
+#define unsafe_setup_sigcontext(sc, tsk, signr, set, handler,		\
+				ctx_has_vsx_region, e)			\
+	unsafe_op_wrap(__unsafe_setup_sigcontext(sc, tsk, signr, set,	\
+			handler, ctx_has_vsx_region), e)
+static long notrace __unsafe_setup_sigcontext(struct sigcontext __user *sc,
+					struct task_struct *tsk, int signr, sigset_t *set,
+					unsigned long handler, int ctx_has_vsx_region)
 {
 	/* When CONFIG_ALTIVEC is set, we _always_ setup v_regs even if the
 	 * process never used altivec yet (MSR_VEC is zero in pt_regs of
@@ -101,21 +105,20 @@ static long setup_sigcontext(struct sigcontext __user *sc,
 #endif
 	struct pt_regs *regs = tsk->thread.regs;
 	unsigned long msr = regs->msr;
-	long err = 0;
 	/* Force usr to alway see softe as 1 (interrupts enabled) */
 	unsigned long softe = 0x1;
 
 	BUG_ON(tsk != current);
 
 #ifdef CONFIG_ALTIVEC
-	err |= __put_user(v_regs, &sc->v_regs);
+	unsafe_put_user(v_regs, &sc->v_regs, efault_out);
 
 	/* save altivec registers */
 	if (tsk->thread.used_vr) {
 		flush_altivec_to_thread(tsk);
 		/* Copy 33 vec registers (vr0..31 and vscr) to the stack */
-		err |= __copy_to_user(v_regs, &tsk->thread.vr_state,
-				      33 * sizeof(vector128));
+		unsafe_copy_to_user(v_regs, &tsk->thread.vr_state,
+				    33 * sizeof(vector128), efault_out);
 		/* set MSR_VEC in the MSR value in the frame to indicate that sc->v_reg)
 		 * contains valid data.
 		 */
@@ -130,13 +133,13 @@ static long setup_sigcontext(struct sigcontext __user *sc,
 		tsk->thread.vrsave = vrsave;
 	}
 
-	err |= __put_user(vrsave, (u32 __user *)&v_regs[33]);
+	unsafe_put_user(vrsave, (u32 __user *)&v_regs[33], efault_out);
 #else /* CONFIG_ALTIVEC */
-	err |= __put_user(0, &sc->v_regs);
+	unsafe_put_user(0, &sc->v_regs, efault_out);
 #endif /* CONFIG_ALTIVEC */
 	flush_fp_to_thread(tsk);
 	/* copy fpr regs and fpscr */
-	err |= copy_fpr_to_user(&sc->fp_regs, tsk);
+	unsafe_copy_fpr_to_user(&sc->fp_regs, tsk, efault_out);
 
 	/*
 	 * Clear the MSR VSX bit to indicate there is no valid state attached
@@ -152,24 +155,27 @@ static long setup_sigcontext(struct sigcontext __user *sc,
 	if (tsk->thread.used_vsr && ctx_has_vsx_region) {
 		flush_vsx_to_thread(tsk);
 		v_regs += ELF_NVRREG;
-		err |= copy_vsx_to_user(v_regs, tsk);
+		unsafe_copy_vsx_to_user(v_regs, tsk, efault_out);
 		/* set MSR_VSX in the MSR value in the frame to
 		 * indicate that sc->vs_reg) contains valid data.
 		 */
 		msr |= MSR_VSX;
 	}
 #endif /* CONFIG_VSX */
-	err |= __put_user(&sc->gp_regs, &sc->regs);
+	unsafe_put_user(&sc->gp_regs, &sc->regs, efault_out);
 	WARN_ON(!FULL_REGS(regs));
-	err |= __copy_to_user(&sc->gp_regs, regs, GP_REGS_SIZE);
-	err |= __put_user(msr, &sc->gp_regs[PT_MSR]);
-	err |= __put_user(softe, &sc->gp_regs[PT_SOFTE]);
-	err |= __put_user(signr, &sc->signal);
-	err |= __put_user(handler, &sc->handler);
+	unsafe_copy_to_user(&sc->gp_regs, regs, GP_REGS_SIZE, efault_out);
+	unsafe_put_user(msr, &sc->gp_regs[PT_MSR], efault_out);
+	unsafe_put_user(softe, &sc->gp_regs[PT_SOFTE], efault_out);
+	unsafe_put_user(signr, &sc->signal, efault_out);
+	unsafe_put_user(handler, &sc->handler, efault_out);
 	if (set != NULL)
-		err |=  __put_user(set->sig[0], &sc->oldmask);
+		unsafe_put_user(set->sig[0], &sc->oldmask, efault_out);
 
-	return err;
+	return 0;
+
+efault_out:
+	return -EFAULT;
 }
 
 #ifdef CONFIG_PPC_TRANSACTIONAL_MEM
@@ -655,12 +661,15 @@ SYSCALL_DEFINE3(swapcontext, struct ucontext __user *, old_ctx,
 		ctx_has_vsx_region = 1;
 
 	if (old_ctx != NULL) {
-		if (!access_ok(old_ctx, ctx_size)
-		    || setup_sigcontext(&old_ctx->uc_mcontext, current, 0, NULL, 0,
-					ctx_has_vsx_region)
-		    || __copy_to_user(&old_ctx->uc_sigmask,
-				      &current->blocked, sizeof(sigset_t)))
+		if (!user_write_access_begin(old_ctx, ctx_size))
 			return -EFAULT;
+
+		unsafe_setup_sigcontext(&old_ctx->uc_mcontext, current, 0, NULL,
+					0, ctx_has_vsx_region, efault_out);
+		unsafe_copy_to_user(&old_ctx->uc_sigmask, &current->blocked,
+				    sizeof(sigset_t), efault_out);
+
+		user_write_access_end();
 	}
 	if (new_ctx == NULL)
 		return 0;
@@ -689,6 +698,10 @@ SYSCALL_DEFINE3(swapcontext, struct ucontext __user *, old_ctx,
 	/* This returns like rt_sigreturn */
 	set_thread_flag(TIF_RESTOREALL);
 	return 0;
+
+efault_out:
+	user_write_access_end();
+	return -EFAULT;
 }
 
 
@@ -842,9 +855,13 @@ int handle_rt_signal64(struct ksignal *ksig, sigset_t *set,
 #endif
 	{
 		err |= __put_user(0, &frame->uc.uc_link);
-		err |= setup_sigcontext(&frame->uc.uc_mcontext, tsk, ksig->sig,
-					NULL, (unsigned long)ksig->ka.sa.sa_handler,
-					1);
+
+		if (!user_write_access_begin(frame, sizeof(struct rt_sigframe)))
+			return -EFAULT;
+		err |= __unsafe_setup_sigcontext(&frame->uc.uc_mcontext, tsk,
+						ksig->sig, NULL,
+						(unsigned long)ksig->ka.sa.sa_handler, 1);
+		user_write_access_end();
 	}
 	err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set));
 	if (err)
-- 
2.28.0


^ permalink raw reply related

* [PATCH 5/8] powerpc/signal64: Replace restore_sigcontext() w/ unsafe_restore_sigcontext()
From: Christopher M. Riedl @ 2020-10-15 15:01 UTC (permalink / raw)
  To: linuxppc-dev
In-Reply-To: <20201015150159.28933-1-cmr@codefail.de>

Previously restore_sigcontext() performed a costly KUAP switch on every
uaccess operation. These repeated uaccess switches cause a significant
drop in signal handling performance.

Rewrite restore_sigcontext() to assume that a userspace read access
window is open. Replace all uaccess functions with their 'unsafe'
versions which avoid the repeated uaccess switches.

Signed-off-by: Christopher M. Riedl <cmr@codefail.de>
---
 arch/powerpc/kernel/signal_64.c | 68 ++++++++++++++++++++-------------
 1 file changed, 41 insertions(+), 27 deletions(-)

diff --git a/arch/powerpc/kernel/signal_64.c b/arch/powerpc/kernel/signal_64.c
index 26934ceeb925..bd92064e5576 100644
--- a/arch/powerpc/kernel/signal_64.c
+++ b/arch/powerpc/kernel/signal_64.c
@@ -318,14 +318,14 @@ static long setup_tm_sigcontexts(struct sigcontext __user *sc,
 /*
  * Restore the sigcontext from the signal frame.
  */
-
-static long restore_sigcontext(struct task_struct *tsk, sigset_t *set, int sig,
-			      struct sigcontext __user *sc)
+#define unsafe_restore_sigcontext(tsk, set, sig, sc, e) \
+	unsafe_op_wrap(__unsafe_restore_sigcontext(tsk, set, sig, sc), e)
+static long notrace __unsafe_restore_sigcontext(struct task_struct *tsk, sigset_t *set,
+						int sig, struct sigcontext __user *sc)
 {
 #ifdef CONFIG_ALTIVEC
 	elf_vrreg_t __user *v_regs;
 #endif
-	unsigned long err = 0;
 	unsigned long save_r13 = 0;
 	unsigned long msr;
 	struct pt_regs *regs = tsk->thread.regs;
@@ -340,27 +340,28 @@ static long restore_sigcontext(struct task_struct *tsk, sigset_t *set, int sig,
 		save_r13 = regs->gpr[13];
 
 	/* copy the GPRs */
-	err |= __copy_from_user(regs->gpr, sc->gp_regs, sizeof(regs->gpr));
-	err |= __get_user(regs->nip, &sc->gp_regs[PT_NIP]);
+	unsafe_copy_from_user(regs->gpr, sc->gp_regs, sizeof(regs->gpr),
+			      efault_out);
+	unsafe_get_user(regs->nip, &sc->gp_regs[PT_NIP], efault_out);
 	/* get MSR separately, transfer the LE bit if doing signal return */
-	err |= __get_user(msr, &sc->gp_regs[PT_MSR]);
+	unsafe_get_user(msr, &sc->gp_regs[PT_MSR], efault_out);
 	if (sig)
 		regs->msr = (regs->msr & ~MSR_LE) | (msr & MSR_LE);
-	err |= __get_user(regs->orig_gpr3, &sc->gp_regs[PT_ORIG_R3]);
-	err |= __get_user(regs->ctr, &sc->gp_regs[PT_CTR]);
-	err |= __get_user(regs->link, &sc->gp_regs[PT_LNK]);
-	err |= __get_user(regs->xer, &sc->gp_regs[PT_XER]);
-	err |= __get_user(regs->ccr, &sc->gp_regs[PT_CCR]);
+	unsafe_get_user(regs->orig_gpr3, &sc->gp_regs[PT_ORIG_R3], efault_out);
+	unsafe_get_user(regs->ctr, &sc->gp_regs[PT_CTR], efault_out);
+	unsafe_get_user(regs->link, &sc->gp_regs[PT_LNK], efault_out);
+	unsafe_get_user(regs->xer, &sc->gp_regs[PT_XER], efault_out);
+	unsafe_get_user(regs->ccr, &sc->gp_regs[PT_CCR], efault_out);
 	/* Don't allow userspace to set SOFTE */
 	set_trap_norestart(regs);
-	err |= __get_user(regs->dar, &sc->gp_regs[PT_DAR]);
-	err |= __get_user(regs->dsisr, &sc->gp_regs[PT_DSISR]);
-	err |= __get_user(regs->result, &sc->gp_regs[PT_RESULT]);
+	unsafe_get_user(regs->dar, &sc->gp_regs[PT_DAR], efault_out);
+	unsafe_get_user(regs->dsisr, &sc->gp_regs[PT_DSISR], efault_out);
+	unsafe_get_user(regs->result, &sc->gp_regs[PT_RESULT], efault_out);
 
 	if (!sig)
 		regs->gpr[13] = save_r13;
 	if (set != NULL)
-		err |=  __get_user(set->sig[0], &sc->oldmask);
+		unsafe_get_user(set->sig[0], &sc->oldmask, efault_out);
 
 	/*
 	 * Force reload of FP/VEC.
@@ -370,29 +371,28 @@ static long restore_sigcontext(struct task_struct *tsk, sigset_t *set, int sig,
 	regs->msr &= ~(MSR_FP | MSR_FE0 | MSR_FE1 | MSR_VEC | MSR_VSX);
 
 #ifdef CONFIG_ALTIVEC
-	err |= __get_user(v_regs, &sc->v_regs);
-	if (err)
-		return err;
+	unsafe_get_user(v_regs, &sc->v_regs, efault_out);
 	if (v_regs && !access_ok(v_regs, 34 * sizeof(vector128)))
 		return -EFAULT;
 	/* Copy 33 vec registers (vr0..31 and vscr) from the stack */
 	if (v_regs != NULL && (msr & MSR_VEC) != 0) {
-		err |= __copy_from_user(&tsk->thread.vr_state, v_regs,
-					33 * sizeof(vector128));
+		unsafe_copy_from_user(&tsk->thread.vr_state, v_regs,
+				      33 * sizeof(vector128), efault_out);
 		tsk->thread.used_vr = true;
 	} else if (tsk->thread.used_vr) {
 		memset(&tsk->thread.vr_state, 0, 33 * sizeof(vector128));
 	}
 	/* Always get VRSAVE back */
 	if (v_regs != NULL)
-		err |= __get_user(tsk->thread.vrsave, (u32 __user *)&v_regs[33]);
+		unsafe_get_user(tsk->thread.vrsave, (u32 __user *)&v_regs[33],
+				efault_out);
 	else
 		tsk->thread.vrsave = 0;
 	if (cpu_has_feature(CPU_FTR_ALTIVEC))
 		mtspr(SPRN_VRSAVE, tsk->thread.vrsave);
 #endif /* CONFIG_ALTIVEC */
 	/* restore floating point */
-	err |= copy_fpr_from_user(tsk, &sc->fp_regs);
+	unsafe_copy_fpr_from_user(tsk, &sc->fp_regs, efault_out);
 #ifdef CONFIG_VSX
 	/*
 	 * Get additional VSX data. Update v_regs to point after the
@@ -401,14 +401,17 @@ static long restore_sigcontext(struct task_struct *tsk, sigset_t *set, int sig,
 	 */
 	v_regs += ELF_NVRREG;
 	if ((msr & MSR_VSX) != 0) {
-		err |= copy_vsx_from_user(tsk, v_regs);
+		unsafe_copy_vsx_from_user(tsk, v_regs, efault_out);
 		tsk->thread.used_vsr = true;
 	} else {
 		for (i = 0; i < 32 ; i++)
 			tsk->thread.fp_state.fpr[i][TS_VSRLOWOFFSET] = 0;
 	}
 #endif
-	return err;
+	return 0;
+
+efault_out:
+	return -EFAULT;
 }
 
 #ifdef CONFIG_PPC_TRANSACTIONAL_MEM
@@ -692,8 +695,14 @@ SYSCALL_DEFINE3(swapcontext, struct ucontext __user *, old_ctx,
 	if (__copy_from_user(&set, &new_ctx->uc_sigmask, sizeof(set)))
 		do_exit(SIGSEGV);
 	set_current_blocked(&set);
-	if (restore_sigcontext(current, NULL, 0, &new_ctx->uc_mcontext))
+
+	if (!user_read_access_begin(new_ctx, ctx_size))
+		return -EFAULT;
+	if (__unsafe_restore_sigcontext(current, NULL, 0, &new_ctx->uc_mcontext)) {
+		user_read_access_end();
 		do_exit(SIGSEGV);
+	}
+	user_read_access_end();
 
 	/* This returns like rt_sigreturn */
 	set_thread_flag(TIF_RESTOREALL);
@@ -798,8 +807,13 @@ SYSCALL_DEFINE0(rt_sigreturn)
 		 * causing a TM bad thing.
 		 */
 		current->thread.regs->msr &= ~MSR_TS_MASK;
-		if (restore_sigcontext(current, NULL, 1, &uc->uc_mcontext))
+		if (!user_read_access_begin(uc, sizeof(*uc)))
+			return -EFAULT;
+		if (__unsafe_restore_sigcontext(current, NULL, 1, &uc->uc_mcontext)) {
+			user_read_access_end();
 			goto badframe;
+		}
+		user_read_access_end();
 	}
 
 	if (restore_altstack(&uc->uc_stack))
-- 
2.28.0


^ permalink raw reply related

* [PATCH 6/8] powerpc/signal64: Replace setup_trampoline() w/ unsafe_setup_trampoline()
From: Christopher M. Riedl @ 2020-10-15 15:01 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Daniel Axtens
In-Reply-To: <20201015150159.28933-1-cmr@codefail.de>

From: Daniel Axtens <dja@axtens.net>

Previously setup_trampoline() performed a costly KUAP switch on every
uaccess operation. These repeated uaccess switches cause a significant
drop in signal handling performance.

Rewrite setup_trampoline() to assume that a userspace write access
window is open. Replace all uaccess functions with their 'unsafe'
versions to avoid the repeated uaccess switches.

Signed-off-by: Daniel Axtens <dja@axtens.net>
Signed-off-by: Christopher M. Riedl <cmr@codefail.de>
---
 arch/powerpc/kernel/signal_64.c | 32 +++++++++++++++++++-------------
 1 file changed, 19 insertions(+), 13 deletions(-)

diff --git a/arch/powerpc/kernel/signal_64.c b/arch/powerpc/kernel/signal_64.c
index bd92064e5576..6d4f7a5c4fbf 100644
--- a/arch/powerpc/kernel/signal_64.c
+++ b/arch/powerpc/kernel/signal_64.c
@@ -600,30 +600,33 @@ static long restore_tm_sigcontexts(struct task_struct *tsk,
 /*
  * Setup the trampoline code on the stack
  */
-static long setup_trampoline(unsigned int syscall, unsigned int __user *tramp)
+#define unsafe_setup_trampoline(syscall, tramp, e) \
+	unsafe_op_wrap(__unsafe_setup_trampoline(syscall, tramp), e)
+static long notrace __unsafe_setup_trampoline(unsigned int syscall,
+					unsigned int __user *tramp)
 {
 	int i;
-	long err = 0;
 
 	/* bctrl # call the handler */
-	err |= __put_user(PPC_INST_BCTRL, &tramp[0]);
+	unsafe_put_user(PPC_INST_BCTRL, &tramp[0], err);
 	/* addi r1, r1, __SIGNAL_FRAMESIZE  # Pop the dummy stackframe */
-	err |= __put_user(PPC_INST_ADDI | __PPC_RT(R1) | __PPC_RA(R1) |
-			  (__SIGNAL_FRAMESIZE & 0xffff), &tramp[1]);
+	unsafe_put_user(PPC_INST_ADDI | __PPC_RT(R1) | __PPC_RA(R1) |
+			  (__SIGNAL_FRAMESIZE & 0xffff), &tramp[1], err);
 	/* li r0, __NR_[rt_]sigreturn| */
-	err |= __put_user(PPC_INST_ADDI | (syscall & 0xffff), &tramp[2]);
+	unsafe_put_user(PPC_INST_ADDI | (syscall & 0xffff), &tramp[2], err);
 	/* sc */
-	err |= __put_user(PPC_INST_SC, &tramp[3]);
+	unsafe_put_user(PPC_INST_SC, &tramp[3], err);
 
 	/* Minimal traceback info */
 	for (i=TRAMP_TRACEBACK; i < TRAMP_SIZE ;i++)
-		err |= __put_user(0, &tramp[i]);
+		unsafe_put_user(0, &tramp[i], err);
 
-	if (!err)
-		flush_icache_range((unsigned long) &tramp[0],
-			   (unsigned long) &tramp[TRAMP_SIZE]);
+	flush_icache_range((unsigned long)&tramp[0],
+			   (unsigned long)&tramp[TRAMP_SIZE]);
 
-	return err;
+	return 0;
+err:
+	return 1;
 }
 
 /*
@@ -888,7 +891,10 @@ int handle_rt_signal64(struct ksignal *ksig, sigset_t *set,
 	if (vdso64_rt_sigtramp && tsk->mm->context.vdso_base) {
 		regs->nip = tsk->mm->context.vdso_base + vdso64_rt_sigtramp;
 	} else {
-		err |= setup_trampoline(__NR_rt_sigreturn, &frame->tramp[0]);
+		if (!user_write_access_begin(frame, sizeof(struct rt_sigframe)))
+			return -EFAULT;
+		err |= __unsafe_setup_trampoline(__NR_rt_sigreturn, &frame->tramp[0]);
+		user_write_access_end();
 		if (err)
 			goto badframe;
 		regs->nip = (unsigned long) &frame->tramp[0];
-- 
2.28.0


^ permalink raw reply related

* [PATCH 0/8] Improve signal performance on PPC64 with KUAP
From: Christopher M. Riedl @ 2020-10-15 15:01 UTC (permalink / raw)
  To: linuxppc-dev

As reported by Anton, there is a large penalty to signal handling
performance on radix systems using KUAP. The signal handling code
performs many user access operations, each of which needs to switch the
KUAP permissions bit to open and then close user access. This involves a
costly 'mtspr' operation [0].

There is existing work done on x86 and by Christopher Leroy for PPC32 to
instead open up user access in "blocks" using user_*_access_{begin,end}.
We can do the same in PPC64 to bring performance back up on KUAP-enabled
radix systems.

This series applies on top of Christophe Leroy's work for PPC32 [1] (I'm
sure patchwork won't be too happy about that).

The first two patches add some needed 'unsafe' versions of copy-from
functions. While these do not make use of asm-goto they still allow for
avoiding the repeated uaccess switches. The third patch adds 'notrace'
to any functions expected to be called in a uaccess block context.
Normally functions called in such a context should be inlined, but this
is not feasible everywhere. Marking them 'notrace' should provide _some_
protection against leaving the user access window open.

The next three patches rewrite some of the signal64 helper functions to
be 'unsafe'. Finally, the last two patches update the main signal
handling functions to make use of the new 'unsafe' helpers and eliminate
some additional uaccess switching.

I used the will-it-scale signal1 benchmark to measure and compare
performance [2]. The below results are from a P9 Blackbird system. Note
that currently hash does not support KUAP and is therefore used as the
"baseline" comparison. Bigger numbers are better:

	signal1_threads -t1 -s10

	|                 | hash   | radix  |
	| --------------- | ------ | ------ |
	| linuxppc/next   | 289014 | 158408 |
	| unsafe-signal64 | 298506 | 253053 |

[0]: https://github.com/linuxppc/issues/issues/277
[1]: https://patchwork.ozlabs.org/project/linuxppc-dev/list/?series=196278
[2]: https://github.com/antonblanchard/will-it-scale/blob/master/tests/signal1.c

Christopher M. Riedl (5):
  powerpc/uaccess: Add unsafe_copy_from_user
  powerpc/signal: Add unsafe_copy_{vsx,fpr}_from_user()
  powerpc: Mark functions called inside uaccess blocks w/ 'notrace'
  powerpc/signal64: Replace setup_sigcontext() w/
    unsafe_setup_sigcontext()
  powerpc/signal64: Replace restore_sigcontext() w/
    unsafe_restore_sigcontext()

Daniel Axtens (3):
  powerpc/signal64: Replace setup_trampoline() w/
    unsafe_setup_trampoline()
  powerpc/signal64: Rewrite handle_rt_signal64() to minimise uaccess
    switches
  powerpc/signal64: Rewrite rt_sigreturn() to minimise uaccess switches

 arch/powerpc/include/asm/uaccess.h |  28 ++--
 arch/powerpc/kernel/process.c      |  20 +--
 arch/powerpc/kernel/signal.h       |  33 +++++
 arch/powerpc/kernel/signal_64.c    | 216 +++++++++++++++++------------
 arch/powerpc/mm/mem.c              |   4 +-
 5 files changed, 194 insertions(+), 107 deletions(-)

-- 
2.28.0


^ permalink raw reply

* Re: [PATCH 1/2] mm/mprotect: Call arch_validate_prot under mmap_lock and with length
From: Khalid Aziz @ 2020-10-15 14:53 UTC (permalink / raw)
  To: Catalin Marinas
  Cc: Jann Horn, linuxppc-dev, linux-kernel, Christoph Hellwig,
	linux-mm, Paul Mackerras, sparclinux, Anthony Yznaga,
	Andrew Morton, Will Deacon, David S. Miller, linux-arm-kernel
In-Reply-To: <20201015084936.GC20197@gaia>

On 10/15/20 3:05 AM, Catalin Marinas wrote:
> On Wed, Oct 14, 2020 at 03:21:16PM -0600, Khalid Aziz wrote:
>> What FreeBSD does seems like a reasonable thing to do. Any way first
>> thing to do is to update sparc to use arch_validate_flags() and update
>> sparc_validate_prot() to not peek into vma without lock.
> 
> If you go for arch_validate_flags(), I think sparc_validate_prot()
> doesn't need the vma at all.

Yes, the plan is to move vma flag check from sparc_validate_prot() to
arch_validate_flags()..

> 
> BTW, on the ADI topic, I think you have a race in do_swap_page() since
> set_pte_at() is called before arch_do_swap_page(). So a thread in the
> same process would see the new mapping but the tags have not been
> updated yet. Unless sparc relies on the new user pte to be set, I think
> you can just swap the two calls.
> 

Thanks for pointing that out. I will take a look at it.

--
Khalid



^ permalink raw reply

* Re: [PATCH v6 02/11] mm/gup: Use functions to track lockless pgtbl walks on gup_pgd_range
From: Michal Suchánek @ 2020-10-15 14:46 UTC (permalink / raw)
  To: Leonardo Bras
  Cc: linux-mm, Paul Mackerras, Mike Rapoport, linux-arch, Steven Price,
	Mahesh Salgaonkar, Arnd Bergmann, Robin Murphy, kvm-ppc,
	Nicholas Piggin, Thomas Gleixner, Reza Arbab, Allison Randal,
	Christophe Leroy, Greg Kroah-Hartman, linux-kernel,
	Aneesh Kumar K.V, Andrew Morton, linuxppc-dev
In-Reply-To: <760c238043196e0628c8c0eff48a8e938ef539ba.camel@linux.ibm.com>

Hello,

On Thu, Feb 06, 2020 at 12:25:18AM -0300, Leonardo Bras wrote:
> On Thu, 2020-02-06 at 00:08 -0300, Leonardo Bras wrote:
> >                 gup_pgd_range(addr, end, gup_flags, pages, &nr);
> > -               local_irq_enable();
> > +               end_lockless_pgtbl_walk(IRQS_ENABLED);
> >                 ret = nr;
> >         }
> >  
> 
> Just noticed IRQS_ENABLED is not available on other archs than ppc64.
> I will fix this for v7.

Has threre been v7?

I cannot find it.

Thanks

Michal

^ permalink raw reply

* Re: [PATCH 20/20] arch: dts: Fix DWC USB3 DT nodes name
From: Serge Semin @ 2020-10-15 14:15 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Andrew Lunn, linux-usb, Neil Armstrong, Tony Lindgren,
	Bjorn Andersson, Pavel Parkhomenko,
	linux-samsung-soc@vger.kernel.org, Kevin Hilman, Gregory Clement,
	Wei Xu, Chen-Yu Tsai, Kukjin Kim, Andy Gross, linux-arm-msm,
	linux-snps-arc, Sebastian Hesselbarth, devicetree, Jason Cooper,
	Mathias Nyman, linux-kernel@vger.kernel.org, Lad Prabhakar,
	Maxime Ripard, Alexey Malahov, Rob Herring, Santosh Shilimkar,
	linux-omap, linux-arm-kernel, Roger Quadros, Felipe Balbi,
	linux-mips, Greg Kroah-Hartman, Yoshihiro Shimoda, linuxppc-dev,
	Patrice Chotard, Serge Semin, Li Yang, Manu Gautam,
	Benoît Cousson, Shawn Guo
In-Reply-To: <20201015061439.GA2926@kozik-lap>

On Thu, Oct 15, 2020 at 08:14:39AM +0200, Krzysztof Kozlowski wrote:
> On Thu, Oct 15, 2020 at 02:51:05AM +0300, Serge Semin wrote:
>  > >
> > > > So to speak thanks for suggesting it. I'll try it to validate the proposed
> > > > changes.
> > > >
> > > > Two questions:
> > > > 1) Any advise of a good inliner/command to compile all dtbs at once? Of course I
> > > > can get all the updated dtsi'es, then find out all the dts'es which include
> > > > them, then directly use dtc to compile the found dts'es... On the other hand I
> > > > can just compile all dts'es, then compare old and new ones. The diff of the
> > > > non-modified dtb'es will be just empty...
> > > 
> > 
> > > make dtbs
> > 
> > It's not that easy.) "make dtbs" will build dtbs only for enabled boards, which
> > first need to be enabled in the kernel config. So I'll need to have a config
> > with all the affected dts. The later is the same as if I just found all the
> > affected dts and built them one-by-one by directly calling dtc.
> 
> True. Sometimes allyesconfig for given arch might be helpful but not
> always (e.g. for ARM it does not select all of ARMv4 and ARMv5 boards).
> Most likely your approach is actually faster/more reliable.
> 
> > 
> > > touch your dts or git stash pop
> > > make dtbs
> > > compare
> > > diff for all unchanged will be simply empty, so easy to spot
> > > 
> > > > 2) What crosc64 is?
> > > 
> > > Ah, just an alias for cross compiling + ccache + kbuild out. I just
> > > copied you my helpers, so you need to tweak them.
> > > 
> > > >
> > > > >
> > > > > 2. Split it per arm architectures (and proper subject prefix - not
> > > > > "arch") and subarchitectures so maintainers can pick it up.
> > > >
> > > > Why? The changes are simple and can be formatted as a single patch. I've seen
> > > > tons of patches submitted like that, accepted and then merged. What you suggest
> > > > is just much more work, which I don't see quite required.
> > > 
> > 
> > > DTS changes go separate between arm64 and arm. There is nothing
> > > unusual here - all changes are submitted like this.
> > > Second topic is to split by subarchitectures which is necessary if you
> > > want it to be picked up by maintainers. It also makes it easier to
> > > review.
> > 
> > The current patches are easy enough for review. The last three patches of the
> > series is a collection of the one-type changes concerning the same type of
> > nodes. So reviewing them won't cause any difficulty. But I assume that's not
> > the main point in this discussion.
> > 
> > > Sure, without split ber subarchitectures this could be picked
> > > up by SoC folks but you did not even CC them. So if you do not want to
> > > split it per subarchitectures for maintainers and you do not CC SoC,
> > > then how do you believe this should be picked up? Out of the regular
> > > patch submission way? That's not how the changes are handled.
> > 
> > AFAIU there are another ways of merging comprehensive patches. If they get to collect
> > all the Acked-by tags, they could be merged in, for instance, through Greg' or Rob'
> > (for dts) repos, if of course they get to agree with doing that. Am I wrong?
> > 
> > My hope was to ask Rob or Greg to get the patches merged in when they get
> > to collect all the ackes, since I thought it was an option in such cases. So if
> > they refuse to do so I'll have no choice but to split the series up into a
> > smaller patches as you say.
> 

> This is neither Rob's nor Greg's patch to pick up, but ARM SoC (which was
> not CCed here). And most likely they won't pick it up because judging by
> contents it is obvious it should go via ARM SoC.
> 
> Sure, if there are dependencies between some patches they can go with
> acks through unrelated trees, but this not the usual way. This is an
> exception in the process to solve particular dependency problem.  It has
> drawbacks - increases the chances of annoying conflicts.
> 
> The case here does not fall into this criteria - there is no dependency
> of this patch on the others  Therefore there is no reason to use the
> unusual/exceptional way of handling patches.  There is no reason why
> this shouldn't go via either specific ARM subarchitecture maintainers or
> via ARM SoC.

Ok. I see your point. To sum it up I've studied the git log arch/ commit
messages and it turns out even Rob has to split the cleanup changes like this
ones. So thanks for your patience with stating your point. I'll split the last
three patches up to be merged in via the corresponding archs/subarch'es repos.

-Sergey

> 
> > > > > 3. The subject title could be more accurate - there is no fix here
> > > > > because there was no errors in the first place. Requirement of DWC
> > > > > node names comes recently, so it is more alignment with dtschema.
> > > > > Otherwise automatic-pickup-stable-bot might want to pick up... and it
> > > > > should not go to stable.
> > > >
> > > > Actually it is a fix, because the USB DT nodes should have been named with "usb"
> > > > prefix in the first place. Legacy DWC USB3 bindings didn't define the nodes
> > > > naming, but implied to be "usb"-prefixed by the USB HCD schema. The Qualcomm
> > > > DWC3 schema should have defined the sub-nodes as "dwc3@"-prefixed, which was
> > > > wrong in the first place.
> > > 
> > 
> > > Not following the naming convention of DT spec which was loosely
> > > enforced is not an error which should be "fixed". Simply wrong title.
> > > This is an alignment with dtschema or correcting naming convention.
> > > Not fixing errors.
> > 
> > From your perspective it wasn't an error, from mine and most likely Rob' it
> > was.) Anyway as I said I don't care that much about preserving the subject
> > wording, so what about the next one:
> > <arch>: <subarch>: Harmonize DWC USB3 nodes name with DT schema
> > ?
> 
> Looks good.
> 
> Best regards,
> Krzysztof
> 

^ permalink raw reply

* Re: [PATCH] powerpc: force inlining of csum_partial() to avoid multiple csum_partial() with GCC10
From: Christophe Leroy @ 2020-10-15 13:59 UTC (permalink / raw)
  To: Segher Boessenkool; +Cc: Paul Mackerras, linuxppc-dev, linux-kernel
In-Reply-To: <20201015132512.GG2672@gate.crashing.org>



Le 15/10/2020 à 15:25, Segher Boessenkool a écrit :
> Hi!
> 
> On Thu, Oct 15, 2020 at 10:52:20AM +0000, Christophe Leroy wrote:
>> With gcc9 I get:
> 
> <snip>
> 
>> With gcc10 I get:
> 
> <snip>
> 
>> gcc10 defines multiple versions of csum_partial() which are just
>> an unconditionnal branch to __csum_partial().
> 
> It doesn't inline it, yes.
> 
> Could you open a GCC PR for this please?
> 

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97445

Christophe

^ permalink raw reply

* Re: [PATCH 20/20] arch: dts: Fix DWC USB3 DT nodes name
From: Serge Semin @ 2020-10-15 13:53 UTC (permalink / raw)
  To: Felipe Balbi
  Cc: Andrew Lunn, linux-usb, Neil Armstrong, Tony Lindgren,
	Bjorn Andersson, Wei Xu, linux-samsung-soc, Kevin Hilman,
	Gregory Clement, Krzysztof Kozlowski, Chen-Yu Tsai, Kukjin Kim,
	Andy Gross, linux-arm-msm, linux-snps-arc, Sebastian Hesselbarth,
	devicetree, Jason Cooper, Mathias Nyman, linux-kernel,
	Lad Prabhakar, Maxime Ripard, Alexey Malahov, Rob Herring,
	Santosh Shilimkar, linux-omap, linux-arm-kernel, Roger Quadros,
	linux-mips, Greg Kroah-Hartman, Yoshihiro Shimoda, linuxppc-dev,
	Patrice Chotard, Serge Semin, Li Yang, Manu Gautam,
	Benoît Cousson, Shawn Guo, Pavel Parkhomenko
In-Reply-To: <875z7blrqu.fsf@kernel.org>

On Thu, Oct 15, 2020 at 01:15:37PM +0300, Felipe Balbi wrote:
> Serge Semin <Sergey.Semin@baikalelectronics.ru> writes:
> 
> > On Wed, Oct 14, 2020 at 05:09:37PM +0300, Felipe Balbi wrote:
> >> 
> >> Hi Serge,
> >> 
> >> Serge Semin <Sergey.Semin@baikalelectronics.ru> writes:
> >> > In accordance with the DWC USB3 bindings the corresponding node name is
> >> > suppose to comply with Generic USB HCD DT schema, which requires the USB
> >> 
> >
> >> DWC3 is not a simple HDC, though.
> >
> > Yeah, strictly speaking it is equipped with a lot of vendor-specific stuff,
> > which are tuned by the DWC USB3 driver in the kernel. But after that the
> > controller is registered as xhci-hcd device so it's serviced by the xHCI driver,
> 

> in Dual-role or host-only builds, that's correct. We can also have
> peripheral-only builds (both SW or HW versions) which means xhci isn't
> even in the picture.

Hm, good point. In that case perhaps we'll need to apply the xHCI DT schema
conditionally. Like this:

- allOf:
-   - $ref: usb-xhci.yaml#
+ allOf:
+   - if:
+       properties:
+         dr_mode:
+           const: peripheral
+     then:
+       $ref: usb-hcd.yaml#
+     else:
+       $ref: usb-xhci.yaml#

Note, we need to have the peripheral device being compatible with the
usb-hcd.yaml schema to support the maximum-speed, dr_mode properties and to
comply with the USB node naming constraint.

-Sergey

> 
> -- 
> balbi



^ permalink raw reply

* Re: [PATCH] powerpc: force inlining of csum_partial() to avoid multiple csum_partial() with GCC10
From: Christophe Leroy @ 2020-10-15 13:32 UTC (permalink / raw)
  To: Segher Boessenkool; +Cc: Paul Mackerras, linuxppc-dev, linux-kernel
In-Reply-To: <20201015132512.GG2672@gate.crashing.org>



Le 15/10/2020 à 15:25, Segher Boessenkool a écrit :
> Hi!
> 
> On Thu, Oct 15, 2020 at 10:52:20AM +0000, Christophe Leroy wrote:
>> With gcc9 I get:
> 
> <snip>
> 
>> With gcc10 I get:
> 
> <snip>
> 
>> gcc10 defines multiple versions of csum_partial() which are just
>> an unconditionnal branch to __csum_partial().
> 
> It doesn't inline it, yes.
> 
> Could you open a GCC PR for this please?

Sure.

I also have get_order() 75 times in my vmlinux, all the same as the following:

c0016790 <get_order>:
c0016790:	38 63 ff ff 	addi    r3,r3,-1
c0016794:	54 63 a3 3e 	rlwinm  r3,r3,20,12,31
c0016798:	7c 63 00 34 	cntlzw  r3,r3
c001679c:	20 63 00 20 	subfic  r3,r3,32
c00167a0:	4e 80 00 20 	blr

Christophe

^ permalink raw reply

* Re: [PATCH] powerpc: force inlining of csum_partial() to avoid multiple csum_partial() with GCC10
From: Segher Boessenkool @ 2020-10-15 13:25 UTC (permalink / raw)
  To: Christophe Leroy; +Cc: Paul Mackerras, linuxppc-dev, linux-kernel
In-Reply-To: <a1d31f84ddb0926813b17fcd5cc7f3fa7b4deac2.1602759123.git.christophe.leroy@csgroup.eu>

Hi!

On Thu, Oct 15, 2020 at 10:52:20AM +0000, Christophe Leroy wrote:
> With gcc9 I get:

<snip>

> With gcc10 I get:

<snip>

> gcc10 defines multiple versions of csum_partial() which are just
> an unconditionnal branch to __csum_partial().

It doesn't inline it, yes.

Could you open a GCC PR for this please?

> To enforce inlining of that branch to __csum_partial(),
> mark csum_partial() as __always_inline.

That should be fine of course, but it would be good if we could fix this
in the compiler :-)

Reviewed-by: Segher Boessenkool  <segher@kernel.crashing.org>


Segher

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox