Commit Graph

1155873 Commits

Author SHA1 Message Date
SeongJae Park
19364f11a4 UPSTREAM: mm/damon/sysfs: use damon_addr_range for region's start and end values
DAMON has a struct for each address range but DAMON sysfs interface is
using the low type (unsigned long) for storing the start and end addresses
of regions.  Use the dedicated struct for better type safety.

Link: https://lkml.kernel.org/r/20221026225943.100429-6-sj@kernel.org
Signed-off-by: SeongJae Park <sj@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

(cherry picked from commit 789a230613)

Bug: 300502883
Change-Id: I3bcd00e51144728c7daace32bd1f5283a1ff9e3f
Signed-off-by: cui yangpei <cuiyangpei@xiaomi.com>
2023-12-16 01:38:42 +00:00
SeongJae Park
b6e6b1dbf8 UPSTREAM: mm/damon/core: split out scheme quota adjustment logic into a new function
DAMOS quota adjustment logic in 'kdamond_apply_schemes()', has some amount
of code, and the logic is not so straightforward.  Split it out to a new
function for better readability.

Link: https://lkml.kernel.org/r/20221026225943.100429-5-sj@kernel.org
Signed-off-by: SeongJae Park <sj@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

(cherry picked from commit 898810e5ca)

Bug: 300502883
Change-Id: I2d13cf290774d36884b533fe703eb01dfc47094c
Signed-off-by: cui yangpei <cuiyangpei@xiaomi.com>
2023-12-16 01:38:42 +00:00
SeongJae Park
43475d9708 UPSTREAM: mm/damon/core: split out scheme stat update logic into a new function
The function for applying a given DAMON scheme action to a given DAMON
region, 'damos_apply_scheme()' is not quite short.  Make it better to read
by splitting out the stat update logic into a new function.

Link: https://lkml.kernel.org/r/20221026225943.100429-4-sj@kernel.org
Signed-off-by: SeongJae Park <sj@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

(cherry picked from commit d1cbbf621f)

Bug: 300502883
Change-Id: I1502a102cdd6959494c249b3633ff97af6ccb94c
Signed-off-by: cui yangpei <cuiyangpei@xiaomi.com>
2023-12-16 01:38:42 +00:00
SeongJae Park
0b0a43029e UPSTREAM: mm/damon/core: split damos application logic into a new function
The DAMOS action applying function, 'damon_do_apply_schemes()', is still
long and not easy to read.  Split out the code for applying a single
action to a single region into a new function for better readability.

Link: https://lkml.kernel.org/r/20221026225943.100429-3-sj@kernel.org
Signed-off-by: SeongJae Park <sj@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

(cherry picked from commit e63a30c51f)

Bug: 300502883
Change-Id: Iea228c7ed452fffb72f3d9a94078ad00dabf3269
Signed-off-by: cui yangpei <cuiyangpei@xiaomi.com>
2023-12-16 01:38:42 +00:00
SeongJae Park
6c7495f04a UPSTREAM: mm/damon/core: split out DAMOS-charged region skip logic into a new function
Patch series "mm/damon: cleanup and refactoring code", v2.

This patchset cleans up and refactors a range of DAMON code including the
core, DAMON sysfs interface, and DAMON modules, for better readability and
convenient future feature implementations.

In detail, this patchset splits unnecessarily long and complex functions
in core into smaller functions (patches 1-4).  Then, it cleans up the
DAMON sysfs interface by using more type-safe code (patch 5) and removing
unnecessary function parameters (patch 6).  Further, it refactor the code
by distributing the code into multiple files (patches 7-10).  Last two
patches (patches 11 and 12) deduplicates and remove unnecessary header
inclusion in DAMON modules (reclaim and lru_sort).

This patch (of 12):

The DAMOS action applying function, 'damon_do_apply_schemes()', is quite
long and not so simple.  Split out the already quota-charged region skip
code, which is not a small amount of simple code, into a new function with
some comments for better readability.

Link: https://lkml.kernel.org/r/20221026225943.100429-1-sj@kernel.org
Link: https://lkml.kernel.org/r/20221026225943.100429-2-sj@kernel.org
Signed-off-by: SeongJae Park <sj@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

(cherry picked from commit 2ea3498980)

Bug: 300502883
Change-Id: I416f3c24d8a6e41df5512a8cfee57a9de26ae185
Signed-off-by: cui yangpei <cuiyangpei@xiaomi.com>
2023-12-16 01:38:42 +00:00
Lee Jones
ac1031618a ANDROID: Snapshot Mainline's version of checkpatch.pl
Nothing fancy here.  Keeping full history is not required.

  `git checkout mainline/master -- scripts/checkpatch.pl`

This may need to be done periodically.

Bug: 316492624
Signed-off-by: Lee Jones <joneslee@google.com>
Change-Id: I4c90b50197ca7277c59e96bf332ecf795c4f3d12
2023-12-15 09:36:46 +00:00
Keir Fraser
4fa87d4d8f ANDROID: KVM: arm64: Skip prefaulting ptes which will be modified later
Block mappings can be split as part of a page table update. When
prefaulting entries during the split, it is pointless to install
valid ptes which will later be modified by the same walk.

