Commit Graph

1149519 Commits

Author SHA1 Message Date
Cixi Geng
70586aaa7c ANDROID: GKI: Add symbols and update symbol list for Unisoc(2nd)
16 function symbol(s) added
  'void __dynamic_netdev_dbg(struct _ddebug*, const struct net_device*, const char*, ...)'
  'int drm_of_component_probe(struct device*, int(*)(struct device*, void*), const struct component_master_ops*)'
  'int input_ff_create_memless(struct input_dev*, void*, int(*)(struct input_dev*, void*, struct ff_effect*))'
  'u64 ktime_get_boot_fast_ns()'
  'struct dma_chan* of_dma_simple_xlate(struct of_phandle_args*, struct of_dma*)'
  'struct nvmem_cell* of_nvmem_cell_get(struct device_node*, const char*)'
  'struct pinctrl_dev* pinctrl_register(struct pinctrl_desc*, struct device*, void*)'
  'void pinctrl_unregister(struct pinctrl_dev*)'
  'int pinctrl_utils_add_map_mux(struct pinctrl_dev*, struct pinctrl_map**, unsigned int*, unsigned int*, const char*, const char*)'
  'struct power_supply_battery_ocv_table* power_supply_find_ocv2cap_table(struct power_supply_battery_info*, int, int*)'
  'int power_supply_get_battery_info(struct power_supply*, struct power_supply_battery_info**)'
  'int power_supply_ocv2cap_simple(struct power_supply_battery_ocv_table*, int, int)'
  'void power_supply_put_battery_info(struct power_supply*, struct power_supply_battery_info*)'
  'int power_supply_temp2resist_simple(struct power_supply_resistance_temp_table*, int, int)'
  'struct regmap* syscon_regmap_lookup_by_phandle_args(struct device_node*, const char*, int, unsigned int*)'
  'void usb_phy_get_charger_current(struct usb_phy*, unsigned int*, unsigned int*)'

Bug: 282902304
Change-Id: Ibe065ba237b62f3c4222bb8070d13e9e99f90fa5
Signed-off-by: Cixi Geng <cixi.geng1@unisoc.com>
2023-06-07 10:06:20 +00:00
Jaewon Kim
94e4512c31 ANDROID: ABI: update symbol list related to meminfo for galaxy
update symbol list related to meminfo for galaxy

3 variable symbol(s) added
  'struct tracepoint __tracepoint_android_vh_meminfo_cache_adjust'
  'struct tracepoint __tracepoint_android_vh_si_mem_available_adjust'
  'struct tracepoint __tracepoint_android_vh_si_meminfo_adjust'

Bug: 283896254

Change-Id: Ia6081e553312781a37c5eae8b0f6751909fad4bf
Signed-off-by: Jaewon Kim <jaewon31.kim@samsung.com>
2023-06-07 01:06:25 +00:00
Jaewon Kim
a390414140 ANDROID: vendor_hooks: add hooks for extra memory
Add vendor hooks for extra memory. If there is extra memory, this can
be accounted like other memory stats. One of the usecases could be
cleancache. If some of ram memory is used for cleancache, its free,
cache, and total size could be added through these vendor hooks.

Bug: 283896254

Change-Id: Iad7330310528581f09842f45860f05dc84823f41
Signed-off-by: Jaewon Kim <jaewon31.kim@samsung.com>
2023-06-07 01:06:25 +00:00
Zhihao Cheng
c3ee18fefa BACKPORT: FROMLIST: ovl: get_acl: Fix null pointer dereference at realinode in rcu-walk mode
Following process:
         P1                     P2
 path_openat
  link_path_walk
   may_lookup
    inode_permission(rcu)
     ovl_permission
      acl_permission_check
       check_acl
        get_cached_acl_rcu
         ovl_get_inode_acl
          realinode = ovl_inode_real(ovl_inode)
                              drop_cache
                               __dentry_kill(ovl_dentry)
                                iput(ovl_inode)
                                 ovl_destroy_inode(ovl_inode)
                                  dput(oi->__upperdentry)
                                   dentry_kill(upperdentry)
                                    dentry_unlink_inode
                                     upperdentry->d_inode = NULL
            ovl_inode_upper
             upperdentry = ovl_i_dentry_upper(ovl_inode)
             d_inode(upperdentry) // returns NULL
          IS_POSIXACL(realinode) // NULL pointer dereference
, will trigger an null pointer dereference at realinode:
  [  205.472797] BUG: kernel NULL pointer dereference, address:
                 0000000000000028
  [  205.476701] CPU: 2 PID: 2713 Comm: ls Not tainted
                 6.3.0-12064-g2edfa098e750-dirty #1216
  [  205.478754] RIP: 0010:do_ovl_get_acl+0x5d/0x300
  [  205.489584] Call Trace:
  [  205.489812]  <TASK>
  [  205.490014]  ovl_get_inode_acl+0x26/0x30
  [  205.490466]  get_cached_acl_rcu+0x61/0xa0
  [  205.490908]  generic_permission+0x1bf/0x4e0
  [  205.491447]  ovl_permission+0x79/0x1b0
  [  205.491917]  inode_permission+0x15e/0x2c0
  [  205.492425]  link_path_walk+0x115/0x550
  [  205.493311]  path_lookupat.isra.0+0xb2/0x200
  [  205.493803]  filename_lookup+0xda/0x240
  [  205.495747]  vfs_fstatat+0x7b/0xb0

Fetch a reproducer in [Link].

Use the helper ovl_i_path_realinode() to get realinode and then do
non-nullptr checking.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=217404
Fixes: 332f606b32 ("ovl: enable RCU'd ->get_acl()")
Signed-off-by: Zhihao Cheng <chengzhihao1@huawei.com>
Suggested-by: Christian Brauner <brauner@kernel.org>
Suggested-by: Amir Goldstein <amir73il@gmail.com>

Reviewed-by: Amir Goldstein <amir73il@gmail.com>

