Commit Graph

988393 Commits

Author SHA1 Message Date
Yifan Hong
7b87b9ddb4 ANDROID: kleaf: Explicit list of ABI files.
In BUILD.bazel, explicitly list abi_definition,
kmi_symbol_list, and additional_kmi_symbol_lists.
This avoids using the glob expression which may
accidentally match editor backup files.

Bug: 246344503
Test: TH
Change-Id: I3cd494dee47b68a0fe7c3c80dd379b5af6b060fe
Signed-off-by: Yifan Hong <elsk@google.com>
2022-09-20 19:19:36 +00:00
Weichao Guo
d25aa0dbae FROMLIST: f2fs: let FI_OPU_WRITE override FADVISE_COLD_BIT
Cold files may be fragmented due to SSR, defragment is needed as
sequential reads are dominant scenarios of these files. FI_OPU_WRITE
should override FADVISE_COLD_BIT to avoid defragment fails.

Bug: 246903585

Signed-off-by: Weichao Guo <guoweichao@oppo.com>
Signed-off-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: Weichao Guo <guoweichao@oppo.corp-partner.google.com>
Link: https://lore.kernel.org/all/YxlTQ3H+PPKcvpyc@google.com/T/
Change-Id: I52ab86a15ec275772c5356bfc985803bbdde4408
2022-09-20 18:22:45 +00:00
Tadeusz Struk
5625e355a9 ANDROID: incfs: Add check for ATTR_KILL_SUID and ATTR_MODE in incfs_setattr
Add an explicite check for ATTR_KILL_SUID and ATTR_MODE in incfs_setattr.
Both of these attributes can not be set at the same time, otherwise
notify_change() function will check it and invoke BUG(), crashing
the system.

Bug: 243394930

Signed-off-by: Tadeusz Struk <tadeusz.struk@linaro.org>
Change-Id: I91080d68efbd62f1441e20a5c02feef3d1b06e4e
2022-09-20 18:12:59 +00:00
Bart Van Assche
0cf7d9ce9f Revert "UPSTREAM: scsi: ufs: core: Reduce the power mode change timeout"
This reverts commit 3d35c6b91d.

Patch "scsi: ufs: core: Reduce the power mode change timeout" caused a
spike in the number of UFS suspend timeouts. Hence revert that change
and also later UFS driver changes.

Bug: b/246990788
Change-Id: I5aae929f0598020dc5e7c440946eb0d2101b07cc
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2022-09-19 15:20:50 -07:00
Bart Van Assche
1d61c5b5a0 Revert "FROMLIST: scsi: ufs: Fix deadlocks between power management and error handler"
This reverts commit f68d040c31.

Patch "scsi: ufs: core: Reduce the power mode change timeout" caused a
spike in the number of UFS suspend timeouts. Hence revert that change
and also later UFS driver changes.

Bug: b/246990788
Change-Id: Ic20594727d47dc6d9af9a320d64bd7011112e789
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2022-09-19 15:20:43 -07:00
Masahiro Yamada
dd18c291f9 BACKPORT: UPSTREAM: kbuild: rename cmd_{bzip2,lzma,lzo,lz4,xzkern,zstd22}
GZIP-compressed files end with 4 byte data that represents the size
of the original input. The decompressors (the self-extracting kernel)
exploit it to know the vmlinux size beforehand. To mimic the GZIP's
trailer, Kbuild provides cmd_{bzip2,lzma,lzo,lz4,xzkern,zstd22}.
Unfortunately these macros are used everywhere despite the appended
size data is only useful for the decompressors.

There is no guarantee that such hand-crafted trailers are safely ignored.
In fact, the kernel refuses compressed initramdfs with the garbage data.
That is why usr/Makefile overrides size_append to make it no-op.

To limit the use of such broken compressed files, this commit renames
the existing macros as follows:

  cmd_bzip2   --> cmd_bzip2_with_size
  cmd_lzma    --> cmd_lzma_with_size
  cmd_lzo     --> cmd_lzo_with_size
  cmd_lz4     --> cmd_lz4_with_size
  cmd_xzkern  --> cmd_xzkern_with_size
  cmd_zstd22  --> cmd_zstd22_with_size

To keep the decompressors working, I updated the following Makefiles
accordingly:

  arch/arm/boot/compressed/Makefile
  arch/h8300/boot/compressed/Makefile
  arch/mips/boot/compressed/Makefile
  arch/parisc/boot/compressed/Makefile
  arch/s390/boot/compressed/Makefile
  arch/sh/boot/compressed/Makefile
  arch/x86/boot/compressed/Makefile

I reused the current macro names for the normal usecases; they produce
the compressed data in the proper format.

I did not touch the following:

  arch/arc/boot/Makefile
  arch/arm64/boot/Makefile
  arch/csky/boot/Makefile
  arch/mips/boot/Makefile
  arch/riscv/boot/Makefile
  arch/sh/boot/Makefile
  kernel/Makefile