At the same time, push the check for pte_is_counted into the
prefault handler, where it logically belongs.

Bug: 308373293
Change-Id: If4599b2860aa62d82ce8db019a8410c2d883de71
Signed-off-by: Keir Fraser <keirf@google.com>
2023-12-15 08:45:53 +00:00
Keir Fraser
fbc707442c ANDROID: KVM: arm64: Introduce module_change_host_prot_range
This allows protection attributes to be changed for a range of
pages via a single module API call.

The original API call modifying a single page is now implemented
as a shim on top of the new range-based call.

The ABI STG is also fixed up:

type 'struct pkvm_module_ops' changed
  member 'union { int(* host_stage2_mod_prot_range)(u64, enum kvm_pgtable_prot, u64); struct { u64 android_kabi_reserved1; }; union { }; }' was added
  member 'u64 android_kabi_reserved1' was removed

Bug: 308373293
Change-Id: I6fbb2e0b325aa972148f48746565dcc10d74edaf
Signed-off-by: Keir Fraser <keirf@google.com>
2023-12-15 08:45:53 +00:00
Keir Fraser
fd720ebc6a ANDROID: KVM: arm64: Relax checks in module_change_host_page_prot
Modules can only relax permissions to RWX. This seems rather arbitrary.
Instead, allow any valid permissions to be set, as long as the page is
a pristine host page, or already module owned.

Bug: 308373293
Change-Id: I905786fad6543f47a00bd9b9f07e17dd660d457c
Signed-off-by: Keir Fraser <keirf@google.com>
2023-12-15 08:45:53 +00:00
Keir Fraser
f082d22541 ANDROID: KVM: arm64: Optimise module_change_host_page_prot
Merge the relaxation and restriction paths to both only need to adjust
permissions. This avoids un-map + re-map on the restriction path; and
avoids installing an annotated entry on the relaxation path (which
will cause a translation fault on first access by the host).

Bug: 308373293
Change-Id: I9c7a6ac149aad64b19a5ce7808334188475b27cc
Signed-off-by: Keir Fraser <keirf@google.com>
2023-12-15 08:45:53 +00:00
Will Deacon
01dd8c280b ANDROID: KVM: arm64: Prefault entries when splitting a block mapping
When splitting a block mapping, we install a table entry pointing to an
empty page and recreate the new entries lazily as we fault them in. For
page-tables with the KVM_PGTABLE_S2_IDMAP flag, this can result in
unnecessary translation faults.

When splitting a block for a page-table with KVM_PGTABLE_S2_IDMAP set,
pre-populate the newly allocate page-table page with contiguous ptes
based on the attributes of the block.

Bug: 308373293
Change-Id: I0c53d048de913e193830caef93d75755270db709
Signed-off-by: Will Deacon <willdeacon@google.com>
Signed-off-by: Keir Fraser <keirf@google.com>
2023-12-15 08:45:53 +00:00
Elliot Berman
cc653d701f ANDROID: virt: gunyah: Zero state_data after vcpu_run
Do not re-use stale state_data on subsequent vcpu runs as the stale data
could be interpreted by Gunyah and rejected.

Bug: 268234781
Change-Id: I3d4bf7a922da1e0e85006ffa58b64a74e320d3c9
Signed-off-by: Elliot Berman <quic_eberman@quicinc.com>
2023-12-14 15:39:09 -08:00
Benjamin Schwartz
cc294d9503 ANDROID: Update the ABI symbol list
Adding the following symbols:
     - __traceiter_android_vh_ep_create_wakeup_source
     - __traceiter_android_vh_timerfd_create
     - __tracepoint_android_vh_ep_create_wakeup_source
     - __tracepoint_android_vh_timerfd_create

Bug: 155142106

Change-Id: Ie895faefacd62674ac58783ba6a3cd5c3bc46637
Signed-off-by: Benjamin Schwartz <bsschwar@google.com>
2023-12-14 17:32:26 +00:00
Manish Varma
956a0d3998 ANDROID: fs: Add vendor hooks for ep_create_wakeup_source & timerfd_create
timerfd doesn't create any wakelocks, but eventpoll can.  When it does,
it names them after the underlying file descriptor, and since all
timerfd file descriptors are named "[timerfd]" (which saves memory on
systems like desktops with potentially many timerfd instances), all
wakesources created as a result of using the eventpoll-on-timerfd idiom
are called... "[timerfd]".

However, it becomes impossible to tell which "[timerfd]" wakesource is
affliated with which process and hence troubleshooting is difficult.

Adding vendor hooks to allow vendor to assign appropriate names to
timerfd descriptors and eventoll wakesource.

Bug: 155142106

