LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* Re: [mm/debug] f675f2f91d: WARNING:at_mm/debug_vm_pgtable.c:#debug_vm_pgtable
From: Anshuman Khandual @ 2020-04-05 14:49 UTC (permalink / raw)
  To: kernel test robot
  Cc: Heiko Carstens, linux-mm, Paul Mackerras, H. Peter Anvin,
	linux-riscv, Will Deacon, linux-arch, linux-s390, x86,
	Mike Rapoport, Christian Borntraeger, Ingo Molnar,
	Catalin Marinas, linux-snps-arc, Vasily Gorbik, lkp,
	Borislav Petkov, Paul Walmsley, Kirill A . Shutemov,
	Thomas Gleixner, linux-arm-kernel, Vineet Gupta, linux-kernel,
	Palmer Dabbelt, Andrew Morton, linuxppc-dev
In-Reply-To: <20200330085636.GG11705@shao2-debian>

On 03/30/2020 02:26 PM, kernel test robot wrote:
> [  283.486118] WARNING: CPU: 1 PID: 1 at mm/debug_vm_pgtable.c:371 debug_vm_pgtable+0x4dc/0x7e3
> [  283.487342] Modules linked in:
> [  283.487752] CPU: 1 PID: 1 Comm: swapper/0 Not tainted 5.6.0-rc7-next-20200323-00001-gf675f2f91d045 #1
> [  283.488817] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.12.0-1 04/01/2014
> [  283.489794] RIP: 0010:debug_vm_pgtable+0x4dc/0x7e3
> [  283.490361] Code: b5 fd 48 8b 7d d0 be 20 01 00 00 e8 3d 9f b5 fd 48 8b 75 c8 48 8b 7d d0 e8 30 9f b5 fd 48 8b 75 c8 48 8b 7d d0 e8 23 9f b5 fd <0f> 0b 48 8b 75 c8 48 8b 7d d0 e8 14 9f b5 fd 0f 0b 48 8b 75 c8 48
> [  283.492577] RSP: 0000:ffff888236493ed8 EFLAGS: 00010202
> [  283.493235] RAX: 00000001e1d31025 RBX: ffff88823e7f6cd8 RCX: ffffffffffffffff
> [  283.494135] RDX: 0000000000000000 RSI: 0000000000000025 RDI: 00000001e1d31000
> [  283.495002] RBP: ffff888236493f38 R08: 0000000000000001 R09: 0000000000000001
> [  283.495858] R10: 0000000000000001 R11: 0000000000000000 R12: ffff88821d907000
> [  283.496748] R13: ffff88821d8fc498 R14: ffff88821d8fda90 R15: ffff88821d8fc000
> [  283.497614] FS:  0000000000000000(0000) GS:ffff888237800000(0000) knlGS:0000000000000000
> [  283.498585] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> [  283.499290] CR2: 00000000ffffffff CR3: 00000001e1222000 CR4: 00000000000406e0
> [  283.500165] Call Trace:
> [  283.500499]  ? rest_init+0x240/0x240
> [  283.500985]  kernel_init+0x13/0x110
> [  283.501433]  ret_from_fork+0x24/0x30
> [  283.501907] irq event stamp: 4760776
> [  283.502366] hardirqs last  enabled at (4760775): [<ffffffffb481e34d>] _raw_spin_unlock_irqrestore+0x4d/0x60
> [  283.511686] hardirqs last disabled at (4760776): [<ffffffffb3c038d4>] trace_hardirqs_off_thunk+0x1a/0x1c
> [  283.512914] softirqs last  enabled at (4760748): [<ffffffffb4c002cf>] __do_softirq+0x2cf/0x4ad
> [  283.514086] softirqs last disabled at (4760741): [<ffffffffb3cf4f4d>] irq_exit+0xcd/0xe0
> [  283.515114] ---[ end trace 7e3383c4261f8faa ]---

The above failure here and the one on the other thread can be solved with
the following change. The failure is caused by the fact that even though
the soft dirty helpers are defined within CONFIG_HAVE_ARCH_SOFT_DIRTY, the
required PTE bits (_PAGE_SOFT_DIRTY and _PAGE_SWP_SOFT_DIRTY) are available
only when CONFIG_MEM_SOFT_DIRTY is enabled. Hence these tests should not
proceed unless CONFIG_MEM_SOFT_DIRTY is enabled. Similar situation exists
in s390 (_PAGE_SOFT_DIRTY and _SEGMENT_ENTRY_SOFT_DIRTY) and powerpc (at
least with _PAGE_SWP_SOFT_DIRTY).