This means those Makefiles will stop appending the size data.

I dropped the 'override size_append' hack from usr/Makefile.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Reviewed-by: Nicolas Schier <n.schier@avm.de>

Bug: 135791357
(cherry picked from commit 7ce7e984ab
 https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master)
Change-Id: I3524909ef3daab85f7d22afdebc2e5bbfd5e5cf3
[szuweilin: Resolved the conflict about non-existing zstd22 in arch/s390/boot/compressed/Makefile]
Signed-off-by: SzuWei Lin <szuweilin@google.com>
2022-09-17 11:53:58 +00:00
Bart Van Assche
f68d040c31 FROMLIST: scsi: ufs: Fix deadlocks between power management and error handler
The following deadlocks have been observed on multiple test setups:

* ufshcd_wl_suspend() is waiting for blk_execute_rq() to complete while it
  holds host_sem.
* ufshcd_eh_host_reset_handler() invokes ufshcd_err_handler() and the
  latter function tries to obtain host_sem.
This is a deadlock because blk_execute_rq() can't execute SCSI commands
while the host is in the SHOST_RECOVERY state and because the error
handler cannot make progress either.

* ufshcd_wl_runtime_resume() is waiting for blk_execute_rq() to finish
  while it holds host_sem.
* ufshcd_eh_host_reset_handler() invokes ufshcd_err_handler() and the
  latter function calls pm_runtime_resume().
This is a deadlock because of the same reason as the previous scenario.

Fix both deadlocks by not obtaining host_sem from the power management
code paths. Removing the host_sem locking from the power management code
is safe because the ufshcd_err_handler() is already serialized against
SCSI command execution.

Cc: dh0421.hwang@samsung.com
Cc: Asutosh Das <asutoshd@codeaurora.org>
Fixes: b294ff3e34 ("scsi: ufs: core: Enable power management for wlun")
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Bug: 240498410
Bug: 246990788
Bug: 247073231
Bug: 247081382
Bug: 247082093
Link: https://lore.kernel.org/linux-scsi/
Signed-off-by: Bart Van Assche <bvanassche@google.com>
Change-Id: Ifb9b429ba89ff6d8a133d96a172eaefc09d85955
2022-09-16 07:01:24 -07:00
Jiapeng Chong
32934b542c UPSTREAM: ASoC: hdmi-codec: make hdmi_codec_controls static
This symbol is not used outside of hdmi-codec.c, so marks it static.

Fix the following sparse warning:

sound/soc/codecs/hdmi-codec.c:750:25: warning: symbol
'hdmi_codec_controls' was not declared. Should it be static?

Bug: 239396464
Change-Id: I6569284ef557fee683afb9031e5cc1b5684a1c30
Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
Link: https://lore.kernel.org/r/1623822941-3077-1-git-send-email-jiapeng.chong@linux.alibaba.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
(cherry picked from commit e99d7c69fd)
2022-09-15 20:16:04 +00:00
Maxime Ripard
46a21348d6 UPSTREAM: ASoC: hdmi-codec: Add a prepare hook
The IEC958 status bit is usually set by the userspace after hw_params
has been called, so in order to use whatever is set by the userspace, we
need to implement the prepare hook. Let's add it to the hdmi_codec_ops,
and mandate that either prepare or hw_params is implemented.

Bug: 239396464
Change-Id: I06ccde5d8185955bb60783b597f0205811460968
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Acked-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20210525132354.297468-6-maxime@cerno.tech
Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
(cherry picked from commit 2fef64eec2)
2022-09-15 20:16:04 +00:00
Maxime Ripard
21e97dfa19 UPSTREAM: ASoC: hdmi-codec: Add iec958 controls
The IEC958 status bits can be exposed and modified by the userspace
through dedicated ALSA controls.

This patch implements those controls for the hdmi-codec driver. It
relies on a default value being setup at probe time that can later be
overridden by the control put.

The hw_params callback is then called with a buffer filled with the
proper bits for the current parameters being passed on so the underlying
driver can just reuse those bits as is.

Bug: 239396464
Change-Id: I99f37b7e74655687e73a75ba19fd2de8041f8646
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Acked-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20210525132354.297468-5-maxime@cerno.tech
Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
(cherry picked from commit 7a8e1d4421)
2022-09-15 20:16:04 +00:00
Maxime Ripard
9e9d26699d UPSTREAM: ASoC: hdmi-codec: Rework to support more controls
We're going to add more controls to support the IEC958 output, so let's
rework the control registration a bit to support more of them.

Bug: 239396464
Change-Id: Ia8c0bf8c997638b5a121ae7356fa1eb27746036f
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Acked-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20210525132354.297468-4-maxime@cerno.tech
Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
(cherry picked from commit 366b45b974)
2022-09-15 20:16:04 +00:00
Maxime Ripard
8de9ae8605 UPSTREAM: ALSA: iec958: Split status creation and fill
In some situations, like a codec probe, we need to provide an IEC status
default but don't have access to the sampling rate and width yet since
no stream has been configured yet.

