Commit graph

970,778 commits

Author SHA1 Message Date
Sami Tolvanen
3dc2da6928 FROMLIST: objtool: Don't autodetect vmlinux.o
With LTO, we run objtool on vmlinux.o, but don't want noinstr
validation. This change requires --vmlinux to be passed to objtool
explicitly.

Bug: 145210207
Change-Id: Ibfd814126df6b3d1a52f5461f2e5aac1377b02c9
Link: https://lore.kernel.org/lkml/20201013003203.4168817-4-samitolvanen@google.com/
Suggested-by: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
2020-12-16 08:56:35 -08:00
Sami Tolvanen
4ebe2a37ac ANDROID: objtool: Fix __mcount_loc generation with Clang's assembler
When objtool generates relocations for the __mcount_loc section, it
tries to reference __fentry__ calls by their section symbol offset.
However, this fails with Clang's integrated assembler as it may not
generate section symbols for every section. This patch looks up a
function symbol instead if the section symbol is missing, similarly
to commit e81e072443 ("objtool: Support Clang non-section symbols
in ORC generation").

Bug: 145210207
Change-Id: I1069c45a81a3b60eb8f8333581c379701145982f
Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
2020-12-16 08:56:35 -08:00
Peter Zijlstra
7dcfcd46b9 FROMLIST: objtool: Add a pass for generating __mcount_loc
Add the --mcount option for generating __mcount_loc sections
needed for dynamic ftrace. Using this pass requires the kernel to
be compiled with -mfentry and CC_USING_NOP_MCOUNT to be defined
in Makefile.

Bug: 145210207
Change-Id: I34eeeb00c184bf265391549094fc15525536886b
Link: https://lore.kernel.org/lkml/20200625200235.GQ4781@hirez.programming.kicks-ass.net/
Signed-off-by: Peter Zijlstra <peterz@infradead.org>
[Sami: rebased, dropped config changes, fixed to actually use --mcount,
       and wrote a commit message.]
Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
2020-12-16 08:56:35 -08:00
Sami Tolvanen
589c80767a FROMLIST: arm64: allow LTO to be selected
Allow CONFIG_LTO_CLANG to be enabled.

Bug: 145210207
Change-Id: Ie640b49355a0339a786093b55e71cbb9cc550943
Link: https://lore.kernel.org/lkml/20201211184633.3213045-17-samitolvanen@google.com/
Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
Acked-by: Will Deacon <will@kernel.org>
2020-12-16 08:56:35 -08:00
Sami Tolvanen
14adafff91 FROMLIST: arm64: disable recordmcount with DYNAMIC_FTRACE_WITH_REGS
DYNAMIC_FTRACE_WITH_REGS uses -fpatchable-function-entry, which makes
running recordmcount unnecessary as there are no mcount calls in object
files, and __mcount_loc doesn't need to be generated.

While there's normally no harm in running recordmcount even when it's
not strictly needed, this won't work with LTO as we have LLVM bitcode
instead of ELF objects.

This change selects FTRACE_MCOUNT_USE_PATCHABLE_FUNCTION_ENTRY, which
disables recordmcount when patchable function entries are used instead.

Bug: 145210207
Change-Id: Ifd57e2dabc70de5f202abd4b84e06e283657bd1d
Link: https://lore.kernel.org/lkml/20201211184633.3213045-16-samitolvanen@google.com/
Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
Acked-by: Will Deacon <will@kernel.org>
2020-12-16 08:56:34 -08:00
Sami Tolvanen
9fa364c98f FROMLIST: arm64: vdso: disable LTO
Disable LTO for the vDSO by filtering out CC_FLAGS_LTO, as there's no
point in using link-time optimization for the small amount of C code.

Bug: 145210207
Change-Id: Ibfd8a19f63d81e1edb18576ddd3794e86c4e78cf
Link: https://lore.kernel.org/lkml/20201211184633.3213045-15-samitolvanen@google.com/
Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
Acked-by: Will Deacon <will@kernel.org>
2020-12-16 08:56:34 -08:00
Sami Tolvanen
614b4c4b1b FROMLIST: drivers/misc/lkdtm: disable LTO for rodata.o
Disable LTO for rodata.o to allow objcopy to be used to
manipulate sections.

Bug: 145210207
Change-Id: Ic7e003c420cb6d209758fecbed944d494d3de67e
Link: https://lore.kernel.org/lkml/20201211184633.3213045-14-samitolvanen@google.com/
Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
Acked-by: Kees Cook <keescook@chromium.org>
2020-12-16 08:56:34 -08:00
Sami Tolvanen
004d72144e FROMLIST: efi/libstub: disable LTO
With CONFIG_LTO_CLANG, we produce LLVM bitcode instead of ELF object
files. Since LTO is not really needed here and the Makefile assumes we
produce an object file, disable LTO for libstub.

Bug: 145210207
Change-Id: Ie8b570c05995eb0fdb272ef9d1afc444449e57c9
Link: https://lore.kernel.org/lkml/20201211184633.3213045-13-samitolvanen@google.com/
Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
2020-12-16 08:56:34 -08:00
Sami Tolvanen
beab453713 FROMLIST: scripts/mod: disable LTO for empty.c
With CONFIG_LTO_CLANG, clang generates LLVM IR instead of ELF object
files. As empty.o is used for probing target properties, disable LTO
for it to produce an object file instead.

Bug: 145210207
Change-Id: I8fa54c4c9b71f5d481a364b6eb10a4c34b2b71b7
Link: https://lore.kernel.org/lkml/20201211184633.3213045-12-samitolvanen@google.com/
Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
2020-12-16 08:56:34 -08:00
Sami Tolvanen
1f975cd7dd FROMLIST: modpost: lto: strip .lto from module names
With LTO, everything is compiled into LLVM bitcode, so we have to link
each module into native code before modpost. Kbuild uses the .lto.o
suffix for these files, which also ends up in module information. This
change strips the unnecessary .lto suffix from the module name.

Bug: 145210207
Change-Id: I25b97a586f273b1b8d1f153b71e567136b0016ec
Link: https://lore.kernel.org/lkml/20201211184633.3213045-11-samitolvanen@google.com/
Suggested-by: Bill Wendling <morbo@google.com>
Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
2020-12-16 08:56:34 -08:00
Sami Tolvanen
7ffcc1cf4c FROMLIST: PCI: Fix PREL32 relocations for LTO
With Clang's Link Time Optimization (LTO), the compiler can rename
static functions to avoid global naming collisions. As PCI fixup
functions are typically static, renaming can break references
to them in inline assembly. This change adds a global stub to
DECLARE_PCI_FIXUP_SECTION to fix the issue when PREL32 relocations
are used.

Bug: 145210207
Change-Id: Iaf4a28d14c5ab86d49d6fec07704c3cb48301d64
Link: https://lore.kernel.org/lkml/20201211184633.3213045-10-samitolvanen@google.com/
Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
Acked-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
2020-12-16 08:56:33 -08:00
Sami Tolvanen
13968440c3 FROMLIST: init: lto: fix PREL32 relocations
With LTO, the compiler can rename static functions to avoid global
naming collisions. As initcall functions are typically static,
renaming can break references to them in inline assembly. This
change adds a global stub with a stable name for each initcall to
fix the issue when PREL32 relocations are used.

Bug: 145210207
Change-Id: I4e82728d472c72236cf1374300b5b71d53712687
Link: https://lore.kernel.org/lkml/20201211184633.3213045-9-samitolvanen@google.com/
Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
2020-12-16 08:56:33 -08:00
Sami Tolvanen
110784e046 FROMLIST: init: lto: ensure initcall ordering
With LTO, the compiler doesn't necessarily obey the link order for
initcalls, and initcall variables need globally unique names to avoid
collisions at link time.

This change exports __KBUILD_MODNAME and adds the initcall_id() macro,
which uses it together with __COUNTER__ and __LINE__ to help ensure
these variables have unique names, and moves each variable to its own
section when LTO is enabled, so the correct order can be specified using
a linker script.

The generate_initcall_ordering.pl script uses nm to find initcalls from
the object files passed to the linker, and generates a linker script
that specifies the same order for initcalls that we would have without
LTO. With LTO enabled, the script is called in link-vmlinux.sh through
jobserver-exec to limit the number of jobs spawned.

Bug: 145210207
Change-Id: I80619eac3674acd9c6d2566443d16b3d09515351
Link: https://lore.kernel.org/lkml/20201211184633.3213045-8-samitolvanen@google.com/
Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
2020-12-16 08:56:33 -08:00
Sami Tolvanen
3ea19301f7 FROMLIST: kbuild: lto: add a default list of used symbols
With CONFIG_LTO_CLANG, LLVM bitcode has not yet been compiled into a
binary when the .mod files are generated, which means they don't yet
contain references to certain symbols that will be present in the final
binaries. This includes intrinsic functions, such as memcpy, memmove,
and memset [1], and stack protector symbols [2]. This change adds a
default symbol list to use with CONFIG_TRIM_UNUSED_KSYMS when Clang's
LTO is used.

[1] https://llvm.org/docs/LangRef.html#standard-c-c-library-intrinsics
[2] https://llvm.org/docs/LangRef.html#llvm-stackprotector-intrinsic

Bug: 145210207
Change-Id: I9da92fba820c72633209e292fdc6f1c44abe7b9a
Link: https://lore.kernel.org/lkml/20201211184633.3213045-7-samitolvanen@google.com/
Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
2020-12-16 08:56:33 -08:00
Sami Tolvanen
76df447444 FROMLIST: kbuild: lto: merge module sections
LLD always splits sections with LTO, which increases module sizes. This
change adds linker script rules to merge the split sections in the final
module.

Bug: 145210207
Change-Id: Id0b964e732b5c72177d8f6dc0f75114551445b97
Link: https://lore.kernel.org/lkml/20201211184633.3213045-6-samitolvanen@google.com/
Suggested-by: Nick Desaulniers <ndesaulniers@google.com>
Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
2020-12-16 08:56:33 -08:00
Sami Tolvanen
819ae9e4b2 FROMLIST: kbuild: lto: limit inlining
This change limits function inlining across translation unit boundaries
in order to reduce the binary size with LTO. The -import-instr-limit
flag defines a size limit, as the number of LLVM IR instructions, for
importing functions from other TUs, defaulting to 100.

Based on testing with arm64 defconfig, we found that a limit of 5 is a
reasonable compromise between performance and binary size, reducing the
size of a stripped vmlinux by 11%.

Bug: 145210207
Change-Id: Ief7053b55f99f7be0da8a01b6c4edb0a9e41ee07
Link: https://lore.kernel.org/lkml/20201211184633.3213045-1-samitolvanen@google.com/
Suggested-by: George Burgess IV <gbiv@google.com>
Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
2020-12-16 08:56:33 -08:00
Sami Tolvanen
93f3831e2c FROMLIST: kbuild: lto: fix module versioning
With CONFIG_MODVERSIONS, version information is linked into each
compilation unit that exports symbols. With LTO, we cannot use this
method as all C code is compiled into LLVM bitcode instead. This
change collects symbol versions into .symversions files and merges
them in link-vmlinux.sh where they are all linked into vmlinux.o at
the same time.

Bug: 145210207
Change-Id: Icd8fd0c760891eff7a0ed12ce48b4db2a85fc2ad
Link: https://lore.kernel.org/lkml/20201211184633.3213045-1-samitolvanen@google.com/
Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
2020-12-16 08:56:32 -08:00
Sami Tolvanen
ba01e93b41 FROMLIST: kbuild: add support for Clang LTO
This change adds build system support for Clang's Link Time
Optimization (LTO). With -flto, instead of ELF object files, Clang
produces LLVM bitcode, which is compiled into native code at link
time, allowing the final binary to be optimized globally. For more
details, see:

  https://llvm.org/docs/LinkTimeOptimization.html

The Kconfig option CONFIG_LTO_CLANG is implemented as a choice,
which defaults to LTO being disabled. To use LTO, the architecture
must select ARCH_SUPPORTS_LTO_CLANG and support:

  - compiling with Clang,
  - compiling all assembly code with Clang's integrated assembler,
  - and linking with LLD.

While using CONFIG_LTO_CLANG_FULL results in the best runtime
performance, the compilation is not scalable in time or
memory. CONFIG_LTO_CLANG_THIN enables ThinLTO, which allows
parallel optimization and faster incremental builds. ThinLTO is
used by default if the architecture also selects
ARCH_SUPPORTS_LTO_CLANG_THIN:

  https://clang.llvm.org/docs/ThinLTO.html

To enable LTO, LLVM tools must be used to handle bitcode files, by
passing LLVM=1 and LLVM_IAS=1 options to make:

  $ make LLVM=1 LLVM_IAS=1 defconfig
  $ scripts/config -e LTO_CLANG_THIN
  $ make LLVM=1 LLVM_IAS=1

To prepare for LTO support with other compilers, common parts are
gated behind the CONFIG_LTO option, and LTO can be disabled for
specific files by filtering out CC_FLAGS_LTO.

Bug: 145210207
Change-Id: I85eb4523ea787e4f9884e12ed6301f876d0d888e
Link: https://lore.kernel.org/lkml/20201211184633.3213045-1-samitolvanen@google.com/
Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
2020-12-16 08:56:32 -08:00
Sami Tolvanen
450788232d FROMLIST: tracing: move function tracer options to Kconfig
Move function tracer options to Kconfig to make it easier to add
new methods for generating __mcount_loc, and to make the options
available also when building kernel modules.

Note that FTRACE_MCOUNT_USE_* options are updated on rebuild and
therefore, work even if the .config was generated in a different
environment.

Bug: 145210207
Change-Id: I6fc38abde50b602788148cb236aba1261affa896
Link: https://lore.kernel.org/lkml/20201211184633.3213045-1-samitolvanen@google.com/
Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
Acked-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2020-12-16 08:56:32 -08:00
Sudarshan Rajagopalan
1cf4b070e0 UPSTREAM: arm64/mm: add fallback option to allocate virtually contiguous memory
When section mappings are enabled, we allocate vmemmap pages from
physically continuous memory of size PMD_SIZE using
vmemmap_alloc_block_buf(). Section mappings are good to reduce TLB
pressure. But when system is highly fragmented and memory blocks are
being hot-added at runtime, its possible that such physically continuous
memory allocations can fail. Rather than failing the memory hot-add
procedure, add a fallback option to allocate vmemmap pages from
discontinuous pages using vmemmap_populate_basepages().

Signed-off-by: Sudarshan Rajagopalan <sudaraja@codeaurora.org>
Reviewed-by: Gavin Shan <gshan@redhat.com>
Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>
Acked-by: Will Deacon <will@kernel.org>
Cc: Will Deacon <will@kernel.org>
Cc: Anshuman Khandual <anshuman.khandual@arm.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Logan Gunthorpe <logang@deltatee.com>
Cc: David Hildenbrand <david@redhat.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Steven Price <steven.price@arm.com>
Link: https://lore.kernel.org/r/d6c06f2ef39bbe6c715b2f6db76eb16155fdcee6.1602722808.git.sudaraja@codeaurora.org
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>

(cherry picked from commit 9f84f39f55)

Bug: 170202780
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Change-Id: I449b6d2dfab6b480e6d9487aa5e25f4281d0eabd
2020-12-16 14:58:51 +00:00
Matthias Maennich
3106314066 ANDROID: add initial symbol list for cuttlefish
Generated with:

BUILD_CONFIG=common-modules/virtual-device/build.config.cuttlefish.aarch64 build/build_abi.sh -s

Bug: 175534863
Signed-off-by: Matthias Maennich <maennich@google.com>
Change-Id: I7841f2a2298bc1ddae8039006f8cddf374ff0f19
2020-12-16 11:36:20 +00:00
Matthias Maennich
895a2f809a ANDROID: add initial symbol list for db845c
Generated with:
  BUILD_CONFIG=common/build.config.db845c build/build_abi.sh -s

Bug: 175534863
Signed-off-by: Matthias Maennich <maennich@google.com>
Change-Id: I51a1981556da3439618dfc5ad40e8927a53434ec
2020-12-16 11:36:20 +00:00
Matthias Maennich
33a674bd42 ANDROID: create initial symbol lists for android12-5.10
Bug: 175534863
Signed-off-by: Matthias Maennich <maennich@google.com>
Change-Id: I99bb33802b001bbe9e0adb96b52ba81b9df3b30b
2020-12-16 11:36:20 +00:00
Satya Durga Srinivasu Prabhala
85b85c3836 ANDROID: binder: Export binder_transaction_received trace point
Vendor modules would like to register with the binder_transaction_received
trace point to implement features carried in their downstream kernels.

Bug: 174219217
Change-Id: Ica0f90c60964fc845de05169cbdd8a4948adb1cd
Signed-off-by: Satya Durga Srinivasu Prabhala <satyap@codeaurora.org>
2020-12-15 22:36:07 +00:00
Satya Durga Srinivasu Prabhala
90bd50a4d7 ANDROID: binder: consolidate wakeup vendor hooks into one
There are few vendor hooks available for binder wakeup related
functionality. As they both essentially do the same thing, we can
consolidate them into one.

Bug: 174219217
Change-Id: I44b472e7564eecbe8236ad2eb88b0433195f14d8
Signed-off-by: Satya Durga Srinivasu Prabhala <satyap@codeaurora.org>
2020-12-15 22:35:10 +00:00
Alistair Delva
8390e533e5 ANDROID: GKI: Drop CONFIG_LOCALVERSION on 5.10
Not needed on release branches.

Bug: 175707513
Change-Id: I9e60d8c6b9ce99251757957e080f01e671fb0890
Signed-off-by: Alistair Delva <adelva@google.com>
2020-12-15 11:57:29 -08:00
Badhri Jagan Sridharan
912795eaa2 ANDROID: usb: typec: tcpm: Add a helper function to port is toggling
Helper function needed for fixing TD.4.7.4 and TEST.PD.PROT.SRC.10
PR_Swap while having contamiant detection enabled.

tcpm_is_toggling returns true when a DRP port is in one of the toggling
states.

Bug: 169213252
Bug: 174094095
Signed-off-by: Badhri Jagan Sridharan <badhri@google.com>
Change-Id: Ie3837c3067fd91f3e9ea4afdfc1d5c7bf44659de
2020-12-15 10:20:24 +00:00
Matthias Maennich
da5e68a82d ANDROID: disable BTF generation
This is to allow LTO on this branch which currently is incompatible with
pahole's BTF extraction mechanism.

Bug: 168714651
Signed-off-by: Matthias Maennich <maennich@google.com>
Change-Id: I8eb00db99fa97674155e47cf5f1e01ff651375ba
2020-12-15 09:42:07 +00:00
John Stultz
ff2efbe6cc FROMLIST: dma-buf: system_heap: Add a system-uncached heap re-using the system heap
This adds a heap that allocates non-contiguous buffers that are
marked as writecombined, so they are not cached by the CPU.

This is useful, as most graphics buffers are usually not touched
by the CPU or only written into once by the CPU. So when mapping
the buffer over and over between devices, we can skip the CPU
syncing, which saves a lot of cache management overhead, greatly
improving performance.

For folk using ION, there was a ION_FLAG_CACHED flag, which
signaled if the returned buffer should be CPU cacheable or not.
With DMA-BUF heaps, we do not yet have such a flag, and by default
the current heaps (system and cma) produce CPU cachable buffers.
So for folks transitioning from ION to DMA-BUF Heaps, this fills
in some of that missing functionality.

There has been a suggestion to make this functionality a flag
(DMAHEAP_FLAG_UNCACHED?) on the system heap, similar to how
ION used the ION_FLAG_CACHED. But I want to make sure an
_UNCACHED flag would truely be a generic attribute across all
heaps. So far that has been unclear, so having it as a separate
heap seemes better for now. (But I'm open to discussion on this
point!)

This is a rework of earlier efforts to add a uncached system heap,
done utilizing the exisitng system heap, adding just a bit of
logic to handle the uncached case.

Feedback would be very welcome!

Many thanks to Liam Mark for his help to get this working.

Pending opensource users of this code include:
* AOSP HiKey960 gralloc:
  - https://android-review.googlesource.com/c/device/linaro/hikey/+/1399519
  - Visibly improves performance over the system heap
* AOSP Codec2 (possibly, needs more review):
  - https://android-review.googlesource.com/c/platform/frameworks/av/+/1360640/17/media/codec2/vndk/C2DmaBufAllocator.cpp#325

Signed-off-by: John Stultz <john.stultz@linaro.org>
Link: https://lore.kernel.org/lkml/20201110034934.70898-8-john.stultz@linaro.org/
Bug: 170887642
Change-Id: I56cb3acf58546c7dfd423a2ce432e3d6d7fd7a69
2020-12-14 23:23:46 +00:00
John Stultz
c8bdd32555 FROMLIST: dma-buf: dma-heap: Keep track of the heap device struct
Keep track of the heap device struct.

This will be useful for special DMA allocations
and actions.

Signed-off-by: John Stultz <john.stultz@linaro.org>
Link: https://lore.kernel.org/lkml/20201110034934.70898-7-john.stultz@linaro.org/
Bug: 170887642
Change-Id: I55b8df5fd9fd46795a8f0171318895297d2dd379
2020-12-14 23:23:26 +00:00
Greg Kroah-Hartman
a54c7055d9 This is the 5.10.1 stable release
-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEZH8oZUiU471FcZm+ONu9yGCSaT4FAl/Xr+oACgkQONu9yGCS
 aT7kiA//aqCOtFgnpnLdFBWuW0/tnJbClAj26mbabebIGLVazNZtRNZD/eoPzhw5
 /E+3CrLI76E+HMrN/Sk6ULSyPd8efwLtZOQWx5U+VNTx9UcprFsSgahMszBbZymw
 NhkhKqm3b2xDtpHbR09qxH3odN7ilPcX3gWxWfy1ks6hQD6/7iydedRJesnRcV7j
 NznU2ZpQg6gnrah6eVjTjHTV8mlG2h3p4Qn3ml+xAbT+F4N7CmDhJFhj8oK5N+ia
 XElRiUCLkW73O8g5stY8gV9H9Glj1YMGHwChmd9V+gpLtgHdvuI9xtqpoJfuYCXk
 wQfgkLwNfbX4KgA9378Wdc1y3lWIHcMoUMY1Sovx4jq7k9iTrkAEQ+ITJ7eWVpqR
 IV9UWw3dWkAyD2rWXZqmY6NZHNGPToUQBKugNUNDoWVLWJaz501DIzVnlpgkUGQ9
 t2R1o/mc2aUs4EyQNVKm/OAVB0UiDtu1DQTfIxTmRFLtrx2M2ngZjRI1c75+9M0/
 VWQuqAvktr0ZqdD/dhbr2aUTsOCAgU5ctKr62Nwf+R2ZWmGZRHOvomGdoVDLa17U
 37dNWuHd4GLixNFB05f9lj2rK+ocbsM0k6DJQSfhuC2QjyMS6krTG6e60pmWfga4
 LuK1y2RJ4sMHy6OSE5ksUUgVqLGNKL0cllEk6a2wZ/2FkgC4GLY=
 =AB8z
 -----END PGP SIGNATURE-----

Merge 5.10.1 into android-5.10

Changes in 5.10.1
	Revert "md: change mddev 'chunk_sectors' from int to unsigned"
	Revert "dm raid: fix discard limits for raid1 and raid10"
	Linux 5.10.1

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: Ifa253f67e0b25ec9a2afa77d5be98b77bc61b6a5
2020-12-14 20:46:40 +01:00
Greg Kroah-Hartman
841fca5a32 Linux 5.10.1
Link: https://lore.kernel.org/r/20201214170452.563016590@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-12-14 19:33:01 +01:00
Greg Kroah-Hartman
26934c8300 Revert "dm raid: fix discard limits for raid1 and raid10"
This reverts commit e0910c8e4f.

It causes problems :(

Reported-by: Dave Jones <davej@codemonkey.org.uk>
Reported-by: Mike Snitzer <snitzer@redhat.com>
Cc: Zdenek Kabelac <zkabelac@redhat.com>
Cc: Mikulas Patocka <mpatocka@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-12-14 19:33:01 +01:00
Greg Kroah-Hartman
859f703543 Revert "md: change mddev 'chunk_sectors' from int to unsigned"
This reverts commit 6ffeb1c3f8.

It causes problems :(

Reported-by: Dave Jones <davej@codemonkey.org.uk>
Reported-by: Mike Snitzer <snitzer@redhat.com>
Cc: Song Liu <songliubraving@fb.com>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Linus Torvalds <torvalds@linux-foundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-12-14 19:33:01 +01:00
Todd Kjos
69d00e3688 ANDROID: GKI: remove lockup detection configs
Remove CONFIG_LOCKUP_DETECTOR which is selected by
CONFIG_SOFTLOCKUP_DETECTOR since it causes power
regressions for partners.

Bug: 168445946
Signed-off-by: Todd Kjos <tkjos@google.com>
Change-Id: I9699a47968abac644bdd4b2d16ef85fdb3b595a0
2020-12-14 18:30:48 +00:00
Elliot Berman
37f671817b ANDROID: tty: hvc_dcc: Save irq flags when locking
Disable interrupts when using DCC fifo to prevent deadlock if interrupt
occurs that causes a console write.

Bug: 175415911
Fixes: 61d87acb93 ("FROMLIST: hvc_dcc: bind driver to core0 for reads
and writes")
Change-Id: I645bafef1d8bc58ee93b086b46d822c046aece2d
Signed-off-by: Elliot Berman <eberman@codeaurora.org>
2020-12-14 18:20:14 +00:00
J. Avila
0edac9cb95 ANDROID: sched: Export sched_setattr_nocheck
This symbol is needed for certain vendor modules which cannot rely on
only the sysfs interface for uclamp alone.

Bug: 170697030
Signed-off-by: J. Avila <elavila@google.com>
Change-Id: Ic904ade83a45d259cfc95501e6b81e6c5a0e90a0
2020-12-14 18:09:43 +00:00
Satya Durga Srinivasu Prabhala
d31ea0950a ANDROID: sched/fair: fix place_entity() vendor hook
place_entity() vendor hook is meant to tweak vruntime by vendor
modules as needed, but with current form of the hook that is not
possible as vruntime is passed by it's value. Fix it by switching
to pass by reference.

Bug: 175448877
Change-Id: Ibb51592f94da31019fa98a6767d080ec61daafe6
Signed-off-by: Satya Durga Srinivasu Prabhala <satyap@codeaurora.org>
2020-12-14 18:00:22 +00:00
Satya Durga Srinivasu Prabhala
3650f0d4c7 ANDROID: sched/fair: export sysctl_sched_latency symbol
Export sysctl_sched_latency symbol to be able to access from vendor modules.

Bug: 175448877
Change-Id: Ieae39579f4adfe2bb97d0ee6b1970dd904aafdda
Signed-off-by: Satya Durga Srinivasu Prabhala <satyap@codeaurora.org>
2020-12-14 18:00:09 +00:00
Lina Iyer
283e327164 FROMLIST: PM / Domains: use device's next wakeup to determine domain idle state
Currently, a PM domain's idle state is determined based on whether the
QoS requirements are met. This may not save power, if the idle state
residency requirements are not met.

CPU PM domains use the next timer wakeup for the CPUs in the domain to
determine the sleep duration of the domain. This is compared with the
idle state residencies to determine the optimal idle state. For other PM
domains, determining the sleep length is not that straight forward. But
if the device's next_event is available, we can use that to determine
the sleep duration of the PM domain.

Let's update the domain governor logic to check for idle state residency
based on the next wakeup of devices as well as QoS constraints.

Bug: 170654157
Link: https://lore.kernel.org/linux-pm/CAJZ5v0g+nK+jV+Gy+BKEALRtsXDK0HnDbz07Nv3KPK5L3V3OKg@mail.gmail.com/T/#meedddf8b7c5c6b3972b71922a6caae88fd499168
Signed-off-by: Lina Iyer <ilina@codeaurora.org>
Change-Id: Ibbb5fb28720ab87fb551ce09e478e5f6822e9004
2020-12-14 09:18:49 -07:00
Lina Iyer
7a9d53c2ea FROMLIST: PM / domains: inform PM domain of a device's next wakeup
Some devices may have a predictable interrupt pattern while executing
usecases. An example would be the VSYNC interrupt associated with
display devices. A 60 Hz display could cause a interrupt every 16 ms. If
the device were in a PM domain, the domain would need to be powered up
for device to resume and handle the interrupt.

Entering a domain idle state saves power, only if the residency of the
idle state is met. Without knowing the idle duration of the domain, the
governor would just choose the deepest idle state that matches the QoS
requirements. The domain might be powered off just as the device is
expecting to wake up. If devices could inform PM frameworks of their
next event, the parent PM domain's idle duration can be determined.

So let's add the dev_pm_genpd_set_next_wakeup() API for the device to
inform PM domains of the impending wakeup. This information will be the
domain governor to determine the best idle state given the wakeup.

Bug: 170654157
Link: https://lore.kernel.org/linux-pm/CAJZ5v0g+nK+jV+Gy+BKEALRtsXDK0HnDbz07Nv3KPK5L3V3OKg@mail.gmail.com/T/#m55f3f4a218f6c91431066505841ba5339486b1ab
Signed-off-by: Lina Iyer <ilina@codeaurora.org>
Change-Id: I34371ef21fde9c045ecf739e9b53c3128656db8e
2020-12-14 09:18:34 -07:00
Lina Iyer
e6c313525b FROMLIST: PM / Domains: add domain feature flag for next wakeup
PM domains may support entering multiple power down states when the
component devices and sub-domains are suspended. Also, they may specify
the residency value for an idle state, only after which the idle state
may provide power benefits. If the domain does not specify the residency
for any of its idle states, the governor's choice is much simplified.

Let's make this optional with the use of a PM domain feature flag.

Bug: 170654157
Link: https://lore.kernel.org/linux-pm/CAJZ5v0g+nK+jV+Gy+BKEALRtsXDK0HnDbz07Nv3KPK5L3V3OKg@mail.gmail.com/T/#meffa01877c7c78964b3ddf55bd88959969ed8ad2
Signed-off-by: Lina Iyer <ilina@codeaurora.org>
Change-Id: Ie98bebf15f81428b53512f37935af2e885edec97
2020-12-14 09:18:20 -07:00
Abhijeet Dharmapurikar
fa3cc7989c ANDROID: sched: Export key used by module
sched_uclamp_used will be used by vendor modules for enhancing placements.

Bug: 175448875
Change-Id: Ib6aa7839ae4d72de6490e2d1ff92729830830e3b
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
(cherry picked from commit 7923ce03f7b8d7787dee287d1fb57a314e680fc3)
2020-12-14 13:23:16 +00:00
Abhijeet Dharmapurikar
3975c98baf ANDROID: cgroup: Export functions used by modules
Below symbols would be used by vendor modules for tracking tasks
in various cgroups
	1. cgroup_taskset_first
	2. cgroup_taskset_next

Bug: 175045928
Change-Id: I6d89148eb4c71174a02a27acab196ff940be9082
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
(cherry picked from commit 7333bd73c055e8ebe9862316eaaff691e0eace27)
2020-12-14 11:22:22 +00:00
Matthias Maennich
3bab27c056 ANDROID: build.config: set branch to android12-5.10
Bug: 175534863
Signed-off-by: Matthias Maennich <maennich@google.com>
Change-Id: Ie50e1fbaa0f96b052c3f5f856a58531b5a67e11d
2020-12-14 10:05:46 +00:00
Greg Kroah-Hartman
b9e54f8e02 Linux 5.10
-----BEGIN PGP SIGNATURE-----
 
 iQFSBAABCAA8FiEEq68RxlopcLEwq+PEeb4+QwBBGIYFAl/WmJoeHHRvcnZhbGRz
 QGxpbnV4LWZvdW5kYXRpb24ub3JnAAoJEHm+PkMAQRiGv1oH+wUPC+TflsJyjjG4
 /UrmkfQGkMJlUuZbiuLSgLys2AxpiKE81qKpqi9+Fgv3TLZs1WZbWB4Aspj1SM9d
 dVHNz1RXqUKZVNLrBdB/NyiBDWO/XJyNe14DFJa7VQJzlPYheIr7Nij5MPt0ipEQ
 ZXNiXrVSC511fvLJ+74kQFXKohJ1LvxKO9tXHwn+RnTdQf+Rdat17BKEkxgjzEJr
 JV8KpzXeUHfAJInNye9YaZFSy2IY7PDBFbR4BAd/jRnqY58q71w0pVb7k1hWphT8
 XtzJbR1CHpriBuTG5YrFtSPUbkkPNIXcXa7v1Jo7kscJypjoIYbkfVDU++UbN9j/
 ipzLI5o=
 =MX0J
 -----END PGP SIGNATURE-----

Merge tag 'v5.10' into android-mainline

Linux 5.10

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I5cff928adff4f083fec6db63cee0319f1e212bee
2020-12-14 09:28:04 +01:00
Linus Torvalds
2c85ebc57b Linux 5.10 2020-12-13 14:41:30 -08:00
Linus Torvalds
ec6f5e0e5c A set of x86 and membarrier fixes:
- Correct a few problems in the x86 and the generic membarrier
     implementation. Small corrections for assumptions about visibility
     which have turned out not to be true.
 
   - Make the PAT bits for memory encryption correct vs. 4K and 2M/1G page
     table entries as they are at a different location.
 
   - Fix a concurrency issue in the the local bandwidth readout of resource
     control leading to incorrect values
 
   - Fix the ordering of allocating a vector for an interrupt. The order
     missed to respect the provided cpumask when the first attempt of
     allocating node local in the mask fails. It then tries the node instead
     of trying the full provided mask first. This leads to erroneous error
     messages and breaking the (user) supplied affinity request. Reorder it.
 
   - Make the INT3 padding detection in optprobe work correctly.
 -----BEGIN PGP SIGNATURE-----
 
 iQJHBAABCgAxFiEEQp8+kY+LLUocC4bMphj1TA10mKEFAl/WOw0THHRnbHhAbGlu
 dXRyb25peC5kZQAKCRCmGPVMDXSYodUhEACW02Al+mlpZjOhzIGwNUALGX7YGEOi
 wJoiIDTV2vOtKhcJ/AOVn05CznoWXa6PN1+7pm0nR2M1XaiXZ3B6HMjy1+0rpSqK
 5dCCEqr+QowwMRsKd4hnuJowR/7Og66FiYIcknDJg/1egg+RXy7yKds577W6/KW0
 2VV/x35xDywERiQ28qIftQ4L7NREyiioomN/GFpeoQf8tQF06Rb4t12T5pdA6D8S
 /C1wj0IKVRMJo/7HbB/X6skxPOK0PWAEBpaT0+Q66VKSNnFVN5ap+rGTKdUoTmuM
 NdxHOukpHyFCQtbRPOjRUeeSZJLKSX5oXsBO1GUvyyxcT2XNlTOdNamYLWyO+RfV
 uP97qhzYDKL+cgDkwypJ0WOzOb9EIXOh4P9BTnJFBGhc4EQwen3cpb3CyWWftjnv
 /obXiRDnAOE6P6H2AGiwrK3Pny+SvgrFYKMe+iy+ntToz1yrDh7ZrZ0DQKVoFWEr
 n3qUnlPZmVvRzHIRVYoK69nS/UgmNN0LssavzRBzab3BcK93f23QkW86P42kNCLa
 9kL+ZgGwlpqUZZR/p3pHq9Mv2ZXGEdUYY99h2vy1fgMwOw/RQZnPDAj/131UXlsU
 4DL0mAlTK1/0/81H6/V1GDBkMkO+hN4x6Y3asi7bPHEKEzlLe+P1tUt3YELd3CEC
 dc8ebICG1InXsw==
 =t31y
 -----END PGP SIGNATURE-----

Merge tag 'x86-urgent-2020-12-13' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull x86 fixes from Thomas Gleixner:
 "A set of x86 and membarrier fixes:

   - Correct a few problems in the x86 and the generic membarrier
     implementation. Small corrections for assumptions about visibility
     which have turned out not to be true.

   - Make the PAT bits for memory encryption correct vs 4K and 2M/1G
     page table entries as they are at a different location.

   - Fix a concurrency issue in the the local bandwidth readout of
     resource control leading to incorrect values

   - Fix the ordering of allocating a vector for an interrupt. The order
     missed to respect the provided cpumask when the first attempt of
     allocating node local in the mask fails. It then tries the node
     instead of trying the full provided mask first. This leads to
     erroneous error messages and breaking the (user) supplied affinity
     request. Reorder it.

   - Make the INT3 padding detection in optprobe work correctly"

* tag 'x86-urgent-2020-12-13' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  x86/kprobes: Fix optprobe to detect INT3 padding correctly
  x86/apic/vector: Fix ordering in vector assignment
  x86/resctrl: Fix incorrect local bandwidth when mba_sc is enabled
  x86/mm/mem_encrypt: Fix definition of PMD_FLAGS_DEC_WP
  membarrier: Execute SYNC_CORE on the calling thread
  membarrier: Explicitly sync remote cores when SYNC_CORE is requested
  membarrier: Add an actual barrier before rseq_preempt()
  x86/membarrier: Get rid of a dubious optimization
2020-12-13 11:31:19 -08:00
Linus Torvalds
d2360a398f block-5.10-2020-12-12
-----BEGIN PGP SIGNATURE-----
 
 iQJEBAABCAAuFiEEwPw5LcreJtl1+l5K99NY+ylx4KYFAl/VMG8QHGF4Ym9lQGtl
 cm5lbC5kawAKCRD301j7KXHgpsBdEACjbsECHIyQZOtTHW+vY2wkOj2ph+OkXtUU
 nmRlXn5itcrTEeHyenwDEc/W03WbU5m4C6BUz9ecRtXLda6K9W2d7YspSWND1JP/
 Gz3YtingA4xwAl7wOtHT6gi6JHb/seDObiKWAik6f7A3xvBW3o9lV1QRy3kaNdG1
 XgcYvBZBHDaP7Gdvvbg6FucSe3dNjSi+skVdvx8j+i27HF3LAEp3eoWG4vZBUePH
 RIpdDyCXRao+Z22V+EeY0X5cH568fxS408Z6xXewV/g2TDd4XUaXz3WM0O9FN0jU
 oTiQeXL+1y4EfU8QoboTWvHmpoKRqWMSZVD0GXbmx4ZwpiFHbyBub2SydU2Xm/Vl
 oNwHc1wktVU2HFrWU9dwrlWz4Egt4KZO6D9SzJ3VDt9HLKIciyZD16rbsVwSr/Bc
 BVQaFJjRYoR60xxNohIEC8C3rF3qRbkAy5HYSHFUyuOE6gm05RQIHLprY6gIjSei
 7gJnP1FL3iu5bQywp7ptqaRIlkeau6kqvboc8oYFDQvVAp35JqnxjdOsAByWUZR9
 lrN87bIh0n1Vqprs5arXWhw5Ixy7ZQsf0DsrFImZgU+VNTFmuB+1cKaa94EsQwo5
 gQH2j39QQSlGmkXphQVWDd0eGCAt3OrmjYe721ZSSLvJjM64+7pZFZpYPc//VpR5
 8Kcq/yDeOA==
 =PmVb
 -----END PGP SIGNATURE-----

Merge tag 'block-5.10-2020-12-12' of git://git.kernel.dk/linux-block

Pull block fixes from Jens Axboe:
 "This should be it for 5.10.

  Mike and Song looked into the warning case, and thankfully it appears
  the fix was pretty trivial - we can just change the md device chunk
  type to unsigned int to get rid of it. They cannot currently be < 0,
  and nobody is checking for that either.

  We're reverting the discard changes as the corruption reports came in
  very late, and there's just no time to attempt to deal with it at this
  point. Reverting the changes in question is the right call for 5.10"

* tag 'block-5.10-2020-12-12' of git://git.kernel.dk/linux-block:
  md: change mddev 'chunk_sectors' from int to unsigned
  Revert "md: add md_submit_discard_bio() for submitting discard bio"
  Revert "md/raid10: extend r10bio devs to raid disks"
  Revert "md/raid10: pull codes that wait for blocked dev into one function"
  Revert "md/raid10: improve raid10 discard request"
  Revert "md/raid10: improve discard request for far layout"
  Revert "dm raid: remove unnecessary discard limits for raid10"
2020-12-13 10:36:23 -08:00
Greg Kroah-Hartman
3f43bd6f2c Merge 6bff9bb8a2 ("Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi") into android-mainline
Steps on the way to 5.10-rc8/final

Change-Id: I52a3a13446bf00937f61bf2b2b3559e000e8a47d
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2020-12-13 08:42:04 +01:00