Bug: 285105314
Link: https://lore.kernel.org/linux-unionfs/20230516-topografie-gejubelt-dba162b6e735@brauner/T/
Change-Id: Ib1f5fcb707a3db43a497cf4ae663156c202d6849
Signed-off-by: Pradeep P V K <quic_pragalla@quicinc.com>
2023-06-07 00:40:32 +00:00
Zhihao Cheng
8d59a7676c BACKPORT: FROMLIST: ovl: ovl_permission: Fix null pointer dereference at realinode in rcu-walk mode
Following process:
          P1                     P2
  path_lookupat
   link_path_walk
    inode_permission
     ovl_permission
       ovl_i_path_real(inode, &realpath)
         path->dentry = ovl_i_dentry_upper(inode)
                           drop_cache
                            __dentry_kill(ovl_dentry)
                             iput(ovl_inode)
                              ovl_destroy_inode(ovl_inode)
                               dput(oi->__upperdentry)
                                dentry_kill(upperdentry)
                                 dentry_unlink_inode
                                  upperdentry->d_inode = NULL
       realinode = d_inode(realpath.dentry) // return NULL
       inode_permission(realinode)
        inode->i_sb  // NULL pointer dereference
 , will trigger an null pointer dereference at realinode:
   [  335.664979] BUG: kernel NULL pointer dereference,
                  address: 0000000000000002
   [  335.668032] CPU: 0 PID: 2592 Comm: ls Not tainted 6.3.0
   [  335.669956] RIP: 0010:inode_permission+0x33/0x2c0
   [  335.678939] Call Trace:
   [  335.679165]  <TASK>
   [  335.679371]  ovl_permission+0xde/0x320
   [  335.679723]  inode_permission+0x15e/0x2c0
   [  335.680090]  link_path_walk+0x115/0x550
   [  335.680771]  path_lookupat.isra.0+0xb2/0x200
   [  335.681170]  filename_lookup+0xda/0x240
   [  335.681922]  vfs_statx+0xa6/0x1f0
   [  335.682233]  vfs_fstatat+0x7b/0xb0

 Fetch a reproducer in [Link].

 Use the helper ovl_i_path_realinode() to get realinode and then do
 non-nullptr checking.

 Link: https://bugzilla.kernel.org/show_bug.cgi?id=217405
 Fixes: 4b7791b2e9 ("ovl: handle idmappings in ovl_permission()")
 Signed-off-by: Zhihao Cheng <chengzhihao1@huawei.com>
 Suggested-by: Christian Brauner <brauner@kernel.org>
 Suggested-by: Amir Goldstein <amir73il@gmail.com>

 Reviewed-by: Amir Goldstein <amir73il@gmail.com>

Bug: 285105314
Link: https://lore.kernel.org/linux-unionfs/20230516-topografie-gejubelt-dba162b6e735@brauner/T/
Change-Id: If89ff32991b8075844f11efbae05edaa6465b5ee
Signed-off-by: Pradeep P V K <quic_pragalla@quicinc.com>
2023-06-07 00:40:32 +00:00
Zhihao Cheng
2de1ee6dd8 BACKPORT: FROMLIST: ovl: Let helper ovl_i_path_real() return the realinode
Let helper ovl_i_path_real() return the realinode to prepare for
checking non-null realinode in rcu walking path.

Signed-off-by: Zhihao Cheng <chengzhihao1@huawei.com>
Reviewed-by: Amir Goldstein <amir73il@gmail.com>

Bug: 285105314
Link: https://lore.kernel.org/lkml/20230516-topografie-gejubelt-dba162b6e735@brauner/T/
Change-Id: I4fed6fe0874215eb381b6879565a98b855916931
Signed-off-by: Pradeep P V K <quic_pragalla@quicinc.com>
2023-06-06 23:18:25 +00:00
xiaofeng
963667856e ANDROID: GKI: Update symbol list for xiaomi
1 function symbol(s) added
  'int __traceiter_android_rvh_ctl_dirty_rate(void *unused)'

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

Bug: 284059793
Change-Id: I6a564fab67a2393ddd108a223b879b3dfd09c373
Signed-off-by: xiaofeng <xiaofeng5@xiaomi.com>
2023-06-06 23:03:20 +00:00
xiaofeng
508ca06639 ANDROID: vendor_hooks:vendor hook for control memory dirty rate
When the IO pressure increases or the system performs dirty
page balancing, the frame rate of the foreground application
may become unstable. Therefore, a hook point is added to limit
the buffer IO rate from the source.

Bug: 262189942
Change-Id: I5214d611a388c5e8d87dc44ffde86ead1834ddff
Signed-off-by: xiaofeng <xiaofeng5@xiaomi.com>
2023-06-06 23:03:20 +00:00
Minchan Kim
c959a3fc91 ANDROID: f2fs: enable cleancache
cleancache is enabled for only ext4 and btrfs. Since f2fs is one
of the main fs in Android, this patch enables cleancache for f2fs.

Bug: 236887352
Change-Id: Ib6e6e832234f72681058da848e9cff36c5a496f2
Signed-off-by: Minchan Kim <minchan@google.com>
(cherry picked from commit 32dfefb4c8)
2023-06-06 21:17:38 +00:00
Liam R. Howlett
2ea053d317 FROMGIT: userfaultfd: fix regression in userfaultfd_unmap_prep()
Android reported a performance regression in the userfaultfd unmap path.
A closer inspection on the userfaultfd_unmap_prep() change showed that a
second tree walk would be necessary in the reworked code.

Fix the regression by passing each VMA that will be unmapped through to
the userfaultfd_unmap_prep() function as they are added to the unmap list,
instead of re-walking the tree for the VMA.

Link: https://lkml.kernel.org/r/20230601015402.2819343-1-Liam.Howlett@oracle.com
Fixes: 69dbe6daf1 ("userfaultfd: use maple tree iterator to iterate VMAs")
Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
Reported-by: Suren Baghdasaryan <surenb@google.com>
Suggested-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

(cherry picked from commit de53cc0be1c8b47d595682932beb3c11be9e4e5a
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm mm-unstable)

Bug: 274059236
Change-Id: Ia189a5e98ffe86c4ca5ac3b686ada5f51826f2ed
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2023-06-06 20:05:25 +00:00
Liam R. Howlett
2f5f352e6a FROMGIT: BACKPORT: mm: avoid rewalk in mmap_region
If the iterator has moved to the previous entry, then step forward one
range, back to the gap.

Link: https://lkml.kernel.org/r/20230518145544.1722059-36-Liam.Howlett@oracle.com
Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
Cc: David Binderman <dcb314@hotmail.com>
Cc: Peng Zhang <zhangpeng.00@bytedance.com>
Cc: Sergey Senozhatsky <senozhatsky@chromium.org>
Cc: Vernon Yang <vernon2gm@gmail.com>
Cc: Wei Yang <richard.weiyang@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

(cherry picked from commit d3f028c7599ea2297dd630e1a6acaf4915c769d3
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm mm-unstable)