Each and every driver has its own default, whereas the core iec958 code
also has some buried in the snd_pcm_create_iec958_consumer functions.

Let's split these functions in two to provide a default that doesn't
rely on the sampling rate and width, and another function to fill them
when available.

Bug: 239396464
Change-Id: I277899145367b219b337bc796f2faee8c4917082
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20210525132354.297468-3-maxime@cerno.tech
Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
(cherry picked from commit 9eafc11f92)
2022-09-15 20:16:04 +00:00
Maxime Ripard
92c209708a UPSTREAM: ALSA: doc: Clarify IEC958 controls iface
The doc currently mentions that the IEC958 Playback Default should be
exposed on the PCM iface, and the Playback Mask on the mixer iface.

It's a bit confusing to advise to have two related controls on two
separate ifaces, and it looks like the drivers that currently expose
those controls use any combination of the mixer and PCM ifaces.

Let's try to clarify the situation a bit, and encourage to at least have
the controls on the same iface.

Bug: 239396464
Change-Id: Ie0fb033564972f74154c378c644c581dc4d06dfa
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20210525132354.297468-2-maxime@cerno.tech
Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
(cherry picked from commit aa7899537a)
2022-09-15 20:16:04 +00:00
Pierre-Louis Bossart
6cc06d03bf UPSTREAM: ASoC: hdmi-codec: remove unused spk_mask member
fix cppcheck warning:

sound/soc/codecs/hdmi-codec.c:25:16: style: struct member
'hdmi_codec_channel_map_table::spk_mask' is never
used. [unusedStructMember]
 unsigned long spk_mask;  /* speaker position bit mask */
               ^

Bug: 239396464
Change-Id: I235b7757db88bfbd059ad0f9795908fbfbb1cfdb
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20210312182246.5153-12-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
(cherry picked from commit 9ad869fee5)
2022-09-15 20:16:04 +00:00
Pierre-Louis Bossart
004a44b913 UPSTREAM: ASoC: hdmi-codec: remove useless initialization
Fix cppcheck warning:

sound/soc/codecs/hdmi-codec.c:745:5: style: Redundant initialization
for 'cf'. The initialized value is overwritten before it is
read. [redundantInitialization]
 cf = dai->playback_dma_data;
    ^
sound/soc/codecs/hdmi-codec.c:738:31: note: cf is initialized
 struct hdmi_codec_daifmt *cf = dai->playback_dma_data;
                              ^
sound/soc/codecs/hdmi-codec.c:745:5: note: cf is overwritten
 cf = dai->playback_dma_data;
    ^

Bug: 239396464
Change-Id: Ia903635862e043207929827afcaeb531e6344283
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20210312182246.5153-11-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
(cherry picked from commit 3c011ef344)
2022-09-15 20:16:04 +00:00
Sia Jee Heng
a7633aa2d9 UPSTREAM: ASoC: codec: hdmi-codec: Support IEC958 encoded PCM format
Existing hdmi-codec driver only support standard pcm format.
Support of IEC958 encoded format pass from ALSA IEC958 plugin is needed
so that the IEC958 encoded data can be streamed to the HDMI chip.

Bug: 239396464
Change-Id: I01516e34605e380995b5312273035a0d000d36f1
Signed-off-by: Sia Jee Heng <jee.heng.sia@intel.com>
Link: https://lore.kernel.org/r/20210204014258.10197-2-jee.heng.sia@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
(cherry picked from commit 28785f548d)
2022-09-15 20:16:04 +00:00
Stephan Gerhold
c584eb99bb UPSTREAM: ASoC: hdmi-codec: Fix return value in hdmi_codec_set_jack()
Sound is broken on the DragonBoard 410c (apq8016_sbc) since 5.10:

  hdmi-audio-codec hdmi-audio-codec.1.auto: ASoC: error at snd_soc_component_set_jack on hdmi-audio-codec.1.auto: -95
  qcom-apq8016-sbc 7702000.sound: Failed to set jack: -95
  ADV7533: ASoC: error at snd_soc_link_init on ADV7533: -95
  hdmi-audio-codec hdmi-audio-codec.1.auto: ASoC: error at snd_soc_component_set_jack on hdmi-audio-codec.1.auto: -95
  qcom-apq8016-sbc: probe of 7702000.sound failed with error -95

This happens because apq8016_sbc calls snd_soc_component_set_jack() on
all codec DAIs and attempts to ignore failures with return code -ENOTSUPP.
-ENOTSUPP is also excluded from error logging in soc_component_ret().

However, hdmi_codec_set_jack() returns -E*OP*NOTSUPP if jack detection
is not supported, which is not handled in apq8016_sbc and soc_component_ret().
Make it return -ENOTSUPP instead to fix sound and silence the errors.