diff --git a/mm/debug_vm_pgtable.c b/mm/debug_vm_pgtable.c
index 87b4b495333b..2a75a51fed06 100644
--- a/mm/debug_vm_pgtable.c
+++ b/mm/debug_vm_pgtable.c
@@ -589,7 +589,7 @@ static void __init pte_soft_dirty_tests(unsigned long pfn, pgprot_t prot)
 {
        pte_t pte = pfn_pte(pfn, prot);
 
-       if (!IS_ENABLED(CONFIG_HAVE_ARCH_SOFT_DIRTY))
+       if (!IS_ENABLED(CONFIG_MEM_SOFT_DIRTY))
                return;
 
        WARN_ON(!pte_soft_dirty(pte_mksoft_dirty(pte)));
@@ -600,7 +600,7 @@ static void __init pte_swap_soft_dirty_tests(unsigned long pfn, pgprot_t prot)
 {
        pte_t pte = pfn_pte(pfn, prot);
 
-       if (!IS_ENABLED(CONFIG_HAVE_ARCH_SOFT_DIRTY))
+       if (!IS_ENABLED(CONFIG_MEM_SOFT_DIRTY))
                return;
 
        WARN_ON(!pte_swp_soft_dirty(pte_swp_mksoft_dirty(pte)));
@@ -612,7 +612,7 @@ static void __init pmd_soft_dirty_tests(unsigned long pfn, pgprot_t prot)
 {
        pmd_t pmd = pfn_pmd(pfn, prot);
 
-       if (!IS_ENABLED(CONFIG_HAVE_ARCH_SOFT_DIRTY))
+       if (!IS_ENABLED(CONFIG_MEM_SOFT_DIRTY))
                return;
 
        WARN_ON(!pmd_soft_dirty(pmd_mksoft_dirty(pmd)));
@@ -623,7 +623,7 @@ static void __init pmd_swap_soft_dirty_tests(unsigned long pfn, pgprot_t prot)
 {
        pmd_t pmd = pfn_pmd(pfn, prot);
 
-       if (!IS_ENABLED(CONFIG_HAVE_ARCH_SOFT_DIRTY) ||
+       if (!IS_ENABLED(CONFIG_MEM_SOFT_DIRTY) ||
                !IS_ENABLED(CONFIG_ARCH_ENABLE_THP_MIGRATION))
                return;

^ permalink raw reply related

* Re: [PATCH v2 01/22] powerpc/pkeys: Avoid using lockless page table walk
From: Aneesh Kumar K.V @ 2020-04-05 13:37 UTC (permalink / raw)
  To: Ram Pai
  Cc: Ram Pai, linux-kernel, npiggin, linux-mm, kvm-ppc, kirill,
	leonardo, linuxppc-dev
In-Reply-To: <20200403002649.GB22412@oc0525413822.ibm.com>

Ram Pai <linuxram@us.ibm.com> writes:

> On Thu, Mar 19, 2020 at 09:25:48AM +0530, Aneesh Kumar K.V wrote:
>> Fetch pkey from vma instead of linux page table. Also document the fact that in
>> some cases the pkey returned in siginfo won't be the same as the one we took
>> keyfault on. Even with linux page table walk, we can end up in a similar scenario.
>
> There is no way to correctly ensure that the key returned through
> siginfo is actually the key that took the fault.  Either get it
> from page table or get it from the corresponding vma.

That is correct.

>
> So we had to choose the lesser evil. Getting it from the page table was
> faster, and did not involve taking any locks.

That is because you are locks which need to be held on page table walk.

>Getting it from the vma
> was slower, since it needed locks.  Also I faintly recall, there
> is a scenario where the address that gets a key fault, has no
> corresponding VMA associated with it yet.

I would be interested in this. For now IIUC even x86 fetch the key from
VMA.

>
> Hence the logic used was --
> 	if it is key-fault, than procure the key quickly
> 	from the page table.  In the unlikely event that the fault is
> 	something else, but still has a non-permissive key associated
> 	with it, get the key from the vma.


I am fixing that logic further in the next patch. I do have a test case
attached for that. We always check for the key in the vma and if it
allows access, then we retry.


>
> A well written application should avoid changing the key of an address
> space without synchronizing the corresponding threads that operate in
> that address range.  However, if the application ignores to do so, than
> it is vulnerable to a undefined behavior. There is no way to prove that
> the reported key is correct or incorrect, since there is no provable
> order between the two events; the key-fault event and the key-change
> event.
>
> Hence I think the change proposed in this patch may not be necessary.
> RP

The change is needed so that we can make the page table walk safer.


-aneesh

^ permalink raw reply

* [GIT PULL] Please pull powerpc/linux.git powerpc-5.7-1 tag
From: Michael Ellerman @ 2020-04-05 12:53 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: tyreld, shilpa.bhat, gustavold, aik, ndesaulniers, psampat,
	bala24, grant.likely, oohall, afzal.mohd.ma, srikar, sfr,
	joe.lawrence, maskray, ilie.halip, aneesh.kumar, yuehaibing, rppt,
	chenzhou10, ganeshgr, dougmill, kjain, leonardo, naveen.n.rao,
	agust, laurentiu.tudor, nathanl, arnd, alistair, npiggin, oss,
	olof, maddy, christophe.jaillet, clg, courbet, vaibhav, bhelgaas,
	natechancellor, dja, farosas, gregkh, lpechacek, linux-kernel,
	sourabhjain, joe, po-hsu.lin, linuxppc-dev

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

Hi Linus,

Please pull powerpc updates for 5.7.

Slightly late as I had to rebase mid-week to insert a bug fix.

There is one conflict in fs/sysfs/group.c, between our:

  9255782f7061 ("sysfs: Wrap __compat_only_sysfs_link_entry_to_kobj function to change the symlink name")

And:

  303a42769c4c ("sysfs: add sysfs_group{s}_change_owner()")

The resolution is to take all of the changes from 303a42769c4c, except that the
EXPORT_SYMBOL_GPL prior to sysfs_group_attrs_change_owner() should be:

EXPORT_SYMBOL_GPL(compat_only_sysfs_link_entry_to_kobj);

not:

EXPORT_SYMBOL_GPL(__compat_only_sysfs_link_entry_to_kobj);

cheers


The following changes since commit 11a48a5a18c63fd7621bb050228cebf13566e4d8:

  Linux 5.6-rc2 (2020-02-16 13:16:59 -0800)

are available in the git repository at:

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

for you to fetch changes up to c17eb4dca5a353a9dbbb8ad6934fe57af7165e91:

  powerpc: Make setjmp/longjmp signature standard (2020-04-01 14:30:51 +1100)

- ------------------------------------------------------------------
powerpc updates for 5.7

 - A large series from Nick for 64-bit to further rework our exception vectors,
   and rewrite portions of the syscall entry/exit and interrupt return in C. The
   result is much easier to follow code that is also faster in general.

 - Cleanup of our ptrace code to split various parts out that had become badly
   intertwined with #ifdefs over the years.

 - Changes to our NUMA setup under the PowerVM hypervisor which should
   hopefully avoid non-sensical topologies which can lead to warnings from the
   workqueue code and other problems.

 - MAINTAINERS updates to remove some of our old orphan entries and update the
   status of others.

 - Quite a few other small changes and fixes all over the map.

Thanks to:
  Abdul Haleem, afzal mohammed, Alexey Kardashevskiy, Andrew Donnellan, Aneesh
  Kumar K.V, Balamuruhan S, Cédric Le Goater, Chen Zhou, Christophe JAILLET,
  Christophe Leroy, Christoph Hellwig, Clement Courbet, Daniel Axtens, David
  Gibson, Douglas Miller, Fabiano Rosas, Fangrui Song, Ganesh Goudar, Gautham R.
  Shenoy, Greg Kroah-Hartman, Greg Kurz, Gustavo Luiz Duarte, Hari Bathini, Ilie
  Halip, Jan Kara, Joe Lawrence, Joe Perches, Kajol Jain, Larry Finger,
  Laurentiu Tudor, Leonardo Bras, Libor Pechacek, Madhavan Srinivasan, Mahesh
  Salgaonkar, Masahiro Yamada, Masami Hiramatsu, Mauricio Faria de Oliveira,
  Michael Neuling, Michal Suchanek, Mike Rapoport, Nageswara R Sastry, Nathan
  Chancellor, Nathan Lynch, Naveen N. Rao, Nicholas Piggin, Nick Desaulniers,
  Oliver O'Halloran, Po-Hsu Lin, Pratik Rajesh Sampat, Rasmus Villemoes, Ravi
  Bangoria, Roman Bolshakov, Sam Bobroff, Sandipan Das, Santosh S, Sedat Dilek,
  Segher Boessenkool, Shilpasri G Bhat, Sourabh Jain, Srikar Dronamraju, Stephen
  Rothwell, Tyrel Datwyler, Vaibhav Jain, YueHaibing.

- ------------------------------------------------------------------
Alexey Kardashevskiy (2):
      powerpc/book3s64: Fix error handling in mm_iommu_do_alloc()
      powerpc/prom_init: Pass the "os-term" message to hypervisor

Aneesh Kumar K.V (2):
      powerpc/hash64/devmap: Use H_PAGE_THP_HUGE when setting up huge devmap PTE entries
      powerpc/64: Avoid isync in flush_dcache_range()

Balamuruhan S (1):
      powerpc/sstep: Fix DS operand in ld encoding to appropriate value

Chen Zhou (1):
      PCI: rpaphp: Remove unused variable 'value'

Christophe JAILLET (2):
      powerpc/83xx: Fix some typo in some warning message
      powerpc/83xx: Add some error handling in 'quirk_mpc8360e_qe_enet10()'

Christophe Leroy (32):
      powerpc/process: Remove unneccessary #ifdef CONFIG_PPC64 in copy_thread_tls()
      powerpc/32s: Don't flush all TLBs when flushing one page
      powerpc/32: Warn and return ENOSYS on syscalls from kernel
      powerpc: Don't use thread struct for saving SRR0/1 on syscall.
      powerpc/32s: Slenderize _tlbia() for powerpc 603/603e
      powerpc/32: don't restore r0, r6-r8 on exception entry path after trace_hardirqs_off()
      powerpc/32: refactor pmd_offset(pud_offset(pgd_offset...
      powerpc/32: drop get_pteptr()
      powerpc/mm: Don't kmap_atomic() in pte_offset_map() on PPC32
      powerpc: Add current_stack_pointer as a register global
      powerpc/irq: Use current_stack_pointer in check_stack_overflow()
      powerpc/irq: use IS_ENABLED() in check_stack_overflow()
      powerpc/irq: Use current_stack_pointer in do_IRQ()
      powerpc/32: Fix missing NULL pmd check in virt_to_kpte()
      selftests/powerpc: Add tlbie_test in .gitignore
      powerpc/kprobes: Remove redundant code
      powerpc/kasan: Fix kasan_remap_early_shadow_ro()
      powerpc/32s: reorder Linux PTE bits to better match Hash PTE bits.
      powerpc/kprobes: Ignore traps that happened in real mode
      powerpc: Move ptrace into a subdirectory.
      powerpc/ptrace: remove unused header includes
      powerpc/ptrace: drop unnecessary #ifdefs CONFIG_PPC64
      powerpc/ptrace: drop PARAMETER_SAVE_AREA_OFFSET
      powerpc/ptrace: split out VSX related functions.
      powerpc/ptrace: split out ALTIVEC related functions.
      powerpc/ptrace: split out SPE related functions.
      powerpc/ptrace: split out TRANSACTIONAL_MEM related functions.
      powerpc/ptrace: move register viewing functions out of ptrace.c
      powerpc/ptrace: split out ADV_DEBUG_REGS related functions.
      powerpc/ptrace: create ptrace_get_debugreg()
      powerpc/ptrace: create ppc_gethwdinfo()
      powerpc/ptrace: move ptrace_triggered() into hw_breakpoint.c

Clement Courbet (1):
      powerpc: Make setjmp/longjmp signature standard

Cédric Le Goater (4):
      powerpc/xive: Use XIVE_BAD_IRQ instead of zero to catch non configured IPIs
      powerpc/xive: Fix xmon support on the PowerNV platform
      powerpc/xmon: Add source flags to output of XIVE interrupts
      powerpc/xive: Add a debugfs file to dump internal XIVE state

Daniel Axtens (1):
      powerpc/64: Setup a paca before parsing device tree etc.

Douglas Miller (1):
      powerpc/xmon: Add ASCII dump to d1,d2,d4,d8 commands.

Fabiano Rosas (1):
      powerpc/prom_init: Remove leftover comment

Fangrui Song (1):
      powerpc/boot: Delete unneeded .globl _zimage_start

Ganesh Goudar (1):
      powerpc/pseries: Handle UE event for memcpy_mcsafe

Greg Kroah-Hartman (6):
      powerpc/kernel: no need to check return value of debugfs_create functions
      powerpc/kvm: no need to check return value of debugfs_create functions
      powerpc/mm: book3s64: hash_utils: no need to check return value of debugfs_create functions
      powerpc/mm: ptdump: no need to check return value of debugfs_create functions
      powerpc/cell/axon_msi: no need to check return value of debugfs_create functions
      powerpc/powernv: no need to check return value of debugfs_create functions

Gustavo Luiz Duarte (2):
      selftests/powerpc: Add tm-signal-pagefault test
      selftests/powerpc: Don't rely on segfault to rerun the test

Ilie Halip (1):
      powerpc/pmac/smp: Avoid unused-variable warnings

Joe Lawrence (1):
      powerpc/vdso: remove deprecated VDS64_HAS_DESCRIPTORS references

Joe Perches (1):
      powerpc/cell: Use fallthrough;

Kajol Jain (1):
      powerpc/kernel/sysfs: Add new config option PMU_SYSFS to enable PMU SPRs sysfs file creation

Laurentiu Tudor (1):
      powerpc/fsl_booke: Avoid creating duplicate tlb1 entry

Leonardo Bras (1):
      powerpc/cputable: Remove unnecessary copy of cpu_spec->oprofile_type

Libor Pechacek (1):
      powerpc/pseries: Avoid NULL pointer dereference when drmem is unavailable

Madhavan Srinivasan (1):
      powerpc/kernel/sysfs: Refactor current sysfs.c

Michael Ellerman (22):
      powerpc/Makefile: Mark phony targets as PHONY
      powerpc: Rename current_stack_pointer() to current_stack_frame()
      Merge branch 'fixes' into next
      selftests/powerpc: Add a test of sigreturn vs VDSO
      powerpc/kuap: PPC_KUAP_DEBUG should depend on PPC_KUAP
      powerpc/xmon: Lower limits on nidump and ndump
      powerpc/64s: Fix section mismatch warnings from boot code
      powerpc/64: Prevent stack protection in early boot
      powerpc: Update MAINTAINERS
      powerpc: Update wiki link in MAINTAINERS
      powerpc: Remove PA SEMI MAINTAINERS entries
      powerpc: Mark 4xx as Orphan in MAINTAINERS
      powerpc: Drop XILINX MAINTAINERS entry
      powerpc: Update MPC5XXX MAINTAINERS entry
      powerpc: Update powermac MAINTAINERS entry
      powerpc: Update 83xx/85xx MAINTAINERS entry
      powerpc: Switch 8xx MAINTAINERS entry to Christophe
      powerpc/smp: Drop superfluous NULL check
      powerpc/smp: Use IS_ENABLED() to avoid #ifdef
      powerpc/64/tm: Don't let userspace set regs->trap via sigreturn
      powerpc/vmlinux.lds: Explicitly retain .gnu.hash
      selftests/powerpc: Fix try-run when source tree is not writable

Mike Rapoport (1):
      powerpc/32: drop unused ISA_DMA_THRESHOLD

Nathan Chancellor (1):
      powerpc/maple: Fix declaration made after definition

Naveen N. Rao (2):
      powerpc: Drop -fno-dwarf2-cfi-asm
      powerpc: Suppress .eh_frame generation

Nicholas Piggin (34):
      powerpc/64s/radix: Fix CONFIG_SMP=n build
      powerpc/lib: Fix emulate_step() std test
      powerpc/pseries: Avoid harmless preempt warning
      powerpc/64: mark emergency stacks valid to unwind
      powerpc/64s/exception: Introduce INT_DEFINE parameter block for code generation
      powerpc/64s/exception: Add GEN_COMMON macro that uses INT_DEFINE parameters
      powerpc/64s/exception: Add GEN_KVM macro that uses INT_DEFINE parameters
      powerpc/64s/exception: Expand EXC_COMMON and EXC_COMMON_ASYNC macros
      powerpc/64s/exception: Move all interrupt handlers to new style code gen macros
      powerpc/64s/exception: Remove old INT_ENTRY macro
      powerpc/64s/exception: Remove old INT_COMMON macro
      powerpc/64s/exception: Remove old INT_KVM_HANDLER
      powerpc/64s/exception: Add ISIDE option
      powerpc/64s/exception: Move real to virt switch into the common handler
      powerpc/64s/exception: Move soft-mask test to common code
      powerpc/64s/exception: Move KVM test to common code
      powerpc/64s/exception: Remove confusing IEARLY option
      powerpc/64s/exception: Remove the SPR saving patch code macros
      powerpc/64s/exception: Trim unused arguments from KVMTEST macro
      powerpc/64s/exception: Avoid touching the stack in hdecrementer
      powerpc/64s/exception: Re-inline some handlers
      powerpc/64s/exception: Clean up SRR specifiers
      powerpc/64s/exception: Add more comments for interrupt handlers
      powerpc/64s/exception: Only test KVM in SRR interrupts when PR KVM is supported
      powerpc/64s/exception: Reconcile interrupts in system_reset
      powerpc/64s/exception: Soft NMI interrupt should not use ret_from_except
      powerpc/64/syscall: Remove non-volatile GPR save optimisation
      powerpc/64/sstep: Ifdef the deprecated fast endian switch syscall
      powerpc/64/sycall: Implement syscall entry/exit logic in C
      powerpc/64/syscall: Zero volatile registers when returning
      powerpc/64: Implement soft interrupt replay in C
      powerpc/64s: Implement interrupt exit logic in C
      powerpc/64s/exception: Remove lite interrupt return
      powerpc/64/syscall: Reconcile interrupts

Nick Desaulniers (1):
      powerpc: Prefer __section and __printf from compiler_attributes.h

Oliver O'Halloran (12):
      powerpc/pseries/vio: Remove stray #ifdef CONFIG_PPC_PSERIES
      powerpc/pseries/Makefile: Remove CONFIG_PPC_PSERIES check
      powerpc/powernv: Treat an empty reboot string as default
      powerpc/powernv: Add explicit fast-reboot support
      cpufreq: powernv: Fix use-after-free
      cpufreq: powernv: Fix unsafe notifiers
      powerpc/eeh: Add sysfs files in late probe
      powerpc/eeh: Remove eeh_add_device_tree_late()
      powerpc/eeh: Do early EEH init only when required
      powerpc/eeh: Remove PHB check in probe
      powerpc/eeh: Make early EEH init pseries specific
      powerpc/eeh: Rework eeh_ops->probe()

Po-Hsu Lin (1):
      selftests/powerpc: Turn off timeout setting for benchmarks, dscr, signal, tm

Pratik Rajesh Sampat (1):
      cpufreq: powernv: Fix frame-size-overflow in powernv_cpufreq_work_fn

Shilpasri G Bhat (1):
      powerpc/powernv: Add documentation for the opal sensor_groups sysfs interfaces

Sourabh Jain (6):
      Documentation/ABI: Add ABI documentation for /sys/kernel/fadump_*
      sysfs: Wrap __compat_only_sysfs_link_entry_to_kobj function to change the symlink name
      powerpc/fadump: Reorganize /sys/kernel/fadump_* sysfs files
      powerpc/powernv: Move core and fadump_release_opalcore under new kobject
      Documentation/ABI: Mark /sys/kernel/fadump_* sysfs files deprecated
      powerpc/fadump: sysfs for fadump memory reservation

Srikar Dronamraju (6):
      powerpc/smp: Use nid as fallback for package_id
      powerpc/vphn: Check for error from hcall_vphn
      powerpc/numa: Handle extra hcall_vphn error cases
      powerpc/numa: Use cpu node map of first sibling thread
      powerpc/numa: Early request for home node associativity
      powerpc/numa: Remove late request for home node associativity

Stephen Rothwell (1):
      tty: evh_bytechan: Fix out of bounds accesses

Tyrel Datwyler (1):
      powerpc/pseries: Fix of_read_drc_info_cell() to point at next record

Vaibhav Jain (1):
      powerpc/papr_scm: Mark papr_scm_ndctl() as static

YueHaibing (1):
      powerpc/pmac/smp: Drop unnecessary volatile qualifier

afzal mohammed (1):
      powerpc: Replace setup_irq() by request_irq()


 Documentation/ABI/obsolete/sysfs-kernel-fadump_enabled          |    9 +
 Documentation/ABI/obsolete/sysfs-kernel-fadump_registered       |   10 +
 Documentation/ABI/obsolete/sysfs-kernel-fadump_release_mem      |   10 +
 Documentation/ABI/removed/sysfs-kernel-fadump_release_opalcore  |    9 +
 Documentation/ABI/testing/sysfs-firmware-opal-sensor-groups     |   21 +
 Documentation/ABI/testing/sysfs-kernel-fadump                   |   40 +
 Documentation/powerpc/firmware-assisted-dump.rst                |   32 +-
 MAINTAINERS                                                     |   49 +-
 arch/powerpc/Makefile                                           |   12 +-
 arch/powerpc/boot/Makefile                                      |    2 +
 arch/powerpc/boot/crt0.S                                        |    3 -
 arch/powerpc/include/asm/asm-prototypes.h                       |   15 +-
 arch/powerpc/include/asm/book3s/32/hash.h                       |    8 +-
 arch/powerpc/include/asm/book3s/32/pgtable.h                    |    6 +-
 arch/powerpc/include/asm/book3s/64/hash-4k.h                    |    6 +
 arch/powerpc/include/asm/book3s/64/hash-64k.h                   |    8 +-
 arch/powerpc/include/asm/book3s/64/kup-radix.h                  |   24 +-
 arch/powerpc/include/asm/book3s/64/pgtable.h                    |    4 +-
 arch/powerpc/include/asm/book3s/64/radix.h                      |    5 +
 arch/powerpc/include/asm/cache.h                                |    2 +-
 arch/powerpc/include/asm/cacheflush.h                           |    6 +-
 arch/powerpc/include/asm/cputime.h                              |   33 +
 arch/powerpc/include/asm/dma.h                                  |    3 +-
 arch/powerpc/include/asm/drmem.h                                |    4 +-
 arch/powerpc/include/asm/eeh.h                                  |   26 +-
 arch/powerpc/include/asm/exception-64s.h                        |    4 -
 arch/powerpc/include/asm/hw_irq.h                               |    6 +-
 arch/powerpc/include/asm/kvm_host.h                             |    3 -
 arch/powerpc/include/asm/mce.h                                  |    2 +
 arch/powerpc/include/asm/nohash/32/pgtable.h                    |    6 +-
 arch/powerpc/include/asm/opal-api.h                             |    1 +
 arch/powerpc/include/asm/perf_event.h                           |    2 +-
 arch/powerpc/include/asm/pgtable.h                              |   19 +
 arch/powerpc/include/asm/ptrace.h                               |    5 +
 arch/powerpc/include/asm/reg.h                                  |    4 +-
 arch/powerpc/include/asm/setjmp.h                               |    6 +-
 arch/powerpc/include/asm/signal.h                               |    3 +
 arch/powerpc/include/asm/switch_to.h                            |   11 +
 arch/powerpc/include/asm/time.h                                 |    4 +-
 arch/powerpc/include/asm/topology.h                             |   10 +-
 arch/powerpc/include/asm/vdso.h                                 |   24 -
 arch/powerpc/kernel/Makefile                                    |   11 +-
 arch/powerpc/kernel/btext.c                                     |    2 +-
 arch/powerpc/kernel/cputable.c                                  |    1 -
 arch/powerpc/kernel/dt_cpu_ftrs.c                               |    1 -
 arch/powerpc/kernel/eeh.c                                       |  145 +-
 arch/powerpc/kernel/entry_32.S                                  |   38 +-
 arch/powerpc/kernel/entry_64.S                                  |  895 ++---
 arch/powerpc/kernel/exceptions-64e.S                            |  287 +-
 arch/powerpc/kernel/exceptions-64s.S                            | 2043 ++++++++----
 arch/powerpc/kernel/fadump.c                                    |  134 +-
 arch/powerpc/kernel/head_32.S                                   |    9 +-
 arch/powerpc/kernel/head_32.h                                   |   28 +-
 arch/powerpc/kernel/head_64.S                                   |    4 +-
 arch/powerpc/kernel/head_booke.h                                |    5 +-
 arch/powerpc/kernel/hw_breakpoint.c                             |   16 +
 arch/powerpc/kernel/irq.c                                       |  192 +-
 arch/powerpc/kernel/kprobes.c                                   |   84 +-
 arch/powerpc/kernel/mce.c                                       |   14 +
 arch/powerpc/kernel/mce_power.c                                 |    8 +-
 arch/powerpc/kernel/misc.S                                      |    4 +-
 arch/powerpc/kernel/of_platform.c                               |   12 +-
 arch/powerpc/kernel/paca.c                                      |   14 +-
 arch/powerpc/kernel/pci-common.c                                |    6 -
 arch/powerpc/kernel/pci-hotplug.c                               |    2 -
 arch/powerpc/kernel/process.c                                   |  124 +-
 arch/powerpc/kernel/prom_init.c                                 |    4 +-
 arch/powerpc/kernel/ptrace.c                                    | 3468 --------------------
 arch/powerpc/kernel/ptrace/Makefile                             |   20 +
 arch/powerpc/kernel/ptrace/ptrace-adv.c                         |  492 +++
 arch/powerpc/kernel/ptrace/ptrace-altivec.c                     |  128 +
 arch/powerpc/kernel/ptrace/ptrace-decl.h                        |  184 ++
 arch/powerpc/kernel/ptrace/ptrace-noadv.c                       |  265 ++
 arch/powerpc/kernel/ptrace/ptrace-novsx.c                       |   57 +
 arch/powerpc/kernel/ptrace/ptrace-spe.c                         |   68 +
 arch/powerpc/kernel/ptrace/ptrace-tm.c                          |  851 +++++
 arch/powerpc/kernel/ptrace/ptrace-view.c                        |  904 +++++
 arch/powerpc/kernel/ptrace/ptrace-vsx.c                         |  151 +
 arch/powerpc/kernel/ptrace/ptrace.c                             |  481 +++
 arch/powerpc/kernel/{ => ptrace}/ptrace32.c                     |   11 -
 arch/powerpc/kernel/setup-common.c                              |    3 +-
 arch/powerpc/kernel/setup.h                                     |    6 +
 arch/powerpc/kernel/setup_32.c                                  |    1 -
 arch/powerpc/kernel/setup_64.c                                  |   32 +-
 arch/powerpc/kernel/signal.h                                    |    2 -
 arch/powerpc/kernel/signal_64.c                                 |    4 +-
 arch/powerpc/kernel/smp.c                                       |   31 +-
 arch/powerpc/kernel/stacktrace.c                                |    6 +-
 arch/powerpc/kernel/syscall_64.c                                |  379 +++
 arch/powerpc/kernel/syscalls/syscall.tbl                        |   22 +-
 arch/powerpc/kernel/sysfs.c                                     |  381 ++-
 arch/powerpc/kernel/systbl.S                                    |    9 +-
 arch/powerpc/kernel/time.c                                      |    9 -
 arch/powerpc/kernel/traps.c                                     |   25 +-
 arch/powerpc/kernel/vdso.c                                      |    5 -
 arch/powerpc/kernel/vector.S                                    |    2 +-
 arch/powerpc/kernel/vmlinux.lds.S                               |    1 +
 arch/powerpc/kexec/Makefile                                     |    3 -
 arch/powerpc/kvm/book3s_64_mmu_hv.c                             |    5 +-
 arch/powerpc/kvm/book3s_64_mmu_radix.c                          |    5 +-
 arch/powerpc/kvm/book3s_hv.c                                    |    9 +-
 arch/powerpc/kvm/book3s_hv_rmhandlers.S                         |   11 -
 arch/powerpc/kvm/book3s_segment.S                               |    7 -
 arch/powerpc/kvm/timing.c                                       |   17 +-
 arch/powerpc/lib/sstep.c                                        |    5 +-
 arch/powerpc/lib/test_emulate_step.c                            |    7 +-
 arch/powerpc/mm/book3s32/hash_low.S                             |   27 +-
 arch/powerpc/mm/book3s32/mmu.c                                  |    2 +-
 arch/powerpc/mm/book3s32/tlb.c                                  |   11 +-
 arch/powerpc/mm/book3s64/hash_utils.c                           |    7 +-
 arch/powerpc/mm/book3s64/iommu_api.c                            |   39 +-
 arch/powerpc/mm/book3s64/radix_pgtable.c                        |    1 +
 arch/powerpc/mm/book3s64/radix_tlb.c                            |    7 +-
 arch/powerpc/mm/kasan/kasan_init_32.c                           |   10 +-
 arch/powerpc/mm/mem.c                                           |    6 -
 arch/powerpc/mm/nohash/40x.c                                    |    4 +-
 arch/powerpc/mm/nohash/tlb_low.S                                |   12 +-
 arch/powerpc/mm/numa.c                                          |   97 +-
 arch/powerpc/mm/pgtable_32.c                                    |   41 +-
 arch/powerpc/mm/ptdump/bats.c                                   |    8 +-
 arch/powerpc/mm/ptdump/hashpagetable.c                          |    7 +-
 arch/powerpc/mm/ptdump/ptdump.c                                 |    8 +-
 arch/powerpc/mm/ptdump/segment_regs.c                           |    8 +-
 arch/powerpc/platforms/44x/warp.c                               |    3 -
 arch/powerpc/platforms/52xx/efika.c                             |    1 -
 arch/powerpc/platforms/83xx/km83xx.c                            |    9 +-
 arch/powerpc/platforms/85xx/mpc85xx_cds.c                       |   11 +-
 arch/powerpc/platforms/8xx/cpm1.c                               |    9 +-
 arch/powerpc/platforms/8xx/m8xx_setup.c                         |    9 +-
 arch/powerpc/platforms/Kconfig.cputype                          |    8 +-
 arch/powerpc/platforms/amigaone/setup.c                         |    1 -
 arch/powerpc/platforms/cell/axon_msi.c                          |    6 +-
 arch/powerpc/platforms/cell/spufs/switch.c                      |    2 +-
 arch/powerpc/platforms/chrp/setup.c                             |   15 +-
 arch/powerpc/platforms/maple/setup.c                            |   34 +-
 arch/powerpc/platforms/powermac/pic.c                           |   29 +-
 arch/powerpc/platforms/powermac/setup.c                         |    1 -
 arch/powerpc/platforms/powermac/smp.c                           |   20 +-
 arch/powerpc/platforms/powernv/eeh-powernv.c                    |   37 +-
 arch/powerpc/platforms/powernv/memtrace.c                       |    7 -
 arch/powerpc/platforms/powernv/opal-core.c                      |   55 +-
 arch/powerpc/platforms/powernv/opal-imc.c                       |   24 +-
 arch/powerpc/platforms/powernv/pci-ioda.c                       |    5 -
 arch/powerpc/platforms/powernv/setup.c                          |    4 +-
 arch/powerpc/platforms/powernv/vas-debug.c                      |   37 +-
 arch/powerpc/platforms/pseries/Makefile                         |    2 -
 arch/powerpc/platforms/pseries/eeh_pseries.c                    |   87 +-
 arch/powerpc/platforms/pseries/hotplug-memory.c                 |    8 +-
 arch/powerpc/platforms/pseries/lpar.c                           |   10 +-
 arch/powerpc/platforms/pseries/of_helpers.c                     |    2 +-
 arch/powerpc/platforms/pseries/papr_scm.c                       |    5 +-
 arch/powerpc/platforms/pseries/pci_dlpar.c                      |    2 +-
 arch/powerpc/platforms/pseries/ras.c                            |    3 +
 arch/powerpc/platforms/pseries/vio.c                            |    2 -
 arch/powerpc/platforms/pseries/vphn.c                           |    3 +-
 arch/powerpc/sysdev/xive/common.c                               |  126 +-
 arch/powerpc/sysdev/xive/native.c                               |    7 +-
 arch/powerpc/sysdev/xive/spapr.c                                |   23 +-
 arch/powerpc/sysdev/xive/xive-internal.h                        |    9 +
 arch/powerpc/xmon/Makefile                                      |    3 -
 arch/powerpc/xmon/xmon.c                                        |   14 +-
 drivers/cpufreq/powernv-cpufreq.c                               |   30 +-
 drivers/pci/hotplug/rpadlpar_core.c                             |    2 +-
 drivers/pci/hotplug/rpaphp_core.c                               |    5 +-
 drivers/pci/hotplug/rpaphp_pci.c                                |    4 +-
 drivers/tty/ehv_bytechan.c                                      |   21 +-
 fs/sysfs/group.c                                                |   28 +-
 include/linux/sysfs.h                                           |   12 +
 tools/testing/selftests/powerpc/benchmarks/Makefile             |    2 +
 tools/testing/selftests/powerpc/benchmarks/settings             |    1 +
 tools/testing/selftests/powerpc/dscr/Makefile                   |    2 +
 tools/testing/selftests/powerpc/dscr/settings                   |    1 +
 tools/testing/selftests/powerpc/mm/.gitignore                   |    1 +
 tools/testing/selftests/powerpc/pmu/ebb/Makefile                |    1 +
 tools/testing/selftests/powerpc/signal/.gitignore               |    1 +
 tools/testing/selftests/powerpc/signal/Makefile                 |    4 +-
 tools/testing/selftests/powerpc/signal/settings                 |    1 +
 tools/testing/selftests/powerpc/signal/sigreturn_vdso.c         |  127 +
 tools/testing/selftests/powerpc/tm/.gitignore                   |    1 +
 tools/testing/selftests/powerpc/tm/Makefile                     |    5 +-
 tools/testing/selftests/powerpc/tm/settings                     |    1 +
 tools/testing/selftests/powerpc/tm/tm-signal-context-force-tm.c |   74 +-
 tools/testing/selftests/powerpc/tm/tm-signal-pagefault.c        |  284 ++
 183 files changed, 7989 insertions(+), 6154 deletions(-)
 create mode 100644 Documentation/ABI/obsolete/sysfs-kernel-fadump_enabled
 create mode 100644 Documentation/ABI/obsolete/sysfs-kernel-fadump_registered
 create mode 100644 Documentation/ABI/obsolete/sysfs-kernel-fadump_release_mem
 create mode 100644 Documentation/ABI/removed/sysfs-kernel-fadump_release_opalcore
 create mode 100644 Documentation/ABI/testing/sysfs-firmware-opal-sensor-groups
 create mode 100644 Documentation/ABI/testing/sysfs-kernel-fadump
 delete mode 100644 arch/powerpc/kernel/ptrace.c
 create mode 100644 arch/powerpc/kernel/ptrace/Makefile
 create mode 100644 arch/powerpc/kernel/ptrace/ptrace-adv.c
 create mode 100644 arch/powerpc/kernel/ptrace/ptrace-altivec.c
 create mode 100644 arch/powerpc/kernel/ptrace/ptrace-decl.h
 create mode 100644 arch/powerpc/kernel/ptrace/ptrace-noadv.c
 create mode 100644 arch/powerpc/kernel/ptrace/ptrace-novsx.c
 create mode 100644 arch/powerpc/kernel/ptrace/ptrace-spe.c
 create mode 100644 arch/powerpc/kernel/ptrace/ptrace-tm.c
 create mode 100644 arch/powerpc/kernel/ptrace/ptrace-view.c
 create mode 100644 arch/powerpc/kernel/ptrace/ptrace-vsx.c
 create mode 100644 arch/powerpc/kernel/ptrace/ptrace.c
 rename arch/powerpc/kernel/{ => ptrace}/ptrace32.c (96%)
 create mode 100644 arch/powerpc/kernel/syscall_64.c
 create mode 100644 tools/testing/selftests/powerpc/benchmarks/settings
 create mode 100644 tools/testing/selftests/powerpc/dscr/settings
 create mode 100644 tools/testing/selftests/powerpc/signal/settings
 create mode 100644 tools/testing/selftests/powerpc/signal/sigreturn_vdso.c
 create mode 100644 tools/testing/selftests/powerpc/tm/settings
 create mode 100644 tools/testing/selftests/powerpc/tm/tm-signal-pagefault.c
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEEJFGtCPCthwEv2Y/bUevqPMjhpYAFAl6J1FoACgkQUevqPMjh
pYBpVQ/9H139JlzRhwGlWekfNskHKPMNWkveqeMGRr/OY1bv2XPl39q56TmbKnbs
afAmWn6AK24chQk2nQ2cPnoL+mcJ2sX6v2hwxT4vy3vrEzAf9om1MXtJPc5IvYzh
n4+1cOtZFnqRIFryJ0wrN/tXck//9z5IfUV5MNUjIkmTcoiUkwfTBM+Nq7nrDTCe
NcPU5Uf9eXsPrZUxOryeghSQD620lr6kzE10N56ewj3RIf6jDQdaFk4dBCgRzUEp
sNxDDKWWUL6ftd62RSzHflwbRSBHLr2ulWFlUw3CsBiiwK2zV4oq36R1GMRmMn+C
FbIxM3+8+G/rb9SwU5yRo55oWMFs/+0UodX7XXM1diKkg5KYqfQF2IIR2Ygmb82h
QNJP/eaS2AmVT1fD/P0ogfkb3SxU1fKt2OfJWGMLTTcYTOGGur471L6twGSCp5ON
tM1mFyMO76w0vNRuezsM6KhrLUz9O4d3OdQVB70Zv7dEUTiz0WNPWpPSvj4oTZTm
35dAx2EsGB6eQ0xDqyRAWrHmaxloSb/rbOThaUVgIcQHYwFA0C7+fG8Q7p6OPicN
zdmNix39/6Szy8763m+dXhCkB77nDDwICIJIblsKmHgtThULulQuOeITbrLnyH0J
LT9rzZHkBtHcDVQm7EQprPOu0++Ydbwb3MQ0OdQXEVnBot3FX9E=
=3l6Y
-----END PGP SIGNATURE-----

^ permalink raw reply

* Re: [PATCH V2 0/3] mm/debug: Add more arch page table helper tests
From: Anshuman Khandual @ 2020-04-05 12:28 UTC (permalink / raw)
  To: Gerald Schaefer
  Cc: linux-doc, Heiko Carstens, linux-mm, Paul Mackerras,
	H. Peter Anvin, linux-riscv, Will Deacon, linux-arch, linux-s390,
	Jonathan Corbet, x86, Mike Rapoport, Christian Borntraeger,
	Ingo Molnar, Catalin Marinas, linux-snps-arc, Vasily Gorbik,
	Borislav Petkov, Paul Walmsley, Kirill A . Shutemov,
	Thomas Gleixner, linux-arm-kernel, Vineet Gupta, linux-kernel,
	Palmer Dabbelt, Andrew Morton, linuxppc-dev
In-Reply-To: <20200331143059.29fca8fa@thinkpad>

On 03/31/2020 06:00 PM, Gerald Schaefer wrote:
> On Tue, 24 Mar 2020 10:52:52 +0530
> Anshuman Khandual <anshuman.khandual@arm.com> wrote:
> 
>> This series adds more arch page table helper tests. The new tests here are
>> either related to core memory functions and advanced arch pgtable helpers.
>> This also creates a documentation file enlisting all expected semantics as
>> suggested by Mike Rapoport (https://lkml.org/lkml/2020/1/30/40).
>>
>> This series has been tested on arm64 and x86 platforms. There is just one
>> expected failure on arm64 that will be fixed when we enable THP migration.
>>
>> [   21.741634] WARNING: CPU: 0 PID: 1 at mm/debug_vm_pgtable.c:782
>>
>> which corresponds to
>>
>> WARN_ON(!pmd_present(pmd_mknotpresent(pmd_mkhuge(pmd))))
>>
>> There are many TRANSPARENT_HUGEPAGE and ARCH_HAS_TRANSPARENT_HUGEPAGE_PUD
>> ifdefs scattered across the test. But consolidating all the fallback stubs
>> is not very straight forward because ARCH_HAS_TRANSPARENT_HUGEPAGE_PUD is
>> not explicitly dependent on ARCH_HAS_TRANSPARENT_HUGEPAGE.
>>
>> This series has been build tested on many platforms including the ones that
>> subscribe the test through ARCH_HAS_DEBUG_VM_PGTABLE.
>>
> 
> Hi Anshuman,
> 
> thanks for the update. There are a couple of issues on s390, some might
> also affect other archs.

Sure, thanks for taking a look and giving it a spin on s390.

> 
> 1) The pxd_huge_tests are using pxd_set/clear_huge, which defaults to
> returning 0 if !CONFIG_HAVE_ARCH_HUGE_VMAP. As result, the checks for
> !pxd_test/clear_huge in the pxd_huge_tests will always trigger the
> warning. This should affect all archs w/o CONFIG_HAVE_ARCH_HUGE_VMAP.
> Could be fixed like this:
> 
> @@ -923,8 +923,10 @@ void __init debug_vm_pgtable(void)
>         pmd_leaf_tests(pmd_aligned, prot);
>         pud_leaf_tests(pud_aligned, prot);
>  
> -       pmd_huge_tests(pmdp, pmd_aligned, prot);
> -       pud_huge_tests(pudp, pud_aligned, prot);
> +       if (IS_ENABLED(CONFIG_HAVE_ARCH_HUGE_VMAP)) {
> +               pmd_huge_tests(pmdp, pmd_aligned, prot);
> +               pud_huge_tests(pudp, pud_aligned, prot);
> +       }

That is correct. It was an omission on my part and will fix it.

>  
>         pte_savedwrite_tests(pte_aligned, prot);
>         pmd_savedwrite_tests(pmd_aligned, prot);
> 
> BTW, please add some comments to the various #ifdef/#else stuff, especially
> when the different parts are far away and/or nested.

Sure, will do.

> 
> 2) The hugetlb_advanced_test will fail because it directly de-references
> huge *ptep pointers instead of using huge_ptep_get() for this. We have
> very different pagetable entry layout for pte and (large) pmd on s390,
> and unfortunately the whole hugetlbfs code is using pte_t instead of pmd_t
> like THP. For this reason, huge_ptep_get() was introduced, which will
> return a "converted" pte, because directly reading from a *ptep (pointing
> to a large pmd) will not return a proper pte. Only ARM has also an
> implementation of huge_ptep_get(), so they could be affected, depending
> on what exactly they need it for.

Currently, we dont support ARM (32). But as huge_ptep_get() already got a
fallback, its better to use that than a direct READ_ONCE().

> 
> Could be fixed like this (the first de-reference is a bit special,
> because at that point *ptep does not really point to a large (pmd) entry
> yet, it is initially an invalid pte entry, which breaks our huge_ptep_get()

There seems to be an inconsistency on s390 platform. Even though it defines
a huge_ptep_get() override, it does not subscribe __HAVE_ARCH_HUGE_PTEP_GET
which should have forced it fallback on generic huge_ptep_get() but it does
not :) Then I realized that __HAVE_ARCH_HUGE_PTEP_GET only makes sense when
an arch uses <asm-generic/hugetlb.h>. s390 does not use that and hence gets
away with it's own huge_ptep_get() without __HAVE_ARCH_HUGE_PTEP_GET. Sounds
confusing ? But I might not have the entire context here.

> conversion logic. I also added PMD_MASK alignment for RANDOM_ORVALUE,
> because we do have some special bits there in our large pmds. It seems
> to also work w/o that alignment, but it feels a bit wrong):

Sure, we can accommodate that.

> 
> @@ -731,26 +731,26 @@ static void __init hugetlb_advanced_test
>                                           unsigned long vaddr, pgprot_t prot)
>  {
>         struct page *page = pfn_to_page(pfn);
> -       pte_t pte = READ_ONCE(*ptep);
> +       pte_t pte;
> 
> -       pte = __pte(pte_val(pte) | RANDOM_ORVALUE);
> +       pte = pte_mkhuge(mk_pte_phys(RANDOM_ORVALUE & PMD_MASK, prot));

So that keeps the existing value in 'ptep' pointer at bay and instead
construct a PTE from scratch. I would rather have READ_ONCE(*ptep) at
least provide the seed that can be ORed with RANDOM_ORVALUE before
being masked with PMD_MASK. Do you see any problem ?

Some thing like this instead.

pte_t pte = READ_ONCE(*ptep);
pte = pte_mkhuge(__pte((pte_val(pte) | RANDOM_ORVALUE) & PMD_MASK));

We cannot use mk_pte_phys() as it is defined only on some platforms
without any generic fallback for others.

>         set_huge_pte_at(mm, vaddr, ptep, pte);
>         barrier();
>         WARN_ON(!pte_same(pte, huge_ptep_get(ptep)));
>         huge_pte_clear(mm, vaddr, ptep, PMD_SIZE);
> -       pte = READ_ONCE(*ptep);
> +       pte = huge_ptep_get(ptep);
>         WARN_ON(!huge_pte_none(pte));
>  
>         pte = mk_huge_pte(page, prot);
>         set_huge_pte_at(mm, vaddr, ptep, pte);
>         huge_ptep_set_wrprotect(mm, vaddr, ptep);
> -       pte = READ_ONCE(*ptep);
> +       pte = huge_ptep_get(ptep);
>         WARN_ON(huge_pte_write(pte));
>  
>         pte = mk_huge_pte(page, prot);
>         set_huge_pte_at(mm, vaddr, ptep, pte);
>         huge_ptep_get_and_clear(mm, vaddr, ptep);
> -       pte = READ_ONCE(*ptep);
> +       pte = huge_ptep_get(ptep);
>         WARN_ON(!huge_pte_none(pte));
>  
>         pte = mk_huge_pte(page, prot);
> @@ -759,7 +759,7 @@ static void __init hugetlb_advanced_test
>         pte = huge_pte_mkwrite(pte);
>         pte = huge_pte_mkdirty(pte);
>         huge_ptep_set_access_flags(vma, vaddr, ptep, pte, 1);
> -       pte = READ_ONCE(*ptep);
> +       pte = huge_ptep_get(ptep);
>         WARN_ON(!(huge_pte_write(pte) && huge_pte_dirty(pte)));
>  }
>  #else
> 
> 3) The pmd_protnone_tests() has an issue, because it passes a pmd to
> pmd_protnone() which has not been marked as large. We check for large
> pmd in the s390 implementation of pmd_protnone(), and will fail if a
> pmd is not large. We had similar issues before, in other helpers, where
> I changed the logic on s390 to not require the pmd large check, but I'm
> not so sure in this case. Is there a valid use case for doing
> pmd_protnone() on "normal" pmds? Or could this be changed like this:

That is a valid question. IIUC, all existing callers for pmd_protnone()
ensure that it is indeed a huge PMD. But even assuming otherwise should
not the huge PMD requirement get checked in the caller itself rather than
in the arch helper which is just supposed to check the existence of the
dedicated PTE bit(s) for this purpose. Purely from a helper perspective
pmd_protnone() should not really care about being large even though it
might never get used without one.

Also all platforms (except s390) derive the pmd_protnone() from their
respective pte_protnone(). I wonder why should s390 be any different
unless it is absolutely necessary.

> 
> @@ -537,7 +537,7 @@ static void __init pte_protnone_tests(un
>  #ifdef CONFIG_TRANSPARENT_HUGEPAGE
>  static void __init pmd_protnone_tests(unsigned long pfn, pgprot_t prot)
>  {
> -       pmd_t pmd = pfn_pmd(pfn, prot);
> +       pmd_t pmd = mk_huge_pmd(pfn_to_page(pfn), prot);
> 
>         if (!IS_ENABLED(CONFIG_NUMA_BALANCING))
>                 return;
> 
> Regards,
> Gerald
> 
> 

^ permalink raw reply

* [PATCH v3] powerpc/powernv: add NULL check after kzalloc in opal_add_one_export
From: Qiujun Huang @ 2020-04-05 12:25 UTC (permalink / raw)
  To: benh, paulus, mpe, tglx; +Cc: linuxppc-dev, linux-kernel, Qiujun Huang

Here needs a NULL check.

Issue found by coccinelle.

Signed-off-by: Qiujun Huang <hqjagain@gmail.com>
---
 arch/powerpc/platforms/powernv/opal.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/platforms/powernv/opal.c b/arch/powerpc/platforms/powernv/opal.c
index 2b3dfd0b6cdd..908d749bcef5 100644
--- a/arch/powerpc/platforms/powernv/opal.c
+++ b/arch/powerpc/platforms/powernv/opal.c
@@ -801,16 +801,19 @@ static ssize_t export_attr_read(struct file *fp, struct kobject *kobj,
 static int opal_add_one_export(struct kobject *parent, const char *export_name,
 			       struct device_node *np, const char *prop_name)
 {
-	struct bin_attribute *attr = NULL;
-	const char *name = NULL;
+	struct bin_attribute *attr;
+	const char *name;
 	u64 vals[2];
 	int rc;
 
 	rc = of_property_read_u64_array(np, prop_name, &vals[0], 2);
 	if (rc)
-		goto out;
+		return rc;
 
 	attr = kzalloc(sizeof(*attr), GFP_KERNEL);
+	if (!attr)
+		return -ENOMEM;
+
 	name = kstrdup(export_name, GFP_KERNEL);
 	if (!name) {
 		rc = -ENOMEM;
-- 
2.17.1


^ permalink raw reply related

* Re: [PATCH v2] powerpc/powernv: add NULL check after kzalloc in opal_add_one_export
From: Qiujun Huang @ 2020-04-05 12:20 UTC (permalink / raw)
  To: Christophe Leroy; +Cc: LKML, paulus, tglx, linuxppc-dev
In-Reply-To: <46e9dd45-c590-36c3-a60e-55750cde8935@c-s.fr>

On Sun, Apr 5, 2020 at 8:12 PM Christophe Leroy <christophe.leroy@c-s.fr> wrote:
>
>
>
> Le 05/04/2020 à 12:30, Qiujun Huang a écrit :
> > Here needs a NULL check.
> >
> > Issue found by coccinelle.
> >
> > Signed-off-by: Qiujun Huang <hqjagain@gmail.com>
> > ---
> >   arch/powerpc/platforms/powernv/opal.c | 5 ++++-
> >   1 file changed, 4 insertions(+), 1 deletion(-)
> >
> > diff --git a/arch/powerpc/platforms/powernv/opal.c b/arch/powerpc/platforms/powernv/opal.c
> > index 2b3dfd0b6cdd..5b98c98817aa 100644
> > --- a/arch/powerpc/platforms/powernv/opal.c
> > +++ b/arch/powerpc/platforms/powernv/opal.c
> > @@ -808,9 +808,12 @@ static int opal_add_one_export(struct kobject *parent, const char *export_name,
> >
> >       rc = of_property_read_u64_array(np, prop_name, &vals[0], 2);
> >       if (rc)
> > -             goto out;
> > +             return rc;
>
> Nice you changed that too.
>
> Then there is no need the initialise attr and name to NULL in their
> declaration, as they won't be used before they are assigned.

So that's it.

>
> >
> >       attr = kzalloc(sizeof(*attr), GFP_KERNEL);
> > +     if (!attr)
> > +             return -ENOMEM;
> > +
> >       name = kstrdup(export_name, GFP_KERNEL);
> >       if (!name) {
> >               rc = -ENOMEM;
> >
>
> Christophe

^ permalink raw reply

* Re: [PATCH v2] powerpc/powernv: add NULL check after kzalloc in opal_add_one_export
From: Christophe Leroy @ 2020-04-05 12:12 UTC (permalink / raw)
  To: Qiujun Huang, benh, paulus, mpe, tglx; +Cc: linuxppc-dev, linux-kernel
In-Reply-To: <20200405103059.30769-1-hqjagain@gmail.com>



Le 05/04/2020 à 12:30, Qiujun Huang a écrit :
> Here needs a NULL check.
> 
> Issue found by coccinelle.
> 
> Signed-off-by: Qiujun Huang <hqjagain@gmail.com>
> ---
>   arch/powerpc/platforms/powernv/opal.c | 5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/powerpc/platforms/powernv/opal.c b/arch/powerpc/platforms/powernv/opal.c
> index 2b3dfd0b6cdd..5b98c98817aa 100644
> --- a/arch/powerpc/platforms/powernv/opal.c
> +++ b/arch/powerpc/platforms/powernv/opal.c
> @@ -808,9 +808,12 @@ static int opal_add_one_export(struct kobject *parent, const char *export_name,
>   
>   	rc = of_property_read_u64_array(np, prop_name, &vals[0], 2);
>   	if (rc)
> -		goto out;
> +		return rc;

Nice you changed that too.

Then there is no need the initialise attr and name to NULL in their 
declaration, as they won't be used before they are assigned.

>   
>   	attr = kzalloc(sizeof(*attr), GFP_KERNEL);
> +	if (!attr)
> +		return -ENOMEM;
> +
>   	name = kstrdup(export_name, GFP_KERNEL);
>   	if (!name) {
>   		rc = -ENOMEM;
> 

Christophe

^ permalink raw reply

* [PATCH v2] powerpc/powernv: add NULL check after kzalloc in opal_add_one_export
From: Qiujun Huang @ 2020-04-05 10:30 UTC (permalink / raw)
  To: benh, paulus, mpe, tglx; +Cc: linuxppc-dev, linux-kernel, Qiujun Huang

Here needs a NULL check.

Issue found by coccinelle.

Signed-off-by: Qiujun Huang <hqjagain@gmail.com>
---
 arch/powerpc/platforms/powernv/opal.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/platforms/powernv/opal.c b/arch/powerpc/platforms/powernv/opal.c
index 2b3dfd0b6cdd..5b98c98817aa 100644
--- a/arch/powerpc/platforms/powernv/opal.c
+++ b/arch/powerpc/platforms/powernv/opal.c
@@ -808,9 +808,12 @@ static int opal_add_one_export(struct kobject *parent, const char *export_name,
 
 	rc = of_property_read_u64_array(np, prop_name, &vals[0], 2);
 	if (rc)
-		goto out;
+		return rc;
 
 	attr = kzalloc(sizeof(*attr), GFP_KERNEL);
+	if (!attr)
+		return -ENOMEM;
+
 	name = kstrdup(export_name, GFP_KERNEL);
 	if (!name) {
 		rc = -ENOMEM;
-- 
2.17.1


^ permalink raw reply related

* Re: [PATCH] powerpc/powernv: add NULL check after kzalloc in opal_add_one_export
From: Qiujun Huang @ 2020-04-05 10:21 UTC (permalink / raw)
  To: Christophe Leroy; +Cc: tglx, paulus, linuxppc-dev, LKML
In-Reply-To: <99de2220-5a64-e81e-6886-447296431548@c-s.fr>

On Sun, Apr 5, 2020 at 6:13 PM Christophe Leroy <christophe.leroy@c-s.fr> wrote:
>
>
>
> Le 05/04/2020 à 09:51, Qiujun Huang a écrit :
> > Here needs a NULL check.
> >
> > Issue found by coccinelle.
> >
> > Signed-off-by: Qiujun Huang <hqjagain@gmail.com>
> > ---
> >   arch/powerpc/platforms/powernv/opal.c | 5 +++++
> >   1 file changed, 5 insertions(+)
> >
> > diff --git a/arch/powerpc/platforms/powernv/opal.c b/arch/powerpc/platforms/powernv/opal.c
> > index 2b3dfd0b6cdd..09443ae3a86e 100644
> > --- a/arch/powerpc/platforms/powernv/opal.c
> > +++ b/arch/powerpc/platforms/powernv/opal.c
> > @@ -811,6 +811,11 @@ static int opal_add_one_export(struct kobject *parent, const char *export_name,
> >               goto out;
> >
> >       attr = kzalloc(sizeof(*attr), GFP_KERNEL);
> > +     if (!attr) {
> > +             rc = -ENOMEM;
> > +             goto out;
>
> You don't need to go to out:, there is nothing to do. You should do:
>
>         if (!attr)
>                 return -ENOMEM;

Yeah, I get that. Thanks.

>
> > +     }
> > +
> >       name = kstrdup(export_name, GFP_KERNEL);
> >       if (!name) {
> >               rc = -ENOMEM;
> >
>
> Christophe

^ permalink raw reply

* Re: [PATCH] powerpc/powernv: add NULL check after kzalloc in opal_add_one_export
From: Christophe Leroy @ 2020-04-05 10:13 UTC (permalink / raw)
  To: Qiujun Huang, benh, paulus, mpe, tglx; +Cc: linuxppc-dev, linux-kernel
In-Reply-To: <20200405075123.28756-1-hqjagain@gmail.com>



Le 05/04/2020 à 09:51, Qiujun Huang a écrit :
> Here needs a NULL check.
> 
> Issue found by coccinelle.
> 
> Signed-off-by: Qiujun Huang <hqjagain@gmail.com>
> ---
>   arch/powerpc/platforms/powernv/opal.c | 5 +++++
>   1 file changed, 5 insertions(+)
> 
> diff --git a/arch/powerpc/platforms/powernv/opal.c b/arch/powerpc/platforms/powernv/opal.c
> index 2b3dfd0b6cdd..09443ae3a86e 100644
> --- a/arch/powerpc/platforms/powernv/opal.c
> +++ b/arch/powerpc/platforms/powernv/opal.c
> @@ -811,6 +811,11 @@ static int opal_add_one_export(struct kobject *parent, const char *export_name,
>   		goto out;
>   
>   	attr = kzalloc(sizeof(*attr), GFP_KERNEL);
> +	if (!attr) {
> +		rc = -ENOMEM;
> +		goto out;

You don't need to go to out:, there is nothing to do. You should do:

	if (!attr)
		return -ENOMEM;

> +	}
> +
>   	name = kstrdup(export_name, GFP_KERNEL);
>   	if (!name) {
>   		rc = -ENOMEM;
> 

Christophe

^ permalink raw reply

* [PATCH] KVM: PPC: Book3S HV: Remove NULL check before kfree
From: Qiujun Huang @ 2020-04-05  9:10 UTC (permalink / raw)
  To: paulus, benh, mpe; +Cc: Qiujun Huang, linuxppc-dev, linux-kernel, kvm-ppc

NULL check before kfree is unnecessary, so remove it.

This issue was detected by using the Coccinelle software.

Signed-off-by: Qiujun Huang <hqjagain@gmail.com>
---
 arch/powerpc/kvm/book3s_hv_nested.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/arch/powerpc/kvm/book3s_hv_nested.c b/arch/powerpc/kvm/book3s_hv_nested.c
index dc97e5be76f6..cad324312040 100644
--- a/arch/powerpc/kvm/book3s_hv_nested.c
+++ b/arch/powerpc/kvm/book3s_hv_nested.c
@@ -1416,8 +1416,7 @@ static long int __kvmhv_nested_page_fault(struct kvm_run *run,
 	rmapp = &memslot->arch.rmap[gfn - memslot->base_gfn];
 	ret = kvmppc_create_pte(kvm, gp->shadow_pgtable, pte, n_gpa, level,
 				mmu_seq, gp->shadow_lpid, rmapp, &n_rmap);
-	if (n_rmap)
-		kfree(n_rmap);
+	kfree(n_rmap);
 	if (ret == -EAGAIN)
 		ret = RESUME_GUEST;	/* Let the guest try again */
 
-- 
2.17.1


^ permalink raw reply related

* [PATCH] powerpc/powernv: add NULL check after kzalloc in opal_add_one_export
From: Qiujun Huang @ 2020-04-05  7:51 UTC (permalink / raw)
  To: benh, paulus, mpe, tglx; +Cc: linuxppc-dev, linux-kernel, Qiujun Huang

Here needs a NULL check.

Issue found by coccinelle.

Signed-off-by: Qiujun Huang <hqjagain@gmail.com>
---
 arch/powerpc/platforms/powernv/opal.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/arch/powerpc/platforms/powernv/opal.c b/arch/powerpc/platforms/powernv/opal.c
index 2b3dfd0b6cdd..09443ae3a86e 100644
--- a/arch/powerpc/platforms/powernv/opal.c
+++ b/arch/powerpc/platforms/powernv/opal.c
@@ -811,6 +811,11 @@ static int opal_add_one_export(struct kobject *parent, const char *export_name,
 		goto out;
 
 	attr = kzalloc(sizeof(*attr), GFP_KERNEL);
+	if (!attr) {
+		rc = -ENOMEM;
+		goto out;
+	}
+
 	name = kstrdup(export_name, GFP_KERNEL);
 	if (!name) {
 		rc = -ENOMEM;
-- 
2.17.1


^ permalink raw reply related

* Re: [PATCH v11 0/8] Disable compat cruft on ppc64le v11
From: Michael Ellerman @ 2020-04-05  0:40 UTC (permalink / raw)
  To: Nicholas Piggin, Christophe Leroy, linuxppc-dev, Michal Suchanek
  Cc: Mark Rutland, Gustavo Luiz Duarte, Alexander Shishkin,
	Sebastian Andrzej Siewior, linux-kernel, Paul Mackerras,
	Jiri Olsa, Rob Herring, Michael Neuling, Eric Richter,
	Masahiro Yamada, Nayna Jain, Peter Zijlstra, Ingo Molnar,
	Hari Bathini, Jordan Niethe, Valentin Schneider, Arnd Bergmann,
	Arnaldo Carvalho de Melo, Alexander Viro, Jonathan Cameron,
	Namhyung Kim, Thomas Gleixner, Andy Shevchenko, Allison Randal,
	Greg Kroah-Hartman, Claudio Carvalho, Mauro Carvalho Chehab,
	Eric W. Biederman, linux-fsdevel, David S. Miller,
	Thiago Jung Bauermann
In-Reply-To: <1585906885.3dbukubyr8.astroid@bobo.none>

Nicholas Piggin <npiggin@gmail.com> writes:
> Christophe Leroy's on April 3, 2020 5:26 pm:
>> Le 03/04/2020 à 09:25, Nicholas Piggin a écrit :
>>> Michal Suchanek's on March 19, 2020 10:19 pm:
>>>> Less code means less bugs so add a knob to skip the compat stuff.
>>>>
>>>> Changes in v2: saner CONFIG_COMPAT ifdefs
>>>> Changes in v3:
>>>>   - change llseek to 32bit instead of builing it unconditionally in fs
>>>>   - clanup the makefile conditionals
>>>>   - remove some ifdefs or convert to IS_DEFINED where possible
>>>> Changes in v4:
>>>>   - cleanup is_32bit_task and current_is_64bit
>>>>   - more makefile cleanup
>>>> Changes in v5:
>>>>   - more current_is_64bit cleanup
>>>>   - split off callchain.c 32bit and 64bit parts
>>>> Changes in v6:
>>>>   - cleanup makefile after split
>>>>   - consolidate read_user_stack_32
>>>>   - fix some checkpatch warnings
>>>> Changes in v7:
>>>>   - add back __ARCH_WANT_SYS_LLSEEK to fix build with llseek
>>>>   - remove leftover hunk
>>>>   - add review tags
>>>> Changes in v8:
>>>>   - consolidate valid_user_sp to fix it in the split callchain.c
>>>>   - fix build errors/warnings with PPC64 !COMPAT and PPC32
>>>> Changes in v9:
>>>>   - remove current_is_64bit()
>>>> Chanegs in v10:
>>>>   - rebase, sent together with the syscall cleanup
>>>> Changes in v11:
>>>>   - rebase
>>>>   - add MAINTAINERS pattern for ppc perf
>>> 
>>> These all look good to me. I had some minor comment about one patch but
>>> not really a big deal and there were more cleanups on top of it, so I
>>> don't mind if it's merged as is.
>>> 
>>> Actually I think we have a bit of stack reading fixes for 64s radix now
>>> (not a bug fix as such, but we don't need the hash fault logic in radix),
>>> so if I get around to that I can propose the changes in that series.
>>> 
>> 
>> As far as I can see, there is a v12
>
> For the most part I was looking at the patches in mpe's next-test
> tree on github, if that's the v12 series, same comment applies but
> it's a pretty small nitpick.

Yeah I have v12 in my tree.

This has floated around long enough (our fault), so I'm going to take it
and we can fix anything up later.

cheers

^ permalink raw reply

* Re: WARNING in ext4_da_update_reserve_space
From: syzbot @ 2020-04-04 22:13 UTC (permalink / raw)
  To: a, adilger.kernel, b.a.t.m.a.n, benh, davem, linux-ext4,
	linux-kernel, linuxppc-dev, mareklindner, mpe, muriloo, netdev,
	paulus, sw, syzkaller-bugs, tytso
In-Reply-To: <20200404183707.GK45598@mit.edu>

Hello,

syzbot has tested the proposed patch and the reproducer did not trigger crash:

Reported-and-tested-by: syzbot+67e4f16db666b1c8253c@syzkaller.appspotmail.com

Tested on:

commit:         54d3adbc ext4: save all error info in save_error_info() an..
git tree:       https://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4.git dev
kernel config:  https://syzkaller.appspot.com/x/.config?x=4527d1e2fb19fd5c
dashboard link: https://syzkaller.appspot.com/bug?extid=67e4f16db666b1c8253c
compiler:       gcc (GCC) 9.0.0 20181231 (experimental)

Note: testing is done by a robot and is best-effort only.

^ permalink raw reply

* Re: [PATCH v2 13/14] powerpc/64s: system reset do not trace
From: kbuild test robot @ 2020-04-04 21:40 UTC (permalink / raw)
  To: Nicholas Piggin; +Cc: linuxppc-dev, kbuild-all
In-Reply-To: <20200403132622.130394-14-npiggin@gmail.com>

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

Hi Nicholas,

I love your patch! Yet something to improve:

[auto build test ERROR on powerpc/next]
[also build test ERROR on next-20200404]
[cannot apply to v5.6]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Nicholas-Piggin/powerpc-64-machine-check-and-system-reset-fixes/20200405-030723
base:   https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next
config: powerpc-allnoconfig (attached as .config)
compiler: powerpc-linux-gcc (GCC) 9.3.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        GCC_VERSION=9.3.0 make.cross ARCH=powerpc 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   arch/powerpc/kernel/traps.c: In function 'system_reset_exception':
>> arch/powerpc/kernel/traps.c:446:22: error: 'local_paca' undeclared (first use in this function); did you mean 'local_dec'?
     446 |  u8 ftrace_enabled = local_paca->ftrace_enabled;
         |                      ^~~~~~~~~~
         |                      local_dec
   arch/powerpc/kernel/traps.c:446:22: note: each undeclared identifier is reported only once for each function it appears in

vim +446 arch/powerpc/kernel/traps.c

   440	
   441	void system_reset_exception(struct pt_regs *regs)
   442	{
   443		unsigned long hsrr0, hsrr1;
   444		bool nested = in_nmi();
   445		bool saved_hsrrs = false;
 > 446		u8 ftrace_enabled = local_paca->ftrace_enabled;
   447	
   448		local_paca->ftrace_enabled = 0;
   449	
   450		/*
   451		 * Avoid crashes in case of nested NMI exceptions. Recoverability
   452		 * is determined by RI and in_nmi
   453		 */
   454		if (!nested)
   455			nmi_enter();
   456	
   457		/*
   458		 * System reset can interrupt code where HSRRs are live and MSR[RI]=1.
   459		 * The system reset interrupt itself may clobber HSRRs (e.g., to call
   460		 * OPAL), so save them here and restore them before returning.
   461		 *
   462		 * Machine checks don't need to save HSRRs, as the real mode handler
   463		 * is careful to avoid them, and the regular handler is not delivered
   464		 * as an NMI.
   465		 */
   466		if (cpu_has_feature(CPU_FTR_HVMODE)) {
   467			hsrr0 = mfspr(SPRN_HSRR0);
   468			hsrr1 = mfspr(SPRN_HSRR1);
   469			saved_hsrrs = true;
   470		}
   471	
   472		hv_nmi_check_nonrecoverable(regs);
   473	
   474		__this_cpu_inc(irq_stat.sreset_irqs);
   475	
   476		/* See if any machine dependent calls */
   477		if (ppc_md.system_reset_exception) {
   478			if (ppc_md.system_reset_exception(regs))
   479				goto out;
   480		}
   481	
   482		if (debugger(regs))
   483			goto out;
   484	
   485		kmsg_dump(KMSG_DUMP_OOPS);
   486		/*
   487		 * A system reset is a request to dump, so we always send
   488		 * it through the crashdump code (if fadump or kdump are
   489		 * registered).
   490		 */
   491		crash_fadump(regs, "System Reset");
   492	
   493		crash_kexec(regs);
   494	
   495		/*
   496		 * We aren't the primary crash CPU. We need to send it
   497		 * to a holding pattern to avoid it ending up in the panic
   498		 * code.
   499		 */
   500		crash_kexec_secondary(regs);
   501	
   502		/*
   503		 * No debugger or crash dump registered, print logs then
   504		 * panic.
   505		 */
   506		die("System Reset", regs, SIGABRT);
   507	
   508		mdelay(2*MSEC_PER_SEC); /* Wait a little while for others to print */
   509		add_taint(TAINT_DIE, LOCKDEP_NOW_UNRELIABLE);
   510		nmi_panic(regs, "System Reset");
   511	
   512	out:
   513	#ifdef CONFIG_PPC_BOOK3S_64
   514		BUG_ON(get_paca()->in_nmi == 0);
   515		if (get_paca()->in_nmi > 1)
   516			nmi_panic(regs, "Unrecoverable nested System Reset");
   517	#endif
   518		/* Must die if the interrupt is not recoverable */
   519		if (!(regs->msr & MSR_RI))
   520			nmi_panic(regs, "Unrecoverable System Reset");
   521	
   522		if (saved_hsrrs) {
   523			mtspr(SPRN_HSRR0, hsrr0);
   524			mtspr(SPRN_HSRR1, hsrr1);
   525		}
   526	
   527		if (!nested)
   528			nmi_exit();
   529	
   530		local_paca->ftrace_enabled = ftrace_enabled;
   531	
   532		/* What should we do here? We could issue a shutdown or hard reset. */
   533	}
   534	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 6413 bytes --]

^ permalink raw reply

* Re: [PATCH] powerpc/mce: Add MCE notification chain
From: Ganesh @ 2020-04-04 13:05 UTC (permalink / raw)
  To: Nicholas Piggin, linuxppc-dev, mpe; +Cc: aneesh.kumar, santosh, arbab, mahesh
In-Reply-To: <1585879413.ubv3w8ta2y.astroid@bobo.none>

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

On 4/3/20 7:38 AM, Nicholas Piggin wrote:

> Ganesh Goudar's on March 30, 2020 5:12 pm:
>> From: Santosh S <santosh@fossix.org>
>>
>> Introduce notification chain which lets know about uncorrected memory
>> errors(UE). This would help prospective users in pmem or nvdimm subsystem
>> to track bad blocks for better handling of persistent memory allocations.
>>
>> Signed-off-by: Santosh S <santosh@fossix.org>
>> Signed-off-by: Ganesh Goudar <ganeshgr@linux.ibm.com>
> Do you have any such users yet? It would be good to refer to an example
> user and give a brief description of what it does in its notifier.

Santosh has sent a patch which uses this notification.
https://patchwork.ozlabs.org/patch/1265062/

>> @@ -263,6 +277,7 @@ static void machine_process_ue_event(struct work_struct *work)
>>   	while (__this_cpu_read(mce_ue_count) > 0) {
>>   		index = __this_cpu_read(mce_ue_count) - 1;
>>   		evt = this_cpu_ptr(&mce_ue_event_queue[index]);
>> +		blocking_notifier_call_chain(&mce_notifier_list, 0, evt);
> Can we really use a blocking notifier here? I'm not sure that we can.

I think we can, do you see any problem?

>
> Thanks,
> Nick


[-- Attachment #2: Type: text/html, Size: 2393 bytes --]

^ permalink raw reply

* Re: WARNING in ext4_da_update_reserve_space
From: Theodore Y. Ts'o @ 2020-04-04 18:37 UTC (permalink / raw)
  To: syzbot
  Cc: mareklindner, sw, muriloo, a, linux-kernel, syzkaller-bugs,
	b.a.t.m.a.n, netdev, adilger.kernel, paulus, linux-ext4,
	linuxppc-dev, davem
In-Reply-To: <0000000000008c5a4605a24cbb16@google.com>

#syz test https://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4.git dev

I'm curious why this is only showing up as failing on next-next.
Let's see if it fails on the ext4.git tree.

From the bisect logs syzbot is able to repro on all of v5.x and
v4.20.0.  However, I'm not able to repro it using kvm with either
v5.6-rc4 or the tip of the ext4 git tree.  So let's see what syzbot
can do with the tip of the dev tree.

						- Ted

^ permalink raw reply

* Re: [PATCH v2 4/4] powerpc/uaccess: add more __builtin_expect annotations
From: kbuild test robot @ 2020-04-04 14:56 UTC (permalink / raw)
  To: Nicholas Piggin; +Cc: linuxppc-dev, kbuild-all
In-Reply-To: <20200403093529.43587-4-npiggin@gmail.com>

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

Hi Nicholas,

I love your patch! Perhaps something to improve:

[auto build test WARNING on powerpc/next]
[also build test WARNING on v5.6 next-20200404]
[cannot apply to scottwood/next]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Nicholas-Piggin/powerpc-64s-implement-probe_kernel_read-write-without-touching-AMR/20200404-192647
base:   https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next
config: powerpc-rhel-kconfig (attached as .config)
compiler: powerpc64le-linux-gcc (GCC) 9.3.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        GCC_VERSION=9.3.0 make.cross ARCH=powerpc 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

   In file included from include/linux/uaccess.h:11,
                    from arch/powerpc/include/asm/sections.h:7,
                    from include/linux/interrupt.h:20,
                    from include/linux/serial_core.h:13,
                    from drivers/of/fdt.c:25:
   include/asm-generic/termios-base.h: In function 'user_termio_to_kernel_termios':
   arch/powerpc/include/asm/uaccess.h:328:2: warning: statement with no effect [-Wunused-value]
     328 |  __gu_err;       \
         |  ^~~~~~~~
>> arch/powerpc/include/asm/uaccess.h:89:2: note: in expansion of macro '__get_user_check'
      89 |  __get_user_check((x), (ptr), sizeof(*(ptr)))
         |  ^~~~~~~~~~~~~~~~
>> include/asm-generic/termios-base.h:20:6: note: in expansion of macro 'get_user'
      20 |  if (get_user(tmp, &termio->c_iflag) < 0)
         |      ^~~~~~~~
   arch/powerpc/include/asm/uaccess.h:328:2: warning: statement with no effect [-Wunused-value]
     328 |  __gu_err;       \
         |  ^~~~~~~~
>> arch/powerpc/include/asm/uaccess.h:89:2: note: in expansion of macro '__get_user_check'
      89 |  __get_user_check((x), (ptr), sizeof(*(ptr)))
         |  ^~~~~~~~~~~~~~~~
   include/asm-generic/termios-base.h:24:6: note: in expansion of macro 'get_user'
      24 |  if (get_user(tmp, &termio->c_oflag) < 0)
         |      ^~~~~~~~
   arch/powerpc/include/asm/uaccess.h:328:2: warning: statement with no effect [-Wunused-value]
     328 |  __gu_err;       \
         |  ^~~~~~~~
>> arch/powerpc/include/asm/uaccess.h:89:2: note: in expansion of macro '__get_user_check'
      89 |  __get_user_check((x), (ptr), sizeof(*(ptr)))
         |  ^~~~~~~~~~~~~~~~
   include/asm-generic/termios-base.h:28:6: note: in expansion of macro 'get_user'
      28 |  if (get_user(tmp, &termio->c_cflag) < 0)
         |      ^~~~~~~~
   arch/powerpc/include/asm/uaccess.h:328:2: warning: statement with no effect [-Wunused-value]
     328 |  __gu_err;       \
         |  ^~~~~~~~
>> arch/powerpc/include/asm/uaccess.h:89:2: note: in expansion of macro '__get_user_check'
      89 |  __get_user_check((x), (ptr), sizeof(*(ptr)))
         |  ^~~~~~~~~~~~~~~~
   include/asm-generic/termios-base.h:32:6: note: in expansion of macro 'get_user'
      32 |  if (get_user(tmp, &termio->c_lflag) < 0)
         |      ^~~~~~~~
   arch/powerpc/include/asm/uaccess.h:328:2: warning: statement with no effect [-Wunused-value]
     328 |  __gu_err;       \
         |  ^~~~~~~~
>> arch/powerpc/include/asm/uaccess.h:89:2: note: in expansion of macro '__get_user_check'
      89 |  __get_user_check((x), (ptr), sizeof(*(ptr)))
         |  ^~~~~~~~~~~~~~~~
   include/asm-generic/termios-base.h:36:6: note: in expansion of macro 'get_user'
      36 |  if (get_user(termios->c_line, &termio->c_line) < 0)
         |      ^~~~~~~~
   include/asm-generic/termios-base.h: In function 'kernel_termios_to_user_termio':
   arch/powerpc/include/asm/uaccess.h:194:2: warning: statement with no effect [-Wunused-value]
     194 |  __pu_err;       \
         |  ^~~~~~~~
>> arch/powerpc/include/asm/uaccess.h:91:2: note: in expansion of macro '__put_user_check'
      91 |  __put_user_check((__typeof__(*(ptr)))(x), (ptr), sizeof(*(ptr)))
         |  ^~~~~~~~~~~~~~~~
>> include/asm-generic/termios-base.h:54:6: note: in expansion of macro 'put_user'
      54 |  if (put_user(termios->c_iflag, &termio->c_iflag) < 0 ||
         |      ^~~~~~~~
   arch/powerpc/include/asm/uaccess.h:194:2: warning: statement with no effect [-Wunused-value]
     194 |  __pu_err;       \
         |  ^~~~~~~~
>> arch/powerpc/include/asm/uaccess.h:91:2: note: in expansion of macro '__put_user_check'
      91 |  __put_user_check((__typeof__(*(ptr)))(x), (ptr), sizeof(*(ptr)))
         |  ^~~~~~~~~~~~~~~~
   include/asm-generic/termios-base.h:55:6: note: in expansion of macro 'put_user'
      55 |      put_user(termios->c_oflag, &termio->c_oflag) < 0 ||
         |      ^~~~~~~~
   arch/powerpc/include/asm/uaccess.h:194:2: warning: statement with no effect [-Wunused-value]
     194 |  __pu_err;       \
         |  ^~~~~~~~
>> arch/powerpc/include/asm/uaccess.h:91:2: note: in expansion of macro '__put_user_check'
      91 |  __put_user_check((__typeof__(*(ptr)))(x), (ptr), sizeof(*(ptr)))
         |  ^~~~~~~~~~~~~~~~
   include/asm-generic/termios-base.h:56:6: note: in expansion of macro 'put_user'
      56 |      put_user(termios->c_cflag, &termio->c_cflag) < 0 ||
         |      ^~~~~~~~
   arch/powerpc/include/asm/uaccess.h:194:2: warning: statement with no effect [-Wunused-value]
     194 |  __pu_err;       \
         |  ^~~~~~~~
>> arch/powerpc/include/asm/uaccess.h:91:2: note: in expansion of macro '__put_user_check'
      91 |  __put_user_check((__typeof__(*(ptr)))(x), (ptr), sizeof(*(ptr)))
         |  ^~~~~~~~~~~~~~~~
   include/asm-generic/termios-base.h:57:6: note: in expansion of macro 'put_user'
      57 |      put_user(termios->c_lflag, &termio->c_lflag) < 0 ||
         |      ^~~~~~~~
   arch/powerpc/include/asm/uaccess.h:194:2: warning: statement with no effect [-Wunused-value]
     194 |  __pu_err;       \
         |  ^~~~~~~~
>> arch/powerpc/include/asm/uaccess.h:91:2: note: in expansion of macro '__put_user_check'
      91 |  __put_user_check((__typeof__(*(ptr)))(x), (ptr), sizeof(*(ptr)))
         |  ^~~~~~~~~~~~~~~~
   include/asm-generic/termios-base.h:58:6: note: in expansion of macro 'put_user'
      58 |      put_user(termios->c_line,  &termio->c_line) < 0 ||
         |      ^~~~~~~~
--
   In file included from include/linux/uaccess.h:11,
                    from include/linux/sched/task.h:11,
                    from include/linux/sched/signal.h:9,
                    from include/linux/ptrace.h:7,
                    from arch/powerpc/kernel/signal_32.c:23:
   arch/powerpc/kernel/signal_32.c: In function 'handle_rt_signal32':
   arch/powerpc/include/asm/uaccess.h:194:2: warning: statement with no effect [-Wunused-value]
     194 |  __pu_err;       \
         |  ^~~~~~~~
>> arch/powerpc/include/asm/uaccess.h:91:2: note: in expansion of macro '__put_user_check'
      91 |  __put_user_check((__typeof__(*(ptr)))(x), (ptr), sizeof(*(ptr)))
         |  ^~~~~~~~~~~~~~~~
>> arch/powerpc/kernel/signal_32.c:967:6: note: in expansion of macro 'put_user'
     967 |  if (put_user(regs->gpr[1], (u32 __user *)newsp))
         |      ^~~~~~~~
   arch/powerpc/kernel/signal_32.c: In function 'handle_signal32':
   arch/powerpc/include/asm/uaccess.h:194:2: warning: statement with no effect [-Wunused-value]
     194 |  __pu_err;       \
         |  ^~~~~~~~
>> arch/powerpc/include/asm/uaccess.h:91:2: note: in expansion of macro '__put_user_check'
      91 |  __put_user_check((__typeof__(*(ptr)))(x), (ptr), sizeof(*(ptr)))
         |  ^~~~~~~~~~~~~~~~
   arch/powerpc/kernel/signal_32.c:1423:6: note: in expansion of macro 'put_user'
    1423 |  if (put_user(regs->gpr[1], (u32 __user *)newsp))
         |      ^~~~~~~~
--
   In file included from include/linux/uaccess.h:11,
                    from include/linux/sched/task.h:11,
                    from arch/powerpc/kernel/process.c:16:
   arch/powerpc/kernel/process.c: In function 'get_fpexc_mode':
   arch/powerpc/include/asm/uaccess.h:194:2: warning: statement with no effect [-Wunused-value]
     194 |  __pu_err;       \
         |  ^~~~~~~~
>> arch/powerpc/include/asm/uaccess.h:91:2: note: in expansion of macro '__put_user_check'
      91 |  __put_user_check((__typeof__(*(ptr)))(x), (ptr), sizeof(*(ptr)))
         |  ^~~~~~~~~~~~~~~~
>> arch/powerpc/kernel/process.c:1909:9: note: in expansion of macro 'put_user'
    1909 |  return put_user(val, (unsigned int __user *) adr);
         |         ^~~~~~~~
   arch/powerpc/kernel/process.c: In function 'get_endian':
   arch/powerpc/include/asm/uaccess.h:194:2: warning: statement with no effect [-Wunused-value]
     194 |  __pu_err;       \
         |  ^~~~~~~~
>> arch/powerpc/include/asm/uaccess.h:91:2: note: in expansion of macro '__put_user_check'
      91 |  __put_user_check((__typeof__(*(ptr)))(x), (ptr), sizeof(*(ptr)))
         |  ^~~~~~~~~~~~~~~~
   arch/powerpc/kernel/process.c:1953:9: note: in expansion of macro 'put_user'
    1953 |  return put_user(val, (unsigned int __user *)adr);
         |         ^~~~~~~~
   arch/powerpc/kernel/process.c: In function 'get_unalign_ctl':
   arch/powerpc/include/asm/uaccess.h:194:2: warning: statement with no effect [-Wunused-value]
     194 |  __pu_err;       \
         |  ^~~~~~~~
>> arch/powerpc/include/asm/uaccess.h:91:2: note: in expansion of macro '__put_user_check'
      91 |  __put_user_check((__typeof__(*(ptr)))(x), (ptr), sizeof(*(ptr)))
         |  ^~~~~~~~~~~~~~~~
   arch/powerpc/kernel/process.c:1964:9: note: in expansion of macro 'put_user'
    1964 |  return put_user(tsk->thread.align_ctl, (unsigned int __user *)adr);
         |         ^~~~~~~~
--
   In file included from include/linux/uaccess.h:11,
                    from include/linux/sched/task.h:11,
                    from include/linux/sched/signal.h:9,
                    from include/linux/ptrace.h:7,
                    from arch/powerpc/kernel/traps.c:22:
   arch/powerpc/kernel/traps.c: In function 'emulate_string_inst':
   arch/powerpc/include/asm/uaccess.h:328:2: warning: statement with no effect [-Wunused-value]
     328 |  __gu_err;       \
         |  ^~~~~~~~
>> arch/powerpc/include/asm/uaccess.h:89:2: note: in expansion of macro '__get_user_check'
      89 |  __get_user_check((x), (ptr), sizeof(*(ptr)))
         |  ^~~~~~~~~~~~~~~~
>> arch/powerpc/kernel/traps.c:1243:9: note: in expansion of macro 'get_user'
    1243 |     if (get_user(val, (u8 __user *)EA))
         |         ^~~~~~~~
   arch/powerpc/include/asm/uaccess.h:194:2: warning: statement with no effect [-Wunused-value]
     194 |  __pu_err;       \
         |  ^~~~~~~~
>> arch/powerpc/include/asm/uaccess.h:91:2: note: in expansion of macro '__put_user_check'
      91 |  __put_user_check((__typeof__(*(ptr)))(x), (ptr), sizeof(*(ptr)))
         |  ^~~~~~~~~~~~~~~~
>> arch/powerpc/kernel/traps.c:1254:9: note: in expansion of macro 'put_user'
    1254 |     if (put_user(val, (u8 __user *)EA))
         |         ^~~~~~~~
   arch/powerpc/kernel/traps.c: In function 'emulate_instruction':
   arch/powerpc/include/asm/uaccess.h:328:2: warning: statement with no effect [-Wunused-value]
     328 |  __gu_err;       \
         |  ^~~~~~~~
>> arch/powerpc/include/asm/uaccess.h:89:2: note: in expansion of macro '__get_user_check'
      89 |  __get_user_check((x), (ptr), sizeof(*(ptr)))
         |  ^~~~~~~~~~~~~~~~
   arch/powerpc/kernel/traps.c:1338:6: note: in expansion of macro 'get_user'
    1338 |  if (get_user(instword, (u32 __user *)(regs->nip)))
         |      ^~~~~~~~
   arch/powerpc/kernel/traps.c: In function 'facility_unavailable_exception':
   arch/powerpc/include/asm/uaccess.h:328:2: warning: statement with no effect [-Wunused-value]
     328 |  __gu_err;       \
         |  ^~~~~~~~
>> arch/powerpc/include/asm/uaccess.h:89:2: note: in expansion of macro '__get_user_check'
      89 |  __get_user_check((x), (ptr), sizeof(*(ptr)))
         |  ^~~~~~~~~~~~~~~~
   arch/powerpc/kernel/traps.c:1770:7: note: in expansion of macro 'get_user'
    1770 |   if (get_user(instword, (u32 __user *)(regs->nip))) {
         |       ^~~~~~~~
--
   In file included from include/linux/uaccess.h:11,
                    from include/linux/sched/task.h:11,
                    from include/linux/sched/signal.h:9,
                    from include/linux/ptrace.h:7,
                    from arch/powerpc/kernel/signal_64.c:21:
   arch/powerpc/kernel/signal_64.c: In function '__do_sys_swapcontext':
   arch/powerpc/include/asm/uaccess.h:328:2: warning: statement with no effect [-Wunused-value]
     328 |  __gu_err;       \
         |  ^~~~~~~~
>> arch/powerpc/include/asm/uaccess.h:89:2: note: in expansion of macro '__get_user_check'
      89 |  __get_user_check((x), (ptr), sizeof(*(ptr)))
         |  ^~~~~~~~~~~~~~~~
>> arch/powerpc/kernel/signal_64.c:644:6: note: in expansion of macro 'get_user'
     644 |      get_user(new_msr, &new_ctx->uc_mcontext.gp_regs[PT_MSR]))
         |      ^~~~~~~~
   arch/powerpc/kernel/signal_64.c: In function 'handle_rt_signal64':
   arch/powerpc/include/asm/uaccess.h:194:2: warning: statement with no effect [-Wunused-value]
     194 |  __pu_err;       \
         |  ^~~~~~~~
>> arch/powerpc/include/asm/uaccess.h:91:2: note: in expansion of macro '__put_user_check'
      91 |  __put_user_check((__typeof__(*(ptr)))(x), (ptr), sizeof(*(ptr)))
         |  ^~~~~~~~~~~~~~~~
>> arch/powerpc/kernel/signal_64.c:880:9: note: in expansion of macro 'put_user'
     880 |  err |= put_user(regs->gpr[1], (unsigned long __user *)newsp);
         |         ^~~~~~~~
   arch/powerpc/include/asm/uaccess.h:328:2: warning: statement with no effect [-Wunused-value]
     328 |  __gu_err;       \
         |  ^~~~~~~~
>> arch/powerpc/include/asm/uaccess.h:89:2: note: in expansion of macro '__get_user_check'
      89 |  __get_user_check((x), (ptr), sizeof(*(ptr)))
         |  ^~~~~~~~~~~~~~~~
   arch/powerpc/kernel/signal_64.c:895:10: note: in expansion of macro 'get_user'
     895 |   err |= get_user(regs->nip, &funct_desc_ptr->entry);
         |          ^~~~~~~~
   arch/powerpc/include/asm/uaccess.h:328:2: warning: statement with no effect [-Wunused-value]
     328 |  __gu_err;       \
         |  ^~~~~~~~
>> arch/powerpc/include/asm/uaccess.h:89:2: note: in expansion of macro '__get_user_check'
      89 |  __get_user_check((x), (ptr), sizeof(*(ptr)))
         |  ^~~~~~~~~~~~~~~~
   arch/powerpc/kernel/signal_64.c:896:10: note: in expansion of macro 'get_user'
     896 |   err |= get_user(regs->gpr[2], &funct_desc_ptr->toc);
         |          ^~~~~~~~
   arch/powerpc/include/asm/uaccess.h:328:2: warning: statement with no effect [-Wunused-value]
     328 |  __gu_err;       \
         |  ^~~~~~~~
>> arch/powerpc/include/asm/uaccess.h:89:2: note: in expansion of macro '__get_user_check'
      89 |  __get_user_check((x), (ptr), sizeof(*(ptr)))
         |  ^~~~~~~~~~~~~~~~
   arch/powerpc/kernel/signal_64.c:906:10: note: in expansion of macro 'get_user'
     906 |   err |= get_user(regs->gpr[4], (unsigned long __user *)&frame->pinfo);
         |          ^~~~~~~~
   arch/powerpc/include/asm/uaccess.h:328:2: warning: statement with no effect [-Wunused-value]
     328 |  __gu_err;       \
         |  ^~~~~~~~
>> arch/powerpc/include/asm/uaccess.h:89:2: note: in expansion of macro '__get_user_check'
      89 |  __get_user_check((x), (ptr), sizeof(*(ptr)))
         |  ^~~~~~~~~~~~~~~~
   arch/powerpc/kernel/signal_64.c:907:10: note: in expansion of macro 'get_user'
     907 |   err |= get_user(regs->gpr[5], (unsigned long __user *)&frame->puc);
         |          ^~~~~~~~
--
   In file included from include/linux/uaccess.h:11,
                    from arch/powerpc/kernel/vecemu.c:12:
   arch/powerpc/kernel/vecemu.c: In function 'emulate_altivec':
   arch/powerpc/include/asm/uaccess.h:328:2: warning: statement with no effect [-Wunused-value]
     328 |  __gu_err;       \
         |  ^~~~~~~~
>> arch/powerpc/include/asm/uaccess.h:89:2: note: in expansion of macro '__get_user_check'
      89 |  __get_user_check((x), (ptr), sizeof(*(ptr)))
         |  ^~~~~~~~~~~~~~~~
>> arch/powerpc/kernel/vecemu.c:267:6: note: in expansion of macro 'get_user'
     267 |  if (get_user(instr, (unsigned int __user *) regs->nip))
         |      ^~~~~~~~
--
   In file included from include/linux/uaccess.h:11,
                    from arch/powerpc/include/asm/sections.h:7,
                    from include/linux/interrupt.h:20,
                    from arch/powerpc/include/asm/kvm_host.h:14,
                    from include/linux/kvm_host.h:36,
                    from arch/powerpc/kvm/../../../virt/kvm/vfio.c:11:
   arch/powerpc/kvm/../../../virt/kvm/vfio.c: In function 'kvm_vfio_set_group':
   arch/powerpc/include/asm/uaccess.h:328:2: warning: statement with no effect [-Wunused-value]
     328 |  __gu_err;       \
         |  ^~~~~~~~
>> arch/powerpc/include/asm/uaccess.h:89:2: note: in expansion of macro '__get_user_check'
      89 |  __get_user_check((x), (ptr), sizeof(*(ptr)))
         |  ^~~~~~~~~~~~~~~~
>> arch/powerpc/kvm/../../../virt/kvm/vfio.c:196:7: note: in expansion of macro 'get_user'
     196 |   if (get_user(fd, argp))
         |       ^~~~~~~~
   arch/powerpc/include/asm/uaccess.h:328:2: warning: statement with no effect [-Wunused-value]
     328 |  __gu_err;       \
         |  ^~~~~~~~
>> arch/powerpc/include/asm/uaccess.h:89:2: note: in expansion of macro '__get_user_check'
      89 |  __get_user_check((x), (ptr), sizeof(*(ptr)))
         |  ^~~~~~~~~~~~~~~~
   arch/powerpc/kvm/../../../virt/kvm/vfio.c:240:7: note: in expansion of macro 'get_user'
     240 |   if (get_user(fd, argp))
         |       ^~~~~~~~
..

vim +/__get_user_check +89 arch/powerpc/include/asm/uaccess.h

2df5e8bcca53e5 include/asm-powerpc/uaccess.h      Stephen Rothwell       2005-10-29   64  
96d4f267e40f95 arch/powerpc/include/asm/uaccess.h Linus Torvalds         2019-01-03   65  #define access_ok(addr, size)		\
4caf4ebfe4cf0e arch/powerpc/include/asm/uaccess.h Linus Torvalds         2019-01-04   66  	(__chk_user_ptr(addr),		\
2df5e8bcca53e5 include/asm-powerpc/uaccess.h      Stephen Rothwell       2005-10-29   67  	 __access_ok((__force unsigned long)(addr), (size), get_fs()))
2df5e8bcca53e5 include/asm-powerpc/uaccess.h      Stephen Rothwell       2005-10-29   68  
2df5e8bcca53e5 include/asm-powerpc/uaccess.h      Stephen Rothwell       2005-10-29   69  /*
2df5e8bcca53e5 include/asm-powerpc/uaccess.h      Stephen Rothwell       2005-10-29   70   * These are the main single-value transfer routines.  They automatically
2df5e8bcca53e5 include/asm-powerpc/uaccess.h      Stephen Rothwell       2005-10-29   71   * use the right size if we just have the right pointer type.
2df5e8bcca53e5 include/asm-powerpc/uaccess.h      Stephen Rothwell       2005-10-29   72   *
2df5e8bcca53e5 include/asm-powerpc/uaccess.h      Stephen Rothwell       2005-10-29   73   * This gets kind of ugly. We want to return _two_ values in "get_user()"
2df5e8bcca53e5 include/asm-powerpc/uaccess.h      Stephen Rothwell       2005-10-29   74   * and yet we don't want to do any pointers, because that is too much
2df5e8bcca53e5 include/asm-powerpc/uaccess.h      Stephen Rothwell       2005-10-29   75   * of a performance impact. Thus we have a few rather ugly macros here,
2df5e8bcca53e5 include/asm-powerpc/uaccess.h      Stephen Rothwell       2005-10-29   76   * and hide all the ugliness from the user.
2df5e8bcca53e5 include/asm-powerpc/uaccess.h      Stephen Rothwell       2005-10-29   77   *
2df5e8bcca53e5 include/asm-powerpc/uaccess.h      Stephen Rothwell       2005-10-29   78   * The "__xxx" versions of the user access functions are versions that
2df5e8bcca53e5 include/asm-powerpc/uaccess.h      Stephen Rothwell       2005-10-29   79   * do not verify the address space, that must have been done previously
2df5e8bcca53e5 include/asm-powerpc/uaccess.h      Stephen Rothwell       2005-10-29   80   * with a separate "access_ok()" call (this is used when we do multiple
2df5e8bcca53e5 include/asm-powerpc/uaccess.h      Stephen Rothwell       2005-10-29   81   * accesses to the same area of user memory).
2df5e8bcca53e5 include/asm-powerpc/uaccess.h      Stephen Rothwell       2005-10-29   82   *
2df5e8bcca53e5 include/asm-powerpc/uaccess.h      Stephen Rothwell       2005-10-29   83   * As we use the same address space for kernel and user data on the
2df5e8bcca53e5 include/asm-powerpc/uaccess.h      Stephen Rothwell       2005-10-29   84   * PowerPC, we can just do these as direct assignments.  (Of course, the
2df5e8bcca53e5 include/asm-powerpc/uaccess.h      Stephen Rothwell       2005-10-29   85   * exception handling means that it's no longer "just"...)
2df5e8bcca53e5 include/asm-powerpc/uaccess.h      Stephen Rothwell       2005-10-29   86   *
2df5e8bcca53e5 include/asm-powerpc/uaccess.h      Stephen Rothwell       2005-10-29   87   */
2df5e8bcca53e5 include/asm-powerpc/uaccess.h      Stephen Rothwell       2005-10-29   88  #define get_user(x, ptr) \
2df5e8bcca53e5 include/asm-powerpc/uaccess.h      Stephen Rothwell       2005-10-29  @89  	__get_user_check((x), (ptr), sizeof(*(ptr)))
2df5e8bcca53e5 include/asm-powerpc/uaccess.h      Stephen Rothwell       2005-10-29   90  #define put_user(x, ptr) \
2df5e8bcca53e5 include/asm-powerpc/uaccess.h      Stephen Rothwell       2005-10-29  @91  	__put_user_check((__typeof__(*(ptr)))(x), (ptr), sizeof(*(ptr)))
2df5e8bcca53e5 include/asm-powerpc/uaccess.h      Stephen Rothwell       2005-10-29   92  
2df5e8bcca53e5 include/asm-powerpc/uaccess.h      Stephen Rothwell       2005-10-29   93  #define __get_user(x, ptr) \
5cd623333e7cf4 arch/powerpc/include/asm/uaccess.h Christophe Leroy       2020-01-24   94  	__get_user_nocheck((x), (ptr), sizeof(*(ptr)), true)
2df5e8bcca53e5 include/asm-powerpc/uaccess.h      Stephen Rothwell       2005-10-29   95  #define __put_user(x, ptr) \
5cd623333e7cf4 arch/powerpc/include/asm/uaccess.h Christophe Leroy       2020-01-24   96  	__put_user_nocheck((__typeof__(*(ptr)))(x), (ptr), sizeof(*(ptr)), true)
5cd623333e7cf4 arch/powerpc/include/asm/uaccess.h Christophe Leroy       2020-01-24   97  
5cd623333e7cf4 arch/powerpc/include/asm/uaccess.h Christophe Leroy       2020-01-24   98  #define __get_user_allowed(x, ptr) \
5cd623333e7cf4 arch/powerpc/include/asm/uaccess.h Christophe Leroy       2020-01-24   99  	__get_user_nocheck((x), (ptr), sizeof(*(ptr)), false)
5cd623333e7cf4 arch/powerpc/include/asm/uaccess.h Christophe Leroy       2020-01-24  100  #define __put_user_allowed(x, ptr) \
5cd623333e7cf4 arch/powerpc/include/asm/uaccess.h Christophe Leroy       2020-01-24  101  	__put_user_nocheck((__typeof__(*(ptr)))(x), (ptr), sizeof(*(ptr)), false)
e68c825bb01670 include/asm-powerpc/uaccess.h      Benjamin Herrenschmidt 2007-04-11  102  
e68c825bb01670 include/asm-powerpc/uaccess.h      Benjamin Herrenschmidt 2007-04-11  103  #define __get_user_inatomic(x, ptr) \
e68c825bb01670 include/asm-powerpc/uaccess.h      Benjamin Herrenschmidt 2007-04-11  104  	__get_user_nosleep((x), (ptr), sizeof(*(ptr)))
e68c825bb01670 include/asm-powerpc/uaccess.h      Benjamin Herrenschmidt 2007-04-11  105  #define __put_user_inatomic(x, ptr) \
e68c825bb01670 include/asm-powerpc/uaccess.h      Benjamin Herrenschmidt 2007-04-11  106  	__put_user_nosleep((__typeof__(*(ptr)))(x), (ptr), sizeof(*(ptr)))
e68c825bb01670 include/asm-powerpc/uaccess.h      Benjamin Herrenschmidt 2007-04-11  107  
2df5e8bcca53e5 include/asm-powerpc/uaccess.h      Stephen Rothwell       2005-10-29  108  extern long __put_user_bad(void);
2df5e8bcca53e5 include/asm-powerpc/uaccess.h      Stephen Rothwell       2005-10-29  109  
2df5e8bcca53e5 include/asm-powerpc/uaccess.h      Stephen Rothwell       2005-10-29  110  /*
2df5e8bcca53e5 include/asm-powerpc/uaccess.h      Stephen Rothwell       2005-10-29  111   * We don't tell gcc that we are accessing memory, but this is OK
2df5e8bcca53e5 include/asm-powerpc/uaccess.h      Stephen Rothwell       2005-10-29  112   * because we do not write to any memory gcc knows about, so there
2df5e8bcca53e5 include/asm-powerpc/uaccess.h      Stephen Rothwell       2005-10-29  113   * are no aliasing issues.
2df5e8bcca53e5 include/asm-powerpc/uaccess.h      Stephen Rothwell       2005-10-29  114   */
2df5e8bcca53e5 include/asm-powerpc/uaccess.h      Stephen Rothwell       2005-10-29  115  #define __put_user_asm(x, addr, err, op)			\
2df5e8bcca53e5 include/asm-powerpc/uaccess.h      Stephen Rothwell       2005-10-29  116  	__asm__ __volatile__(					\
2df5e8bcca53e5 include/asm-powerpc/uaccess.h      Stephen Rothwell       2005-10-29  117  		"1:	" op " %1,0(%2)	# put_user\n"		\
2df5e8bcca53e5 include/asm-powerpc/uaccess.h      Stephen Rothwell       2005-10-29  118  		"2:\n"						\
2df5e8bcca53e5 include/asm-powerpc/uaccess.h      Stephen Rothwell       2005-10-29  119  		".section .fixup,\"ax\"\n"			\
2df5e8bcca53e5 include/asm-powerpc/uaccess.h      Stephen Rothwell       2005-10-29  120  		"3:	li %0,%3\n"				\
2df5e8bcca53e5 include/asm-powerpc/uaccess.h      Stephen Rothwell       2005-10-29  121  		"	b 2b\n"					\
2df5e8bcca53e5 include/asm-powerpc/uaccess.h      Stephen Rothwell       2005-10-29  122  		".previous\n"					\
24bfa6a9e0d4fe arch/powerpc/include/asm/uaccess.h Nicholas Piggin        2016-10-13  123  		EX_TABLE(1b, 3b)				\
2df5e8bcca53e5 include/asm-powerpc/uaccess.h      Stephen Rothwell       2005-10-29  124  		: "=r" (err)					\
551c3c04b478b9 include/asm-powerpc/uaccess.h      Michael Ellerman       2008-07-17  125  		: "r" (x), "b" (addr), "i" (-EFAULT), "0" (err))
2df5e8bcca53e5 include/asm-powerpc/uaccess.h      Stephen Rothwell       2005-10-29  126  
5015b49448cbe5 include/asm-powerpc/uaccess.h      Stephen Rothwell       2005-10-31  127  #ifdef __powerpc64__
5015b49448cbe5 include/asm-powerpc/uaccess.h      Stephen Rothwell       2005-10-31  128  #define __put_user_asm2(x, ptr, retval)				\
5015b49448cbe5 include/asm-powerpc/uaccess.h      Stephen Rothwell       2005-10-31  129  	  __put_user_asm(x, ptr, retval, "std")
5015b49448cbe5 include/asm-powerpc/uaccess.h      Stephen Rothwell       2005-10-31  130  #else /* __powerpc64__ */
2df5e8bcca53e5 include/asm-powerpc/uaccess.h      Stephen Rothwell       2005-10-29  131  #define __put_user_asm2(x, addr, err)				\
2df5e8bcca53e5 include/asm-powerpc/uaccess.h      Stephen Rothwell       2005-10-29  132  	__asm__ __volatile__(					\
2df5e8bcca53e5 include/asm-powerpc/uaccess.h      Stephen Rothwell       2005-10-29  133  		"1:	stw %1,0(%2)\n"				\
2df5e8bcca53e5 include/asm-powerpc/uaccess.h      Stephen Rothwell       2005-10-29  134  		"2:	stw %1+1,4(%2)\n"			\
2df5e8bcca53e5 include/asm-powerpc/uaccess.h      Stephen Rothwell       2005-10-29  135  		"3:\n"						\
2df5e8bcca53e5 include/asm-powerpc/uaccess.h      Stephen Rothwell       2005-10-29  136  		".section .fixup,\"ax\"\n"			\
2df5e8bcca53e5 include/asm-powerpc/uaccess.h      Stephen Rothwell       2005-10-29  137  		"4:	li %0,%3\n"				\
2df5e8bcca53e5 include/asm-powerpc/uaccess.h      Stephen Rothwell       2005-10-29  138  		"	b 3b\n"					\
2df5e8bcca53e5 include/asm-powerpc/uaccess.h      Stephen Rothwell       2005-10-29  139  		".previous\n"					\
24bfa6a9e0d4fe arch/powerpc/include/asm/uaccess.h Nicholas Piggin        2016-10-13  140  		EX_TABLE(1b, 4b)				\
24bfa6a9e0d4fe arch/powerpc/include/asm/uaccess.h Nicholas Piggin        2016-10-13  141  		EX_TABLE(2b, 4b)				\
2df5e8bcca53e5 include/asm-powerpc/uaccess.h      Stephen Rothwell       2005-10-29  142  		: "=r" (err)					\
551c3c04b478b9 include/asm-powerpc/uaccess.h      Michael Ellerman       2008-07-17  143  		: "r" (x), "b" (addr), "i" (-EFAULT), "0" (err))
2df5e8bcca53e5 include/asm-powerpc/uaccess.h      Stephen Rothwell       2005-10-29  144  #endif /* __powerpc64__ */
2df5e8bcca53e5 include/asm-powerpc/uaccess.h      Stephen Rothwell       2005-10-29  145  
5cd623333e7cf4 arch/powerpc/include/asm/uaccess.h Christophe Leroy       2020-01-24  146  #define __put_user_size_allowed(x, ptr, size, retval)		\
2df5e8bcca53e5 include/asm-powerpc/uaccess.h      Stephen Rothwell       2005-10-29  147  do {								\
2df5e8bcca53e5 include/asm-powerpc/uaccess.h      Stephen Rothwell       2005-10-29  148  	retval = 0;						\
2df5e8bcca53e5 include/asm-powerpc/uaccess.h      Stephen Rothwell       2005-10-29  149  	switch (size) {						\
2df5e8bcca53e5 include/asm-powerpc/uaccess.h      Stephen Rothwell       2005-10-29  150  	  case 1: __put_user_asm(x, ptr, retval, "stb"); break;	\
2df5e8bcca53e5 include/asm-powerpc/uaccess.h      Stephen Rothwell       2005-10-29  151  	  case 2: __put_user_asm(x, ptr, retval, "sth"); break;	\
2df5e8bcca53e5 include/asm-powerpc/uaccess.h      Stephen Rothwell       2005-10-29  152  	  case 4: __put_user_asm(x, ptr, retval, "stw"); break;	\
2df5e8bcca53e5 include/asm-powerpc/uaccess.h      Stephen Rothwell       2005-10-29  153  	  case 8: __put_user_asm2(x, ptr, retval); break;	\
2df5e8bcca53e5 include/asm-powerpc/uaccess.h      Stephen Rothwell       2005-10-29  154  	  default: __put_user_bad();				\
2df5e8bcca53e5 include/asm-powerpc/uaccess.h      Stephen Rothwell       2005-10-29  155  	}							\
5cd623333e7cf4 arch/powerpc/include/asm/uaccess.h Christophe Leroy       2020-01-24  156  } while (0)
5cd623333e7cf4 arch/powerpc/include/asm/uaccess.h Christophe Leroy       2020-01-24  157  
5cd623333e7cf4 arch/powerpc/include/asm/uaccess.h Christophe Leroy       2020-01-24  158  #define __put_user_size(x, ptr, size, retval)			\
5cd623333e7cf4 arch/powerpc/include/asm/uaccess.h Christophe Leroy       2020-01-24  159  do {								\
5cd623333e7cf4 arch/powerpc/include/asm/uaccess.h Christophe Leroy       2020-01-24  160  	allow_write_to_user(ptr, size);				\
5cd623333e7cf4 arch/powerpc/include/asm/uaccess.h Christophe Leroy       2020-01-24  161  	__put_user_size_allowed(x, ptr, size, retval);		\
de78a9c42a7900 arch/powerpc/include/asm/uaccess.h Christophe Leroy       2019-04-18  162  	prevent_write_to_user(ptr, size);			\
2df5e8bcca53e5 include/asm-powerpc/uaccess.h      Stephen Rothwell       2005-10-29  163  } while (0)
2df5e8bcca53e5 include/asm-powerpc/uaccess.h      Stephen Rothwell       2005-10-29  164  
5cd623333e7cf4 arch/powerpc/include/asm/uaccess.h Christophe Leroy       2020-01-24  165  #define __put_user_nocheck(x, ptr, size, do_allow)			\
2df5e8bcca53e5 include/asm-powerpc/uaccess.h      Stephen Rothwell       2005-10-29  166  ({								\
2df5e8bcca53e5 include/asm-powerpc/uaccess.h      Stephen Rothwell       2005-10-29  167  	long __pu_err;						\
6bfd93c32a5065 include/asm-powerpc/uaccess.h      Paul Mackerras         2006-05-03  168  	__typeof__(*(ptr)) __user *__pu_addr = (ptr);		\
fea87fb7a00046 arch/powerpc/include/asm/uaccess.h Nicholas Piggin        2020-04-03  169  	__typeof__(*(ptr)) __pu_val = (x);			\
fea87fb7a00046 arch/powerpc/include/asm/uaccess.h Nicholas Piggin        2020-04-03  170  	__typeof__(size) __pu_size = (size);			\
fea87fb7a00046 arch/powerpc/include/asm/uaccess.h Nicholas Piggin        2020-04-03  171  								\
6bfd93c32a5065 include/asm-powerpc/uaccess.h      Paul Mackerras         2006-05-03  172  	if (!is_kernel_addr((unsigned long)__pu_addr))		\
1af1717dbf96eb arch/powerpc/include/asm/uaccess.h Michael S. Tsirkin     2013-05-26  173  		might_fault();					\
fea87fb7a00046 arch/powerpc/include/asm/uaccess.h Nicholas Piggin        2020-04-03  174  	__chk_user_ptr(__pu_addr);				\
5cd623333e7cf4 arch/powerpc/include/asm/uaccess.h Christophe Leroy       2020-01-24  175  	if (do_allow)								\
fea87fb7a00046 arch/powerpc/include/asm/uaccess.h Nicholas Piggin        2020-04-03  176  		__put_user_size(__pu_val, __pu_addr, __pu_size, __pu_err);	\
5cd623333e7cf4 arch/powerpc/include/asm/uaccess.h Christophe Leroy       2020-01-24  177  	else									\
fea87fb7a00046 arch/powerpc/include/asm/uaccess.h Nicholas Piggin        2020-04-03  178  		__put_user_size_allowed(__pu_val, __pu_addr, __pu_size, __pu_err); \
fea87fb7a00046 arch/powerpc/include/asm/uaccess.h Nicholas Piggin        2020-04-03  179  								\
958106a072021d arch/powerpc/include/asm/uaccess.h Nicholas Piggin        2020-04-03  180  	__builtin_expect(__pu_err, 0);				\
2df5e8bcca53e5 include/asm-powerpc/uaccess.h      Stephen Rothwell       2005-10-29  181  })
2df5e8bcca53e5 include/asm-powerpc/uaccess.h      Stephen Rothwell       2005-10-29  182  
2df5e8bcca53e5 include/asm-powerpc/uaccess.h      Stephen Rothwell       2005-10-29  183  #define __put_user_check(x, ptr, size)					\
2df5e8bcca53e5 include/asm-powerpc/uaccess.h      Stephen Rothwell       2005-10-29  184  ({									\
2df5e8bcca53e5 include/asm-powerpc/uaccess.h      Stephen Rothwell       2005-10-29  185  	long __pu_err = -EFAULT;					\
2df5e8bcca53e5 include/asm-powerpc/uaccess.h      Stephen Rothwell       2005-10-29  186  	__typeof__(*(ptr)) __user *__pu_addr = (ptr);			\
fea87fb7a00046 arch/powerpc/include/asm/uaccess.h Nicholas Piggin        2020-04-03  187  	__typeof__(*(ptr)) __pu_val = (x);				\
fea87fb7a00046 arch/powerpc/include/asm/uaccess.h Nicholas Piggin        2020-04-03  188  	__typeof__(size) __pu_size = (size);				\
fea87fb7a00046 arch/powerpc/include/asm/uaccess.h Nicholas Piggin        2020-04-03  189  									\
1af1717dbf96eb arch/powerpc/include/asm/uaccess.h Michael S. Tsirkin     2013-05-26  190  	might_fault();							\
fea87fb7a00046 arch/powerpc/include/asm/uaccess.h Nicholas Piggin        2020-04-03  191  	if (access_ok(__pu_addr, __pu_size))				\
fea87fb7a00046 arch/powerpc/include/asm/uaccess.h Nicholas Piggin        2020-04-03  192  		__put_user_size(__pu_val, __pu_addr, __pu_size, __pu_err); \
fea87fb7a00046 arch/powerpc/include/asm/uaccess.h Nicholas Piggin        2020-04-03  193  									\
2df5e8bcca53e5 include/asm-powerpc/uaccess.h      Stephen Rothwell       2005-10-29 @194  	__pu_err;							\
958106a072021d arch/powerpc/include/asm/uaccess.h Nicholas Piggin        2020-04-03  195  	__builtin_expect(__pu_err, 0);					\
2df5e8bcca53e5 include/asm-powerpc/uaccess.h      Stephen Rothwell       2005-10-29  196  })
2df5e8bcca53e5 include/asm-powerpc/uaccess.h      Stephen Rothwell       2005-10-29  197  

:::::: The code at line 89 was first introduced by commit
:::::: 2df5e8bcca53e528a78ee0e3b114d0d21dd6d043 powerpc: merge uaccess.h

:::::: TO: Stephen Rothwell <sfr@canb.auug.org.au>
:::::: CC: Stephen Rothwell <sfr@canb.auug.org.au>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 15339 bytes --]

^ permalink raw reply

* Re: [PATCH v2 5/5] uaccess: Rename user_access_begin/end() to user_full_access_begin/end()
From: kbuild test robot @ 2020-04-04  7:17 UTC (permalink / raw)
  To: Christophe Leroy
  Cc: linux-arch, linuxppc-dev, kbuild-all, keescook, airlied,
	intel-gfx, hpa, linux-kernel, linux-mm, Paul Mackerras, viro,
	daniel, akpm, torvalds
In-Reply-To: <42da416106d5c1cf92bda1e058434fe240b35f44.1585898438.git.christophe.leroy@c-s.fr>

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

Hi Christophe,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on linus/master]
[also build test ERROR on next-20200403]
[cannot apply to powerpc/next drm-intel/for-linux-next tip/x86/core v5.6]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Christophe-Leroy/uaccess-Add-user_read_access_begin-end-and-user_write_access_begin-end/20200404-080555
base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 5364abc57993b3bf60c41923cb98a8f1a594e749
config: i386-allyesconfig (attached as .config)
compiler: gcc-7 (Ubuntu 7.5.0-6ubuntu2) 7.5.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   arch/x86/kernel/vm86_32.c: In function 'save_v86_state':
>> arch/x86/kernel/vm86_32.c:116:7: error: implicit declaration of function 'user_access_begin'; did you mean 'user_access_end'? [-Werror=implicit-function-declaration]
     if (!user_access_begin(user, vm86->vm86plus.is_vm86pus ?
          ^~~~~~~~~~~~~~~~~
          user_access_end
   cc1: some warnings being treated as errors

vim +116 arch/x86/kernel/vm86_32.c

^1da177e4c3f41 arch/i386/kernel/vm86.c   Linus Torvalds      2005-04-16   95  
5ed92a8ab71f88 arch/x86/kernel/vm86_32.c Brian Gerst         2015-07-29   96  void save_v86_state(struct kernel_vm86_regs *regs, int retval)
^1da177e4c3f41 arch/i386/kernel/vm86.c   Linus Torvalds      2005-04-16   97  {
ed0b2edb61ba4e arch/x86/kernel/vm86_32.c Brian Gerst         2015-07-19   98  	struct task_struct *tsk = current;
ed0b2edb61ba4e arch/x86/kernel/vm86_32.c Brian Gerst         2015-07-19   99  	struct vm86plus_struct __user *user;
9fda6a0681e070 arch/x86/kernel/vm86_32.c Brian Gerst         2015-07-29  100  	struct vm86 *vm86 = current->thread.vm86;
^1da177e4c3f41 arch/i386/kernel/vm86.c   Linus Torvalds      2005-04-16  101  
^1da177e4c3f41 arch/i386/kernel/vm86.c   Linus Torvalds      2005-04-16  102  	/*
^1da177e4c3f41 arch/i386/kernel/vm86.c   Linus Torvalds      2005-04-16  103  	 * This gets called from entry.S with interrupts disabled, but
^1da177e4c3f41 arch/i386/kernel/vm86.c   Linus Torvalds      2005-04-16  104  	 * from process context. Enable interrupts here, before trying
^1da177e4c3f41 arch/i386/kernel/vm86.c   Linus Torvalds      2005-04-16  105  	 * to access user space.
^1da177e4c3f41 arch/i386/kernel/vm86.c   Linus Torvalds      2005-04-16  106  	 */
^1da177e4c3f41 arch/i386/kernel/vm86.c   Linus Torvalds      2005-04-16  107  	local_irq_enable();
^1da177e4c3f41 arch/i386/kernel/vm86.c   Linus Torvalds      2005-04-16  108  
1342635638cba9 arch/x86/kernel/vm86_32.c Brian Gerst         2015-07-29  109  	if (!vm86 || !vm86->user_vm86) {
1342635638cba9 arch/x86/kernel/vm86_32.c Brian Gerst         2015-07-29  110  		pr_alert("no user_vm86: BAD\n");
^1da177e4c3f41 arch/i386/kernel/vm86.c   Linus Torvalds      2005-04-16  111  		do_exit(SIGSEGV);
^1da177e4c3f41 arch/i386/kernel/vm86.c   Linus Torvalds      2005-04-16  112  	}
decd275e62d5ee arch/x86/kernel/vm86_32.c Brian Gerst         2015-07-29  113  	set_flags(regs->pt.flags, VEFLAGS, X86_EFLAGS_VIF | vm86->veflags_mask);
1342635638cba9 arch/x86/kernel/vm86_32.c Brian Gerst         2015-07-29  114  	user = vm86->user_vm86;
ed0b2edb61ba4e arch/x86/kernel/vm86_32.c Brian Gerst         2015-07-19  115  
a37d01ead405e3 arch/x86/kernel/vm86_32.c Al Viro             2020-02-15 @116  	if (!user_access_begin(user, vm86->vm86plus.is_vm86pus ?
ed0b2edb61ba4e arch/x86/kernel/vm86_32.c Brian Gerst         2015-07-19  117  		       sizeof(struct vm86plus_struct) :
a37d01ead405e3 arch/x86/kernel/vm86_32.c Al Viro             2020-02-15  118  		       sizeof(struct vm86_struct)))
a37d01ead405e3 arch/x86/kernel/vm86_32.c Al Viro             2020-02-15  119  		goto Efault;
a37d01ead405e3 arch/x86/kernel/vm86_32.c Al Viro             2020-02-15  120  
a37d01ead405e3 arch/x86/kernel/vm86_32.c Al Viro             2020-02-15  121  	unsafe_put_user(regs->pt.bx, &user->regs.ebx, Efault_end);
a37d01ead405e3 arch/x86/kernel/vm86_32.c Al Viro             2020-02-15  122  	unsafe_put_user(regs->pt.cx, &user->regs.ecx, Efault_end);
a37d01ead405e3 arch/x86/kernel/vm86_32.c Al Viro             2020-02-15  123  	unsafe_put_user(regs->pt.dx, &user->regs.edx, Efault_end);
a37d01ead405e3 arch/x86/kernel/vm86_32.c Al Viro             2020-02-15  124  	unsafe_put_user(regs->pt.si, &user->regs.esi, Efault_end);
a37d01ead405e3 arch/x86/kernel/vm86_32.c Al Viro             2020-02-15  125  	unsafe_put_user(regs->pt.di, &user->regs.edi, Efault_end);
a37d01ead405e3 arch/x86/kernel/vm86_32.c Al Viro             2020-02-15  126  	unsafe_put_user(regs->pt.bp, &user->regs.ebp, Efault_end);
a37d01ead405e3 arch/x86/kernel/vm86_32.c Al Viro             2020-02-15  127  	unsafe_put_user(regs->pt.ax, &user->regs.eax, Efault_end);
a37d01ead405e3 arch/x86/kernel/vm86_32.c Al Viro             2020-02-15  128  	unsafe_put_user(regs->pt.ip, &user->regs.eip, Efault_end);
a37d01ead405e3 arch/x86/kernel/vm86_32.c Al Viro             2020-02-15  129  	unsafe_put_user(regs->pt.cs, &user->regs.cs, Efault_end);
a37d01ead405e3 arch/x86/kernel/vm86_32.c Al Viro             2020-02-15  130  	unsafe_put_user(regs->pt.flags, &user->regs.eflags, Efault_end);
a37d01ead405e3 arch/x86/kernel/vm86_32.c Al Viro             2020-02-15  131  	unsafe_put_user(regs->pt.sp, &user->regs.esp, Efault_end);
a37d01ead405e3 arch/x86/kernel/vm86_32.c Al Viro             2020-02-15  132  	unsafe_put_user(regs->pt.ss, &user->regs.ss, Efault_end);
a37d01ead405e3 arch/x86/kernel/vm86_32.c Al Viro             2020-02-15  133  	unsafe_put_user(regs->es, &user->regs.es, Efault_end);
a37d01ead405e3 arch/x86/kernel/vm86_32.c Al Viro             2020-02-15  134  	unsafe_put_user(regs->ds, &user->regs.ds, Efault_end);
a37d01ead405e3 arch/x86/kernel/vm86_32.c Al Viro             2020-02-15  135  	unsafe_put_user(regs->fs, &user->regs.fs, Efault_end);
a37d01ead405e3 arch/x86/kernel/vm86_32.c Al Viro             2020-02-15  136  	unsafe_put_user(regs->gs, &user->regs.gs, Efault_end);
a37d01ead405e3 arch/x86/kernel/vm86_32.c Al Viro             2020-02-15  137  	unsafe_put_user(vm86->screen_bitmap, &user->screen_bitmap, Efault_end);
a37d01ead405e3 arch/x86/kernel/vm86_32.c Al Viro             2020-02-15  138  
a37d01ead405e3 arch/x86/kernel/vm86_32.c Al Viro             2020-02-15  139  	user_access_end();
^1da177e4c3f41 arch/i386/kernel/vm86.c   Linus Torvalds      2005-04-16  140  
da51da189a24bb arch/x86/kernel/vm86_32.c Andy Lutomirski     2017-11-02  141  	preempt_disable();
9fda6a0681e070 arch/x86/kernel/vm86_32.c Brian Gerst         2015-07-29  142  	tsk->thread.sp0 = vm86->saved_sp0;
ed0b2edb61ba4e arch/x86/kernel/vm86_32.c Brian Gerst         2015-07-19  143  	tsk->thread.sysenter_cs = __KERNEL_CS;
252e1a0526304f arch/x86/kernel/vm86_32.c Joerg Roedel        2018-07-18  144  	update_task_stack(tsk);
bd7dc5a6afac71 arch/x86/kernel/vm86_32.c Andy Lutomirski     2017-11-02  145  	refresh_sysenter_cs(&tsk->thread);
9fda6a0681e070 arch/x86/kernel/vm86_32.c Brian Gerst         2015-07-29  146  	vm86->saved_sp0 = 0;
da51da189a24bb arch/x86/kernel/vm86_32.c Andy Lutomirski     2017-11-02  147  	preempt_enable();
^1da177e4c3f41 arch/i386/kernel/vm86.c   Linus Torvalds      2005-04-16  148  
5ed92a8ab71f88 arch/x86/kernel/vm86_32.c Brian Gerst         2015-07-29  149  	memcpy(&regs->pt, &vm86->regs32, sizeof(struct pt_regs));
49d26b6eaa8e97 arch/i386/kernel/vm86.c   Jeremy Fitzhardinge 2006-12-07  150  
5ed92a8ab71f88 arch/x86/kernel/vm86_32.c Brian Gerst         2015-07-29  151  	lazy_load_gs(vm86->regs32.gs);
49d26b6eaa8e97 arch/i386/kernel/vm86.c   Jeremy Fitzhardinge 2006-12-07  152  
5ed92a8ab71f88 arch/x86/kernel/vm86_32.c Brian Gerst         2015-07-29  153  	regs->pt.ax = retval;
a37d01ead405e3 arch/x86/kernel/vm86_32.c Al Viro             2020-02-15  154  	return;
a37d01ead405e3 arch/x86/kernel/vm86_32.c Al Viro             2020-02-15  155  
a37d01ead405e3 arch/x86/kernel/vm86_32.c Al Viro             2020-02-15  156  Efault_end:
a37d01ead405e3 arch/x86/kernel/vm86_32.c Al Viro             2020-02-15  157  	user_access_end();
a37d01ead405e3 arch/x86/kernel/vm86_32.c Al Viro             2020-02-15  158  Efault:
a37d01ead405e3 arch/x86/kernel/vm86_32.c Al Viro             2020-02-15  159  	pr_alert("could not access userspace vm86 info\n");
a37d01ead405e3 arch/x86/kernel/vm86_32.c Al Viro             2020-02-15  160  	do_exit(SIGSEGV);
^1da177e4c3f41 arch/i386/kernel/vm86.c   Linus Torvalds      2005-04-16  161  }
^1da177e4c3f41 arch/i386/kernel/vm86.c   Linus Torvalds      2005-04-16  162  

:::::: The code at line 116 was first introduced by commit
:::::: a37d01ead405e3aa14d72d284721fe46422b3b63 x86: switch save_v86_state() to unsafe_put_user()

:::::: TO: Al Viro <viro@zeniv.linux.org.uk>
:::::: CC: Al Viro <viro@zeniv.linux.org.uk>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 72127 bytes --]

^ permalink raw reply

* Re: [PATCH v2 5/5] uaccess: Rename user_access_begin/end() to user_full_access_begin/end()
From: kbuild test robot @ 2020-04-04  6:20 UTC (permalink / raw)
  To: Christophe Leroy
  Cc: linux-arch, linuxppc-dev, kbuild-all, keescook, airlied,
	intel-gfx, hpa, linux-kernel, linux-mm, Paul Mackerras, viro,
	daniel, akpm, torvalds
In-Reply-To: <42da416106d5c1cf92bda1e058434fe240b35f44.1585898438.git.christophe.leroy@c-s.fr>

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

Hi Christophe,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on linus/master]
[also build test ERROR on next-20200403]
[cannot apply to powerpc/next drm-intel/for-linux-next tip/x86/core v5.6]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Christophe-Leroy/uaccess-Add-user_read_access_begin-end-and-user_write_access_begin-end/20200404-080555
base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 5364abc57993b3bf60c41923cb98a8f1a594e749
config: x86_64-randconfig-s1-20200404 (attached as .config)
compiler: gcc-7 (Ubuntu 7.5.0-6ubuntu2) 7.5.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   arch/x86/ia32/ia32_signal.c: In function 'ia32_setup_frame':
>> arch/x86/ia32/ia32_signal.c:265:7: error: implicit declaration of function 'user_access_begin'; did you mean 'user_access_end'? [-Werror=implicit-function-declaration]
     if (!user_access_begin(frame, sizeof(*frame)))
          ^~~~~~~~~~~~~~~~~
          user_access_end
   cc1: some warnings being treated as errors

vim +265 arch/x86/ia32/ia32_signal.c

^1da177e4c3f41 arch/x86_64/ia32/ia32_signal.c Linus Torvalds      2005-04-16  233  
235b80226b986d arch/x86/ia32/ia32_signal.c    Al Viro             2012-11-09  234  int ia32_setup_frame(int sig, struct ksignal *ksig,
^1da177e4c3f41 arch/x86_64/ia32/ia32_signal.c Linus Torvalds      2005-04-16  235  		     compat_sigset_t *set, struct pt_regs *regs)
^1da177e4c3f41 arch/x86_64/ia32/ia32_signal.c Linus Torvalds      2005-04-16  236  {
3b0d29ee1c73b6 arch/x86/ia32/ia32_signal.c    Hiroshi Shimamoto   2008-12-17  237  	struct sigframe_ia32 __user *frame;
99b9cdf758af70 arch/x86/ia32/ia32_signal.c    Thomas Gleixner     2008-01-30  238  	void __user *restorer;
44a1d996325982 arch/x86/ia32/ia32_signal.c    Al Viro             2020-02-15  239  	void __user *fp = NULL;
^1da177e4c3f41 arch/x86_64/ia32/ia32_signal.c Linus Torvalds      2005-04-16  240  
99b9cdf758af70 arch/x86/ia32/ia32_signal.c    Thomas Gleixner     2008-01-30  241  	/* copy_to_user optimizes that into a single 8 byte store */
99b9cdf758af70 arch/x86/ia32/ia32_signal.c    Thomas Gleixner     2008-01-30  242  	static const struct {
99b9cdf758af70 arch/x86/ia32/ia32_signal.c    Thomas Gleixner     2008-01-30  243  		u16 poplmovl;
99b9cdf758af70 arch/x86/ia32/ia32_signal.c    Thomas Gleixner     2008-01-30  244  		u32 val;
99b9cdf758af70 arch/x86/ia32/ia32_signal.c    Thomas Gleixner     2008-01-30  245  		u16 int80;
99b9cdf758af70 arch/x86/ia32/ia32_signal.c    Thomas Gleixner     2008-01-30  246  	} __attribute__((packed)) code = {
99b9cdf758af70 arch/x86/ia32/ia32_signal.c    Thomas Gleixner     2008-01-30  247  		0xb858,		 /* popl %eax ; movl $...,%eax */
99b9cdf758af70 arch/x86/ia32/ia32_signal.c    Thomas Gleixner     2008-01-30  248  		__NR_ia32_sigreturn,
99b9cdf758af70 arch/x86/ia32/ia32_signal.c    Thomas Gleixner     2008-01-30  249  		0x80cd,		/* int $0x80 */
99b9cdf758af70 arch/x86/ia32/ia32_signal.c    Thomas Gleixner     2008-01-30  250  	};
99b9cdf758af70 arch/x86/ia32/ia32_signal.c    Thomas Gleixner     2008-01-30  251  
44a1d996325982 arch/x86/ia32/ia32_signal.c    Al Viro             2020-02-15  252  	frame = get_sigframe(ksig, regs, sizeof(*frame), &fp);
^1da177e4c3f41 arch/x86_64/ia32/ia32_signal.c Linus Torvalds      2005-04-16  253  
235b80226b986d arch/x86/ia32/ia32_signal.c    Al Viro             2012-11-09  254  	if (ksig->ka.sa.sa_flags & SA_RESTORER) {
235b80226b986d arch/x86/ia32/ia32_signal.c    Al Viro             2012-11-09  255  		restorer = ksig->ka.sa.sa_restorer;
af65d64845a90c arch/x86/ia32/ia32_signal.c    Roland McGrath      2008-01-30  256  	} else {
^1da177e4c3f41 arch/x86_64/ia32/ia32_signal.c Linus Torvalds      2005-04-16  257  		/* Return stub is in 32bit vsyscall page */
1a3e4ca41c5a38 arch/x86/ia32/ia32_signal.c    Roland McGrath      2008-04-09  258  		if (current->mm->context.vdso)
6f121e548f8367 arch/x86/ia32/ia32_signal.c    Andy Lutomirski     2014-05-05  259  			restorer = current->mm->context.vdso +
0a6d1fa0d2b48f arch/x86/ia32/ia32_signal.c    Andy Lutomirski     2015-10-05  260  				vdso_image_32.sym___kernel_sigreturn;
9fbbd4dd17d071 arch/x86_64/ia32/ia32_signal.c Andi Kleen          2007-02-13  261  		else
ade1af77129dea arch/x86/ia32/ia32_signal.c    Jan Engelhardt      2008-01-30  262  			restorer = &frame->retcode;
af65d64845a90c arch/x86/ia32/ia32_signal.c    Roland McGrath      2008-01-30  263  	}
3b4b75700a245d arch/x86/ia32/ia32_signal.c    Hiroshi Shimamoto   2009-01-23  264  
e2390741053e49 arch/x86/ia32/ia32_signal.c    Al Viro             2020-02-15 @265  	if (!user_access_begin(frame, sizeof(*frame)))
e2390741053e49 arch/x86/ia32/ia32_signal.c    Al Viro             2020-02-15  266  		return -EFAULT;
99b9cdf758af70 arch/x86/ia32/ia32_signal.c    Thomas Gleixner     2008-01-30  267  
e2390741053e49 arch/x86/ia32/ia32_signal.c    Al Viro             2020-02-15  268  	unsafe_put_user(sig, &frame->sig, Efault);
e2390741053e49 arch/x86/ia32/ia32_signal.c    Al Viro             2020-02-15  269  	unsafe_put_sigcontext32(&frame->sc, fp, regs, set, Efault);
e2390741053e49 arch/x86/ia32/ia32_signal.c    Al Viro             2020-02-15  270  	unsafe_put_user(set->sig[1], &frame->extramask[0], Efault);
e2390741053e49 arch/x86/ia32/ia32_signal.c    Al Viro             2020-02-15  271  	unsafe_put_user(ptr_to_compat(restorer), &frame->pretcode, Efault);
99b9cdf758af70 arch/x86/ia32/ia32_signal.c    Thomas Gleixner     2008-01-30  272  	/*
99b9cdf758af70 arch/x86/ia32/ia32_signal.c    Thomas Gleixner     2008-01-30  273  	 * These are actually not used anymore, but left because some
99b9cdf758af70 arch/x86/ia32/ia32_signal.c    Thomas Gleixner     2008-01-30  274  	 * gdb versions depend on them as a marker.
99b9cdf758af70 arch/x86/ia32/ia32_signal.c    Thomas Gleixner     2008-01-30  275  	 */
e2390741053e49 arch/x86/ia32/ia32_signal.c    Al Viro             2020-02-15  276  	unsafe_put_user(*((u64 *)&code), (u64 __user *)frame->retcode, Efault);
e2390741053e49 arch/x86/ia32/ia32_signal.c    Al Viro             2020-02-15  277  	user_access_end();
^1da177e4c3f41 arch/x86_64/ia32/ia32_signal.c Linus Torvalds      2005-04-16  278  
^1da177e4c3f41 arch/x86_64/ia32/ia32_signal.c Linus Torvalds      2005-04-16  279  	/* Set up registers for signal handler */
65ea5b03499035 arch/x86/ia32/ia32_signal.c    H. Peter Anvin      2008-01-30  280  	regs->sp = (unsigned long) frame;
235b80226b986d arch/x86/ia32/ia32_signal.c    Al Viro             2012-11-09  281  	regs->ip = (unsigned long) ksig->ka.sa.sa_handler;
^1da177e4c3f41 arch/x86_64/ia32/ia32_signal.c Linus Torvalds      2005-04-16  282  
536e3ee4fed13d arch/x86_64/ia32/ia32_signal.c Andi Kleen          2006-09-26  283  	/* Make -mregparm=3 work */
65ea5b03499035 arch/x86/ia32/ia32_signal.c    H. Peter Anvin      2008-01-30  284  	regs->ax = sig;
65ea5b03499035 arch/x86/ia32/ia32_signal.c    H. Peter Anvin      2008-01-30  285  	regs->dx = 0;
65ea5b03499035 arch/x86/ia32/ia32_signal.c    H. Peter Anvin      2008-01-30  286  	regs->cx = 0;
536e3ee4fed13d arch/x86_64/ia32/ia32_signal.c Andi Kleen          2006-09-26  287  
b6edbb1e045a71 arch/x86/ia32/ia32_signal.c    Jeremy Fitzhardinge 2008-08-19  288  	loadsegment(ds, __USER32_DS);
b6edbb1e045a71 arch/x86/ia32/ia32_signal.c    Jeremy Fitzhardinge 2008-08-19  289  	loadsegment(es, __USER32_DS);
^1da177e4c3f41 arch/x86_64/ia32/ia32_signal.c Linus Torvalds      2005-04-16  290  
^1da177e4c3f41 arch/x86_64/ia32/ia32_signal.c Linus Torvalds      2005-04-16  291  	regs->cs = __USER32_CS;
^1da177e4c3f41 arch/x86_64/ia32/ia32_signal.c Linus Torvalds      2005-04-16  292  	regs->ss = __USER32_DS;
^1da177e4c3f41 arch/x86_64/ia32/ia32_signal.c Linus Torvalds      2005-04-16  293  
1d001df19d5323 arch/x86_64/ia32/ia32_signal.c Andi Kleen          2006-09-26  294  	return 0;
44a1d996325982 arch/x86/ia32/ia32_signal.c    Al Viro             2020-02-15  295  Efault:
44a1d996325982 arch/x86/ia32/ia32_signal.c    Al Viro             2020-02-15  296  	user_access_end();
44a1d996325982 arch/x86/ia32/ia32_signal.c    Al Viro             2020-02-15  297  	return -EFAULT;
^1da177e4c3f41 arch/x86_64/ia32/ia32_signal.c Linus Torvalds      2005-04-16  298  }
^1da177e4c3f41 arch/x86_64/ia32/ia32_signal.c Linus Torvalds      2005-04-16  299  

:::::: The code at line 265 was first introduced by commit
:::::: e2390741053e4931841650b5eadac32697aa88aa x86: ia32_setup_frame(): consolidate uaccess areas

:::::: TO: Al Viro <viro@zeniv.linux.org.uk>
:::::: CC: Al Viro <viro@zeniv.linux.org.uk>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 33551 bytes --]

^ permalink raw reply

* [PATCH 1/2] cpufreq: qoriq: convert to a platform driver
From: Mian Yousaf Kaukab @ 2020-04-03 21:21 UTC (permalink / raw)
  To: linux-pm, andy.tang, shawnguo, leoyang.li
  Cc: Mian Yousaf Kaukab, viresh.kumar, linuxppc-dev, linux-kernel,
	linux-arm-kernel

The driver has to be manually loaded if it is built as a module. It
is neither exporting MODULE_DEVICE_TABLE nor MODULE_ALIAS. Moreover,
no platform-device is created (and thus no uevent is sent) for the
clockgen nodes it depends on.

Convert the module to a platform driver with its own alias. Moreover,
drop whitelisted SOCs. Platform device will be created only for the
compatible platforms.

Signed-off-by: Mian Yousaf Kaukab <ykaukab@suse.de>
---
 drivers/cpufreq/qoriq-cpufreq.c | 76 ++++++++++++++++-------------------------
 1 file changed, 29 insertions(+), 47 deletions(-)

diff --git a/drivers/cpufreq/qoriq-cpufreq.c b/drivers/cpufreq/qoriq-cpufreq.c
index 8e436dc75c8b..6b6b20da2bcf 100644
--- a/drivers/cpufreq/qoriq-cpufreq.c
+++ b/drivers/cpufreq/qoriq-cpufreq.c
@@ -18,6 +18,7 @@
 #include <linux/of.h>
 #include <linux/slab.h>
 #include <linux/smp.h>
+#include <linux/platform_device.h>
 
 /**
  * struct cpu_data
@@ -29,12 +30,6 @@ struct cpu_data {
 	struct cpufreq_frequency_table *table;
 };
 
-/*
- * Don't use cpufreq on this SoC -- used when the SoC would have otherwise
- * matched a more generic compatible.
- */
-#define SOC_BLACKLIST		1
-
 /**
  * struct soc_data - SoC specific data
  * @flags: SOC_xxx
@@ -264,64 +259,51 @@ static struct cpufreq_driver qoriq_cpufreq_driver = {
 	.attr		= cpufreq_generic_attr,
 };
 
-static const struct soc_data blacklist = {
-	.flags = SOC_BLACKLIST,
-};
-
-static const struct of_device_id node_matches[] __initconst = {
+static const struct of_device_id qoriq_cpufreq_blacklist[] = {
 	/* e6500 cannot use cpufreq due to erratum A-008083 */
-	{ .compatible = "fsl,b4420-clockgen", &blacklist },
-	{ .compatible = "fsl,b4860-clockgen", &blacklist },
-	{ .compatible = "fsl,t2080-clockgen", &blacklist },
-	{ .compatible = "fsl,t4240-clockgen", &blacklist },
-
-	{ .compatible = "fsl,ls1012a-clockgen", },
-	{ .compatible = "fsl,ls1021a-clockgen", },
-	{ .compatible = "fsl,ls1028a-clockgen", },
-	{ .compatible = "fsl,ls1043a-clockgen", },
-	{ .compatible = "fsl,ls1046a-clockgen", },
-	{ .compatible = "fsl,ls1088a-clockgen", },
-	{ .compatible = "fsl,ls2080a-clockgen", },
-	{ .compatible = "fsl,lx2160a-clockgen", },
-	{ .compatible = "fsl,p4080-clockgen", },
-	{ .compatible = "fsl,qoriq-clockgen-1.0", },
-	{ .compatible = "fsl,qoriq-clockgen-2.0", },
+	{ .compatible = "fsl,b4420-clockgen", },
+	{ .compatible = "fsl,b4860-clockgen", },
+	{ .compatible = "fsl,t2080-clockgen", },
+	{ .compatible = "fsl,t4240-clockgen", },
 	{}
 };
 
-static int __init qoriq_cpufreq_init(void)
+static int qoriq_cpufreq_probe(struct platform_device *pdev)
 {
 	int ret;
-	struct device_node  *np;
-	const struct of_device_id *match;
-	const struct soc_data *data;
-
-	np = of_find_matching_node(NULL, node_matches);
-	if (!np)
-		return -ENODEV;
-
-	match = of_match_node(node_matches, np);
-	data = match->data;
-
-	of_node_put(np);
+	struct device_node *np;
 
-	if (data && data->flags & SOC_BLACKLIST)
+	np = of_find_matching_node(NULL, qoriq_cpufreq_blacklist);
+	if (np) {
+		dev_info(&pdev->dev, "Disabling due to erratum A-008083");
 		return -ENODEV;
+	}
 
 	ret = cpufreq_register_driver(&qoriq_cpufreq_driver);
-	if (!ret)
-		pr_info("Freescale QorIQ CPU frequency scaling driver\n");
+	if (ret)
+		return ret;
 
-	return ret;
+	dev_info(&pdev->dev, "Freescale QorIQ CPU frequency scaling driver\n");
+	return 0;
 }
-module_init(qoriq_cpufreq_init);
 
-static void __exit qoriq_cpufreq_exit(void)
+static int qoriq_cpufreq_remove(struct platform_device *pdev)
 {
 	cpufreq_unregister_driver(&qoriq_cpufreq_driver);
+
+	return 0;
 }
-module_exit(qoriq_cpufreq_exit);
 
+static struct platform_driver qoriq_cpufreq_platform_driver = {
+	.driver = {
+		.name = "qoriq-cpufreq",
+	},
+	.probe = qoriq_cpufreq_probe,
+	.remove = qoriq_cpufreq_remove,
+};
+module_platform_driver(qoriq_cpufreq_platform_driver);
+
+MODULE_ALIAS("platform:qoriq-cpufreq");
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Tang Yuantian <Yuantian.Tang@freescale.com>");
 MODULE_DESCRIPTION("cpufreq driver for Freescale QorIQ series SoCs");
-- 
2.16.4


^ permalink raw reply related

* [PATCH 2/2] clk: qoriq: add cpufreq platform device
From: Mian Yousaf Kaukab @ 2020-04-03 21:21 UTC (permalink / raw)
  To: linux-pm, andy.tang, shawnguo, leoyang.li
  Cc: Mian Yousaf Kaukab, viresh.kumar, linuxppc-dev, linux-kernel,
	linux-arm-kernel
In-Reply-To: <20200403212114.15565-1-ykaukab@suse.de>

Add a platform device for qoirq-cpufreq driver for the compatible
clockgen blocks.

Signed-off-by: Mian Yousaf Kaukab <ykaukab@suse.de>
---
 drivers/clk/clk-qoriq.c | 30 +++++++++++++++++++++++++++---
 1 file changed, 27 insertions(+), 3 deletions(-)

diff --git a/drivers/clk/clk-qoriq.c b/drivers/clk/clk-qoriq.c
index d5946f7486d6..374afcab89af 100644
--- a/drivers/clk/clk-qoriq.c
+++ b/drivers/clk/clk-qoriq.c
@@ -95,6 +95,7 @@ struct clockgen {
 };
 
 static struct clockgen clockgen;
+static bool add_cpufreq_dev __initdata;
 
 static void cg_out(struct clockgen *cg, u32 val, u32 __iomem *reg)
 {
@@ -1019,7 +1020,7 @@ static void __init create_muxes(struct clockgen *cg)
 	}
 }
 
-static void __init clockgen_init(struct device_node *np);
+static void __init _clockgen_init(struct device_node *np, bool legacy);
 
 /*
  * Legacy nodes may get probed before the parent clockgen node.
@@ -1030,7 +1031,7 @@ static void __init clockgen_init(struct device_node *np);
 static void __init legacy_init_clockgen(struct device_node *np)
 {
 	if (!clockgen.node)
-		clockgen_init(of_get_parent(np));
+		_clockgen_init(of_get_parent(np), true);
 }
 
 /* Legacy node */
@@ -1447,7 +1448,7 @@ static bool __init has_erratum_a4510(void)
 }
 #endif
 
-static void __init clockgen_init(struct device_node *np)
+static void __init _clockgen_init(struct device_node *np, bool legacy)
 {
 	int i, ret;
 	bool is_old_ls1021a = false;
@@ -1516,12 +1517,35 @@ static void __init clockgen_init(struct device_node *np)
 		       __func__, np, ret);
 	}
 
+	/* Don't create cpufreq device for legacy clockgen blocks */
+	add_cpufreq_dev = !legacy;
+
 	return;
 err:
 	iounmap(clockgen.regs);
 	clockgen.regs = NULL;
 }
 
+static void __init clockgen_init(struct device_node *np)
+{
+	_clockgen_init(np, false);
+}
+
+static int __init clockgen_cpufreq_init(void)
+{
+	struct platform_device *pdev;
+
+	if (add_cpufreq_dev) {
+		pdev = platform_device_register_simple("qoriq-cpufreq", -1,
+				NULL, 0);
+		if (IS_ERR(pdev))
+			pr_err("Couldn't register qoriq-cpufreq err=%ld\n",
+				PTR_ERR(pdev));
+	}
+	return 0;
+}
+device_initcall(clockgen_cpufreq_init);
+
 CLK_OF_DECLARE(qoriq_clockgen_1, "fsl,qoriq-clockgen-1.0", clockgen_init);
 CLK_OF_DECLARE(qoriq_clockgen_2, "fsl,qoriq-clockgen-2.0", clockgen_init);
 CLK_OF_DECLARE(qoriq_clockgen_b4420, "fsl,b4420-clockgen", clockgen_init);
-- 
2.16.4


^ permalink raw reply related

* Re: [PATCH v2 5/5] uaccess: Rename user_access_begin/end() to user_full_access_begin/end()
From: Al Viro @ 2020-04-03 20:52 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: linux-arch, Kees Cook, Dave Airlie, intel-gfx, Peter Anvin,
	Linux Kernel Mailing List, Linux-MM, Paul Mackerras,
	Daniel Vetter, Andrew Morton, linuxppc-dev
In-Reply-To: <CAHk-=wh_DY_dysMX0NuvJmMFr3+QDKOZPZqWKwLkkjgZTuyQ+A@mail.gmail.com>

On Fri, Apr 03, 2020 at 11:01:10AM -0700, Linus Torvalds wrote:
> On Fri, Apr 3, 2020 at 12:21 AM Christophe Leroy
> <christophe.leroy@c-s.fr> wrote:
> >
> > Now we have user_read_access_begin() and user_write_access_begin()
> > in addition to user_access_begin().
> 
> I realize Al asked for this, but I don't think it really adds anything
> to the series.
> 
> The "full" makes the names longer, but not really any more legible.
> 
> So I like 1-4, but am unconvinced about 5 and would prefer that to be
> dropped. Sorry for the bikeshedding.
> 
> And I like this series much better without the cookie that was
> discussed, and just making the hard rule be that they can't nest.
> 
> Some architecture may obviously use a cookie internally if they have
> some nesting behavior of their own, but it doesn't look like we have
> any major reason to expose that as the actual interface.
> 
> The only other question is how to synchronize this? I'm ok with it
> going through the ppc tree, for example, and just let others build on
> that.  Maybe using a shared immutable branch with 5.6 as a base?

I can do a 5.7-rc1-based branch with that; depending upon what we end
up doing for arm and s390 we can always change the calling conventions
come next cycle ;-/

My impressions after digging through arm side of things:

1) the only instance of nesting I'd found there (so far) is a mistake.
The rule should be "no fucking nesting, TYVM".

2) I'm really unhappy about the uaccess_with_memcpy thing.  Besides
being fucking ugly, it kills any hope of lifting user_access_begin/end
out of raw_copy_to_user() - the things done in that bastard are
obviously *NOT* fit for uaccess block.  Including the wonders like
        /* the mmap semaphore is taken only if not in an atomic context */
        atomic = faulthandler_disabled();

        if (!atomic)
                down_read(&current->mm->mmap_sem);
which, IMO, deserves to be taken out and shot.  Not that pin_page_for_write()
in the same file (arch/arm/lib/uaccess_with_memcpy.c) did not deserve the
same treatment...  As far as I can tell, the whole point of that thing
is that well, memcpy() is optimized better than raw_copy_to_user()...
So what's wrong with taking the damn optimized memcpy and using it for
raw_copy_to_user() instead?

Is that the lack of STRT analogue that would store several registers?
Because AFAICS commit f441882a5229ffaef61a47bccd4518f7e2749cbc
Author: Vincent Whitchurch <vincent.whitchurch@axis.com>
Date:   Fri Nov 9 10:09:48 2018 +0100
    ARM: 8812/1: Optimise copy_{from/to}_user for !CPU_USE_DOMAINS
makes for much saner solution...  I realize that it's v6+ and this
thing is specifically for a v5 variant, but...

3) how much do we need to keep the old DACR value in a register for
uaccess_restore()?  AFAICS, if we prohibit nesting it becomes
a function of USER_DS/KERNEL_DS setting (and that - only for
CPU_USE_DOMAINS), doesn't it?  And we had to have fetched it
recently, back when access_ok() had been done, so shouldn't
it be in cache?

^ permalink raw reply

* [Bug 206203] kmemleak reports various leaks in drivers/of/unittest.c
From: bugzilla-daemon @ 2020-04-03 19:23 UTC (permalink / raw)
  To: linuxppc-dev
In-Reply-To: <bug-206203-206035@https.bugzilla.kernel.org/>

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

Erhard F. (erhard_f@mailbox.org) changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
 Attachment #286801|0                           |1
        is obsolete|                            |

--- Comment #10 from Erhard F. (erhard_f@mailbox.org) ---
Created attachment 288189
  --> https://bugzilla.kernel.org/attachment.cgi?id=288189&action=edit
kmemleak output (kernel 5.6.2, Talos II)

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

^ permalink raw reply

* [Bug 206203] kmemleak reports various leaks in drivers/of/unittest.c
From: bugzilla-daemon @ 2020-04-03 19:23 UTC (permalink / raw)
  To: linuxppc-dev
In-Reply-To: <bug-206203-206035@https.bugzilla.kernel.org/>

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

Erhard F. (erhard_f@mailbox.org) changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
 Attachment #286805|0                           |1
        is obsolete|                            |

--- Comment #9 from Erhard F. (erhard_f@mailbox.org) ---
Created attachment 288187
  --> https://bugzilla.kernel.org/attachment.cgi?id=288187&action=edit
kernel .config (kernel 5.6.2, Talos II)

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

^ 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