Bug: 274059236
Change-Id: Ic45e095c728095d41647a704a287596d03489cdf
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2023-06-06 20:05:25 +00:00
Liam R. Howlett
86d9de0898 FROMGIT: maple_tree: clear up index and last setting in single entry tree
When there is a single entry tree (range of 0-0 pointing to an entry),
then ensure the limit is either 0-0 or 1-oo, depending on where the user
walks.  Ensure the correct node setting as well; either MAS_ROOT or
MAS_NONE.

Link: https://lkml.kernel.org/r/20230518145544.1722059-33-Liam.Howlett@oracle.com
Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
Cc: Peng Zhang <zhangpeng.00@bytedance.com>
Cc: David Binderman <dcb314@hotmail.com>
Cc: Sergey Senozhatsky <senozhatsky@chromium.org>
Cc: Vernon Yang <vernon2gm@gmail.com>
Cc: Wei Yang <richard.weiyang@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

(cherry picked from commit c0b1bdd9011ef34b654fe62f2607bff0eb1ef0a8
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm mm-unstable)

Bug: 274059236
Change-Id: I22a41c01e525fde88774b509cd5cbc60f56f6dc5
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2023-06-06 20:05:25 +00:00
Liam R. Howlett
9288f53a31 FROMGIT: maple_tree: add mas_prev_range() and mas_find_range_rev interface
Some users of the maple tree may want to move to the previous range
regardless of the value stored there.  Add this interface as well as the
'find' variant to support walking to the first value, then iterating over
the previous ranges.

Link: https://lkml.kernel.org/r/20230518145544.1722059-32-Liam.Howlett@oracle.com
Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
Cc: Vernon Yang <vernon2gm@gmail.com>
Cc: David Binderman <dcb314@hotmail.com>
Cc: Peng Zhang <zhangpeng.00@bytedance.com>
Cc: Sergey Senozhatsky <senozhatsky@chromium.org>
Cc: Wei Yang <richard.weiyang@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

(cherry picked from commit b8194567d8703df2ec488d5ace46b7435c936ba8
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm mm-unstable)

Bug: 274059236
Change-Id: Ic0507e00818c94f43ed3d760422dfc4d52de5981
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2023-06-06 20:05:25 +00:00
Liam R. Howlett
c4f5714056 FROMGIT: maple_tree: introduce mas_prev_slot() interface
Sometimes the user needs to revert to the previous slot, regardless of if
it is empty or not.  Add an interface to go to the previous slot.

Since there can't be two consecutive NULLs in the tree, the mas_prev()
function can be implemented by calling mas_prev_slot() a maximum of 2
times.  Change the underlying interface to use mas_prev_slot() to align
the code.

Link: https://lkml.kernel.org/r/20230518145544.1722059-31-Liam.Howlett@oracle.com
Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
Cc: David Binderman <dcb314@hotmail.com>
Cc: Peng Zhang <zhangpeng.00@bytedance.com>
Cc: Sergey Senozhatsky <senozhatsky@chromium.org>
Cc: Vernon Yang <vernon2gm@gmail.com>
Cc: Wei Yang <richard.weiyang@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

(cherry picked from commit 20ea986f0b783cf38e7fbcc6887b24c28b02c189
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm mm-unstable)

Bug: 274059236
Change-Id: Ib5a677ee01f5d9b88cd9dede943d70c14f0ffb96
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2023-06-06 20:05:25 +00:00
Liam R. Howlett
dbc16cc86a FROMGIT: maple_tree: relocate mas_rewalk() and mas_rewalk_if_dead()
These functions need to move for future use.

Link: https://lkml.kernel.org/r/20230518145544.1722059-30-Liam.Howlett@oracle.com
Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
Cc: David Binderman <dcb314@hotmail.com>
Cc: Peng Zhang <zhangpeng.00@bytedance.com>
Cc: Sergey Senozhatsky <senozhatsky@chromium.org>
Cc: Vernon Yang <vernon2gm@gmail.com>
Cc: Wei Yang <richard.weiyang@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

(cherry picked from commit 0cfc564131d7a63bdddb539a36a4374485df95e4
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm mm-unstable)

Bug: 274059236
Change-Id: I6b60f2c67ad00e83a14b959c0006d6191cf57b31
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2023-06-06 20:05:25 +00:00
Liam R. Howlett
b83cfb2dc4 FROMGIT: maple_tree: add mas_next_range() and mas_find_range() interfaces
Some users of the maple tree may want to move to the next range in the
tree, even if it stores a NULL.  This family of function provides that
functionality by advancing one slot at a time and returning the result,
while mas_contiguous() will iterate over the range and stop on
encountering the first NULL.

Link: https://lkml.kernel.org/r/20230518145544.1722059-29-Liam.Howlett@oracle.com
Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
Cc: David Binderman <dcb314@hotmail.com>
Cc: Peng Zhang <zhangpeng.00@bytedance.com>
Cc: Sergey Senozhatsky <senozhatsky@chromium.org>
Cc: Vernon Yang <vernon2gm@gmail.com>
Cc: Wei Yang <richard.weiyang@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

(cherry picked from commit 727a78967bc89accbce230f7bc3eeba3c49ceb3f
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm mm-unstable)

Bug: 274059236
Change-Id: Ie7b6d058f5e0cd3a011c3506d79f66d423b3a60b
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2023-06-06 20:05:25 +00:00
Liam R. Howlett
84719794e0 FROMGIT: maple_tree: introduce mas_next_slot() interface
Sometimes, during a tree walk, the user needs the next slot regardless of
if it is empty or not.  Add an interface to get the next slot.

Since there are no consecutive NULLs allowed in the tree, the mas_next()
function can only advance two slots at most.  So use the new
mas_next_slot() interface to align both implementations.  Use this method
for mas_find() as well.

Link: https://lkml.kernel.org/r/20230518145544.1722059-28-Liam.Howlett@oracle.com
Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
Cc: David Binderman <dcb314@hotmail.com>
Cc: Peng Zhang <zhangpeng.00@bytedance.com>
Cc: Sergey Senozhatsky <senozhatsky@chromium.org>
Cc: Vernon Yang <vernon2gm@gmail.com>
Cc: Wei Yang <richard.weiyang@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

(cherry picked from commit d0e70747bdb8f9cfc9ff48474e83171587ad94c1
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm mm-unstable)

Bug: 274059236
Change-Id: I9efc69267859c26aae1b776d103dff584f1961ea
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2023-06-06 20:05:25 +00:00
Liam R. Howlett
c5c507cfec FROMGIT: maple_tree: try harder to keep active node with mas_prev()
Keep a reference to the node when possible with mas_prev().  This will
avoid re-walking the tree.  In keeping a reference to the node, keep the
last/index accurate to the range being referenced.  This means the limit
may be within the range, but the range may extend outside of the limit.