Bug: 239396464
Change-Id: Id38ce1cdfc80daaac7d77212cecd29dd6fa4e877
Cc: Cheng-Yi Chiang <cychiang@chromium.org>
Cc: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Fixes: 55c5cc63ab ("ASoC: hdmi-codec: Use set_jack ops to set jack")
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
Acked-by: Nicolin Chen <nicoleotsuka@gmail.com>
Link: https://lore.kernel.org/r/20210107165131.2535-1-stephan@gerhold.net
Signed-off-by: Mark Brown <broonie@kernel.org>
(cherry picked from commit 2a0435df96)
Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
2022-09-15 20:16:04 +00:00
Shengjiu Wang
f5a1cb7fd6 UPSTREAM: ASoC: hdmi-codec: Add RX support
HDMI interface can also be used as receiver, this patch is to
add such support. The most difference compare with TX is that RX
don't need to get edid information.

Bug: 239396464
Change-Id: Ib5f9f347cd50abe95fa9c8a4856bd1a91117ca67
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Link: https://lore.kernel.org/r/1606372608-2329-1-git-send-email-shengjiu.wang@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
(cherry picked from commit 144f836646)
2022-09-15 20:16:04 +00:00
Cheng-Yi Chiang
6140082c11 UPSTREAM: ASoC: hdmi-codec: Get ELD in before reporting plugged event
In plugged callback, ELD should be updated from display driver so that
user space can query information from ELD immediately after receiving jack
plugged event.

When jack is unplugged, clear ELD buffer so that user space does not get
obsolete information of unplugged HDMI.

Bug: 239396464
Change-Id: I2245de6e6f7dbc64863267db864dafdd3af95747
Signed-off-by: Cheng-Yi Chiang <cychiang@chromium.org>
Link: https://lore.kernel.org/r/20201118043852.1338877-1-cychiang@chromium.org
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
(cherry picked from commit 25ce4f2b35)
2022-09-15 20:16:04 +00:00
Robin Peng
185f60f2bb ANDROID: add forward declaration vm_unmapped_area_info
aosp/2215503 remove inclusions from hook definition headers
and build breakage detected on pixel device.

include/trace/hooks/mm.h:80:40: error: declaration of 'struct vm_unmapped_area_info' will not be visible outside of this function

Fix this by adding struct vm_unmapped_area_info forward declaration.

Fixes: 7108d9d0e5 ("ANDROID: remove inclusions from hook definition headers")
Bug: 233047575
Signed-off-by: Robin Peng <robinpeng@google.com>
Change-Id: I8989ba78977a26e13c79f9efb156bf8317c1010e
2022-09-15 01:24:29 +00:00
Soukjin Bae
d1b29856ca ANDROID: net: export symbol for tracepoint_consume_skb
Need to use the tracepoint_consume_skb symbol at module driver

Bug: 244504166
Link: https://lore.kernel.org/lkml/20220617200021.02ad8ffc@kernel.org/T

Signed-off-by: Soukjin Bae <soukjin.bae@samsung.com>
Change-Id: Icffa3e7d2045156691a7711c5f19b309f8356261
2022-09-13 19:34:26 +00:00
Sarthak Kukreti
952141fb92 BACKPORT: dm verity: set DM_TARGET_IMMUTABLE feature flag
commit 4caae58406 upstream.

The device-mapper framework provides a mechanism to mark targets as
immutable (and hence fail table reloads that try to change the target
type). Add the DM_TARGET_IMMUTABLE flag to the dm-verity target's
feature flags to prevent switching the verity target with a different
target type.

Bug: 234475629
Fixes: a4ffc15219 ("dm: add verity target")
Cc: stable@vger.kernel.org
Signed-off-by: Sarthak Kukreti <sarthakkukreti@google.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Mike Snitzer <snitzer@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Lee Jones <joneslee@google.com>
Change-Id: Iaeec7fa3be98a646062439e4551f84242dacfb45
2022-09-12 22:53:31 +00:00
David Howells
b5fe8c470e BACKPORT: pipe: Fix missing lock in pipe_resize_ring()
commit 189b0ddc24 upstream.

pipe_resize_ring() needs to take the pipe->rd_wait.lock spinlock to
prevent post_one_notification() from trying to insert into the ring
whilst the ring is being replaced.

The occupancy check must be done after the lock is taken, and the lock
must be taken after the new ring is allocated.

The bug can lead to an oops looking something like:

 BUG: KASAN: use-after-free in post_one_notification.isra.0+0x62e/0x840
 Read of size 4 at addr ffff88801cc72a70 by task poc/27196
 ...
 Call Trace:
  post_one_notification.isra.0+0x62e/0x840
  __post_watch_notification+0x3b7/0x650
  key_create_or_update+0xb8b/0xd20
  __do_sys_add_key+0x175/0x340
  __x64_sys_add_key+0xbe/0x140
  do_syscall_64+0x5c/0xc0
  entry_SYSCALL_64_after_hwframe+0x44/0xae

