1. 23 Apr, 2019 3 commits
  2. 11 Apr, 2019 1 commit
  3. 03 Apr, 2019 1 commit
  4. 01 Apr, 2019 4 commits
  5. 27 Mar, 2019 1 commit
  6. 20 Mar, 2019 1 commit
  7. 19 Mar, 2019 2 commits
    • He, Bo's avatar
      HID: debug: fix race condition with between rdesc_show() and device removal · cef0d494
      He, Bo authored
      There is a race condition that could happen if hid_debug_rdesc_show()
      is running while hdev is in the process of going away (device removal,
      system suspend, etc) which could result in NULL pointer dereference:
      
      	 BUG: unable to handle kernel paging request at 0000000783316040
      	 CPU: 1 PID: 1512 Comm: getevent Tainted: G     U     O 4.19.20-quilt-2e5dc0ac-00029-gc455a447dd55 #1
      	 RIP: 0010:hid_dump_device+0x9b/0x160
      	 Call Trace:
      	  hid_debug_rdesc_show+0x72/0x1d0
      	  seq_read+0xe0/0x410
      	  full_proxy_read+0x5f/0x90
      	  __vfs_read+0x3a/0x170
      	  vfs_read+0xa0/0x150
      	  ksys_read+0x58/0xc0
      	  __x64_sys_read+0x1a/0x20
      	  do_syscall_64+0x55/0x110
      	  entry_SYSCALL_64_after_hwframe+0x49/0xbe
      
      Grab driver_input_lock to make sure the input device exists throughout the
      whole process of dumping the rdesc.
      
      [jkosina@suse.cz: update changelog a bit]
      Signed-off-by: default avatarhe, bo <bo.he@intel.com>
      Signed-off-by: default avatar"Zhang, Jun" <jun.zhang@intel.com>
      Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
      cef0d494
    • Kangjie Lu's avatar
      HID: logitech: check the return value of create_singlethread_workqueue · 6c44b15e
      Kangjie Lu authored
      create_singlethread_workqueue may fail and return NULL. The fix checks if it is
      NULL to avoid NULL pointer dereference.  Also, the fix moves the call of
      create_singlethread_workqueue earlier to avoid resource-release issues.
      Signed-off-by: default avatarKangjie Lu <kjlu@umn.edu>
      Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
      6c44b15e
  8. 18 Mar, 2019 2 commits
  9. 11 Mar, 2019 4 commits
    • Colin Ian King's avatar
      HID: uclogic: remove redudant duplicated null check on ver_ptr · 1cbbd85f
      Colin Ian King authored
      Currently ver_ptr is being null checked twice, once before calling
      usb_string and once afterwards.  The second null check is redundant
      and can be removed, remove it.
      
      Detected by CoverityScan, CID#1477308 ("Logically dead code")
      Signed-off-by: default avatarColin Ian King <colin.king@canonical.com>
      Signed-off-by: default avatarBenjamin Tissoires <benjamin.tissoires@redhat.com>
      1cbbd85f
    • Andy Shevchenko's avatar
      HID: quirks: Drop misused kernel-doc annotation · 78b92f5f
      Andy Shevchenko authored
      The kernel-doc annotation is misused for hid_mouse_ignore_list. The script
      complains about it:
      
      drivers/hid/hid-quirks.c:894: warning: cannot understand function prototype: 'const struct hid_device_id hid_mouse_ignore_list[] = '
      
      Drop the annotation to make script happy.
      Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Signed-off-by: default avatarBenjamin Tissoires <benjamin.tissoires@redhat.com>
      78b92f5f
    • Arnd Bergmann's avatar
      HID: hid-asus: select CONFIG_POWER_SUPPLY · a23eab89
      Arnd Bergmann authored
      The newly added power supply code fails to link when the power supply core
      code is disabled:
      
      drivers/hid/hid-asus.o: In function `asus_battery_get_property':
      hid-asus.c:(.text+0x11de): undefined reference to `power_supply_get_drvdata'
      drivers/hid/hid-asus.o: In function `asus_probe':
      hid-asus.c:(.text+0x170c): undefined reference to `devm_power_supply_register'
      hid-asus.c:(.text+0x1734): undefined reference to `power_supply_powers'
      drivers/hid/hid-asus.o: In function `asus_raw_event':
      hid-asus.c:(.text+0x1914): undefined reference to `power_supply_changed'
      
      Select the subsystem from Kconfig as we do for other hid drivers already.
      
      Fixes: 6311d329 ("HID: hid-asus: Add BT keyboard dock battery monitoring support")
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarBenjamin Tissoires <benjamin.tissoires@redhat.com>
      a23eab89
    • Louis Taylor's avatar
      HID: quirks: use correct format chars in dbg_hid · 7d01427a
      Louis Taylor authored
      When building with -Wformat, clang warns:
      
      drivers/hid/hid-quirks.c:1075:27: warning: format specifies type
      'unsigned short' but the argument has type '__u32' (aka 'unsigned int')
      [-Wformat]
      		  bl_entry->driver_data, bl_entry->vendor,
      					 ^~~~~~~~~~~~~~~~
      ./include/linux/hid.h:1170:48: note: expanded from macro 'dbg_hid'
      	  printk(KERN_DEBUG "%s: " format, __FILE__, ##arg);      \
      				   ~~~~~~              ^~~
      drivers/hid/hid-quirks.c:1076:4: warning: format specifies type
      'unsigned short' but the argument has type '__u32' (aka 'unsigned int')
      [-Wformat]
      		  bl_entry->product);
      		  ^~~~~~~~~~~~~~~~~
      ./include/linux/hid.h:1170:48: note: expanded from macro 'dbg_hid'
      	  printk(KERN_DEBUG "%s: " format, __FILE__, ##arg);      \
      				   ~~~~~~              ^~~
      drivers/hid/hid-quirks.c:1242:12: warning: format specifies type
      'unsigned short' but the argument has type '__u32' (aka 'unsigned int')
      [-Wformat]
      		  quirks, hdev->vendor, hdev->product);
      			  ^~~~~~~~~~~~
      ./include/linux/hid.h:1170:48: note: expanded from macro 'dbg_hid'
      	  printk(KERN_DEBUG "%s: " format, __FILE__, ##arg);      \
      				   ~~~~~~              ^~~
      drivers/hid/hid-quirks.c:1242:26: warning: format specifies type
      'unsigned short' but the argument has type '__u32' (aka 'unsigned int')
      [-Wformat]
      		  quirks, hdev->vendor, hdev->product);
      					^~~~~~~~~~~~~
      ./include/linux/hid.h:1170:48: note: expanded from macro 'dbg_hid'
      	  printk(KERN_DEBUG "%s: " format, __FILE__, ##arg);      \
      				   ~~~~~~              ^~~
      4 warnings generated.
      
      This patch fixes the format strings to use the correct format type for unsigned
      ints.
      
      Link: https://github.com/ClangBuiltLinux/linux/issues/378Signed-off-by: default avatarLouis Taylor <louis@kragniz.eu>
      Reviewed-by: default avatarNick Desaulniers <ndesaulniers@google.com>
      Signed-off-by: default avatarBenjamin Tissoires <benjamin.tissoires@redhat.com>
      7d01427a
  10. 08 Mar, 2019 21 commits
    • Linus Torvalds's avatar
      Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid · c6400e5c
      Linus Torvalds authored
      Pull HID updates from Jiri Kosina:
      
       - support for Pro Pen slim, from Jason Gerecke
      
       - power management improvements to Intel-ISH driver, from Song Hongyan
      
       - UCLogic driver revamp in order to be able to support wider range of
         Huion tablets, from Nikolai Kondrashov
      
       - Asus Transbook support, from NOGUCHI Hiroshi
      
       - other assorted small bugfixes / cleanups and device ID additions
      
      * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid: (46 commits)
        HID: Remove Waltop tablets from hid_have_special_driver
        HID: Remove KYE tablets from hid_have_special_driver
        HID: Remove hid-uclogic entries from hid_have_special_driver
        HID: uclogic: Do not initialize non-USB devices
        HID: uclogic: Add support for Ugee G5
        HID: uclogic: Support Gray-coded rotary encoders
        HID: uclogic: Support faking Wacom pad device ID
        HID: uclogic: Add support for XP-Pen Deco 01
        HID: uclogic: Add support for XP-Pen Star G640
        HID: uclogic: Add support for XP-Pen Star G540
        HID: uclogic: Add support for Ugee EX07S frame controls
        HID: uclogic: Add support for Ugee M540
        HID: uclogic: Add support for Ugee 2150
        HID: uclogic: Support v2 protocol
        HID: uclogic: Support fragmented high-res reports
        HID: uclogic: Support in-range reporting emulation
        HID: uclogic: Designate current protocol v1
        HID: uclogic: Re-initialize tablets on resume
        HID: uclogic: Extract tablet parameter discovery into a module
        HID: uclogic: Extract report descriptors to a module
        ...
      c6400e5c
    • Linus Torvalds's avatar
      Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/livepatching/livepatching · b7af27bf
      Linus Torvalds authored
      Pull livepatching updates from Jiri Kosina:
      
       - support for something we call 'atomic replace', and allows for much
         better handling of cumulative patches (which is something very useful
         for distros), from Jason Baron with help of Petr Mladek and Joe
         Lawrence
      
       - improvement of handling of tasks blocking finalization, from Miroslav
         Benes
      
       - update of MAINTAINERS file to reflect move towards group
         maintainership
      
      * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/livepatching/livepatching: (22 commits)
        livepatch/selftests: use "$@" to preserve argument list
        livepatch: Module coming and going callbacks can proceed with all listed patches
        livepatch: Proper error handling in the shadow variables selftest
        livepatch: return -ENOMEM on ptr_id() allocation failure
        livepatch: Introduce klp_for_each_patch macro
        livepatch: core: Return EOPNOTSUPP instead of ENOSYS
        selftests/livepatch: add DYNAMIC_DEBUG config dependency
        livepatch: samples: non static warnings fix
        livepatch: update MAINTAINERS
        livepatch: Remove signal sysfs attribute
        livepatch: Send a fake signal periodically
        selftests/livepatch: introduce tests
        livepatch: Remove ordering (stacking) of the livepatches
        livepatch: Atomic replace and cumulative patches documentation
        livepatch: Remove Nop structures when unused
        livepatch: Add atomic replace
        livepatch: Use lists to manage patches, objects and functions
        livepatch: Simplify API by removing registration step
        livepatch: Don't block the removal of patches loaded after a forced transition
        livepatch: Consolidate klp_free functions
        ...
      b7af27bf
    • Linus Torvalds's avatar
      Merge tag 'drm-next-2019-03-06' of git://anongit.freedesktop.org/drm/drm · 851ca779
      Linus Torvalds authored
      Pull drm updates from Dave Airlie:
       "This is the main drm pull request for the 5.1 merge window.
      
        The big changes I'd highlight are:
         - nouveau has HMM support now, there is finally an in-tree user so we
           can quieten down the rip it out people.
         - i915 now enables fastboot by default on Skylake+
         - Displayport Multistream support has been refactored and should
           hopefully be more reliable.
      
        Core:
         - header cleanups aiming towards removing drmP.h
         - dma-buf fence seqnos to 64-bits
         - common helper for DP mst hotplug for radeon,i915,amdgpu + new
           refcounting scheme
         - MST i2c improvements
         - drm_syncobj_cb removal
         - ARM FB compression fourcc
         - P010 + P016 fourcc
         - allwinner tiled format modifier
         - i2c over aux I2C_M_STOP support
         - DRM_AUTH handling fixes
      
        TTM:
         - ref/unref renaming
      
        New driver:
         - ARM komeda display driver
      
        scheduler:
         - refactor mirror list handling
         - rework hw fence processing
         - 0 run queue entity fix
      
        bridge:
         - TI DS90C185 LVDS bridge
         - thc631lvdm83d bridge improvements
         - cadence + allwinner DSI ported to generic phy
      
        panels:
         - Sitronix ST7701 panel
         - Kingdisplay KD097D04
         - LeMaker BL035-RGB-002
         - PDA 91-00156-A0
         - Innolux EE101IA-01D
      
        i915:
         - Enable fastboot by default on SKL+/VLV/CHV
         - Export RPCS configuration for ICL media driver
         - Coffelake PCI ID
         - CNL clocks setup fixes
         - ACPI/PMIC support for MIPI/DSI
         - Per-engine WA init for all engines
         - Shrinker locking fixes
         - Kerneldoc updates
         - Lots of ring improvements and reset fixes
         - Coffeelake GVT Support
         - VFIO GVT EDID Region support
         - runtime PM wakeref tracking
         - ILK->IVB primary plane enable delays
         - userptr mutex locking fixes
         - DSI fixes
         - LVDS/TV cleanups
         - HW readout fixes
         - LUT robustness fixes
         - ICL display and watermark fixes
         - gem mmap race fix
      
        amdgpu:
         - add scheduled dependencies interface
         - DCC on scanout surfaces
         - vega10/20 BACO support
         - Multiple IH rings on soc15
         - XGMI locking fixes
         - DC i2c/aux cleanups
         - runtime SMU debug interface
         - Kexec improvmeents
         - SR-IOV fixes
         - DC freesync + ABM fixes
         - GDS fixes
         - GPUVM fixes
         - vega20 PCIE DPM switching fixes
         - Context priority handling fixes
      
        radeon:
         - fix missing break in evergreen parser
      
        nouveau:
         - SVM support via HMM
      
        msm:
         - QCOM Compressed modifier support
      
        exynos:
         - s5pv210 rotator support
      
        imx:
         - zpos property support
         - pending update fixes
      
        v3d:
         - cache flush improvments
      
        vc4:
         - reflection support
         - HDMI overscan support
      
        tegra:
         - CEC refactoring
         - HDMI audio fixes
         - Tegra186 prep work
         - SOR crossbar device tree fixes
      
        sun4i:
         - implicit fencing support
         - YUV and scalar support improvements
         - A23 support
         - tiling fixes
      
        atmel-hlcdc:
         - clipping and rotation property fixes
      
        qxl:
         - BO and PRIME improvements
         - generic fbdev emulation
      
        dw-hdmi:
         - HDMI 2.0 2160p
         - YUV420 ouput
      
        rockchip:
         - implicit fencing support
         - reflection proerties
      
        virtio-gpu:
         - use generic fbdev emulation
      
        tilcdc:
         - cpufreq vs crtc init fix
      
        rcar-du:
         - R8A774C0 support
         - D3/E3 RGB output routing fixes and DPAD0 support
         - RA87744 LVDS support
      
        bochs:
         - atomic and generic fbdev emulation
         - ID mismatch error on bochs load
      
        meson:
         - remove firmware fbs"
      
      * tag 'drm-next-2019-03-06' of git://anongit.freedesktop.org/drm/drm: (1130 commits)
        drm/amd/display: Use vrr friendly pageflip throttling in DC.
        drm/imx: only send commit done event when all state has been applied
        drm/imx: allow building under COMPILE_TEST
        drm/imx: imx-tve: depend on COMMON_CLK
        drm/imx: ipuv3-plane: add zpos property
        drm/imx: ipuv3-plane: add function to query atomic update status
        gpu: ipu-v3: prg: add function to get channel configure status
        gpu: ipu-v3: pre: add double buffer status readback
        drm/amdgpu: Bump amdgpu version for context priority override.
        drm/amdgpu/powerplay: fix typo in BACO header guards
        drm/amdgpu/powerplay: fix return codes in BACO code
        drm/amdgpu: add missing license on baco files
        drm/bochs: Fix the ID mismatch error
        drm/nouveau/dmem: use dma addresses during migration copies
        drm/nouveau/dmem: use physical vram addresses during migration copies
        drm/nouveau/dmem: extend copy function to allow direct use of physical addresses
        drm/nouveau/svm: new ioctl to migrate process memory to GPU memory
        drm/nouveau/dmem: device memory helpers for SVM
        drm/nouveau/svm: initial support for shared virtual memory
        drm/nouveau: prepare for enabling svm with existing userspace interfaces
        ...
      851ca779
    • Linus Torvalds's avatar
      Merge branch 'akpm' (patches from Andrew) · b5dd0c65
      Linus Torvalds authored
      Merge more updates from Andrew Morton:
      
       - some of the rest of MM
      
       - various misc things
      
       - dynamic-debug updates
      
       - checkpatch
      
       - some epoll speedups
      
       - autofs
      
       - rapidio
      
       - lib/, lib/lzo/ updates
      
      * emailed patches from Andrew Morton <akpm@linux-foundation.org>: (83 commits)
        samples/mic/mpssd/mpssd.h: remove duplicate header
        kernel/fork.c: remove duplicated include
        include/linux/relay.h: fix percpu annotation in struct rchan
        arch/nios2/mm/fault.c: remove duplicate include
        unicore32: stop printing the virtual memory layout
        MAINTAINERS: fix GTA02 entry and mark as orphan
        mm: create the new vm_fault_t type
        arm, s390, unicore32: remove oneliner wrappers for memblock_alloc()
        arch: simplify several early memory allocations
        openrisc: simplify pte_alloc_one_kernel()
        sh: prefer memblock APIs returning virtual address
        microblaze: prefer memblock API returning virtual address
        powerpc: prefer memblock APIs returning virtual address
        lib/lzo: separate lzo-rle from lzo
        lib/lzo: implement run-length encoding
        lib/lzo: fast 8-byte copy on arm64
        lib/lzo: 64-bit CTZ on arm64
        lib/lzo: tidy-up ifdefs
        ipc/sem.c: replace kvmalloc/memset with kvzalloc and use struct_size
        ipc: annotate implicit fall through
        ...
      b5dd0c65
    • Brajeswar Ghosh's avatar
    • YueHaibing's avatar
    • Luc Van Oostenryck's avatar
      include/linux/relay.h: fix percpu annotation in struct rchan · 62461ac2
      Luc Van Oostenryck authored
      The percpu member of this structure is declared as:
      	struct ... ** __percpu member;
      So its type is:
      	__percpu pointer to pointer to struct ...
      
      But looking at how it's used, its type should be:
      	pointer to __percpu pointer to struct ...
      and it should thus be declared as:
      	struct ... * __percpu *member;
      
      So fix the placement of '__percpu' in the definition of this
      structures.
      
      This silents a few Sparse's warnings like:
      	warning: incorrect type in initializer (different address spaces)
      	  expected void const [noderef] <asn:3> *__vpp_verify
      	  got struct sched_domain **
      
      Link: http://lkml.kernel.org/r/20190118144902.79065-1-luc.vanoostenryck@gmail.com
      Fixes: 017c59c0 ("relay: Use per CPU constructs for the relay channel buffer pointers")
      Signed-off-by: default avatarLuc Van Oostenryck <luc.vanoostenryck@gmail.com>
      Cc: Jens Axboe <axboe@suse.de>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      62461ac2
    • Sabyasachi Gupta's avatar
      arch/nios2/mm/fault.c: remove duplicate include · 9587d199
      Sabyasachi Gupta authored
      Remove linux/ptrace.h which is included more than once
      
      Link: http://lkml.kernel.org/r/5c45d345.1c69fb81.d90ed.8e05@mx.google.comSigned-off-by: default avatarSabyasachi Gupta <sabyasachi.linux@gmail.com>
      Cc: Ley Foon Tan <lftan@altera.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      9587d199
    • Geert Uytterhoeven's avatar
      unicore32: stop printing the virtual memory layout · 1476ea25
      Geert Uytterhoeven authored
      Since commit ad67b74d ("printk: hash addresses printed with %p"),
      the virtual memory layout printed during boot up contains "ptrval"
      instead of actual addresses.
      
      Instead of changing the printing to "%px", and leaking virtual memory
      layout information again, just remove the printing completely, cfr.
      e.g.  commits 071929db ("arm64: Stop printing the virtual memory
      layout") and 31833332 ("m68k/mm: Stop printing the virtual memory
      layout").
      
      All interesting information (actual section sizes) is already printed by
      mem_init_print_info() just above anyway.
      
      Link: http://lkml.kernel.org/r/20190121152254.29079-1-geert+renesas@glider.beSigned-off-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
      Reviewed-by: default avatarKees Cook <keescook@chromium.org>
      Cc: Guan Xuetao <gxt@pku.edu.cn>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      1476ea25
    • Jann Horn's avatar
      MAINTAINERS: fix GTA02 entry and mark as orphan · cb66cb48
      Jann Horn authored
      The entry for GTA02 never had paths listed; fix that.  commit 9d76295a
      ("[ARM] GTA02/FreeRunner: Add machine definition"), which added the entry
      for GTA02, created two new files named
      arch/arm/mach-s3c2442/{include/mach/gta02.h,mach-gta02.c}, which were then
      renamed in commit dd6f01b5 ("ARM: S3C2440: move mach-s3c2440/* into
      mach-s3c24xx/") to
      arch/arm/mach-s3c24xx/{include/mach/gta02.h,mach-gta02.c}.
      
      Also, the GTA02 maintainer's email address is from a domain that doesn't
      have an MX record anymore and appears to have expired.  Remove the
      maintainer and mark the subsystem as orphan.
      
      Link: http://lkml.kernel.org/r/20190215140444.37060-1-jannh@google.comSigned-off-by: default avatarJann Horn <jannh@google.com>
      Cc: Nelson Castillo <arhuaco@freaks-unidos.net>
      Cc: Nelson Castillo <nelsoneci@gmail.com>
      Cc: Andy Green <andy@warmcat.com>
      Cc: Ben Dooks <ben-linux@fluff.org>
      Cc: Russell King <rmk+kernel@arm.linux.org.uk>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Will Deacon <will.deacon@arm.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      cb66cb48
    • Souptick Joarder's avatar
      mm: create the new vm_fault_t type · 3d353901
      Souptick Joarder authored
      Page fault handlers are supposed to return VM_FAULT codes, but some
      drivers/file systems mistakenly return error numbers.  Now that all
      drivers/file systems have been converted to use the vm_fault_t return
      type, change the type definition to no longer be compatible with 'int'.
      By making it an unsigned int, the function prototype becomes
      incompatible with a function which returns int.  Sparse will detect any
      attempts to return a value which is not a VM_FAULT code.
      
      VM_FAULT_SET_HINDEX and VM_FAULT_GET_HINDEX values are changed to avoid
      conflict with other VM_FAULT codes.
      
      [jrdr.linux@gmail.com: fix warnings]
        Link: http://lkml.kernel.org/r/20190109183742.GA24326@jordon-HP-15-Notebook-PC
      Link: http://lkml.kernel.org/r/20190108183041.GA12137@jordon-HP-15-Notebook-PCSigned-off-by: default avatarSouptick Joarder <jrdr.linux@gmail.com>
      Reviewed-by: default avatarWilliam Kucharski <william.kucharski@oracle.com>
      Reviewed-by: default avatarMike Rapoport <rppt@linux.ibm.com>
      Reviewed-by: default avatarMatthew Wilcox <willy@infradead.org>
      Cc: Michal Hocko <mhocko@suse.com>
      Cc: Dan Williams <dan.j.williams@intel.com>
      Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Cc: Rik van Riel <riel@redhat.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      3d353901
    • Mike Rapoport's avatar
      arm, s390, unicore32: remove oneliner wrappers for memblock_alloc() · c2938eeb
      Mike Rapoport authored
      arm, s390 and unicore32 use oneliner wrappers for memblock_alloc().
      Replace their usage with direct call to memblock_alloc().
      
      Link: http://lkml.kernel.org/r/1546248566-14910-7-git-send-email-rppt@linux.ibm.comSigned-off-by: default avatarMike Rapoport <rppt@linux.ibm.com>
      Suggested-by: default avatarChristoph Hellwig <hch@infradead.org>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Greentime Hu <green.hu@gmail.com>
      Cc: Guan Xuetao <gxt@pku.edu.cn>
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      Cc: Jonas Bonn <jonas@southpole.se>
      Cc: Mark Salter <msalter@redhat.com>
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Michal Hocko <mhocko@suse.com>
      Cc: Michal Simek <michal.simek@xilinx.com>
      Cc: Michal Simek <monstr@monstr.eu>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Rich Felker <dalias@libc.org>
      Cc: Russell King <linux@armlinux.org.uk>
      Cc: Stafford Horne <shorne@gmail.com>
      Cc: Stefan Kristiansson <stefan.kristiansson@saunalahti.fi>
      Cc: Vincent Chen <deanbo422@gmail.com>
      Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      c2938eeb
    • Mike Rapoport's avatar
      arch: simplify several early memory allocations · b63a07d6
      Mike Rapoport authored
      There are several early memory allocations in arch/ code that use
      memblock_phys_alloc() to allocate memory, convert the returned physical
      address to the virtual address and then set the allocated memory to
      zero.
      
      Exactly the same behaviour can be achieved simply by calling
      memblock_alloc(): it allocates the memory in the same way as
      memblock_phys_alloc(), then it performs the phys_to_virt() conversion
      and clears the allocated memory.
      
      Replace the longer sequence with a simpler call to memblock_alloc().
      
      Link: http://lkml.kernel.org/r/1546248566-14910-6-git-send-email-rppt@linux.ibm.comSigned-off-by: default avatarMike Rapoport <rppt@linux.ibm.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Christoph Hellwig <hch@infradead.org>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Greentime Hu <green.hu@gmail.com>
      Cc: Guan Xuetao <gxt@pku.edu.cn>
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      Cc: Jonas Bonn <jonas@southpole.se>
      Cc: Mark Salter <msalter@redhat.com>
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Michal Hocko <mhocko@suse.com>
      Cc: Michal Simek <michal.simek@xilinx.com>
      Cc: Michal Simek <monstr@monstr.eu>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Rich Felker <dalias@libc.org>
      Cc: Russell King <linux@armlinux.org.uk>
      Cc: Stafford Horne <shorne@gmail.com>
      Cc: Stefan Kristiansson <stefan.kristiansson@saunalahti.fi>
      Cc: Vincent Chen <deanbo422@gmail.com>
      Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      b63a07d6
    • Mike Rapoport's avatar
      openrisc: simplify pte_alloc_one_kernel() · 1e8ffd50
      Mike Rapoport authored
      The pte_alloc_one_kernel() function allocates a page using
      __get_free_page(GFP_KERNEL) when mm initialization is complete and
      memblock_phys_alloc() on the earlier stages.  The physical address of
      the page allocated with memblock_phys_alloc() is converted to the
      virtual address and in the both cases the allocated page is cleared
      using clear_page().
      
      The code is simplified by replacing __get_free_page() with
      get_zeroed_page() and by replacing memblock_phys_alloc() with
      memblock_alloc().
      
      Link: http://lkml.kernel.org/r/1546248566-14910-5-git-send-email-rppt@linux.ibm.comSigned-off-by: default avatarMike Rapoport <rppt@linux.ibm.com>
      Acked-by: default avatarStafford Horne <shorne@gmail.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Christoph Hellwig <hch@infradead.org>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Greentime Hu <green.hu@gmail.com>
      Cc: Guan Xuetao <gxt@pku.edu.cn>
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      Cc: Jonas Bonn <jonas@southpole.se>
      Cc: Mark Salter <msalter@redhat.com>
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Michal Hocko <mhocko@suse.com>
      Cc: Michal Simek <michal.simek@xilinx.com>
      Cc: Michal Simek <monstr@monstr.eu>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Rich Felker <dalias@libc.org>
      Cc: Russell King <linux@armlinux.org.uk>
      Cc: Stefan Kristiansson <stefan.kristiansson@saunalahti.fi>
      Cc: Vincent Chen <deanbo422@gmail.com>
      Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      1e8ffd50
    • Mike Rapoport's avatar
      sh: prefer memblock APIs returning virtual address · 47f1e926
      Mike Rapoport authored
      Rather than use the memblock_alloc_base that returns a physical address
      and then convert this address to the virtual one, use appropriate
      memblock function that returns a virtual address.
      
      There is a small functional change in the allocation of then
      NODE_DATA().  Instead of panicing if the local allocation failed, the
      non-local allocation attempt will be made.
      
      Link: http://lkml.kernel.org/r/1546248566-14910-4-git-send-email-rppt@linux.ibm.comSigned-off-by: default avatarMike Rapoport <rppt@linux.ibm.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Christoph Hellwig <hch@infradead.org>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Greentime Hu <green.hu@gmail.com>
      Cc: Guan Xuetao <gxt@pku.edu.cn>
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      Cc: Jonas Bonn <jonas@southpole.se>
      Cc: Mark Salter <msalter@redhat.com>
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Michal Hocko <mhocko@suse.com>
      Cc: Michal Simek <michal.simek@xilinx.com>
      Cc: Michal Simek <monstr@monstr.eu>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Rich Felker <dalias@libc.org>
      Cc: Russell King <linux@armlinux.org.uk>
      Cc: Stafford Horne <shorne@gmail.com>
      Cc: Stefan Kristiansson <stefan.kristiansson@saunalahti.fi>
      Cc: Vincent Chen <deanbo422@gmail.com>
      Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      47f1e926
    • Mike Rapoport's avatar
      microblaze: prefer memblock API returning virtual address · 3e5e79f2
      Mike Rapoport authored
      Rather than use the memblock_alloc_base that returns a physical address
      and then convert this address to the virtual one, use appropriate
      memblock function that returns a virtual address.
      
      Link: http://lkml.kernel.org/r/1546248566-14910-3-git-send-email-rppt@linux.ibm.comSigned-off-by: default avatarMike Rapoport <rppt@linux.ibm.com>
      Tested-by: default avatarMichal Simek <michal.simek@xilinx.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Christoph Hellwig <hch@infradead.org>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Greentime Hu <green.hu@gmail.com>
      Cc: Guan Xuetao <gxt@pku.edu.cn>
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      Cc: Jonas Bonn <jonas@southpole.se>
      Cc: Mark Salter <msalter@redhat.com>
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Michal Hocko <mhocko@suse.com>
      Cc: Michal Simek <monstr@monstr.eu>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Rich Felker <dalias@libc.org>
      Cc: Russell King <linux@armlinux.org.uk>
      Cc: Stafford Horne <shorne@gmail.com>
      Cc: Stefan Kristiansson <stefan.kristiansson@saunalahti.fi>
      Cc: Vincent Chen <deanbo422@gmail.com>
      Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      3e5e79f2
    • Mike Rapoport's avatar
      powerpc: prefer memblock APIs returning virtual address · f806714f
      Mike Rapoport authored
      Patch series "memblock: simplify several early memory allocation", v4.
      
      These patches simplify some of the early memory allocations by replacing
      usage of older memblock APIs with newer and shinier ones.
      
      Quite a few places in the arch/ code allocated memory using a memblock
      API that returns a physical address of the allocated area, then
      converted this physical address to a virtual one and then used memset(0)
      to clear the allocated range.
      
      More recent memblock APIs do all the three steps in one call and their
      usage simplifies the code.
      
      It's important to note that regardless of API used, the core allocation
      is nearly identical for any set of memblock allocators: first it tries
      to find a free memory with all the constraints specified by the caller
      and then falls back to the allocation with some or all constraints
      disabled.
      
      The first three patches perform the conversion of call sites that have
      exact requirements for the node and the possible memory range.
      
      The fourth patch is a bit one-off as it simplifies openrisc's
      implementation of pte_alloc_one_kernel(), and not only the memblock
      usage.
      
      The fifth patch takes care of simpler cases when the allocation can be
      satisfied with a simple call to memblock_alloc().
      
      The sixth patch removes one-liner wrappers for memblock_alloc on arm and
      unicore32, as suggested by Christoph.
      
      This patch (of 6):
      
      There are a several places that allocate memory using memblock APIs that
      return a physical address, convert the returned address to the virtual
      address and frequently also memset(0) the allocated range.
      
      Update these places to use memblock allocators already returning a
      virtual address.  Use memblock functions that clear the allocated memory
      instead of calling memset(0) where appropriate.
      
      The calls to memblock_alloc_base() that were not followed by memset(0)
      are replaced with memblock_alloc_try_nid_raw().  Since the latter does
      not panic() when the allocation fails, the appropriate panic() calls are
      added to the call sites.
      
      Link: http://lkml.kernel.org/r/1546248566-14910-2-git-send-email-rppt@linux.ibm.comSigned-off-by: default avatarMike Rapoport <rppt@linux.ibm.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Guan Xuetao <gxt@pku.edu.cn>
      Cc: Greentime Hu <green.hu@gmail.com>
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      Cc: Jonas Bonn <jonas@southpole.se>
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Michal Hocko <mhocko@suse.com>
      Cc: Michal Simek <monstr@monstr.eu>
      Cc: Mark Salter <msalter@redhat.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Rich Felker <dalias@libc.org>
      Cc: Russell King <linux@armlinux.org.uk>
      Cc: Stefan Kristiansson <stefan.kristiansson@saunalahti.fi>
      Cc: Stafford Horne <shorne@gmail.com>
      Cc: Vincent Chen <deanbo422@gmail.com>
      Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
      Cc: Christoph Hellwig <hch@infradead.org>
      Cc: Michal Simek <michal.simek@xilinx.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      f806714f
    • Dave Rodgman's avatar
      lib/lzo: separate lzo-rle from lzo · 45ec975e
      Dave Rodgman authored
      To prevent any issues with persistent data, separate lzo-rle from lzo so
      that it is treated as a separate algorithm, and lzo is still available.
      
      Link: http://lkml.kernel.org/r/20190205155944.16007-3-dave.rodgman@arm.comSigned-off-by: default avatarDave Rodgman <dave.rodgman@arm.com>
      Cc: David S. Miller <davem@davemloft.net>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Herbert Xu <herbert@gondor.apana.org.au>
      Cc: Markus F.X.J. Oberhumer <markus@oberhumer.com>
      Cc: Matt Sealey <matt.sealey@arm.com>
      Cc: Minchan Kim <minchan@kernel.org>
      Cc: Nitin Gupta <nitingupta910@gmail.com>
      Cc: Richard Purdie <rpurdie@openedhand.com>
      Cc: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
      Cc: Sonny Rao <sonnyrao@google.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      45ec975e
    • Dave Rodgman's avatar
      lib/lzo: implement run-length encoding · 5ee4014a
      Dave Rodgman authored
      Patch series "lib/lzo: run-length encoding support", v5.
      
      Following on from the previous lzo-rle patchset:
      
        https://lkml.org/lkml/2018/11/30/972
      
      This patchset contains only the RLE patches, and should be applied on
      top of the non-RLE patches ( https://lkml.org/lkml/2019/2/5/366 ).
      
      Previously, some questions were raised around the RLE patches.  I've
      done some additional benchmarking to answer these questions.  In short:
      
       - RLE offers significant additional performance (data-dependent)
      
       - I didn't measure any regressions that were clearly outside the noise
      
      One concern with this patchset was around performance - specifically,
      measuring RLE impact separately from Matt Sealey's patches (CTZ & fast
      copy).  I have done some additional benchmarking which I hope clarifies
      the benefits of each part of the patchset.
      
      Firstly, I've captured some memory via /dev/fmem from a Chromebook with
      many tabs open which is starting to swap, and then split this into 4178
      4k pages.  I've excluded the all-zero pages (as zram does), and also the
      no-zero pages (which won't tell us anything about RLE performance).
      This should give a realistic test dataset for zram.  What I found was
      that the data is VERY bimodal: 44% of pages in this dataset contain 5%
      or fewer zeros, and 44% contain over 90% zeros (30% if you include the
      no-zero pages).  This supports the idea of special-casing zeros in zram.
      
      Next, I've benchmarked four variants of lzo on these pages (on 64-bit
      Arm at max frequency): baseline LZO; baseline + Matt Sealey's patches
      (aka MS); baseline + RLE only; baseline + MS + RLE.  Numbers are for
      weighted roundtrip throughput (the weighting reflects that zram does
      more compression than decompression).
      
        https://drive.google.com/file/d/1VLtLjRVxgUNuWFOxaGPwJYhl_hMQXpHe/view?usp=sharing
      
      Matt's patches help in all cases for Arm (and no effect on Intel), as
      expected.
      
      RLE also behaves as expected: with few zeros present, it makes no
      difference; above ~75%, it gives a good improvement (50 - 300 MB/s on
      top of the benefit from Matt's patches).
      
      Best performance is seen with both MS and RLE patches.
      
      Finally, I have benchmarked the same dataset on an x86-64 device.  Here,
      the MS patches make no difference (as expected); RLE helps, similarly as
      on Arm.  There were no definite regressions; allowing for observational
      error, 0.1% (3/4178) of cases had a regression > 1 standard deviation,
      of which the largest was 4.6% (1.2 standard deviations).  I think this
      is probably within the noise.
      
        https://drive.google.com/file/d/1xCUVwmiGD0heEMx5gcVEmLBI4eLaageV/view?usp=sharing
      
      One point to note is that the graphs show RLE appears to help very
      slightly with no zeros present! This is because the extra code causes
      the clang optimiser to change code layout in a way that happens to have
      a significant benefit.  Taking baseline LZO and adding a do-nothing line
      like "__builtin_prefetch(out_len);" immediately before the "goto next"
      has the same effect.  So this is a real, but basically spurious effect -
      it's small enough not to upset the overall findings.
      
      This patch (of 3):
      
      When using zram, we frequently encounter long runs of zero bytes.  This
      adds a special case which identifies runs of zeros and encodes them
      using run-length encoding.
      
      This is faster for both compression and decompresion.  For high-entropy
      data which doesn't hit this case, impact is minimal.
      
      Compression ratio is within a few percent in all cases.
      
      This modifies the bitstream in a way which is backwards compatible
      (i.e., we can decompress old bitstreams, but old versions of lzo cannot
      decompress new bitstreams).
      
      Link: http://lkml.kernel.org/r/20190205155944.16007-2-dave.rodgman@arm.comSigned-off-by: default avatarDave Rodgman <dave.rodgman@arm.com>
      Cc: David S. Miller <davem@davemloft.net>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Herbert Xu <herbert@gondor.apana.org.au>
      Cc: Markus F.X.J. Oberhumer <markus@oberhumer.com>
      Cc: Matt Sealey <matt.sealey@arm.com>
      Cc: Minchan Kim <minchan@kernel.org>
      Cc: Nitin Gupta <nitingupta910@gmail.com>
      Cc: Richard Purdie <rpurdie@openedhand.com>
      Cc: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
      Cc: Sonny Rao <sonnyrao@google.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      5ee4014a
    • Matt Sealey's avatar
      lib/lzo: fast 8-byte copy on arm64 · 761b3238
      Matt Sealey authored
      Enable faster 8-byte copies on arm64.
      
      Link: http://lkml.kernel.org/r/20181127161913.23863-6-dave.rodgman@arm.com
      Link: http://lkml.kernel.org/r/20190205141950.9058-4-dave.rodgman@arm.comSigned-off-by: default avatarMatt Sealey <matt.sealey@arm.com>
      Signed-off-by: default avatarDave Rodgman <dave.rodgman@arm.com>
      Cc: David S. Miller <davem@davemloft.net>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Herbert Xu <herbert@gondor.apana.org.au>
      Cc: Markus F.X.J. Oberhumer <markus@oberhumer.com>
      Cc: Minchan Kim <minchan@kernel.org>
      Cc: Nitin Gupta <nitingupta910@gmail.com>
      Cc: Richard Purdie <rpurdie@openedhand.com>
      Cc: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
      Cc: Sonny Rao <sonnyrao@google.com>
      Cc: Stephen Rothwell <sfr@canb.auug.org.au>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      761b3238
    • Matt Sealey's avatar
      lib/lzo: 64-bit CTZ on arm64 · 433b3b3d
      Matt Sealey authored
      LZO leaves some performance on the table by not realising that arm64 can
      optimize count-trailing-zeros bit operations.
      
      Add CONFIG_ARM64 to the checked definitions alongside CONFIG_X86_64 to
      enable the use of rbit/clz instructions on full 64-bit quantities.
      
      Link: http://lkml.kernel.org/r/20181127161913.23863-5-dave.rodgman@arm.com
      Link: http://lkml.kernel.org/r/20190205141950.9058-3-dave.rodgman@arm.comSigned-off-by: default avatarMatt Sealey <matt.sealey@arm.com>
      Signed-off-by: default avatarDave Rodgman <dave.rodgman@arm.com>
      Cc: David S. Miller <davem@davemloft.net>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Herbert Xu <herbert@gondor.apana.org.au>
      Cc: Markus F.X.J. Oberhumer <markus@oberhumer.com>
      Cc: Minchan Kim <minchan@kernel.org>
      Cc: Nitin Gupta <nitingupta910@gmail.com>
      Cc: Richard Purdie <rpurdie@openedhand.com>
      Cc: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
      Cc: Sonny Rao <sonnyrao@google.com>
      Cc: Stephen Rothwell <sfr@canb.auug.org.au>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      433b3b3d