Also fix the single entry tree to respect the range (of 0), or set the
node to MAS_NONE in the case of shifting beyond 0.

Link: https://lkml.kernel.org/r/20230518145544.1722059-25-Liam.Howlett@oracle.com
Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
Cc: David Binderman <dcb314@hotmail.com>
Cc: Peng Zhang <zhangpeng.00@bytedance.com>
Cc: Sergey Senozhatsky <senozhatsky@chromium.org>
Cc: Vernon Yang <vernon2gm@gmail.com>
Cc: Wei Yang <richard.weiyang@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

(cherry picked from commit 20e9433710317ab0278c1d76821e213fb2d11e19
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm mm-unstable)

Bug: 274059236
Change-Id: If0b40925884dac6e334474249098d03175ba6dd6
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2023-06-06 20:05:25 +00:00
Liam R. Howlett
cb6d9fa6ad FROMGIT: maple_tree: try harder to keep active node after mas_next()
Clean up the mas_next() call to try and keep a node reference when
possible.  This will avoid re-walking the tree in most cases.

Also clean up the single entry tree handling to ensure index/last are
consistent with what one would expect.  (returning NULL with limit of
1-oo).

Link: https://lkml.kernel.org/r/20230518145544.1722059-24-Liam.Howlett@oracle.com
Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
Cc: David Binderman <dcb314@hotmail.com>
Cc: Peng Zhang <zhangpeng.00@bytedance.com>
Cc: Sergey Senozhatsky <senozhatsky@chromium.org>
Cc: Vernon Yang <vernon2gm@gmail.com>
Cc: Wei Yang <richard.weiyang@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

(cherry picked from commit f7741cbb138e4cd8586e45806313561cec44f9b6
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm mm-unstable)

Bug: 274059236
Change-Id: I61c7e9e1575b5f5400f9fc2eec08ae4a1eaefa5e
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2023-06-06 20:05:25 +00:00
Liam R. Howlett
5ff9438fe1 FROMGIT: BACKPORT: mm/mmap: change do_vmi_align_munmap() for maple tree iterator changes
The maple tree iterator clean up is incompatible with the way
do_vmi_align_munmap() expects it to behave.  Update the expected behaviour
to map now since the change will work currently.

Link: https://lkml.kernel.org/r/20230518145544.1722059-23-Liam.Howlett@oracle.com
Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
Cc: David Binderman <dcb314@hotmail.com>
Cc: Peng Zhang <zhangpeng.00@bytedance.com>
Cc: Sergey Senozhatsky <senozhatsky@chromium.org>
Cc: Vernon Yang <vernon2gm@gmail.com>
Cc: Wei Yang <richard.weiyang@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

(cherry picked from commit a4d5b9fbaf42d668c1b5c7f231f79776a9419a91
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm mm-unstable)
[surenb: adjust for missing vma_iter_load]

Bug: 274059236
Change-Id: Id05ab617a3539f885a32c7d3031098a8c005fff8
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2023-06-06 20:05:25 +00:00
Liam R. Howlett
133fbad5bd FROMLIST: BACKPORT: maple_tree: Refine mas_preallocate() node calculations
Calculate the number of nodes based on the pending write action instead
of assuming the worst case.

This addresses a performance regression introduced in platforms that
have longer allocation timing.

Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>

Link: https://lore.kernel.org/lkml/20230601021605.2823123-14-Liam.Howlett@oracle.com/
[surenb: adjust node_size calculation, allow to store a slot when
possible]

Bug: 274059236
Change-Id: I1db402fb463ee1e391081d2d81c34619f15713ac
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2023-06-06 20:05:25 +00:00
Liam R. Howlett
ce9ebd83aa ANDROID: maple_tree: Move mas_wr_modify node size calculation to mas_wr_node_size()
Create a new function to get the size of the mas_wr_node_size() since it
will be used elsewhere soon.

Drop the incrementing of the node size if this is the left-most node.

Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>