Signed-off-by: Manish Varma <varmam@google.com>
Change-Id: I330a42ab48bed4b26d5eb2f636925c66061165ec
(cherry picked from commit 0ff110fbb3)
2023-12-13 15:54:47 -08:00
DooHyun Hwang
d8d2b95fd0 ANDROID: ABI: update symbol list for galaxy
2 function symbol(s) added
  'int scsi_device_quiesce(struct scsi_device*)'
  'void scsi_device_resume(struct scsi_device*)'

Bug: 316076675
Change-Id: I301b9445f41736ae485c3779b7164962c17117b2
Signed-off-by: DooHyun Hwang <dh0421.hwang@samsung.com>
2023-12-13 17:58:33 +00:00
Lee Jones
bcc758eed7 Reapply "binder: fix UAF caused by faulty buffer cleanup"
This reverts commit 9f67f4f500.

Vanir complained that this fix was missing, but only from this branch.

Let's bring it back and see how the ABI checker behaves.

Bug: 275041864
Bug: 308350116
Signed-off-by: Lee Jones <joneslee@google.com>
Change-Id: I1fc248582347a295d9168bbd8e55dbd6880e34ed
2023-12-13 09:41:09 +00:00
Joerg Roedel
b2b3a1e6d1 UPSTREAM: x86/sev: Check for user-space IOIO pointing to kernel space
Upstream commit: 63e44bc520

Check the memory operand of INS/OUTS before emulating the instruction.
The #VC exception can get raised from user-space, but the memory operand
can be manipulated to access kernel memory before the emulation actually
begins and after the exception handler has run.

  [ bp: Massage commit message. ]

Bug: 309733863
Fixes: 597cfe4821 ("x86/boot/compressed/64: Setup a GHCB-based VC Exception handler")
Reported-by: Tom Dohrmann <erbse.13@gmx.de>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Cc: <stable@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 57d0639f60)
Signed-off-by: Lee Jones <joneslee@google.com>
Change-Id: Iac1c2f15cc922ab215d57654b004d020a0b65e53
2023-12-12 18:32:31 +00:00
Joerg Roedel
62b97630d4 UPSTREAM: x86/sev: Check IOBM for IOIO exceptions from user-space
Upstream commit: b9cb9c4558

Check the IO permission bitmap (if present) before emulating IOIO #VC
exceptions for user-space. These permissions are checked by hardware
already before the #VC is raised, but due to the VC-handler decoding
race it needs to be checked again in software.

Bug: 309733863
Fixes: 25189d08e5 ("x86/sev-es: Add support for handling IOIO exceptions")
Reported-by: Tom Dohrmann <erbse.13@gmx.de>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Tested-by: Tom Dohrmann <erbse.13@gmx.de>
Cc: <stable@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit def94eb9a8)
Signed-off-by: Lee Jones <joneslee@google.com>
Change-Id: Ia520acc67da21353148fd07a3a8e48ee8a97d364
2023-12-12 18:32:28 +00:00
Guan-Yu Lin
071c14698c FROMGIT: usb: typec: tcpm: skip checking port->send_discover in PD3.0
The original Collison Avoidance mechanism, port->send_discover, avoids
the conflict when port partners start AMS almost the same time. However,
this mechanism is replaced by SINK_TX_OK and SINK_TX_NG. Skip the check
in PD3.0 to avoid the deadlock when source is requesting DR_SWAP where
sink is requesting DISCOVER_IDENTITY.

Signed-off-by: Guan-Yu Lin <guanyulin@google.com>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/r/20231116083221.1201892-1-guanyulin@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Bug: 292178486
(cherry picked from commit e0cc05d52ad310cced029449bcda0f9fc847097c
 https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git/ usb-next)
Change-Id: I4691628d8085dfa7be9189b2bd598896664c38b5
Signed-off-by: Guan-Yu Lin <guanyulin@google.com>
2023-12-12 17:25:38 +00:00
Will Deacon
a9567a35d0 ANDROID: arm64: Disable workaround for CPU errata 2441007 and 2441009
CPU errata 2441007 (Cortex-A55) and 2441009 (Cortex-A510) are categorised
as "rare" by Arm and consequently the workaround is not intended to be
deployed in practice as the issue is not expected to occur in real-world
environments.

Given that the cost of the workaround, which issues additional broadcast
TLB invalidation requests, has been shown to impact kswapd significantly
on Pixel devices, disable the workaround following Arm's recommendation.

Bug: 306231846
Signed-off-by: Will Deacon <willdeacon@google.com>
Change-Id: I39b6d9736cfa79827321151b45774f62c8d1a747
(cherry picked from commit 4ba6c3197c)
2023-12-12 08:17:04 +00:00
Richard Chang
2d8a5ddebb ANDROID: Update the ABI symbol list
Adding the following symbol:
  - __cma_alloc