Reported by Selim Enes Karaduman @Enesdex working with Trend Micro Zero
Day Initiative.

Bug: 244395411
Fixes: c73be61ced ("pipe: Add general notification queue support")
Reported-by: zdi-disclosures@trendmicro.com # ZDI-CAN-17291
Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Lee Jones <joneslee@google.com>
Change-Id: I129164eb9dba557d5a4370f4eca124b9916774a6
2022-09-12 22:53:02 +00:00
Sean Christopherson
790fa51f7b BACKPORT: KVM: x86: avoid calling x86 emulator without a decoded instruction
commit fee060cd52 upstream.

Whenever x86_decode_emulated_instruction() detects a breakpoint, it
returns the value that kvm_vcpu_check_breakpoint() writes into its
pass-by-reference second argument.  Unfortunately this is completely
bogus because the expected outcome of x86_decode_emulated_instruction
is an EMULATION_* value.

Then, if kvm_vcpu_check_breakpoint() does "*r = 0" (corresponding to
a KVM_EXIT_DEBUG userspace exit), it is misunderstood as EMULATION_OK
and x86_emulate_instruction() is called without having decoded the
instruction.  This causes various havoc from running with a stale
emulation context.

The fix is to move the call to kvm_vcpu_check_breakpoint() where it was
before commit 4aa2691dcb ("KVM: x86: Factor out x86 instruction
emulation with decoding") introduced x86_decode_emulated_instruction().
The other caller of the function does not need breakpoint checks,
because it is invoked as part of a vmexit and the processor has already
checked those before executing the instruction that #GP'd.

This fixes CVE-2022-1852.

Bug: 235183128
Reported-by: Qiuhao Li <qiuhao@sysec.org>
Reported-by: Gaoning Pan <pgn@zju.edu.cn>
Reported-by: Yongkang Jia <kangel@zju.edu.cn>
Fixes: 4aa2691dcb ("KVM: x86: Factor out x86 instruction emulation with decoding")
Cc: stable@vger.kernel.org
Signed-off-by: Sean Christopherson <seanjc@google.com>
Message-Id: <20220311032801.3467418-2-seanjc@google.com>
[Rewrote commit message according to Qiuhao's report, since a patch
 already existed to fix the bug. - Paolo]
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Lee Jones <joneslee@google.com>
Change-Id: I3acbb7fc23566c4108f15960c420384af52c2703
2022-09-12 22:52:56 +00:00
Ziyi Cui
ee742bccf6 ANDROID: power: fix vendor hook in suspend.c
Fix the position of the trace point.

Bug: 241946090
Fixes: 737a5314c9 ("ANDROID: power: Add vendor hook for suspend")
Signed-off-by: Ziyi Cui <ziyic@google.com>
Change-Id: I8bf231ee35e0c0ebcb35722f4c527ab61116901e
2022-09-12 22:23:00 +00:00
Todd Kjos
7108d9d0e5 ANDROID: remove inclusions from hook definition headers
To avoid changing the visibiliy of data types when including
hook definition headers remove header file inclusions from
the hook definition header files.

Instead, the hook definition headers should just have forward
declarations that don't require full definition.

To provide full definitions of the types for the KMI, the
headers that define the types should be included by the
source file that instantiates the hooks - normally
vendor_hooks.c.

Since the KMI is frozen, some of the inclusions are still
required to preserve the CRC associated with symbols. Keep
these inclusions under #ifdef __GENKSYMS__.

This patch results in 17 fewer opaque types in the KMI
(80 vs 97). Of the remaining 80 opaque types, 50 are
defined in C files (and therefore are truly opaque and
cannot be used by vendor modules). That leaves 30
types that still need definition in the KMI.

Bug: 233047575
Signed-off-by: Todd Kjos <tkjos@google.com>
Change-Id: Ibc1173eb4b07fcec21c7abd8e0ab1950b3fb5b34
2022-09-12 17:09:03 +00:00
Todd Kjos
d6ab8e3ba2 Revert "ANDROID: arm64: smp: fix Lockdep warning: RCU used illegally from idle CPU."
This reverts commit 4af50419db.

Causes a build break for kernel_microdroid_aarch64 builds

Change-Id: I385a8e56ae1245bccba4d1b641175e73807da88b
Signed-off-by: Todd Kjos <tkjos@google.com>
2022-09-12 16:54:10 +00:00
Todd Kjos
aa381a5c71 ANDROID: remove CONFIG_TRACEPOINTS from hook definition headers
Remove the obsolete use of CONFIG_TRACEPOINTS in hook definition
header files. The !CONFIG_TRACEPOINTS case is correctly handled
by the included trace header files.

Bug: 233047575
Signed-off-by: Todd Kjos <tkjos@google.com>
Change-Id: I957649bcfef375284f2885cf732ff2960c303837
2022-09-12 16:54:10 +00:00
Linus Torvalds
aff2309034 BACKPORT: watchqueue: make sure to serialize 'wqueue->defunct' properly
commit 353f7988dd upstream.

When the pipe is closed, we mark the associated watchqueue defunct by
calling watch_queue_clear().  However, while that is protected by the
watchqueue lock, new watchqueue entries aren't actually added under that
lock at all: they use the pipe->rd_wait.lock instead, and looking up
that pipe happens without any locking.

The watchqueue code uses the RCU read-side section to make sure that the
wqueue entry itself hasn't disappeared, but that does not protect the
pipe_info in any way.

So make sure to actually hold the wqueue lock when posting watch events,
properly serializing against the pipe being torn down.

Bug: 235277737
Reported-by: Noam Rathaus <noamr@ssd-disclosure.com>
Cc: Greg KH <gregkh@linuxfoundation.org>
Cc: David Howells <dhowells@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Lee Jones <joneslee@google.com>
Change-Id: I42b0d56021be1d8950c3642ae0acc5cdccadb394
2022-09-12 07:24:16 +00:00
Jack Diver
66047fb431 ANDROID: Update the ABI representation
1 symbol(s) added
  'void __bitmap_xor(unsigned long int *, const unsigned long int *, const unsigned long int *, unsigned int)'

Bug: 228779790
Signed-off-by: Jack Diver <diverj@google.com>
Change-Id: Ia7622941d313214eaf1aaf26aba64e0e149fa7ca
2022-09-09 19:27:05 +00:00
John Scheible
d451b4eee2 ANDROID: Update the ABI representation
Add iommu_dma_enable_best_fit_algo symbol.

1 symbol(s) added
  'int iommu_dma_enable_best_fit_algo(struct device *)'

Bug: 245799843
Signed-off-by: John Scheible <johnscheible@google.com>
Change-Id: I5cc4d870556b62e43a3a5f717d23a512a138cb17
2022-09-09 01:15:21 +00:00
Bart Van Assche
3d35c6b91d UPSTREAM: scsi: ufs: core: Reduce the power mode change timeout
The current power mode change timeout (180 s) is so large that it can cause
a watchdog timer to fire. Reduce the power mode change timeout to 10
seconds.

Link: https://lore.kernel.org/r/20220811234401.1957911-1-bvanassche@acm.org
Reviewed-by: Stanley Chu <stanley.chu@mediatek.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit 8f2c96420c)
Change-Id: I89a7f925812b6e1c4ca158bd7b22a41323557ec5
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2022-09-08 09:45:50 -07:00
Konstantin Vyshetsky
5c6d73ac2c BACKPORT: scsi: ufs: core: Increase fDeviceInit poll frequency
UFS devices are expected to clear fDeviceInit flag in single digit
milliseconds. Current values of 5 to 10 millisecond sleep add to increased
latency during the initialization and resume path. This CL lowers the sleep
range to 500 to 1000 microseconds.