Link: d781921bc8
[surenb: due to the differences with upstream kernel where the node size
can be obtained using mas_wr_new_end() function, this patch is not
applicable upstream. The patch was obtained from the author's tree]

Bug: 274059236
Change-Id: I9f0b5238294d0842b4c2717437ed7288b17c7617
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2023-06-06 20:05:25 +00:00
Liam R. Howlett
b6734cb2ce FROMLIST: BACKPORT: maple_tree: Move mas_wr_end_piv() below mas_wr_extend_null()
Relocate it and call mas_wr_extend_null() from within mas_wr_end_piv().
Extending the NULL may affect the end pivot value so call
mas_wr_endtend_null() from within mas_wr_end_piv() to keep it all
together.

Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>

Link: https://lore.kernel.org/lkml/20230601021605.2823123-12-Liam.Howlett@oracle.com/
[surenb: moved additional wr_mas->end_piv assignment missing in later
kernel versions]

Bug: 274059236
Change-Id: I55c5843273e7a679aef918e66d4b4ed034d493da
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2023-06-06 20:05:25 +00:00
Liam R. Howlett
aede79b81e ANDROID: mm: Fix __vma_adjust() writes for the maple tree
Only write when necessary to the maple tree.  This should only occur
when the VMA changes.  In the __vma_adjust() case, it is either the vma
when it is expanded, the next vma when the boundary expands into 'vma',
writing the 'insert', or when vma expands/shrinks for shift_arg_pages().

The mas_preallocate() setup should track the intended write to ensure
the correct number of nodes are preallocated for the pending write.

Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
Link: 61b337f650
[surenb: __vma_adjust was removed in 6.3, therefore these fixes are
not applicable upstream anymore. The patch was obtained from the
author's tree]

Bug: 274059236
Change-Id: I69d68a5b4ff11c40985f7b03b31eec4bb24dcbb6
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2023-06-06 20:05:25 +00:00
Liam R. Howlett
b802573f44 FROMLIST: BACKPORT: mm: Set up vma iterator for vma_iter_prealloc() calls
Set the correct limits for vma_iter_prealloc() calls so that the maple
tree can be smarter about how many nodes are needed.

Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>

Link: https://lore.kernel.org/lkml/20230601021605.2823123-11-Liam.Howlett@oracle.com/
[surenb: remove vma_iter-related changes not present in 6.1 kernel]

Bug: 274059236
Change-Id: I05d1989e35b2e72b9346743f290da66739b3ee59
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2023-06-06 20:05:25 +00:00
Liam R. Howlett
c3118993c9 FROMGIT: maple_tree: avoid unnecessary ascending
The maple tree node limits are implied by the parent.  When walking up the
tree, the limit may not be known until a slot that does not have implied
limits are encountered.  However, if the node is the left-most or
right-most node, the walking up to find that limit can be skipped.

This commit also fixes the debug/testing code that was not setting the
limit on walking down the tree as that optimization is not compatible with
this change.

Link: https://lkml.kernel.org/r/20230518145544.1722059-4-Liam.Howlett@oracle.com
Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
Reviewed-by: Peng Zhang <zhangpeng.00@bytedance.com>
Cc: David Binderman <dcb314@hotmail.com>
Cc: Sergey Senozhatsky <senozhatsky@chromium.org>
Cc: Vernon Yang <vernon2gm@gmail.com>
Cc: Wei Yang <richard.weiyang@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

(cherry picked from commit 0f4e7f5fc2122534ae0573b37224ddfa367fa7ac
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm mm-unstable)

Bug: 274059236
Change-Id: I4a5e852906692b27ea598fdf38eba8e1a69355d9
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2023-06-06 20:05:25 +00:00
Liam R. Howlett
e9fdabfc2a FROMLIST: BACKPORT: mm: Change do_vmi_align_munmap() side tree index
The majority of the calls to munmap a VMA is for a single vma.  The
maple tree is able to store a single entry at 0, with a size of 1 as a
pointer and avoid any allocations.  Change do_vmi_align_munmap() to
store the VMAs being munmap()'ed into a tree indexed by the count.  This
will leverage the ability to store the first entry without a node
allocation.

Storing the entries into a tree by the count and not the vma start and
end means changing the functions which iterate over the entries.  Update
unmap_vmas() and free_pgtables() to take a maple state and a tree end
address to support this functionality.

Passing through the same maple state to unmap_vmas() and free_pgtables()
means the state needs to be reset between calls.  This happens in the
static unmap_region() and exit_mmap().

Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>

Link: https://lore.kernel.org/lkml/20230601021605.2823123-5-Liam.Howlett@oracle.com/
[surenb: skip changes passing maple state to unmap_vmas() and
free_pgtables()]

Bug: 274059236
Change-Id: If38cfecd51da884bcfdbdfdfbf955a0b338d3d60
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2023-06-06 20:05:25 +00:00
Liam R. Howlett
25bed2fdbc UPSTREAM: mm/mmap: remove preallocation from do_mas_align_munmap()
In preparation of passing the vma state through split, the pre-allocation
that occurs before the split has to be moved to after.  Since the
preallocation would then live right next to the store, just call store
instead of preallocating.  This effectively restores the potential error
path of splitting and not munmap'ing which pre-dates the maple tree.

Link: https://lkml.kernel.org/r/20230120162650.984577-12-Liam.Howlett@oracle.com
Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

(cherry picked from commit 0378c0a0e9)

Bug: 274059236
Change-Id: I3539fb3a08043dae1bc8aaa6c7f285711a0b5548
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2023-06-06 20:05:25 +00:00
Huang Yiwei
312dfb3b7e ANDROID: abi_gki_aarch64_qcom: Update QCOM symbol list
Update QCOM symbol list for MPAM vendor hook.

Symbols added:
   __traceiter_android_vh_mpam_set
   __tracepoint_android_vh_mpam_set

Bug: 285984666
Change-Id: I31e6875e95f4cc39b327ab190ef50d3bab88b57b
Signed-off-by: Huang Yiwei <quic_hyiwei@quicinc.com>
2023-06-06 14:36:09 +08:00
xiaofeng
6b3daa3bba ANDROID: GKI: Update symbol list for xiaomi
1 function symbol(s) added
  'int __traceiter_android_vh_mmput(struct mm_struct *mm)'

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

Bug: 284059793
Change-Id: I6468b53e5c708a7e04c472c69210956e63147251
Signed-off-by: xiaofeng <xiaofeng5@xiaomi.com>
2023-06-05 23:15:22 +00:00
xiaofeng
ec196511bf ANDROID: vendor_hooks:vendor hook for mmput
add vendor hook in mmput while mm_users decreased to 0.

Bug: 238821038
Change-Id: I42a717cbeeb3176bac14b4b2391fdb2366c972d3
Signed-off-by: xiaofeng <xiaofeng5@xiaomi.com>
2023-06-05 23:15:22 +00:00
Sooyong Suk
571c04e945 ANDROID: ABI: update symbol list for galaxy
5 function symbol(s) added
  'int __traceiter_android_vh_madvise_pageout_swap_entry(void*, swp_entry_t, int)'
  'int __traceiter_android_vh_madvise_swapin_walk_pmd_entry(void*, swp_entry_t)'
  'int __traceiter_android_vh_process_madvise_end(void*, int, ssize_t*)'
  'int __traceiter_android_vh_show_smap(void*, struct seq_file*, unsigned long, unsigned long, unsigned long)'
  'int __traceiter_android_vh_smaps_pte_entry(void*, swp_entry_t, unsigned long*, unsigned long*, unsigned long*)'

5 variable symbol(s) added
  'struct tracepoint __tracepoint_android_vh_madvise_pageout_swap_entry'
  'struct tracepoint __tracepoint_android_vh_madvise_swapin_walk_pmd_entry'
  'struct tracepoint __tracepoint_android_vh_process_madvise_end'
  'struct tracepoint __tracepoint_android_vh_show_smap'
  'struct tracepoint __tracepoint_android_vh_smaps_pte_entry'

Bug: 284059805

Change-Id: I3ea820f19eac3b0f053bac0830625891e70c1b71
Signed-off-by: Sooyong Suk <s.suk@samsung.com>
2023-06-05 23:12:28 +00:00
Sooyong Suk
847b3f6c96 ANDROID: task_mmu: add vendor hook for swap entry
Add vendor hook in smaps_pte_entry for swap entry
- android_vh_smaps_pte_entry
- android_vh_show_smap

This vendor hook is to show more information for
swap entries of a process based on the
characteristics, such as written-back, same-filled
or huge (uncompressed).

Bug: 284059805

Change-Id: Ie4a48ae42212c056992d34a10b026b60439d0012
Signed-off-by: Sooyong Suk <s.suk@samsung.com>
2023-06-05 23:12:28 +00:00
Sooyong Suk
aee36dd530 ANDROID: mm: add vendor hooks in madvise for swap entry
Add vendor hooks in madvise for swap entry
- android_vh_madvise_pageout_swap_entry
- android_vh_madvise_swapin_walk_pmd_entry
- android_vh_process_madvise_end

Bug: 284059805

Change-Id: Ic389244e343737a583286c20cadb6774efd8890c
Signed-off-by: Sooyong Suk <s.suk@samsung.com>
2023-06-05 23:12:28 +00:00
Peter Collingbourne
c0cfeeaa88 BACKPORT: FROMLIST: arm64: mte: Simplify swap tag restoration logic
As a result of the previous two patches, there are no circumstances
in which a swapped-in page is installed in a page table without first
having arch_swap_restore() called on it. Therefore, we no longer need
the logic in set_pte_at() that restores the tags, so remove it.

Signed-off-by: Peter Collingbourne <pcc@google.com>
Link: https://linux-review.googlesource.com/id/I8ad54476f3b2d0144ccd8ce0c1d7a2963e5ff6f3
Reviewed-by: Steven Price <steven.price@arm.com>
Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Link: https://lore.kernel.org/all/20230523004312.1807357-4-pcc@google.com/
Change-Id: I8ad54476f3b2d0144ccd8ce0c1d7a2963e5ff6f3
[pcc: resolved merge conflict]
Bug: 274890466
2023-06-05 21:53:19 +00:00
Peter Collingbourne
131714e34b FROMLIST: mm: Call arch_swap_restore() from unuse_pte()
We would like to move away from requiring architectures to restore
metadata from swap in the set_pte_at() implementation, as this is not only
error-prone but adds complexity to the arch-specific code. This requires
us to call arch_swap_restore() before calling swap_free() whenever pages
are restored from swap. We are currently doing so everywhere except in
unuse_pte(); do so there as well.

Signed-off-by: Peter Collingbourne <pcc@google.com>
Link: https://linux-review.googlesource.com/id/I68276653e612d64cde271ce1b5a99ae05d6bbc4f
Suggested-by: David Hildenbrand <david@redhat.com>
Acked-by: David Hildenbrand <david@redhat.com>
Acked-by: "Huang, Ying" <ying.huang@intel.com>
Reviewed-by: Steven Price <steven.price@arm.com>
Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Link: https://lore.kernel.org/all/20230523004312.1807357-3-pcc@google.com/
Change-Id: I68276653e612d64cde271ce1b5a99ae05d6bbc4f
Bug: 274890466
2023-06-05 21:53:19 +00:00
Peter Collingbourne
3805b879f5 FROMLIST: mm: Call arch_swap_restore() from do_swap_page()
Commit c145e0b47c ("mm: streamline COW logic in do_swap_page()") moved
the call to swap_free() before the call to set_pte_at(), which meant that
the MTE tags could end up being freed before set_pte_at() had a chance
to restore them. Fix it by adding a call to the arch_swap_restore() hook
before the call to swap_free().

Signed-off-by: Peter Collingbourne <pcc@google.com>
Link: https://linux-review.googlesource.com/id/I6470efa669e8bd2f841049b8c61020c510678965
Cc: <stable@vger.kernel.org> # 6.1
Fixes: c145e0b47c ("mm: streamline COW logic in do_swap_page()")
Reported-by: Qun-wei Lin (林群崴) <Qun-wei.Lin@mediatek.com>
Closes: https://lore.kernel.org/all/5050805753ac469e8d727c797c2218a9d780d434.camel@mediatek.com/
Acked-by: David Hildenbrand <david@redhat.com>
Acked-by: "Huang, Ying" <ying.huang@intel.com>
Reviewed-by: Steven Price <steven.price@arm.com>
Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Link: https://lore.kernel.org/all/20230523004312.1807357-2-pcc@google.com/
Change-Id: I6470efa669e8bd2f841049b8c61020c510678965
Bug: 274890466
2023-06-05 21:53:19 +00:00
Sachin Gupta
098028adf7 ANDROID: abi_gki_aarch64_qcom: Update symbol list
Symbols added:
   sdhci_dumpregs

Bug: 285546222
Change-Id: I18fe46273b13f21e59fd4f556efbe560f581139d
Signed-off-by: Sachin Gupta <quic_sachgupt@quicinc.com>
2023-06-05 20:44:15 +00:00
xiaofeng
71844b8ed9 ANDROID: GKI: Update symbol list for xiaomi
2 function symbol(s) added
  'int __traceiter_android_vh_alloc_pages_reclaim_bypass(gfp_t gfp_mask, int order, int alloc_flags,
	int migratetype, struct page **page)'
  'int __traceiter_android_vh_alloc_pages_failure_bypass(gfp_t gfp_mask, int order, int alloc_flags,
	int migratetype, struct page **page)'