Bug: 308881290
Change-Id: I5b3ffb0c804dc636355c1462aaa6e96b1189446b
Signed-off-by: Richard Chang <richardycc@google.com>
2023-12-11 02:12:31 +00:00
Jong eon Park
ddf142e5a8 ANDROID: netlink: add netlink poll and hooks
In huge uevents generating system, especially for user apps who have
small size of rcvbuf socket, it has been reported that netlink overrun
happens quite frequently.

Moreover, if there's no POLLERR (caused by this netlink overrun) handler
in user apps, the system can almost be stucked by calling 'poll' repeatedly.

Regarding this issue, I have sent a kernel netlink patch to linux
maintainers and got replied that this is absolutely user app's problem,
must not addressing kernel.

Until Android team look into this issue and some modification comes out,
we need kernel patch for temporary. To minimize the effect by this patch
to the others who have never met this issue, I would like to just add
netlink's dedicated poll and its hooks.

Please refer to below v1/v2 patch links for history.

v1: https://lore.kernel.org/netdev/20231110110002.7279f895@kernel.org/T/#t
v2: https://lore.kernel.org/netdev/d599922fd89b3e61c7cf531a03ea8b81cbcb003e.camel@redhat.com/T/#t

Bug: 300009377
Link: https://lore.kernel.org/netdev/d599922fd89b3e61c7cf531a03ea8b81cbcb003e.camel@redhat.com/T/#t

Change-Id: I4f11399d61c10332ba05bac64cfa1e92bb111565
Signed-off-by: Jong eon Park <jongeon.park@samsung.com>
2023-12-08 20:50:05 +00:00
Taylor Nelms
c9b5c232e7 ANDROID: Update the ABI symbol list
Adding the following symbols:
  - devm_drm_of_get_bridge
  - drm_kms_helper_connector_hotplug_event
  - of_find_mipi_dsi_host_by_node
  - of_get_parent
  - of_graph_get_remote_node

1 function symbol(s) added
  'void drm_kms_helper_connector_hotplug_event(struct drm_connector*)'

Bug: 303500701
Change-Id: Ief76bed701a62cb89cad78cc3d141ee6c6a84dad
Signed-off-by: Taylor Nelms <tknelms@google.com>
2023-12-07 19:24:02 +00:00
Seiya Wang
3c9cb9c06f ANDROID: GKI: Update symbol list for mtk
ABI impact

8 function symbol(s) added
  'struct mii_bus* devm_mdiobus_alloc_size(struct device*, int)'
  'struct phy_device* of_phy_get_and_connect(struct net_device*, struct device_node*, void(*)(struct net_device*))'
  'int pci_enable_device_mem(struct pci_dev*)'
  'int pci_prepare_to_sleep(struct pci_dev*)'
  'int pci_select_bars(struct pci_dev*, unsigned long)'
  'void phy_support_asym_pause(struct phy_device*)'
  'int ptp_find_pin(struct ptp_clock*, enum ptp_pin_function, unsigned int)'
  'int ptp_schedule_worker(struct ptp_clock*, unsigned long)'

1 variable symbol(s) added
  'struct efi efi'

Add following symbols

devm_alloc_etherdev_mqs
devm_mdiobus_alloc_size
efi
eth_prepare_mac_addr_change
of_get_mac_address
of_phy_get_and_connect
pci_disable_msi
pci_disable_msix
pci_enable_device_mem
pci_enable_msi
pci_enable_msix_range
pci_prepare_to_sleep
pci_release_selected_regions
pci_request_selected_regions
pci_select_bars
pci_set_power_state
phy_connect_direct
phy_ethtool_get_eee
phy_ethtool_get_wol
phy_ethtool_set_eee
phy_ethtool_set_wol
phy_find_first
phy_init_eee
phy_mii_ioctl
phy_remove_link_mode
phy_start_aneg
phy_support_asym_pause
ptp_clock_event
ptp_clock_index
ptp_clock_register
ptp_clock_unregister
ptp_find_pin
ptp_schedule_worker

Bug: 315023870
Signed-off-by: Seiya Wang <seiya.wang@mediatek.com>
Change-Id: I046b656fe9049a701ca6a440111eb4bfa420cf52
2023-12-06 19:32:59 +00:00
Richard Chang
5723833390 ANDROID: mm: lru_cache_disable skips lru cache drainnig
lru_cache_disable is not trivial cost since it should run work
from every cores in the system. Thus, repeated call of the
function whenever alloc_contig_range in the cma's allocation loop
is called is expensive.

This patch makes the lru_cache_disable smarter in that it will
not run __lru_add_drain_all since it knows the cache was already
disabled by someone else.
With that, user of alloc_contig_range can disable the lru cache
in advance in their context so that subsequent alloc_contig_range
for user's operation will avoid the costly function call.

