1. 14 5月, 2021 4 次提交
  2. 10 5月, 2021 1 次提交
    • L
      fbmem: fix horribly incorrect placement of __maybe_unused · 6dae40ae
      Linus Torvalds 提交于
      Commit b9d79e4c ("fbmem: Mark proc_fb_seq_ops as __maybe_unused")
      places the '__maybe_unused' in an entirely incorrect location between
      the "struct" keyword and the structure name.
      
      It's a wonder that gcc accepts that silently, but clang quite reasonably
      warns about it:
      
          drivers/video/fbdev/core/fbmem.c:736:21: warning: attribute declaration must precede definition [-Wignored-attributes]
          static const struct __maybe_unused seq_operations proc_fb_seq_ops = {
                              ^
      
      Fix it.
      
      Cc: Guenter Roeck <linux@roeck-us.net>
      Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      6dae40ae
  3. 09 5月, 2021 1 次提交
    • L
      drm/i915/display: fix compiler warning about array overrun · fec4d427
      Linus Torvalds 提交于
      intel_dp_check_mst_status() uses a 14-byte array to read the DPRX Event
      Status Indicator data, but then passes that buffer at offset 10 off as
      an argument to drm_dp_channel_eq_ok().
      
      End result: there are only 4 bytes remaining of the buffer, yet
      drm_dp_channel_eq_ok() wants a 6-byte buffer.  gcc-11 correctly warns
      about this case:
      
        drivers/gpu/drm/i915/display/intel_dp.c: In function ‘intel_dp_check_mst_status’:
        drivers/gpu/drm/i915/display/intel_dp.c:3491:22: warning: ‘drm_dp_channel_eq_ok’ reading 6 bytes from a region of size 4 [-Wstringop-overread]
         3491 |                     !drm_dp_channel_eq_ok(&esi[10], intel_dp->lane_count)) {
              |                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        drivers/gpu/drm/i915/display/intel_dp.c:3491:22: note: referencing argument 1 of type ‘const u8 *’ {aka ‘const unsigned char *’}
        In file included from drivers/gpu/drm/i915/display/intel_dp.c:38:
        include/drm/drm_dp_helper.h:1466:6: note: in a call to function ‘drm_dp_channel_eq_ok’
         1466 | bool drm_dp_channel_eq_ok(const u8 link_status[DP_LINK_STATUS_SIZE],
              |      ^~~~~~~~~~~~~~~~~~~~
             6:14 elapsed
      
      This commit just extends the original array by 2 zero-initialized bytes,
      avoiding the warning.
      
      There may be some underlying bug in here that caused this confusion, but
      this is at least no worse than the existing situation that could use
      random data off the stack.
      
      Cc: Jani Nikula <jani.nikula@intel.com>
      Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
      Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
      Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
      Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
      Cc: Dave Airlie <airlied@redhat.com>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      fec4d427
  4. 08 5月, 2021 8 次提交
  5. 07 5月, 2021 9 次提交
    • M
      treewide: remove editor modelines and cruft · fa60ce2c
      Masahiro Yamada 提交于
      The section "19) Editor modelines and other cruft" in
      Documentation/process/coding-style.rst clearly says, "Do not include any
      of these in source files."
      
      I recently receive a patch to explicitly add a new one.
      
      Let's do treewide cleanups, otherwise some people follow the existing code
      and attempt to upstream their favoriate editor setups.
      
      It is even nicer if scripts/checkpatch.pl can check it.
      
      If we like to impose coding style in an editor-independent manner, I think
      editorconfig (patch [1]) is a saner solution.
      
      [1] https://lore.kernel.org/lkml/20200703073143.423557-1-danny@kdrag0n.dev/
      
      Link: https://lkml.kernel.org/r/20210324054457.1477489-1-masahiroy@kernel.orgSigned-off-by: NMasahiro Yamada <masahiroy@kernel.org>
      Acked-by: NGeert Uytterhoeven <geert@linux-m68k.org>
      Reviewed-by: Miguel Ojeda <ojeda@kernel.org>	[auxdisplay]
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      fa60ce2c
    • D
      drivers/char: remove /dev/kmem for good · bbcd53c9
      David Hildenbrand 提交于
      Patch series "drivers/char: remove /dev/kmem for good".
      
      Exploring /dev/kmem and /dev/mem in the context of memory hot(un)plug and
      memory ballooning, I started questioning the existence of /dev/kmem.
      
      Comparing it with the /proc/kcore implementation, it does not seem to be
      able to deal with things like
      
      a) Pages unmapped from the direct mapping (e.g., to be used by secretmem)
        -> kern_addr_valid(). virt_addr_valid() is not sufficient.
      
      b) Special cases like gart aperture memory that is not to be touched
        -> mem_pfn_is_ram()
      
      Unless I am missing something, it's at least broken in some cases and might
      fault/crash the machine.
      
      Looks like its existence has been questioned before in 2005 and 2010 [1],
      after ~11 additional years, it might make sense to revive the discussion.
      
      CONFIG_DEVKMEM is only enabled in a single defconfig (on purpose or by
      mistake?).  All distributions disable it: in Ubuntu it has been disabled
      for more than 10 years, in Debian since 2.6.31, in Fedora at least
      starting with FC3, in RHEL starting with RHEL4, in SUSE starting from
      15sp2, and OpenSUSE has it disabled as well.
      
      1) /dev/kmem was popular for rootkits [2] before it got disabled
         basically everywhere. Ubuntu documents [3] "There is no modern user of
         /dev/kmem any more beyond attackers using it to load kernel rootkits.".
         RHEL documents in a BZ [5] "it served no practical purpose other than to
         serve as a potential security problem or to enable binary module drivers
         to access structures/functions they shouldn't be touching"
      
      2) /proc/kcore is a decent interface to have a controlled way to read
         kernel memory for debugging puposes. (will need some extensions to
         deal with memory offlining/unplug, memory ballooning, and poisoned
         pages, though)
      
      3) It might be useful for corner case debugging [1]. KDB/KGDB might be a
         better fit, especially, to write random memory; harder to shoot
         yourself into the foot.
      
      4) "Kernel Memory Editor" [4] hasn't seen any updates since 2000 and seems
         to be incompatible with 64bit [1]. For educational purposes,
         /proc/kcore might be used to monitor value updates -- or older
         kernels can be used.
      
      5) It's broken on arm64, and therefore, completely disabled there.
      
      Looks like it's essentially unused and has been replaced by better
      suited interfaces for individual tasks (/proc/kcore, KDB/KGDB). Let's
      just remove it.
      
      [1] https://lwn.net/Articles/147901/
      [2] https://www.linuxjournal.com/article/10505
      [3] https://wiki.ubuntu.com/Security/Features#A.2Fdev.2Fkmem_disabled
      [4] https://sourceforge.net/projects/kme/
      [5] https://bugzilla.redhat.com/show_bug.cgi?id=154796
      
      Link: https://lkml.kernel.org/r/20210324102351.6932-1-david@redhat.com
      Link: https://lkml.kernel.org/r/20210324102351.6932-2-david@redhat.comSigned-off-by: NDavid Hildenbrand <david@redhat.com>
      Acked-by: NMichal Hocko <mhocko@suse.com>
      Acked-by: NKees Cook <keescook@chromium.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: "Alexander A. Klimov" <grandmaster@al2klimov.de>
      Cc: Alexander Viro <viro@zeniv.linux.org.uk>
      Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>
      Cc: Andrew Lunn <andrew@lunn.ch>
      Cc: Andrey Zhizhikin <andrey.zhizhikin@leica-geosystems.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Brian Cain <bcain@codeaurora.org>
      Cc: Christian Borntraeger <borntraeger@de.ibm.com>
      Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
      Cc: Chris Zankel <chris@zankel.net>
      Cc: Corentin Labbe <clabbe@baylibre.com>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: "Eric W. Biederman" <ebiederm@xmission.com>
      Cc: Geert Uytterhoeven <geert@linux-m68k.org>
      Cc: Gerald Schaefer <gerald.schaefer@linux.ibm.com>
      Cc: Greentime Hu <green.hu@gmail.com>
      Cc: Gregory Clement <gregory.clement@bootlin.com>
      Cc: Heiko Carstens <hca@linux.ibm.com>
      Cc: Helge Deller <deller@gmx.de>
      Cc: Hillf Danton <hdanton@sina.com>
      Cc: huang ying <huang.ying.caritas@gmail.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
      Cc: "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>
      Cc: James Troup <james.troup@canonical.com>
      Cc: Jiaxun Yang <jiaxun.yang@flygoat.com>
      Cc: Jonas Bonn <jonas@southpole.se>
      Cc: Jonathan Corbet <corbet@lwn.net>
      Cc: Kairui Song <kasong@redhat.com>
      Cc: Krzysztof Kozlowski <krzk@kernel.org>
      Cc: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
      Cc: Liviu Dudau <liviu.dudau@arm.com>
      Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      Cc: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
      Cc: Luis Chamberlain <mcgrof@kernel.org>
      Cc: Matthew Wilcox <willy@infradead.org>
      Cc: Matt Turner <mattst88@gmail.com>
      Cc: Max Filippov <jcmvbkbc@gmail.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Mike Rapoport <rppt@kernel.org>
      Cc: Mikulas Patocka <mpatocka@redhat.com>
      Cc: Minchan Kim <minchan@kernel.org>
      Cc: Niklas Schnelle <schnelle@linux.ibm.com>
      Cc: Oleksiy Avramchenko <oleksiy.avramchenko@sonymobile.com>
      Cc: openrisc@lists.librecores.org
      Cc: Palmer Dabbelt <palmerdabbelt@google.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: "Pavel Machek (CIP)" <pavel@denx.de>
      Cc: Pavel Machek <pavel@ucw.cz>
      Cc: "Peter Zijlstra (Intel)" <peterz@infradead.org>
      Cc: Pierre Morel <pmorel@linux.ibm.com>
      Cc: Randy Dunlap <rdunlap@infradead.org>
      Cc: Richard Henderson <rth@twiddle.net>
      Cc: Rich Felker <dalias@libc.org>
      Cc: Robert Richter <rric@kernel.org>
      Cc: Rob Herring <robh@kernel.org>
      Cc: Russell King <linux@armlinux.org.uk>
      Cc: Sam Ravnborg <sam@ravnborg.org>
      Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
      Cc: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
      Cc: sparclinux@vger.kernel.org
      Cc: Stafford Horne <shorne@gmail.com>
      Cc: Stefan Kristiansson <stefan.kristiansson@saunalahti.fi>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Sudeep Holla <sudeep.holla@arm.com>
      Cc: Theodore Dubois <tblodt@icloud.com>
      Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Vasily Gorbik <gor@linux.ibm.com>
      Cc: Viresh Kumar <viresh.kumar@linaro.org>
      Cc: William Cohen <wcohen@redhat.com>
      Cc: Xiaoming Ni <nixiaoming@huawei.com>
      Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      bbcd53c9
    • R
      init/initramfs.c: do unpacking asynchronously · e7cb072e
      Rasmus Villemoes 提交于
      Patch series "background initramfs unpacking, and CONFIG_MODPROBE_PATH", v3.
      
      These two patches are independent, but better-together.
      
      The second is a rather trivial patch that simply allows the developer to
      change "/sbin/modprobe" to something else - e.g.  the empty string, so
      that all request_module() during early boot return -ENOENT early, without
      even spawning a usermode helper, needlessly synchronizing with the
      initramfs unpacking.
      
      The first patch delegates decompressing the initramfs to a worker thread,
      allowing do_initcalls() in main.c to proceed to the device_ and late_
      initcalls without waiting for that decompression (and populating of
      rootfs) to finish.  Obviously, some of those later calls may rely on the
      initramfs being available, so I've added synchronization points in the
      firmware loader and usermodehelper paths - there might be other places
      that would need this, but so far no one has been able to think of any
      places I have missed.
      
      There's not much to win if most of the functionality needed during boot is
      only available as modules.  But systems with a custom-made .config and
      initramfs can boot faster, partly due to utilizing more than one cpu
      earlier, partly by avoiding known-futile modprobe calls (which would still
      trigger synchronization with the initramfs unpacking, thus eliminating
      most of the first benefit).
      
      This patch (of 2):
      
      Most of the boot process doesn't actually need anything from the
      initramfs, until of course PID1 is to be executed.  So instead of doing
      the decompressing and populating of the initramfs synchronously in
      populate_rootfs() itself, push that off to a worker thread.
      
      This is primarily motivated by an embedded ppc target, where unpacking
      even the rather modest sized initramfs takes 0.6 seconds, which is long
      enough that the external watchdog becomes unhappy that it doesn't get
      attention soon enough.  By doing the initramfs decompression in a worker
      thread, we get to do the device_initcalls and hence start petting the
      watchdog much sooner.
      
      Normal desktops might benefit as well.  On my mostly stock Ubuntu kernel,
      my initramfs is a 26M xz-compressed blob, decompressing to around 126M.
      That takes almost two seconds:
      
      [    0.201454] Trying to unpack rootfs image as initramfs...
      [    1.976633] Freeing initrd memory: 29416K
      
      Before this patch, these lines occur consecutively in dmesg.  With this
      patch, the timestamps on these two lines is roughly the same as above, but
      with 172 lines inbetween - so more than one cpu has been kept busy doing
      work that would otherwise only happen after the populate_rootfs()
      finished.
      
      Should one of the initcalls done after rootfs_initcall time (i.e., device_
      and late_ initcalls) need something from the initramfs (say, a kernel
      module or a firmware blob), it will simply wait for the initramfs
      unpacking to be done before proceeding, which should in theory make this
      completely safe.
      
      But if some driver pokes around in the filesystem directly and not via one
      of the official kernel interfaces (i.e.  request_firmware*(),
      call_usermodehelper*) that theory may not hold - also, I certainly might
      have missed a spot when sprinkling wait_for_initramfs().  So there is an
      escape hatch in the form of an initramfs_async= command line parameter.
      
      Link: https://lkml.kernel.org/r/20210313212528.2956377-1-linux@rasmusvillemoes.dk
      Link: https://lkml.kernel.org/r/20210313212528.2956377-2-linux@rasmusvillemoes.dkSigned-off-by: NRasmus Villemoes <linux@rasmusvillemoes.dk>
      Reviewed-by: NLuis Chamberlain <mcgrof@kernel.org>
      Cc: Jessica Yu <jeyu@kernel.org>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Jonathan Corbet <corbet@lwn.net>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Nick Desaulniers <ndesaulniers@google.com>
      Cc: Takashi Iwai <tiwai@suse.de>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      e7cb072e
    • M
      include: remove pagemap.h from blkdev.h · 4ee60ec1
      Matthew Wilcox (Oracle) 提交于
      My UEK-derived config has 1030 files depending on pagemap.h before this
      change.  Afterwards, just 326 files need to be rebuilt when I touch
      pagemap.h.  I think blkdev.h is probably included too widely, but
      untangling that dependency is harder and this solves my problem.  x86
      allmodconfig builds, but there may be implicit include problems on other
      architectures.
      
      Link: https://lkml.kernel.org/r/20210309195747.283796-1-willy@infradead.orgSigned-off-by: NMatthew Wilcox (Oracle) <willy@infradead.org>
      Acked-by: Dan Williams <dan.j.williams@intel.com>		[nvdimm]
      Acked-by: Jens Axboe <axboe@kernel.dk>				[block]
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      Acked-by: Coly Li <colyli@suse.de>				[bcache]
      Acked-by: Martin K. Petersen <martin.petersen@oracle.com>	[scsi]
      Reviewed-by: NWilliam Kucharski <william.kucharski@oracle.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      4ee60ec1
    • A
      proc: mandate ->proc_lseek in "struct proc_ops" · d4455fac
      Alexey Dobriyan 提交于
      Now that proc_ops are separate from file_operations and other operations
      it easy to check all instances to have ->proc_lseek hook and remove check
      in main code.
      
      Note:
      nonseekable_open() files naturally don't require ->proc_lseek.
      
      Garbage collect pde_lseek() function.
      
      [adobriyan@gmail.com: smoke test lseek()]
        Link: https://lkml.kernel.org/r/YG4OIhChOrVTPgdN@localhost.localdomain
      
      Link: https://lkml.kernel.org/r/YFYX0Bzwxlc7aBa/@localhost.localdomainSigned-off-by: NAlexey Dobriyan <adobriyan@gmail.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      d4455fac
    • I
      mlxsw: spectrum_mr: Update egress RIF list before route's action · cbaf3f6a
      Ido Schimmel 提交于
      Each multicast route that is forwarding packets (as opposed to trapping
      them) points to a list of egress router interfaces (RIFs) through which
      packets are replicated.
      
      A route's action can transition from trap to forward when a RIF is
      created for one of the route's egress virtual interfaces (eVIF). When
      this happens, the route's action is first updated and only later the
      list of egress RIFs is committed to the device.
      
      This results in the route pointing to an invalid list. In case the list
      pointer is out of range (due to uninitialized memory), the device will
      complain:
      
      mlxsw_spectrum2 0000:06:00.0: EMAD reg access failed (tid=5733bf490000905c,reg_id=300f(pefa),type=write,status=7(bad parameter))
      
      Fix this by first committing the list of egress RIFs to the device and
      only later update the route's action.
      
      Note that a fix is not needed in the reverse function (i.e.,
      mlxsw_sp_mr_route_evif_unresolve()), as there the route's action is
      first updated and only later the RIF is removed from the list.
      
      Cc: stable@vger.kernel.org
      Fixes: c011ec1b ("mlxsw: spectrum: Add the multicast routing offloading logic")
      Signed-off-by: NIdo Schimmel <idosch@nvidia.com>
      Reviewed-by: NPetr Machata <petrm@nvidia.com>
      Link: https://lore.kernel.org/r/20210506072308.3834303-1-idosch@idosch.orgSigned-off-by: NJakub Kicinski <kuba@kernel.org>
      cbaf3f6a
    • A
      net: ipa: fix inter-EE IRQ register definitions · 6a780f51
      Alex Elder 提交于
      In gsi_irq_setup(), two registers are written with the intention of
      disabling inter-EE channel and event IRQs.
      
      But the wrong registers are used (and defined); the ones used are
      read-only registers that indicate whether the interrupt condition is
      present.
      
      Define the mask registers instead of the status registers, and use
      them to disable the inter-EE interrupt types.
      
      Fixes: 46f748cc ("net: ipa: explicitly disallow inter-EE interrupts")
      Signed-off-by: NAlex Elder <elder@linaro.org>
      Link: https://lore.kernel.org/r/20210505223636.232527-1-elder@linaro.orgSigned-off-by: NJakub Kicinski <kuba@kernel.org>
      6a780f51
    • M
      Input: xpad - add support for Amazon Game Controller · 05665cef
      Matt Reynolds 提交于
      The Amazon Luna controller (product name "Amazon Game Controller") behaves
      like an Xbox 360 controller when connected over USB.
      Signed-off-by: NMatt Reynolds <mattreynolds@chromium.org>
      Reviewed-by: NHarry Cutts <hcutts@chromium.org>
      Link: https://lore.kernel.org/r/20210429103548.1.If5f9a44cb81e25b9350f7c6c0b3c88b4ecd81166@changeidSigned-off-by: NDmitry Torokhov <dmitry.torokhov@gmail.com>
      05665cef
    • H
      Input: ili210x - add missing negation for touch indication on ili210x · ac05a8a9
      Hansem Ro 提交于
      This adds the negation needed for proper finger detection on Ilitek
      ili2107/ili210x. This fixes polling issues (on Amazon Kindle Fire)
      caused by returning false for the cooresponding finger on the touchscreen.
      Signed-off-by: NHansem Ro <hansemro@outlook.com>
      Fixes: e3559442 ("ili210x - rework the touchscreen sample processing")
      Cc: stable@vger.kernel.org
      Signed-off-by: NDmitry Torokhov <dmitry.torokhov@gmail.com>
      ac05a8a9
  6. 06 5月, 2021 11 次提交
    • M
      can: m_can: m_can_tx_work_queue(): fix tx_skb race condition · e04b2cfe
      Marc Kleine-Budde 提交于
      The m_can_start_xmit() function checks if the cdev->tx_skb is NULL and
      returns with NETDEV_TX_BUSY in case tx_sbk is not NULL.
      
      There is a race condition in the m_can_tx_work_queue(), where first
      the skb is send to the driver and then the case tx_sbk is set to NULL.
      A TX complete IRQ might come in between and wake the queue, which
      results in tx_skb not being cleared yet.
      
      Fixes: f524f829 ("can: m_can: Create a m_can platform framework")
      Tested-by: NTorin Cooper-Bennun <torin@maxiluxsystems.com>
      Signed-off-by: NMarc Kleine-Budde <mkl@pengutronix.de>
      e04b2cfe
    • F
      can: mcp251x: fix resume from sleep before interface was brought up · 03c42714
      Frieder Schrempf 提交于
      Since 8ce8c0ab the driver queues work via priv->restart_work when
      resuming after suspend, even when the interface was not previously
      enabled. This causes a null dereference error as the workqueue is only
      allocated and initialized in mcp251x_open().
      
      To fix this we move the workqueue init to mcp251x_can_probe() as there
      is no reason to do it later and repeat it whenever mcp251x_open() is
      called.
      
      Fixes: 8ce8c0ab ("can: mcp251x: only reset hardware as required")
      Link: https://lore.kernel.org/r/17d5d714-b468-482f-f37a-482e3d6df84e@kontron.deSigned-off-by: NFrieder Schrempf <frieder.schrempf@kontron.de>
      Reviewed-by: NAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      [mkl: fix error handling in mcp251x_stop()]
      Signed-off-by: NMarc Kleine-Budde <mkl@pengutronix.de>
      03c42714
    • M
      can: mcp251xfd: mcp251xfd_probe(): add missing can_rx_offload_del() in error path · 4376ea42
      Marc Kleine-Budde 提交于
      This patch adds the missing can_rx_offload_del(), that must be called
      if mcp251xfd_register() fails.
      
      Fixes: 55e5b97f ("can: mcp25xxfd: add driver for Microchip MCP25xxFD SPI CAN")
      Link: https://lore.kernel.org/r/20210504091838.1109047-1-mkl@pengutronix.deSigned-off-by: NMarc Kleine-Budde <mkl@pengutronix.de>
      4376ea42
    • D
      can: mcp251xfd: mcp251xfd_probe(): fix an error pointer dereference in probe · 4cc7faa4
      Dan Carpenter 提交于
      When we converted this code to use dev_err_probe() we accidentally
      removed a return. It means that if devm_clk_get() it will lead to an
      Oops when we call clk_get_rate() on the next line.
      
      Fixes: cf8ee6de ("can: mcp251xfd: mcp251xfd_probe(): use dev_err_probe() to simplify error handling")
      Link: https://lore.kernel.org/r/YJANZf13Qxd5Mhr1@mwandaSigned-off-by: NDan Carpenter <dan.carpenter@oracle.com>
      Reviewed-by: NManivannan Sadhasivam <mani@kernel.org>
      Signed-off-by: NMarc Kleine-Budde <mkl@pengutronix.de>
      4cc7faa4
    • B
      drm/amdgpu: Use device specific BO size & stride check. · 234055fd
      Bas Nieuwenhuizen 提交于
      The builtin size check isn't really the right thing for AMD
      modifiers due to a couple of reasons:
      
      1) In the format structs we don't do set any of the tilesize / blocks
      etc. to avoid having format arrays per modifier/GPU
      2) The pitch on the main plane is pixel_pitch * bytes_per_pixel even
      for tiled ...
      3) The pitch for the DCC planes is really the pixel pitch of the main
      surface that would be covered by it ...
      
      Note that we only handle GFX9+ case but we do this after converting
      the implicit modifier to an explicit modifier, so on GFX9+ all
      framebuffers should be checked here.
      
      There is a TODO about DCC alignment, but it isn't worse than before
      and I'd need to dig a bunch into the specifics. Getting this out in
      a reasonable timeframe to make sure it gets the appropriate testing
      seemed more important.
      
      Finally as I've found that debugging addfb2 failures is a pita I was
      generous adding explicit error messages to every failure case.
      
      Fixes: f258907f ("drm/amdgpu: Verify bo size can fit framebuffer size on init.")
      Tested-by: NSimon Ser <contact@emersion.fr>
      Signed-off-by: NBas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
      Signed-off-by: NAlex Deucher <alexander.deucher@amd.com>
      234055fd
    • B
      drm/amdgpu: Init GFX10_ADDR_CONFIG for VCN v3 in DPG mode. · 8bf073ca
      Bas Nieuwenhuizen 提交于
      Otherwise tiling modes that require the values form this field
      (In particular _*_X) would be corrupted upon video decode.
      
      Copied from the VCN v2 code.
      
      Fixes: 99541f39 ("drm/amdgpu: add mc resume DPG mode for VCN3.0")
      Reviewed-and-Tested by: Leo Liu <leo.liu@amd.com>
      Signed-off-by: NBas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
      Signed-off-by: NAlex Deucher <alexander.deucher@amd.com>
      Cc: stable@vger.kernel.org
      8bf073ca
    • Í
      net:CXGB4: fix leak if sk_buff is not used · 52bfcdd8
      Íñigo Huguet 提交于
      An sk_buff is allocated to send a flow control message, but it's not
      sent in all cases: in case the state is not appropiate to send it or if
      it can't be enqueued.
      
      In the first of these 2 cases, the sk_buff was discarded but not freed,
      producing a memory leak.
      Signed-off-by: NÍñigo Huguet <ihuguet@redhat.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      52bfcdd8
    • S
      Fix spelling error from "eleminate" to "eliminate" · f941d686
      Sean Gloumeau 提交于
      Spelling error "eleminate" amended to "eliminate".
      Signed-off-by: NSean Gloumeau <sajgloumeau@gmail.com>
      Reviewed-by: NKieran Bingham <kieran.bingham+renesas@ideasonboard.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      f941d686
    • O
      acpi,memhotplug: enable MHP_MEMMAP_ON_MEMORY when supported · 4a3e5de9
      Oscar Salvador 提交于
      Let the caller check whether it can pass MHP_MEMMAP_ON_MEMORY by
      checking mhp_supports_memmap_on_memory().  MHP_MEMMAP_ON_MEMORY can only
      be set in case ARCH_MHP_MEMMAP_ON_MEMORY_ENABLE is enabled, the
      architecture supports altmap, and the range to be added spans a single
      memory block.
      
      Link: https://lkml.kernel.org/r/20210421102701.25051-6-osalvador@suse.deSigned-off-by: NOscar Salvador <osalvador@suse.de>
      Reviewed-by: NDavid Hildenbrand <david@redhat.com>
      Acked-by: NMichal Hocko <mhocko@suse.com>
      Cc: Anshuman Khandual <anshuman.khandual@arm.com>
      Cc: Pavel Tatashin <pasha.tatashin@soleen.com>
      Cc: Vlastimil Babka <vbabka@suse.cz>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      4a3e5de9
    • O
      mm,memory_hotplug: allocate memmap from the added memory range · a08a2ae3
      Oscar Salvador 提交于
      Physical memory hotadd has to allocate a memmap (struct page array) for
      the newly added memory section.  Currently, alloc_pages_node() is used
      for those allocations.
      
      This has some disadvantages:
       a) an existing memory is consumed for that purpose
          (eg: ~2MB per 128MB memory section on x86_64)
          This can even lead to extreme cases where system goes OOM because
          the physically hotplugged memory depletes the available memory before
          it is onlined.
       b) if the whole node is movable then we have off-node struct pages
          which has performance drawbacks.
       c) It might be there are no PMD_ALIGNED chunks so memmap array gets
          populated with base pages.
      
      This can be improved when CONFIG_SPARSEMEM_VMEMMAP is enabled.
      
      Vmemap page tables can map arbitrary memory.  That means that we can
      reserve a part of the physically hotadded memory to back vmemmap page
      tables.  This implementation uses the beginning of the hotplugged memory
      for that purpose.
      
      There are some non-obviously things to consider though.
      
      Vmemmap pages are allocated/freed during the memory hotplug events
      (add_memory_resource(), try_remove_memory()) when the memory is
      added/removed.  This means that the reserved physical range is not
      online although it is used.  The most obvious side effect is that
      pfn_to_online_page() returns NULL for those pfns.  The current design
      expects that this should be OK as the hotplugged memory is considered a
      garbage until it is onlined.  For example hibernation wouldn't save the
      content of those vmmemmaps into the image so it wouldn't be restored on
      resume but this should be OK as there no real content to recover anyway
      while metadata is reachable from other data structures (e.g.  vmemmap
      page tables).
      
      The reserved space is therefore (de)initialized during the {on,off}line
      events (mhp_{de}init_memmap_on_memory).  That is done by extracting page
      allocator independent initialization from the regular onlining path.
      The primary reason to handle the reserved space outside of
      {on,off}line_pages is to make each initialization specific to the
      purpose rather than special case them in a single function.
      
      As per above, the functions that are introduced are:
      
       - mhp_init_memmap_on_memory:
         Initializes vmemmap pages by calling move_pfn_range_to_zone(), calls
         kasan_add_zero_shadow(), and onlines as many sections as vmemmap pages
         fully span.
      
       - mhp_deinit_memmap_on_memory:
         Offlines as many sections as vmemmap pages fully span, removes the
         range from zhe zone by remove_pfn_range_from_zone(), and calls
         kasan_remove_zero_shadow() for the range.
      
      The new function memory_block_online() calls mhp_init_memmap_on_memory()
      before doing the actual online_pages().  Should online_pages() fail, we
      clean up by calling mhp_deinit_memmap_on_memory().  Adjusting of
      present_pages is done at the end once we know that online_pages()
      succedeed.
      
      On offline, memory_block_offline() needs to unaccount vmemmap pages from
      present_pages() before calling offline_pages().  This is necessary because
      offline_pages() tears down some structures based on the fact whether the
      node or the zone become empty.  If offline_pages() fails, we account back
      vmemmap pages.  If it succeeds, we call mhp_deinit_memmap_on_memory().
      
      Hot-remove:
      
       We need to be careful when removing memory, as adding and
       removing memory needs to be done with the same granularity.
       To check that this assumption is not violated, we check the
       memory range we want to remove and if a) any memory block has
       vmemmap pages and b) the range spans more than a single memory
       block, we scream out loud and refuse to proceed.
      
       If all is good and the range was using memmap on memory (aka vmemmap pages),
       we construct an altmap structure so free_hugepage_table does the right
       thing and calls vmem_altmap_free instead of free_pagetable.
      
      Link: https://lkml.kernel.org/r/20210421102701.25051-5-osalvador@suse.deSigned-off-by: NOscar Salvador <osalvador@suse.de>
      Reviewed-by: NDavid Hildenbrand <david@redhat.com>
      Acked-by: NMichal Hocko <mhocko@suse.com>
      Cc: Anshuman Khandual <anshuman.khandual@arm.com>
      Cc: Pavel Tatashin <pasha.tatashin@soleen.com>
      Cc: Vlastimil Babka <vbabka@suse.cz>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      a08a2ae3
    • O
      drivers/base/memory: introduce memory_block_{online,offline} · 8736cc2d
      Oscar Salvador 提交于
      Patch series "Allocate memmap from hotadded memory (per device)", v10.
      
      The primary goal of this patchset is to reduce memory overhead of the
      hot-added memory (at least for SPARSEMEM_VMEMMAP memory model).  The
      current way we use to populate memmap (struct page array) has two main
      drawbacks:
      
      a) it consumes an additional memory until the hotadded memory itself is
         onlined and
      
      b) memmap might end up on a different numa node which is especially
         true for movable_node configuration.
      
      c) due to fragmentation we might end up populating memmap with base
         pages
      
      One way to mitigate all these issues is to simply allocate memmap array
      (which is the largest memory footprint of the physical memory hotplug)
      from the hot-added memory itself.  SPARSEMEM_VMEMMAP memory model allows
      us to map any pfn range so the memory doesn't need to be online to be
      usable for the array.  See patch 4 for more details.  This feature is
      only usable when CONFIG_SPARSEMEM_VMEMMAP is set.
      
      [Overall design]:
      
      Implementation wise we reuse vmem_altmap infrastructure to override the
      default allocator used by vmemap_populate.  memory_block structure gains a
      new field called nr_vmemmap_pages, which accounts for the number of
      vmemmap pages used by that memory_block.  E.g: On x86_64, that is 512
      vmemmap pages on small memory bloks and 4096 on large memory blocks (1GB)
      
      We also introduce new two functions: memory_block_{online,offline}.  These
      functions take care of initializing/unitializing vmemmap pages prior to
      calling {online,offline}_pages, so the latter functions can remain totally
      untouched.
      
      More details can be found in the respective changelogs.
      
      This patch (of 8):
      
      This is a preparatory patch that introduces two new functions:
      memory_block_online() and memory_block_offline().
      
      For now, these functions will only call online_pages() and offline_pages()
      respectively, but they will be later in charge of preparing the vmemmap
      pages, carrying out the initialization and proper accounting of such
      pages.
      
      Since memory_block struct contains all the information, pass this struct
      down the chain till the end functions.
      
      Link: https://lkml.kernel.org/r/20210421102701.25051-1-osalvador@suse.de
      Link: https://lkml.kernel.org/r/20210421102701.25051-2-osalvador@suse.deSigned-off-by: NOscar Salvador <osalvador@suse.de>
      Reviewed-by: NDavid Hildenbrand <david@redhat.com>
      Acked-by: NMichal Hocko <mhocko@suse.com>
      Cc: Anshuman Khandual <anshuman.khandual@arm.com>
      Cc: Vlastimil Babka <vbabka@suse.cz>
      Cc: Pavel Tatashin <pasha.tatashin@soleen.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      8736cc2d
  7. 05 5月, 2021 6 次提交