2 variable symbol(s) added
  'struct tracepoint __tracepoint_android_vh_alloc_pages_reclaim_bypass'
  'struct tracepoint __tracepoint_android_vh_alloc_pages_failure_bypass'

Bug: 284059793
Change-Id: I766d37e4f4cea8c3ce6e925e95ab920152eebbb1
Signed-off-by: xiaofeng <xiaofeng5@xiaomi.com>
2023-06-05 16:38:22 +00:00
xiaofeng
025b5a487b ANDROID: vendor_hooks:vendor hook for __alloc_pages_slowpath.
add vendor hook in __alloc_pages_slowpath ahead of
__alloc_pages_direct_reclaim and warn_alloc.

Bug: 243629905
Change-Id: Ieacc6cf79823c0bfacfdeec9afb55ed66f40d0b0
Signed-off-by: xiaofeng <xiaofeng5@xiaomi.com>
2023-06-05 16:38:22 +00:00
Dezhi Huang
60b0f85e24 ANDROID: ABI: Update honor symbol list
3 function symbol(s) added
  'int __traceiter_android_vh_file_is_tiny_bypass(void*, bool, bool*)'
  'int __traceiter_android_vh_modify_scan_control(void*, u64*, unsigned long*, struct mem_cgroup*, bool*, bool*)'
  'int __traceiter_android_vh_should_continue_reclaim(u64*, unsigned long*, unsigned long*, bool*)'

3 variable symbol(s) added
  'struct tracepoint __tracepoint_android_vh_file_is_tiny_bypass'
  'struct tracepoint __tracepoint_android_vh_modify_scan_control'
  'struct tracepoint __tracepoint_android_vh_should_continue_reclaim'

Bug: 279793370
Change-Id: Ieb2a90f1317453b982341f06765bb2625daa645a
Signed-off-by: Dezhi Huang <huangdezhi@hihonor.com>
2023-06-05 16:31:49 +00:00
Dezhi Huang
3e2dc32f59 ANDROID: mm: create vendor hooks for memory reclaim
we try to adjust page reclaim operations based on the running task
and kernel memory pressure. Thus, we want to create some vendor hooks
into kernel6.1.