Bug: 313795505
Change-Id: Icbb0e6dbf74644d45f562fd1d845888ca1f1f347
Signed-off-by: Richard Chang <richardycc@google.com>
(cherry picked from commit 816567b17866ca3f9a11e670bd52c82335cbb448)
2023-12-06 18:54:20 +00:00
Richard Chang
0de2f42977 ANDROID: mm: cma: introduce __cma_alloc API
This patch enhances the CMA API with support for failfast mode,
utilizing the __GFP_NORETRY flag. This mode is specifically designed
for high-order bulk allocation scenarios, enabling the CMA API to
avoid prolonged stalls resulting from blocking pages such as those
undergoing page writeback or page locking. Instead of stalling, the
API will continue searching for readily migratable pages across
different pageblocks.

The original patch link:
Link: https://lore.kernel.org/linux-mm/YAnM5PbNJZlk%2F%2FiX@google.com/T/#m36b144ff81fe0a8f0ecaf6813de4819ecc41f8fe

Bug: 308881290
Change-Id: I1c623f17fb49c26005aaffc17330cf820ce6585c
Signed-off-by: Richard Chang <richardycc@google.com>
(cherry picked from commit 3390547fec36527ed15dd213ee55d397f83ffa46)
2023-12-06 18:54:20 +00:00
Eric Biggers
db9d7ba706 ANDROID: Update the ABI representation
INFO: type 'struct fscrypt_info' changed
  member 'u8 ci_data_unit_bits' was added
  member 'u8 ci_data_units_per_block_bits' was added

type 'struct fscrypt_policy_v2' changed
  member '__u8 log2_data_unit_size' was added
  member changed from '__u8 __reserved[4]' to '__u8 __reserved[3]'
    offset changed from 32 to 40
    type changed from '__u8[4]' to '__u8[3]'
      number of elements changed from 4 to 3

Bug: 299136786
Bug: 302588300
Change-Id: Idbbc2123961a41d395323c72cef67d94bdd17ab0
Signed-off-by: Eric Biggers <ebiggers@google.com>
2023-12-06 17:54:14 +00:00
Eric Biggers
6b972d6047 BACKPORT: fscrypt: support crypto data unit size less than filesystem block size
Until now, fscrypt has always used the filesystem block size as the
granularity of file contents encryption.  Two scenarios have come up
where a sub-block granularity of contents encryption would be useful:

1. Inline crypto hardware that only supports a crypto data unit size
   that is less than the filesystem block size.

2. Support for direct I/O at a granularity less than the filesystem
   block size, for example at the block device's logical block size in
   order to match the traditional direct I/O alignment requirement.

(1) first came up with older eMMC inline crypto hardware that only
supports a crypto data unit size of 512 bytes.  That specific case
ultimately went away because all systems with that hardware continued
using out of tree code and never actually upgraded to the upstream
inline crypto framework.  But, now it's coming back in a new way: some
current UFS controllers only support a data unit size of 4096 bytes, and
there is a proposal to increase the filesystem block size to 16K.

(2) was discussed as a "nice to have" feature, though not essential,
when support for direct I/O on encrypted files was being upstreamed.

Still, the fact that this feature has come up several times does suggest
it would be wise to have available.  Therefore, this patch implements it
by using one of the reserved bytes in fscrypt_policy_v2 to allow users
to select a sub-block data unit size.  Supported data unit sizes are
powers of 2 between 512 and the filesystem block size, inclusively.
Support is implemented for both the FS-layer and inline crypto cases.

This patch focuses on the basic support for sub-block data units.  Some
things are out of scope for this patch but may be addressed later:

- Supporting sub-block data units in combination with
  FSCRYPT_POLICY_FLAG_IV_INO_LBLK_64, in most cases.  Unfortunately this
  combination usually causes data unit indices to exceed 32 bits, and
  thus fscrypt_supported_policy() correctly disallows it.  The users who
  potentially need this combination are using f2fs.  To support it, f2fs
  would need to provide an option to slightly reduce its max file size.

- Supporting sub-block data units in combination with
  FSCRYPT_POLICY_FLAG_IV_INO_LBLK_32.  This has the same problem
  described above, but also it will need special code to make DUN
  wraparound still happen on a FS block boundary.

- Supporting use case (2) mentioned above.  The encrypted direct I/O
  code will need to stop requiring and assuming FS block alignment.
  This won't be hard, but it belongs in a separate patch.

- Supporting this feature on filesystems other than ext4 and f2fs.
  (Filesystems declare support for it via their fscrypt_operations.)
  On UBIFS, sub-block data units don't make sense because UBIFS encrypts
  variable-length blocks as a result of compression.  CephFS could
  support it, but a bit more work would be needed to make the
  fscrypt_*_block_inplace functions play nicely with sub-block data
  units.  I don't think there's a use case for this on CephFS anyway.

Link: https://lore.kernel.org/r/20230925055451.59499-6-ebiggers@kernel.org
Signed-off-by: Eric Biggers <ebiggers@google.com>

Bug: 299136786
Bug: 302588300
(cherry picked from commit 5b11888471806edf699316d4dcb9b426caebbef2)
(Reworked this commit to not change struct fscrypt_operations and not
 depend on other commits that changed struct fscrypt_operations.  Also
 resolved conflicts with the HW-wrapped key support.)