Bug: 236993021
Link: https://lore.kernel.org/r/20220421002429.3136933-1-bvanassche@acm.org
Acked-by: Avri Altman <avri.altman@wdc.com>
Signed-off-by: Konstantin Vyshetsky <vkon@google.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit a4e6496fca)
Change-Id: I3a9a01853e89ea73ff5e355007db4730fa853ea0
2022-09-07 04:53:09 +00:00
Jaegeuk Kim
2208908824 FROMGIT: f2fs: increase the limit for reserve_root
This patch increases the threshold that limits the reserved root space from 0.2%
to 12.5% by using simple shift operation.

Typically Android sets 128MB, but if the storage capacity is 32GB, 0.2% which is
around 64MB becomes too small. Let's relax it.

Bug: 243493735
Cc: stable@vger.kernel.org
Reported-by: Aran Dalton <arda@allwinnertech.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Change-Id: Ia76ae8f9dd1c7a5f123a561f081bf5a4a29ac186
(cherry picked from commit cf42f1d7ab33ea2637f3c6b786a76302f719726b
     https://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs.git dev)
2022-09-07 04:53:09 +00:00
Jaegeuk Kim
7af4b3ca30 FROMGIT: f2fs: complete checkpoints during remount
Otherwise, pending checkpoints can contribute a race condition to give a
quota warning.

- Thread                      - checkpoint thread
                              add checkpoints to the list
do_remount()
 down_write(&sb->s_umount);
 f2fs_remount()
                              block_operations()
                               down_read_trylock(&sb->s_umount) = 0
 up_write(&sb->s_umount);
                               f2fs_quota_sync()
                                dquot_writeback_dquots()
                                 WARN_ON_ONCE(!rwsem_is_locked(&sb->s_umount));

Or,

do_remount()
 down_write(&sb->s_umount);
 f2fs_remount()
                              create a ckpt thread
                              f2fs_enable_checkpoint() adds checkpoints
			      wait for f2fs_sync_fs()
                              trigger another pending checkpoint
                               block_operations()
                                down_read_trylock(&sb->s_umount) = 0
 up_write(&sb->s_umount);
                                f2fs_quota_sync()
                                 dquot_writeback_dquots()
                                  WARN_ON_ONCE(!rwsem_is_locked(&sb->s_umount));

Bug: 242127451
Bug: 215554521
Cc: stable@vger.kernel.org
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Change-Id: I85926fe14245058e48bac5699a7b760d7700c653
(cherry picked from commit d14393c5bff2f0c163e6bb384618300e30d19754
     https://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs.git dev)
2022-09-07 04:53:09 +00:00
Jaegeuk Kim
7a04671177 FROMGIT: f2fs: flush pending checkpoints when freezing super
This avoids -EINVAL when trying to freeze f2fs.

Bug: 242127451
Cc: stable@vger.kernel.org
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Change-Id: Id2939642e3b93b42cf1ca03831d6c5e4e54d57fd
(cherry picked from commit a36fe7301268524ffa56ff8a9ad0edec6bd5b85a
     https://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs.git dev)
2022-09-07 04:53:09 +00:00
Chao Yu
f18d40369c FROMGIT: f2fs: remove gc_urgent_high_limited for cleanup
Remove redundant sbi->gc_urgent_high_limited.

Signed-off-by: Chao Yu <chao.yu@oppo.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
(cherry picked from commit 265576181b
     https://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs.git dev)
Change-Id: Id92efe0343922c0b0fc279332ec102f1d8de8ecc
2022-09-07 04:53:09 +00:00
Jaegeuk Kim
68f703b19f FROMGIT: f2fs: fix wrong continue condition in GC
We should decrease the frozen counter.

Cc: stable@vger.kernel.org
Fixes: 325163e989 ("f2fs: add gc_urgent_high_remaining sysfs node")
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
(cherry picked from commit 605b0a778a
     https://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs.git dev)
Change-Id: I892f215e778f7d89b9bbf3dfb292ed820944cf6b
2022-09-07 04:53:09 +00:00
Daeho Jeong
8ecc3b8d53 BACKPORT: f2fs: handle decompress only post processing in softirq
Now decompression is being handled in workqueue and it makes read I/O
latency non-deterministic, because of the non-deterministic scheduling
nature of workqueues. So, I made it handled in softirq context only if
possible, not in low memory devices, since this modification will
maintain decompresion related memory a little longer.

Bug: 232003054
Signed-off-by: Daeho Jeong <daehojeong@google.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Change-Id: I1a7c642e05c2f8544d475039b733403181de641e
(cherry picked from commit 9ef8cd45d7)
2022-09-07 04:53:09 +00:00
Daeho Jeong
23d664773f BACKPORT: f2fs: introduce memory mode
Introduce memory mode to supports "normal" and "low" memory modes.
"low" mode is to support low memory devices. Because of the nature of
low memory devices, in this mode, f2fs will try to save memory sometimes
by sacrificing performance. "normal" mode is the default mode and same
as before.

Bug: 232003054
Signed-off-by: Daeho Jeong <daehojeong@google.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
(cherry picked from commit 60f60d1fd8)
Change-Id: I7cb719b18f0002d7af47f7a18e8ec2f4c534bdd9
2022-09-07 04:53:09 +00:00
Hsiu-Chang Chen
1dd8074b61 ANDROID: Update the ABI representation
1 symbol(s) added
  'int __xa_insert(struct xarray *, unsigned long int, void *, gfp_t)'

Bug: 245009352
Signed-off-by: Hsiu-Chang Chen <hsiuchangchen@google.com>
Change-Id: I80dcbc7d4ef9c1429eace307845c67dc0604f8a0
2022-09-06 15:25:17 +08:00
Greg Kroah-Hartman
9bc5a118ef Revert "ANDROID: usb: host: export additional xhci symbols for ring management"
This reverts commit 6c997d153d.

The symbols exported by it were never used by any external modules, so
remove the unneeded exports.

Bug: 203756332
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I338313c0c2ad1ec83f452db910a6ef9b5ee32b7d
2022-09-04 09:49:48 +02:00
Greg Kroah-Hartman
3743e36578 Revert "ANDROID: GKI: signal: Export for __lock_task_sighand"
This reverts commit a719abf031.

The symbol exported was never used by any external modules, so remove
the unneeded export.

Bug: 158067689
Bug: 203756332
Cc: Abhilasha Rao <abhilasha.hv@samsung.corp-partner.google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I13b65fd0620faf08784dabc7130f199dfa5cf053
2022-09-01 19:24:39 +00:00
Greg Kroah-Hartman
7219ca326a Revert "ANDROID: Sched: Add restricted vendor hooks for scheduler"
This reverts most of commit 292f430816.

Only a small number of the original hooks in this commit were ever used,
so remove all of the unused ones.  The hooks removed are:
	android_rvh_try_to_wake_up
	android_rvh_try_to_wake_up_success
	android_rvh_wake_up_new_task
	android_rvh_new_task_stats
	android_rvh_flush_task
	android_rvh_tick_entry
	android_rvh_schedule
	android_rvh_sched_cpu_starting
	android_rvh_sched_cpu_dying
	android_rvh_account_irq
	android_rvh_place_entity
	android_rvh_update_cpu_capacity
	android_rvh_update_misfit_status

If these are needed by any real user, it can easily be reverted to add it
back and then the symbols must be added to the abi list at the same time
to prevent it from being removed again later.

Bug: 203756332
Bug: 173725277
Cc: Shaleen Agrawal <shalagra@codeaurora.org>
Cc: Pavankumar Kondeti <pkondeti@codeaurora.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: Icc24ed128fe1034ad663b749caa3bc2e2d0efac0
2022-09-01 19:24:39 +00:00
Todd Kjos
4e709a85e5 ANDROID: fix kernelci issue for allnoconfig builds
'allnoconfig' builds failed with:

kernel/sched/sched.h:1203:50: error: ‘struct rq’ has no member named ‘cpu’

rq->cpu needs to be replaced with cpu_of(rq) for !CONFIG_SMP builds

Fixes: 4442801a43 ("ANDROID: sched: Introducing PELT multiplier")
Signed-off-by: Todd Kjos <tkjos@google.com>
Change-Id: Iceb439dc3bba27516b5ecd2c18c9835c23e5a39a
2022-09-01 16:21:53 +00:00
JianMin Liu
909d582d3a ANDROID: sched: Introducing PELT multiplier
The new sysctl sched_pelt_multiplier allows a user to set a clock
multiplier x2 or x4 (x1 being the default). This clock multiplier
artificially speed-up PELT ramp up/down similarly to a faster half-life.
Indeed, if we write PELT as a first order filter:

  y(t) = G * (1 - exp(t/tau))

Then we can see that multiplying the time by a constant X, is the same
as
dividing the time constant tau by X.

  y(t) = G * (1 - exp((t*X)/tau))
  y(t) = G * (1 - exp(t/(tau/X)))

Tau being half-life*ln(2), multiplying the PELT time is the same as
dividing the half-life:

  - x1: 32ms half-life
  - x2: 16ms half-life
  - x4: 8ms  half-life

Internally, a new clock is created: rq->clock_task_mult. It sits in the
clock hierarchy between rq->clock_task and rq->clock_pelt.

Bug: 177593580
Bug: 237219700
Change-Id: I67e6ca7994bebea22bf75732ee11d2b10e0d6b7e
Suggested-by: Morten Rasmussen <morten.rasmussen@arm.com>
Signed-off-by: Vincent Donnefort <vincent.donnefort@arm.com>
Signed-off-by: JianMin Liu <jian-min.liu@mediatek.com>
(cherry picked from commit 4442801a43)
2022-08-31 16:45:35 +00:00
Greg Kroah-Hartman
9cfe2646f7 Revert "ANDROID: vendor_hooks: FPSIMD save/restore by using vendor_hooks"
This reverts commit 74555f3992.

The hook android_vh_is_fpsimd_save is not used by any vendor, so remove
it to help with merge issues with future LTS releases.

If this is needed by any real user, it can easily be reverted to add it
back and then the symbol should be added to the abi list at the same
time to prevent it from being removed again later.

Bug: 203756332
Bug: 149632552
Cc: Wooyeon Kim <wooy88.kim@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: Idecd20a8791c5e4497f8d2222cc54cc42b2ebdff
2022-08-31 13:48:21 +02:00
Greg Kroah-Hartman
c7afbeb17e Revert "ANDROID: mm: export zone_watermark_ok"
This reverts commit e909fe79d2.

The symbols exported in it were never used by any external modules, so
remove the exports as they are not needed.

Bug: 203756332
Bug: 140294230
Cc: Sudarshan Rajagopalan <sudaraja@codeaurora.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: Ib3315ba129773256398a71ffe4c3acb55075b012
2022-08-31 11:46:54 +02:00
Ziyi Cui
e09aff6074 ANDROID: softirq: Add EXPORT_SYMBOL_GPL for softirq and tasklet
The purpose of these symbols are used for getting counter and metrics of long running irq. Currently we only have symbols for irq_handler_entry and irq_handler_exit.

Bug: 227809911
Signed-off-by: Ziyi Cui <ziyic@google.com>
Change-Id: Idf4ccdede5232689b2752283539aee54a5f67866
2022-08-30 23:21:49 +00:00
Woody Lin
dd04e189df ANDROID: Update the ABI representation
1 symbol(s) added
  'int kobject_rename(struct kobject *, const char *)'

Bug: 239090823
Signed-off-by: Woody Lin <woodylin@google.com>
Change-Id: Ifdc8ac7b67a33a94cb3b85f570ddb1a9d1401aaa
2022-08-30 17:36:37 +08:00