Firstly, we add ADNRROID_VENDOR_DATA into the struct scan_control,
special operations would be performed based on this special scan option.
We measure the importance of the current process in the system and
obtain its weight, which is recorded in ANDROID_VENDOR_DATA.

The hook function: trace_android_vh_modify_scan_control is added inside
of the function modify_scan_control() to adjust reclaim operations based
on memory pressure.

The hook function: trace_android_vh_should_continue_reclaim is added inside
of the function shrink_node() to decide if page_reclaim would continue
or not based on memory pressure.

The hook function: trace_android_vh_file_is_tiny_bypass is added into the
function prepare_scan_count() to decide if the file pages should be skipped
in condition to file refualts and memory pressure.

Bug: 279793370
Change-Id: I1efe9d3e866f37b0295c7cd94ec8ca0117a9bd4a
Signed-off-by: Dezhi Huang <huangdezhi@hihonor.com>
2023-06-05 16:31:49 +00:00
杨辉
8e6a28c815 UPSTREAM: kcsan: Avoid READ_ONCE() in read_instrumented_memory()
Haibo Li reported:

 | Unable to handle kernel paging request at virtual address
 |   ffffff802a0d8d7171
 | Mem abort info
 |   ESR = 0x9600002121
 |   EC = 0x25: DABT (current EL), IL = 32 bitsts
 |   SET = 0, FnV = 0 0
 |   EA = 0, S1PTW = 0 0
 |   FSC = 0x21: alignment fault
 | Data abort info
 |   ISV = 0, ISS = 0x0000002121
 |   CM = 0, WnR = 0 0
 | swapper pgtable: 4k pages, 39-bit VAs, pgdp=000000002835200000
 | [ffffff802a0d8d71] pgd=180000005fbf9003, p4d=180000005fbf9003,
 | pud=180000005fbf9003, pmd=180000005fbe8003, pte=006800002a0d8707
 | Internal error: Oops: 96000021 [#1] PREEMPT SMP
 | Modules linked in:
 | CPU: 2 PID: 45 Comm: kworker/u8:2 Not tainted
 |   5.15.78-android13-8-g63561175bbda-dirty #1
 | ...
 | pc : kcsan_setup_watchpoint+0x26c/0x6bc
 | lr : kcsan_setup_watchpoint+0x88/0x6bc
 | sp : ffffffc00ab4b7f0
 | x29: ffffffc00ab4b800 x28: ffffff80294fe588 x27: 0000000000000001
 | x26: 0000000000000019 x25: 0000000000000001 x24: ffffff80294fdb80
 | x23: 0000000000000000 x22: ffffffc00a70fb68 x21: ffffff802a0d8d71
 | x20: 0000000000000002 x19: 0000000000000000 x18: ffffffc00a9bd060
 | x17: 0000000000000001 x16: 0000000000000000 x15: ffffffc00a59f000
 | x14: 0000000000000001 x13: 0000000000000000 x12: ffffffc00a70faa0
 | x11: 00000000aaaaaaab x10: 0000000000000054 x9 : ffffffc00839adf8
 | x8 : ffffffc009b4cf00 x7 : 0000000000000000 x6 : 0000000000000007
 | x5 : 0000000000000000 x4 : 0000000000000000 x3 : ffffffc00a70fb70
 | x2 : 0005ff802a0d8d71 x1 : 0000000000000000 x0 : 0000000000000000
 | Call trace:
 |  kcsan_setup_watchpoint+0x26c/0x6bc
 |  __tsan_read2+0x1f0/0x234
 |  inflate_fast+0x498/0x750
 |  zlib_inflate+0x1304/0x2384
 |  __gunzip+0x3a0/0x45c
 |  gunzip+0x20/0x30
 |  unpack_to_rootfs+0x2a8/0x3fc
 |  do_populate_rootfs+0xe8/0x11c
 |  async_run_entry_fn+0x58/0x1bc
 |  process_one_work+0x3ec/0x738
 |  worker_thread+0x4c4/0x838
 |  kthread+0x20c/0x258
 |  ret_from_fork+0x10/0x20
 | Code: b8bfc2a8 2a0803f7 14000007 d503249f (78bfc2a8) )
 | ---[ end trace 613a943cb0a572b6 ]-----