Change-Id: Ic3dc56ef3f42d123f812e9037e2cc6f0b24bacc1
Signed-off-by: Eric Biggers <ebiggers@google.com>
2023-12-06 17:54:14 +00:00
Pablo Neira Ayuso
72bdb74622 UPSTREAM: netfilter: nf_tables: remove catchall element in GC sync path
[ Upstream commit 93995bf4af2c5a99e2a87f0cd5ce547d31eb7630 ]

The expired catchall element is not deactivated and removed from GC sync
path. This path holds mutex so just call nft_setelem_data_deactivate()
and nft_setelem_catchall_remove() before queueing the GC work.

Bug: 310691882
Fixes: 4a9e12ea7e ("netfilter: nft_set_pipapo: call nft_trans_gc_queue_sync() in catchall GC")
Reported-by: lonial con <kongln9170@gmail.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 13e2d49647)
Signed-off-by: Lee Jones <joneslee@google.com>
Change-Id: Ic5d1d98fe5a749e759869f0789cbb77c4ab5e6c2
2023-12-06 14:44:26 +00:00
liwei
924116f1b8 ANDROID: GKI: Update oplus symbol list
1 function symbol(s) added
  'int __traceiter_mm_vmscan_kswapd_wake(void*, int, int, int)'

1 variable symbol(s) added
  'struct tracepoint __tracepoint_mm_vmscan_kswapd_wake'

Bug: 309352303
Change-Id: Id46347110c482eca8d0fb12bd1dd69a14ad8a337
Signed-off-by: liwei <liwei1234@oppo.com>
2023-12-05 20:22:28 +00:00
liwei
0ad2a3cd4d ANDROID: vendor_hooks: export tracepoint symbol trace_mm_vmscan_kswapd_wake
export tracepoint symbol trace_mm_vmscan_kswapd_wake so we can hook it in our ko
to capture some kswapd running info.

Bug: 309352303
Change-Id: Ieb37f544502f33e708dacda6cbb552792dfbbc6b
Signed-off-by: liwei <liwei1234@oppo.com>
2023-12-05 20:22:28 +00:00
luguohong
6465e29536 BACKPORT: HID: input: map battery system charging
HID descriptors with Battery System (0x85) Charging (0x44) usage are
ignored and POWER_SUPPLY_STATUS_DISCHARGING is always reported to user
space, even when the device is charging.

Map this usage and when it is reported set the right charging status.

In addition, add KUnit tests to make sure that the charging status is
correctly set and reported. They can be run with the usual command:

    $ ./tools/testing/kunit/kunit.py run --kunitconfig=drivers/hid

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>

Bug: 305125317
Change-Id: Iad6a8177ad6954ad8ac2b714cc35acffcf2f226f
(cherry picked from commit a608dc1c06)
Signed-off-by: luguohong <luguohong@xiaomi.corp-partner.google.com>
2023-12-01 19:04:48 +00:00
Paul Lawrence
cfdfc17a46 ANDROID: fuse-bpf: Ignore readaheads unless they go to the daemon
readpages will be triggered on the fuse fs in passthrough mode though
system calls like fadvise. If the daemon isn't aware of the file, this
will likely cause a hang.

For the moment, simply ignore fadvise in this situation

Bug: 301201239
Test: fuse_test, atest ScopedStorageDeviceTest both pass
Signed-off-by: Paul Lawrence <paullawrence@google.com>
Change-Id: I524a84aeeb1b1593e51264fcc37f7cfa66757168
2023-12-01 18:11:28 +00:00
Jaegeuk Kim
354b1b716c FROMGIT: f2fs: skip adding a discard command if exists
When recovering zoned UFS, sometimes we add the same zone to discard multiple
times. Simple workaround is to bypass adding it.

Reviewed-by: Chao Yu <chao@kernel.org>
Change-Id: Ic1501caa02aea8bdc9d7f00a8bd0d35be2ef4ba1
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
(cherry picked from commit bbd3efed3383e332191c665786c61653826d2ac3
 https://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs.git dev)
2023-11-30 12:27:28 -08:00
Daeho Jeong
ccbea4f458 UPSTREAM: f2fs: clean up zones when not successfully unmounted
We can't trust write pointers when the previous mount was not
successfully unmounted.

Change-Id: If67696db9ab820a805711b43cabb50c796c9f75f
Signed-off-by: Daeho Jeong <daehojeong@google.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
(cherry picked from commit 9f792ab8e33de727993bbd84ece892e72de18c85)
2023-11-30 12:25:22 -08:00
Daeho Jeong
88cccede6d UPSTREAM: f2fs: use finish zone command when closing a zone
Use the finish zone command first when a zone should be closed.

Change-Id: Ie38800c2787392980f7914ad10b5f92f6d59e99b
Signed-off-by: Daeho Jeong <daehojeong@google.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
(cherry picked from commit 3b71661214)
2023-11-30 12:24:46 -08:00
Daeho Jeong
b2d3a555d3 UPSTREAM: f2fs: check zone write pointer points to the end of zone
We don't need to report an issue, when the zone write pointer already
points to the end of the zone, since the zone mismatch is already taken
care.

Change-Id: Ifc967abe44521cd239ebac509353c25e36cc7a18
Signed-off-by: Daeho Jeong <daehojeong@google.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
(cherry picked from commit c9667b19e2)
2023-11-30 12:24:00 -08:00
Daeho Jeong
c9e29a0073 UPSTREAM: f2fs: close unused open zones while mounting
Zoned UFS allows only 6 open zones at the same time, so we need to take
care of the count of open zones while mounting.

Change-Id: Ie197b9e9e47b3397446ce2cf97168c9f68fea431
Signed-off-by: Daeho Jeong <daehojeong@google.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
(cherry picked from commit 04abeb699d)
2023-11-30 12:23:09 -08:00
Daeho Jeong
e92b866e22 UPSTREAM: f2fs: maintain six open zones for zoned devices
To keep six open zone constraints, make them not to be open over six
open zones.

Change-Id: If5d02581073f90db4cadd8f928cef9abc5bac8a7
Signed-off-by: Daeho Jeong <daehojeong@google.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
(cherry picked from commit e067dc3c6b)
2023-11-30 12:20:46 -08:00
Fangzheng Zhang
088f228370 ANDROID: update symbol for unisoc whitelist
Add kmalloc_large_order_alloced

1 function symbol(s) added
  'int __traceiter_android_vh_kmalloc_large_alloced(void*, struct page*, unsigned int, gfp_t)'

1 variable symbol(s) added
  'struct tracepoint __tracepoint_android_vh_kmalloc_large_alloced'

Bug: 312897430
Change-Id: I586956fb3cef3d9c5dde63f08de9ed46715163c6
Signed-off-by: Fangzheng Zhang <fangzheng.zhang@unisoc.com>
2023-11-30 18:19:39 +00:00
Fangzheng Zhang
aa71a02cf3 ANDROID: vendor_hooks: mm: add hook to count the number pages
allocated for each slab

Add the tracing interface on the kmalloc_large allocation path,
which can detect the number of pages allocated by the slab,
and if exceeds a threshold, trigger a panic or other actions.

Bug: 312897430
Change-Id: I5575d0e4f91dab1c6e074f3e907fee8ea9327fd7
Signed-off-by: Fangzheng Zhang <fangzheng.zhang@unisoc.com>
2023-11-30 18:19:39 +00:00
Rick Yiu
4326c78f84 ANDROID: Update the ABI symbol list
Adding the following symbols:
  - __traceiter_android_rvh_set_user_nice_locked
  - __tracepoint_android_rvh_set_user_nice_locked

Bug: 300872872
Change-Id: I370d51175efc5ac1bf997bc2425cff8ab00b9b19
Signed-off-by: Rick Yiu <rickyiu@google.com>
2023-11-30 18:18:44 +00:00
Rick Yiu
eb67f58322 ANDROID: sched: Add trace_android_rvh_set_user_nice_locked
We will need vendor hook of set_user_nice with lock to avoid race
condition.

Bug: 300872872
Change-Id: I24fc1e13cc6578dcc418d956a5146ad29ff76a56
Signed-off-by: Rick Yiu <rickyiu@google.com>
2023-11-30 18:18:44 +00:00
yixuanjiang
855511173d UPSTREAM: ASoC: soc-compress: Fix deadlock in soc_compr_open_fe
[ Upstream commit 2222214749 ]

Modify the error handling flow by release lock.
The require mutex will keep holding if open fail.

Fixes: aa9ff6a495 ("ASoC: soc-compress: Reposition and add pcm_mutex")
Signed-off-by: yixuanjiang <yixuanjiang@google.com>
Link: https://lore.kernel.org/r/20230619033127.2522477-1-yixuanjiang@google.com
Signed-off-by: Mark Brown <broonie@kernel.org>

Bug: 303236405
Change-Id: I64172b9d40b061239c7e4087f34759c3b23cfa6a
Signed-off-by: Yixuan Jiang <yixuanjiang@google.com>
2023-11-30 18:09:27 +00:00
Kuninori Morimoto
6cb2109589 BACKPORT: ASoC: add snd_soc_card_mutex_lock/unlock()
ASoC need to use card->mutex with _INIT or _RUNTIME,
but there is no helper function for it.

This patch adds its helper function and use it.

Because people might misunderstand that _init() is mutex initialization,
this patch renames _INIT to _ROOT and adds new
snd_soc_card_mutex_lock_root() for it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87a5zlx3tw.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>

Bug: 303236405
(cherry picked from commit 0f3b818486)
[ Yixuan Jiang: Fix minor conflict ]
Change-Id: Ie8cd7aeeea759576423760d25b5fb5b2c9ae0d12
Signed-off-by: Yixuan Jiang <yixuanjiang@google.com>
2023-11-30 18:09:27 +00:00
Kuninori Morimoto
edfef8fdc9 BACKPORT: ASoC: expand snd_soc_dpcm_mutex_lock/unlock()
soc-pcm.c has snd_soc_dpcm_mutex_lock/unlock(),
but other files can't use it because it is static function.

It requests snd_soc_pcm_runtime as parameter (A), but sometimes we
want to use it by snd_soc_card (B).

(A)	static inline void snd_soc_dpcm_mutex_lock(struct snd_soc_pcm_runtime *rtd)
	{
		mutex_lock_nested(&rtd->card->pcm_mutex, rtd->card->pcm_subclass);
	}			   ^^^^^^^^^

(B)	mutex_lock_nested(&card->pcm_mutex, card->pcm_subclass);
			   ^^^^

We want to use it with both "rtd" and "card" for dapm lock/unlock.
To enable it, this patch uses _Generic macro.

This patch makes snd_soc_dpcm_mutex_{un}lock() global function, and use it on
each files.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87bkk1x3ud.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>

Bug: 303236405
(cherry picked from commit 38e42f6d6c)
[ Yixuan Jiang: Fix minor conflict ]
Change-Id: Id942841c7ca1642b44b1229a7bf4ab1bc5373707
Signed-off-by: Yixuan Jiang <yixuanjiang@google.com>
2023-11-30 18:09:27 +00:00
Kuninori Morimoto
52771d9792 BACKPORT: ASoC: expand snd_soc_dapm_mutex_lock/unlock()
soc.h has snd_soc_dapm_mutex_lock/unlock() definition and
many drivers are using it, but soc-dapm.c is not.

1st reason is snd_soc_dapm_mutex_lock/unlock() requests
snd_soc_dapm_context pointer as parameter (A), but sometimes soc-dapm.c
needs to use snd_soc_card (B).

(A)	static inline void snd_soc_dapm_mutex_lock(struct snd_soc_dapm_context *dapm)
	{
		mutex_lock_nested(&dapm->card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME);
	}			   ^^^^^^^^^^

(B)	mutex_lock_nested(&card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME);
			   ^^^^

2nd reason is it want to use SND_SOC_DAPM_CLASS_INIT for mutex_lock_nested(),
but helper is using _RUNTIME (A).

The conclusion is we want to use "dapm vs card" and "_RUNTIME vs _INIT"
for dapm lock/unlock. To enable this selfish request, this patch uses
_Generic macro. We can use snd_soc_dapm_mutex_lock/unlock() for both
dapm and card case.

	snd_soc_dapm_mutex_lock(dapm);	snd_soc_dapm_mutex_unlock(dapm);
	snd_soc_dapm_mutex_lock(card);	snd_soc_dapm_mutex_unlock(card);

Current soc-dapm.c is using both mutex_lock() and mutex_lock_nested().
This patch handles mutex_lock() as mutex_lock_nested(..., 0),
in other words, handles below as same.

	mutex_lock(&card->dapm_mutex);
	mutex_lock_nested(&card->dapm_mutex, SND_SOC_DAPM_CLASS_INIT);

Because people might misunderstand that _init() is mutex initialization,
this patch renames _INIT to _ROOT and adds new
snd_soc_dapm_mutex_lock_root() for it.

This patch also moves snd_soc_dapm_subclass definition from soc-dapm.h
to soc.h to keep related code together.

Because very complex soc.h vs soc-dapm.h relationship,
it is difficult/impossible to define these helper into soc-dapm.h.

Change-Id: I064718bbad9d053a0c84549be0a5e942f29a5dee
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87cz4hx3v0.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>

Bug: 303236405
(cherry picked from commit 4a778bdc7a)
[ Yixuan Jiang: Fix minor conflict ]
Change-Id: I0fa12ec9272847c320ccdb0d69eceb2a03853d4e
Signed-off-by: Yixuan Jiang <yixuanjiang@google.com>
2023-11-30 18:09:27 +00:00
Greg Kroah-Hartman
dc61d0ccd6 Merge "Merge tag 'android14-6.1.57_r00' into branch 'android14-6.1'" into android14-6.1 2023-11-30 10:20:44 +00:00
Chungkai Mei
ceb6ff1a69 ANDROID: Update the ABI symbol list
Adding the following symbols:
  - __traceiter_android_rvh_update_load_sum
  - __tracepoint_android_rvh_update_load_sum

Bug: 181105055
Change-Id: Ie70d640f252f40af86aff48bcf2d5cfd80485393
Signed-off-by: Chungkai Mei <chungkai@google.com>
2023-11-29 21:33:45 +00:00
Chungkai Mei
0d97bca80a ANDROID: sched: Add vendor hook for update_load_sum
vendor may have the need to modify update_load_sum function

Bug: 181105055
Change-Id: I35964977a4b8917c62773d48a37340f880774e38
Signed-off-by: Chungkai Mei <chungkai@google.com>
(cherry picked from commit 984523c368)
2023-11-29 21:33:45 +00:00