The reason for this is that on certain arm64 configuration since
e35123d83e ("arm64: lto: Strengthen READ_ONCE() to acquire when
CONFIG_LTO=y"), READ_ONCE() may be promoted to a full atomic acquire
instruction which cannot be used on unaligned addresses.

Fix it by avoiding READ_ONCE() in read_instrumented_memory(), and simply
forcing the compiler to do the required access by casting to the
appropriate volatile type. In terms of generated code this currently
only affects architectures that do not use the default READ_ONCE()
implementation.

The only downside is that we are not guaranteed atomicity of the access
itself, although on most architectures a plain load up to machine word
size should still be atomic (a fact the default READ_ONCE() still relies
on itself).

BUG: 285794521
(cherry picked from commit 8dec88070d)
Reported-by: Haibo Li <haibo.li@mediatek.com>
Tested-by: Haibo Li <haibo.li@mediatek.com>
Cc: <stable@vger.kernel.org> # 5.17+
Change-Id: I16c9f83c3b4e28021a936249cafb1501760aa59d
Signed-off-by: Marco Elver <elver@google.com>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Signed-off-by: 杨辉 <yanghui10@xiaomi.corp-partner.google.com>
2023-06-05 15:02:47 +00:00
jianzhou
675bc3a00e ANDROID: abi_gki_aarch64_qcom: update symbol list
Symbols added:
   page_pinner_inited
   __page_pinner_put_page
   _trace_android_vh_record_pcpu_rwsem_starttime

Bug: 285243673
Change-Id: I7cf6ca8ff637f3d7de9daba597b09ca27b813e48
Signed-off-by: jianzhou <quic_jianzhou@quicinc.com>
2023-06-05 14:45:20 +00:00
Todd Kjos
7b14897460 ANDROID: Update ABI as part of crash fix
Ok to commit this before KMI update since CRC change only affects the broken
hooks which are only used by the partner that introduced the hooks.

INFO: variable symbol 'struct tracepoint __tracepoint_android_rvh_psci_cpu_suspend' changed
  CRC changed from 0x4628ef5b to 0xf9b81cca

variable symbol 'struct tracepoint __tracepoint_android_rvh_psci_tos_resident_on' changed
  CRC changed from 0x477813d5 to 0xb163a362

Fixes: b7a7fd15ed ("ANDROID: vendor_hooks: psci: add hook to check if cpu is allowed to power off")
Bug: 285477556
Change-Id: I0539ac8ff1d26a6ba8dd0f13fc09b53f5ee0335b
Signed-off-by: Todd Kjos <tkjos@google.com>
2023-06-02 20:46:44 +00:00
Todd Kjos
9e2fa0a396 ANDROID: Fix incorrect hook declaration
Two hooks that need to be restricted were correctly named with "_rvh_"
but were incorrectly declared as normal hooks. This resulted in crashes
for at least 1 partner:

------------[ cut here ]------------
WARNING: CPU: 0 PID: 0 at include/trace/hooks/psci.h:19 psci_0_2_cpu_suspend+0x124/0x1d8
Modules linked in:
CPU: 0 PID: 0 Comm: swapper/0 Tainted: G S      W          6.1.25-android14-7-00072-gf10e53af33a0 #1
Hardware name: Samsung ERD9945 board based on S5E9945 (DT)
pstate: 624003c5 (nZCv DAIF +PAN -UAO +TCO -DIT -SSBS BTYPE=--)
pc : psci_0_2_cpu_suspend+0x124/0x1d8
lr : psci_0_2_cpu_suspend+0x88/0x1d8
sp : ffffffd00b1f7b20
x29: ffffffd00b1f7b30
[0:      swapper/0:    0]  x28: ffffffd00b217be4 x27: 0000000000000001
x26: 0000000000000000 x25: ffffff8915b689fc x24: 93ffff8837750100

x23: 000000008cc8e544 x22: 00000000000000c0
 x21: 0000000000010000
x20: 000000008147a038 x19: efffffc000000000 x18: 0000000000000000

x17: 0000000000000000 x16: 00000000000000ff x15: 0000000000000000
x14: 0000000000000000 x13: ffffffd00b22ae00 x12: ffffffb90a98d000
x11: ffffffd00b1d9850
x10: 0000000100000001 x9 : efffffc000000000
x8 : 0000000100000001
[0:      swapper/0:    0]  x7 : 015001f2b5593519
[0:      swapper/0:    0]  x6 : 0000000000310000
x5 : 0000000000000000
 x4 : 0000000000000000 x3 : 0000000000000000
[0:      swapper/0:    0] x2 : 0000000000000000 x1 : ffffff8915b66850 x0 : 0000000000000000

Call trace:
 psci_0_2_cpu_suspend+0x124/0x1d8
 psci_suspend_finisher+0x2c/0x38
 cpu_suspend+0x8c/0x16c
 psci_cpu_suspend_enter+0x54/0x7c
 psci_enter_idle_state+0x64/0x94
 cpuidle_enter_state+0x1dc/0x9b8
 cpuidle_enter+0x58/0x7c
 call_cpuidle+0x30/0x58
[0:      swapper/0:    0]  do_idle+0x214/0x2b8
 cpu_startup_entry+0x2c/0x30
 kernel_init+0x0/0x180
 start_kernel+0x0/0x444
 start_kernel+0x368/0x444
 __primary_switched+0xc0/0xc8
Kernel panic - not syncing: kernel: panic_on_warn set ...

Fixes: b7a7fd15ed ("ANDROID: vendor_hooks: psci: add hook to check if cpu is allowed to power off")
Bug: 285477556
Change-Id: I44ca332dc61dab025a0e33c94e8ad2f5eaffb6f8
Signed-off-by: Todd Kjos <tkjos@google.com>
2023-06-02 20:46:44 +00:00
Nagireddy Annem
e57fe10b5a ANDROID: abi_gki_aarch64_qcom: Add GIC and hibernation APIs
Add below fnctions and symbols to support GIC Deepsleep
and Hibernation feature.

4 function symbol(s) added
  'int __traceiter_android_vh_gic_v3_suspend(void*, struct gic_chip_data_v3*)'
  'void gic_v3_cpu_init()'
  'void gic_v3_dist_init()'
  'void gic_v3_dist_wait_for_rwp()'

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

Bug: 279879797

Change-Id: I96e439ef537e5dfc4e16c76fe6dd91bd5f13d6dd
Signed-off-by: Nagireddy Annem <quic_nannem@quicinc.com>
Signed-off-by: Darshankumar Jagdishchandra Thakkar <quic_djagdish@quicinc.com>
Signed-off-by: kamasali Satyanarayan <quic_kamasali@quicinc.com>
2023-06-02 17:11:39 +00:00
Maulik Shah
227d23d61d ANDROID: gic-v3: Export gic_v3_resume() for vendor GIC enhancements
syscore ops in gic-v3 takes care of invoking gic_v3_resume() when
exiting from "deep" suspend. However for "s2idle" suspend syscore
ops will not get invoked.

Vendor modules can register for s2idle notifications and
invoke gic_v3_resume() when the first cpu is waking up from s2idle.

Bug: 279879797
Change-Id: Ifd48d676a5bc907eb957c2002934e18bd1c9c095
Signed-off-by: Maulik Shah <mkshah@codeaurora.org>
Signed-off-by: Shreyas K K <quic_shrekk@quicinc.com>
2023-06-02 17:02:43 +00:00
Nagireddy Annem
275c8705e5 ANDROID: irqchip/irq-gic-v3: Add vendor hook for gic suspend
This change adds vendor hook for gic suspend syscore ops callback.
And it is invoked during deepsleep and hibernation to store
gic register snapshot.

Bug: 279879797
Change-Id: I4e3729afa4daf18d73e00ee9601b6da72a578b4a
Signed-off-by: Nagireddy Annem <quic_nannem@quicinc.com>
Signed-off-by: Shreyas K K <quic_shrekk@quicinc.com>
2023-06-02 17:02:43 +00:00
Mao Jinlong
c9539979a9 ANDROID: abi_gki_aarch64_qcom: Update abi_gki_aarch64_qcom for DMA
Add dma_alloc_noncontiguous, dma_free_noncontiguous,
dma_vmap_noncontiguous and dma_vunmap_noncontiguous symbols.

Symbols added:
   dma_alloc_noncontiguous
   dma_free_noncontiguous
   dma_vmap_noncontiguous
   dma_vunmap_noncontiguous

Bug: 284818225
Change-Id: Ifb8238071fbd15b2d27d1cfc33b856ae4c18c3f1
Signed-off-by: Chetan C R <quic_cchinnad@quicinc.com>
Signed-off-by: Mao Jinlong <quic_jinlmao@quicinc.com>
Signed-off-by: Zhenhua Huang <quic_zhenhuah@quicinc.com>
(cherry picked from commit b3bb41cebdeb0688b508df20f0db5f55a87e46e8)
2023-06-02 16:59:18 +00:00