Commit Graph

1149470 Commits

Author SHA1 Message Date
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
Weichao Guo
6da02f9101 ANDROID: GKI: Update symbols to abi_gki_aarch64_oplus for extend copy & fbarrier feature
8 function symbol(s) added
  'int __blkdev_issue_discard(struct block_device*, sector_t, sector_t, gfp_t, struct bio**)'
  'unsigned long __page_file_index(struct page*)'
  'void address_space_init_once(struct address_space*)'
  'void blk_finish_plug(struct blk_plug*)'
  'void blk_start_plug(struct blk_plug*)'
  'bool prepare_to_wait_exclusive(struct wait_queue_head*, struct wait_queue_entry*, int)'
  'void** radix_tree_lookup_slot(const struct xarray*, unsigned long)'
  'void radix_tree_replace_slot(struct xarray*, void**, void*)'

Bug: 283021230
Change-Id: Iec663ed6ed23c8c3245b609c3d8748919fa34471
Signed-off-by: Weichao Guo <guoweichao@oppo.corp-partner.google.com>
2023-06-01 20:55:23 +00:00
Sarthak Garg
87b384408e ANDROID: abi_gki_aarch64_qcom: Update symbol list
Symbols added:
   dev_pm_opp_remove
   __mmc_claim_host
   mmc_execute_tuning
   mmc_get_card
   mmc_get_ext_csd
   mmc_hs200_tuning
   mmc_issue_type
   __mmc_poll_for_busy
   mmc_prepare_busy_cmd
   mmc_put_card
   mmc_release_host
   mmc_retune_hold
   mmc_retune_release
   mmc_select_bus_width
   mmc_select_card
   mmc_select_hs400
   mmc_select_hs
   mmc_select_hs_ddr
   mmc_select_timing
   mmc_send_status
   mmc_set_bus_mode
   mmc_set_bus_width
   mmc_set_clock
   mmc_set_initial_state
   mmc_set_timing
   mmc_wait_for_cmd
   __traceiter_android_rvh_mmc_resume
   __traceiter_android_rvh_mmc_suspend
   __tracepoint_android_rvh_mmc_resume
   __tracepoint_android_rvh_mmc_suspend

Bug: 283922495
Change-Id: I9d3ff4fbdf6eb5df5798302cbe3409592b4c91c6
Signed-off-by: Sarthak Garg <quic_sartgarg@quicinc.com>
2023-06-01 18:00:57 +00:00
Sarthak Garg
a3a743e67f ANDROID: mmc: core: Export core functions for kernel modules usage
Export core functions for kernel modules usage.

Bug: 283922495
Link:
https://patchwork.kernel.org/project/linux-mmc/patch/20230401165723.19762-3-quic_sartgarg@quicinc.com/

Change-Id: Ia7904a5da3207e6f39590e092a7805e5260cd752
Signed-off-by: Sarthak Garg <quic_sartgarg@quicinc.com>
2023-06-01 18:00:57 +00:00
Sarthak Garg
631a2db5a3 ANDROID: vendor_hooks: Define new hooks in _mmc_suspend/resume
Define new hooks in _mmc_suspend/resume to control few things in card
suspend/resume paths which further allows to enable some additional
steps in mmc_suspend/resume paths as per host specific requirements.

Bug: 283922495
Link:
https://patchwork.kernel.org/project/linux-mmc/patch/20230401165723.19762-2-quic_sartgarg@quicinc.com/

Change-Id: Ief52d1dc6b01e9866f004b46687dffa4eb1e7bc1
Signed-off-by: Sarthak Garg <quic_sartgarg@quicinc.com>
2023-06-01 18:00:57 +00:00
Cixi Geng
e82e89e170 ANDROID: update symbol for unisoc vendor_hooks
Add the psci_cpu_suspend and psci_tos_resident_on.

2 function symbol(s) added
  'int __traceiter_android_rvh_psci_cpu_suspend(void*, u32, bool*)'
  'int __traceiter_android_rvh_psci_tos_resident_on(void*, int, bool*)'

2 variable symbol(s) added
  'struct tracepoint __tracepoint_android_rvh_psci_cpu_suspend'
  'struct tracepoint __tracepoint_android_rvh_psci_tos_resident_on'

Bug: 284797902
Change-Id: Ie4e740757631fe6dc194bf83873a64df34769193
Signed-off-by: Cixi Geng <cixi.geng1@unisoc.com>
2023-06-01 09:20:41 +08:00
Jian Gong
b7a7fd15ed ANDROID: vendor_hooks: psci: add hook to check if cpu is allowed to power off
While TOS is running alongside with linux, cpu power off operation by linux
may need be denied by TOS in some scenarios.
This patch added two hooks in psci_tos_resident_on and psci_cpu_suspend
to hook cpu off operation.

The function psci_tos_resident_on originally is used to check if TOS is resident on
a specific cpu and that cpu is dedicated for running TOS exclusively. If so, that
cpu can not be power off. Actually if TOS supports SMP, TOS may need deny any
other cpu to power down in some cases, i.e. there are no-expired timers in TOS.
Thus the first hook for psci_tos_resident_on is used to determine if
the specific cpu is allowed to power off in the cpu hotplug path.

Besides cpu hotplug, a cpu also can power off by cpu_suspend.
The second hook for psci_cpu_suspend determines if cpu suspend should go through
or not. When the same conditions described above meets, cpu suspend will break up.

The hook cherry-pick from commit 88d88955ae0b8b1f1a555d7810beb6c8ca4ca0f1
and changed vh to rvh according to commit 949edf7539b60058cf2da98f24db2b6d4d89eaa0

Bug: 284797902
Change-Id: Ib329beeff20f0cfef263f6a7813280d33f6a5eaa
Signed-off-by: Jian Gong <Jian.Gong@unisoc.com>
Signed-off-by: Cixi Geng <cixi.geng1@unisoc.com>
2023-06-01 09:18:28 +08:00
Xuewen Yan
3be7d118e7 ANDROID: Add vendor hook to the effective_cpu_util
android_rvh_effective_cpu_util:
	To perform vendor-specific cpu util, it is used in EAS/schedutil/thermal.

The effective_cpu_util would be called when thermal calc the dynamic power,
it's non-atomic context, so set the hook be restricted.

Bug: 226686099
Test: build pass

Signed-off-by: Xuewen Yan <xuewen.yan@unisoc.com>
Change-Id: I6fd77f44ca4328f5ef37d96989aa2e08d65e29bb
2023-06-01 00:39:32 +00:00
Chun-Hung Wu
0c2142745d ANDROID: Update symbol list for mtk
5 function symbol(s) added
  'void _trace_android_vh_record_pcpu_rwsem_starttime(struct task_struct*, unsigned long)'
  'struct file* filp_open_block(const char*, int, umode_t)'
  'int iommu_dev_disable_feature(struct device*, enum iommu_dev_features)'
  'int of_pci_get_max_link_speed(struct device_node*)'
  'void sched_clock_register(u64(*)(), int, unsigned long)'

Bug: 284836453
Change-Id: If41140f2f203664c58aeb9ce49498436a26113be
Signed-off-by: Chun-Hung Wu <chun-hung.wu@mediatek.com>
2023-05-31 23:11:43 +00:00
YOUNGJIN JOO
6f7dc871a6 ANDROID: ABI: update symbol list for galaxy
5 function symbol(s) added
  'void __kfree_skb(struct sk_buff*)'
  'int __traceiter_android_vh_ptype_head(void*, const struct packet_type*, struct list_head*)'
  'int __traceiter_kfree_skb(void*, struct sk_buff*, void*, enum skb_drop_reason)'
  'int skb_copy_ubufs(struct sk_buff*, gfp_t)'
  'struct usb_device* usb_alloc_dev(struct usb_device*, struct usb_bus*, unsigned int)'

2 variable symbol(s) added
  'struct tracepoint __tracepoint_android_vh_ptype_head'
  'struct tracepoint __tracepoint_kfree_skb'

Bug: 284426833
Change-Id: If9dd8836500afd45ed49838f00ccca7effbdb54f
Signed-off-by: YOUNGJIN JOO <youngjin79.joo@samsung.com>
2023-05-31 23:11:08 +00:00
Di Shen
b0a752c3aa ANDROID: update symbol for unisoc vendor_hooks
Add some thermal related symbols.

6 function symbol(s) added
  'int __traceiter_android_vh_get_thermal_zone_device(void*, struct thermal_zone_device*)'
  'int __traceiter_android_vh_modify_thermal_request_freq(void*, struct cpufreq_policy*, unsigned long*)'
  'int __traceiter_android_vh_modify_thermal_target_freq(void*, struct cpufreq_policy*, unsigned int*)'
  'int __traceiter_android_vh_thermal_power_cap(void*, u32*)'
  'int __traceiter_android_vh_thermal_register(void*, struct cpufreq_policy*)'
  'int __traceiter_android_vh_thermal_unregister(void*, struct cpufreq_policy*)'

6 variable symbol(s) added
  'struct tracepoint __tracepoint_android_vh_get_thermal_zone_device'
  'struct tracepoint __tracepoint_android_vh_modify_thermal_request_freq'
  'struct tracepoint __tracepoint_android_vh_modify_thermal_target_freq'
  'struct tracepoint __tracepoint_android_vh_thermal_power_cap'
  'struct tracepoint __tracepoint_android_vh_thermal_register'
  'struct tracepoint __tracepoint_android_vh_thermal_unregister'

Bug: 285078223

Signed-off-by: Di Shen <di.shen@unisoc.com>
Change-Id: I5c9e07c4754f24b70c6bb12333aec10b4db5b03f
2023-05-31 21:08:10 +00:00
Jeson Gao
ce7ceff8c8 ANDROID: thermal: Add vendor hook to check power range
For SoC's skin temperature, we have to use more stringent temperature
control to make IPA can monitor and mitigate temperature control earlier
and faster, so add it to meet platform thermal requirement.

Bug: 211564753

Signed-off-by: Jeson Gao <jeson.gao@unisoc.com>
Signed-off-by: Di Shen <di.shen@unisoc.com>
Change-Id: Iaef87287eef93d6fdbc3c58c93f70c1525e38296
(cherry picked from commit 6709f52325)
(cherry picked from commit 97a290b0e5)
2023-05-31 21:08:10 +00:00
Di Shen
7191b6a759 ANDROID: thermal: Add vendor hook to get thermal zone device
Need to get temperature data and config info from thermal zone device.

Bug: 208946028

Signed-off-by: Di Shen <di.shen@unisoc.com>
Signed-off-by: Jeson Gao <jeson.gao@unisoc.com>
Change-Id: I5945df5258181b4a441b6bbe09327099491418b3
(cherry picked from commit c53f0e3530)
(cherry picked from commit 12b8ef18b2)
2023-05-31 21:08:10 +00:00
Jeson Gao
1fe511720a ANDROID: thermal: Add hook for cpufreq thermal
Add hook to get cpufreq policy data after registering and unregistering
cpufreq thermal for platform thermal requirement.

Bug: 228423762

Signed-off-by: Jeson Gao <jeson.gao@unisoc.com>
Signed-off-by: Di Shen <di.shen@unisoc.com>
Change-Id: I9c6bc88f348f252c428560427bd8bca91092edfa
(cherry picked from commit fbe6f8708d)
2023-05-31 21:08:10 +00:00
Zhenhua Huang
78fe8913d1 UPSTREAM: mm,kfence: decouple kfence from page granularity mapping judgement
Kfence only needs its pool to be mapped as page granularity, if it is
inited early. Previous judgement was a bit over protected. From [1], Mark
suggested to "just map the KFENCE region a page granularity". So I
decouple it from judgement and do page granularity mapping for kfence
pool only. Need to be noticed that late init of kfence pool still requires
page granularity mapping.

Page granularity mapping in theory cost more(2M per 1GB) memory on arm64
platform. Like what I've tested on QEMU(emulated 1GB RAM) with
gki_defconfig, also turning off rodata protection:
Before:
[root@liebao ]# cat /proc/meminfo
MemTotal:         999484 kB
After:
[root@liebao ]# cat /proc/meminfo
MemTotal:        1001480 kB

To implement this, also relocate the kfence pool allocation before the
linear mapping setting up, arm64_kfence_alloc_pool is to allocate phys
addr, __kfence_pool is to be set after linear mapping set up.

LINK: [1] https://lore.kernel.org/linux-arm-kernel/Y+IsdrvDNILA59UN@FVFF77S0Q05N/
Suggested-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Zhenhua Huang <quic_zhenhuah@quicinc.com>
Reviewed-by: Kefeng Wang <wangkefeng.wang@huawei.com>
Reviewed-by: Marco Elver <elver@google.com>
Link: https://lore.kernel.org/r/1679066974-690-1-git-send-email-quic_zhenhuah@quicinc.com
Signed-off-by: Will Deacon <will@kernel.org>

BUG: 284812202
Change-Id: I8e7c565d3f4d6349a028a6a060259d62cf5beee7
(cherry picked from commit bfa7965b33)
Signed-off-by: Zhenhua Huang <quic_zhenhuah@quicinc.com>
2023-05-31 17:22:42 +00:00
Tetsuo Handa
8035e57ec7 UPSTREAM: mm/page_alloc: fix potential deadlock on zonelist_update_seq seqlock
commit 1007843a91 upstream.

syzbot is reporting circular locking dependency which involves
zonelist_update_seq seqlock [1], for this lock is checked by memory
allocation requests which do not need to be retried.

One deadlock scenario is kmalloc(GFP_ATOMIC) from an interrupt handler.

  CPU0
  ----
  __build_all_zonelists() {
    write_seqlock(&zonelist_update_seq); // makes zonelist_update_seq.seqcount odd
    // e.g. timer interrupt handler runs at this moment
      some_timer_func() {
        kmalloc(GFP_ATOMIC) {
          __alloc_pages_slowpath() {
            read_seqbegin(&zonelist_update_seq) {
              // spins forever because zonelist_update_seq.seqcount is odd
            }
          }
        }
      }
    // e.g. timer interrupt handler finishes
    write_sequnlock(&zonelist_update_seq); // makes zonelist_update_seq.seqcount even
  }

This deadlock scenario can be easily eliminated by not calling
read_seqbegin(&zonelist_update_seq) from !__GFP_DIRECT_RECLAIM allocation
requests, for retry is applicable to only __GFP_DIRECT_RECLAIM allocation
requests.  But Michal Hocko does not know whether we should go with this
approach.

Another deadlock scenario which syzbot is reporting is a race between
kmalloc(GFP_ATOMIC) from tty_insert_flip_string_and_push_buffer() with
port->lock held and printk() from __build_all_zonelists() with
zonelist_update_seq held.

  CPU0                                   CPU1
  ----                                   ----
  pty_write() {
    tty_insert_flip_string_and_push_buffer() {
                                         __build_all_zonelists() {
                                           write_seqlock(&zonelist_update_seq);
                                           build_zonelists() {
                                             printk() {
                                               vprintk() {
                                                 vprintk_default() {
                                                   vprintk_emit() {
                                                     console_unlock() {
                                                       console_flush_all() {
                                                         console_emit_next_record() {
                                                           con->write() = serial8250_console_write() {
      spin_lock_irqsave(&port->lock, flags);
      tty_insert_flip_string() {
        tty_insert_flip_string_fixed_flag() {
          __tty_buffer_request_room() {
            tty_buffer_alloc() {
              kmalloc(GFP_ATOMIC | __GFP_NOWARN) {
                __alloc_pages_slowpath() {
                  zonelist_iter_begin() {
                    read_seqbegin(&zonelist_update_seq); // spins forever because zonelist_update_seq.seqcount is odd
                                                             spin_lock_irqsave(&port->lock, flags); // spins forever because port->lock is held
                    }
                  }
                }
              }
            }
          }
        }
      }
      spin_unlock_irqrestore(&port->lock, flags);
                                                             // message is printed to console
                                                             spin_unlock_irqrestore(&port->lock, flags);
                                                           }
                                                         }
                                                       }
                                                     }
                                                   }
                                                 }
                                               }
                                             }
                                           }
                                           write_sequnlock(&zonelist_update_seq);
                                         }
    }
  }

This deadlock scenario can be eliminated by

  preventing interrupt context from calling kmalloc(GFP_ATOMIC)

and

  preventing printk() from calling console_flush_all()

while zonelist_update_seq.seqcount is odd.

Since Petr Mladek thinks that __build_all_zonelists() can become a
candidate for deferring printk() [2], let's address this problem by

  disabling local interrupts in order to avoid kmalloc(GFP_ATOMIC)

and

  disabling synchronous printk() in order to avoid console_flush_all()

.

As a side effect of minimizing duration of zonelist_update_seq.seqcount
being odd by disabling synchronous printk(), latency at
read_seqbegin(&zonelist_update_seq) for both !__GFP_DIRECT_RECLAIM and
__GFP_DIRECT_RECLAIM allocation requests will be reduced.  Although, from
lockdep perspective, not calling read_seqbegin(&zonelist_update_seq) (i.e.
do not record unnecessary locking dependency) from interrupt context is
still preferable, even if we don't allow calling kmalloc(GFP_ATOMIC)
inside
write_seqlock(&zonelist_update_seq)/write_sequnlock(&zonelist_update_seq)
section...

Link: https://lkml.kernel.org/r/8796b95c-3da3-5885-fddd-6ef55f30e4d3@I-love.SAKURA.ne.jp
Fixes: 3d36424b3b ("mm/page_alloc: fix race condition between build_all_zonelists and page allocation")
Link: https://lkml.kernel.org/r/ZCrs+1cDqPWTDFNM@alley [2]
Reported-by: syzbot <syzbot+223c7461c58c58a4cb10@syzkaller.appspotmail.com>
  Link: https://syzkaller.appspot.com/bug?extid=223c7461c58c58a4cb10 [1]
Change-Id: Ifc0c6ed9be6d36166367811ad412bedc66ed713e
Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Acked-by: Michal Hocko <mhocko@suse.com>
Acked-by: Mel Gorman <mgorman@techsingularity.net>
Cc: Petr Mladek <pmladek@suse.com>
Cc: David Hildenbrand <david@redhat.com>
Cc: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Cc: John Ogness <john.ogness@linutronix.de>
Cc: Patrick Daly <quic_pdaly@quicinc.com>
Cc: Sergey Senozhatsky <senozhatsky@chromium.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit b528537d13)
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2023-05-31 16:27:26 +00:00
Mel Gorman
fa3ef799ad UPSTREAM: mm: page_alloc: skip regions with hugetlbfs pages when allocating 1G pages
commit 4d73ba5fa7 upstream.

A bug was reported by Yuanxi Liu where allocating 1G pages at runtime is
taking an excessive amount of time for large amounts of memory.  Further
testing allocating huge pages that the cost is linear i.e.  if allocating
1G pages in batches of 10 then the time to allocate nr_hugepages from
10->20->30->etc increases linearly even though 10 pages are allocated at
each step.  Profiles indicated that much of the time is spent checking the
validity within already existing huge pages and then attempting a
migration that fails after isolating the range, draining pages and a whole
lot of other useless work.

Commit eb14d4eefd ("mm,page_alloc: drop unnecessary checks from
pfn_range_valid_contig") removed two checks, one which ignored huge pages
for contiguous allocations as huge pages can sometimes migrate.  While
there may be value on migrating a 2M page to satisfy a 1G allocation, it's
potentially expensive if the 1G allocation fails and it's pointless to try
moving a 1G page for a new 1G allocation or scan the tail pages for valid
PFNs.

Reintroduce the PageHuge check and assume any contiguous region with
hugetlbfs pages is unsuitable for a new 1G allocation.

The hpagealloc test allocates huge pages in batches and reports the
average latency per page over time.  This test happens just after boot
when fragmentation is not an issue.  Units are in milliseconds.

hpagealloc
                               6.3.0-rc6              6.3.0-rc6              6.3.0-rc6
                                 vanilla   hugeallocrevert-v1r1   hugeallocsimple-v1r2
Min       Latency       26.42 (   0.00%)        5.07 (  80.82%)       18.94 (  28.30%)
1st-qrtle Latency      356.61 (   0.00%)        5.34 (  98.50%)       19.85 (  94.43%)
2nd-qrtle Latency      697.26 (   0.00%)        5.47 (  99.22%)       20.44 (  97.07%)
3rd-qrtle Latency      972.94 (   0.00%)        5.50 (  99.43%)       20.81 (  97.86%)
Max-1     Latency       26.42 (   0.00%)        5.07 (  80.82%)       18.94 (  28.30%)
Max-5     Latency       82.14 (   0.00%)        5.11 (  93.78%)       19.31 (  76.49%)
Max-10    Latency      150.54 (   0.00%)        5.20 (  96.55%)       19.43 (  87.09%)
Max-90    Latency     1164.45 (   0.00%)        5.53 (  99.52%)       20.97 (  98.20%)
Max-95    Latency     1223.06 (   0.00%)        5.55 (  99.55%)       21.06 (  98.28%)
Max-99    Latency     1278.67 (   0.00%)        5.57 (  99.56%)       22.56 (  98.24%)
Max       Latency     1310.90 (   0.00%)        8.06 (  99.39%)       26.62 (  97.97%)
Amean     Latency      678.36 (   0.00%)        5.44 *  99.20%*       20.44 *  96.99%*

                   6.3.0-rc6   6.3.0-rc6   6.3.0-rc6
                     vanilla   revert-v1   hugeallocfix-v2
Duration User           0.28        0.27        0.30
Duration System       808.66       17.77       35.99
Duration Elapsed      830.87       18.08       36.33

The vanilla kernel is poor, taking up to 1.3 second to allocate a huge
page and almost 10 minutes in total to run the test.  Reverting the
problematic commit reduces it to 8ms at worst and the patch takes 26ms.
This patch fixes the main issue with skipping huge pages but leaves the
page_count() out because a page with an elevated count potentially can
migrate.

BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=217022
Link: https://lkml.kernel.org/r/20230414141429.pwgieuwluxwez3rj@techsingularity.net
Fixes: eb14d4eefd ("mm,page_alloc: drop unnecessary checks from pfn_range_valid_contig")
Change-Id: I552f0631f15e41038219e207c994fa7702b269fa
Signed-off-by: Mel Gorman <mgorman@techsingularity.net>
Reported-by: Yuanxi Liu <y.liu@naruida.com>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
Reviewed-by: David Hildenbrand <david@redhat.com>
Acked-by: Michal Hocko <mhocko@suse.com>
Reviewed-by: Oscar Salvador <osalvador@suse.de>
Cc: Matthew Wilcox <willy@infradead.org>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 059f24aff6)
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2023-05-31 16:27:26 +00:00
Uttkarsh Aggarwal
c0462c4b11 UPSTREAM: usb: gadget: f_fs: Add unbind event before functionfs_unbind
While exercising the unbind path, with the current implementation
the functionfs_unbind would be calling which waits for the ffs->mutex
to be available, however within the same time ffs_ep0_read is invoked
& if no setup packets are pending, it will invoke function
wait_event_interruptible_exclusive_locked_irq which by definition waits
for the ev.count to be increased inside the same mutex for which
functionfs_unbind is waiting.
This creates deadlock situation because the functionfs_unbind won't
get the lock until ev.count is increased which can only happen if
the caller ffs_func_unbind can proceed further.

Following is the illustration:

	CPU1				CPU2

ffs_func_unbind()		ffs_ep0_read()
				mutex_lock(ffs->mutex)
				wait_event(ffs->ev.count)
functionfs_unbind()
  mutex_lock(ffs->mutex)
  mutex_unlock(ffs->mutex)

ffs_event_add()

<deadlock>

Fix this by moving the event unbind before functionfs_unbind
to ensure the ev.count is incrased properly.

Fixes: 6a19da1110 ("usb: gadget: f_fs: Prevent race during ffs_ep0_queue_wait")
Cc: stable <stable@kernel.org>
Signed-off-by: Uttkarsh Aggarwal <quic_uaggarwa@quicinc.com>
Link: https://lore.kernel.org/r/20230525092854.7992-1-quic_uaggarwa@quicinc.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Bug: 285072336
(cherry picked from commit efb6b53520)

Change-Id: I1a001606f62f1966825d47809cd1c887e3d6fb71
Signed-off-by: Uttkarsh Aggarwal <quic_uaggarwa@quicinc.com>
2023-05-31 16:16:30 +00:00
Alexander Potapenko
f800df6e1f UPSTREAM: mm: kmsan: handle alloc failures in kmsan_vmap_pages_range_noflush()
commit 47ebd0310e upstream.

As reported by Dipanjan Das, when KMSAN is used together with kernel fault
injection (or, generally, even without the latter), calls to kcalloc() or
__vmap_pages_range_noflush() may fail, leaving the metadata mappings for
the virtual mapping in an inconsistent state.  When these metadata
mappings are accessed later, the kernel crashes.

To address the problem, we return a non-zero error code from
kmsan_vmap_pages_range_noflush() in the case of any allocation/mapping
failure inside it, and make vmap_pages_range_noflush() return an error if
KMSAN fails to allocate the metadata.

This patch also removes KMSAN_WARN_ON() from vmap_pages_range_noflush(),
as these allocation failures are not fatal anymore.

Link: https://lkml.kernel.org/r/20230413131223.4135168-1-glider@google.com
Fixes: b073d7f8ae ("mm: kmsan: maintain KMSAN metadata for page operations")
Change-Id: I2a50da1c7cc438a30026b2b18d425fff2ea349b6
Signed-off-by: Alexander Potapenko <glider@google.com>
Reported-by: Dipanjan Das <mail.dipanjan.das@gmail.com>
  Link: https://lore.kernel.org/linux-mm/CANX2M5ZRrRA64k0hOif02TjmY9kbbO2aCBPyq79es34RXZ=cAw@mail.gmail.com/
Reviewed-by: Marco Elver <elver@google.com>
Cc: Christoph Hellwig <hch@infradead.org>
Cc: Dmitry Vyukov <dvyukov@google.com>
Cc: Uladzislau Rezki (Sony) <urezki@gmail.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit bd6f3421a5)
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2023-05-31 15:20:12 +00:00
xieliujie
e03c7f09c6 ANDROID: ABI: Update oplus symbol list
1 function symbol(s) added
  'int __traceiter_android_vh_sync_txn_recvd(void*, struct task_struct*, struct task_struct*)'

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

Bug: 283132152
Change-Id: Ic03bf3872011bd213106d804d7cf31d71bbaf81d
Signed-off-by: xieliujie <xieliujie@oppo.com>
2023-05-30 22:58:11 +00:00
Avichal Rakesh
cdcdf1d9af Revert "FROMGIT: usb: gadget: udc: core: Prevent redundant calls to pullup"
This reverts commit b9bb33b73c.

Reason: This patch breaks any USB gadget function that deactivates the
gadget on bind (by setting bind_deactivated = true).

Bug: 285019584

Change-Id: I2885819dd75e9d65de8258b7d2f6fc5d98de6c68
Signed-off-by: Avichal Rakesh <arakesh@google.com>
2023-05-30 22:22:38 +00:00
xieliujie
44d674262f ANDROID: GKI: Update symbols to symbol list
3 function symbol(s) added
  'int __traceiter_android_vh_binder_del_ref(void*, task_struct*, uint32_t)'
  'int __traceiter_android_vh_binder_new_ref(void*, task_struct*, uint32_t, int)'
  'int __traceiter_android_vh_binder_proc_transaction(void*, task_struct*, task_struct*, task_struct*, int, unsigned int, bool)'

3 variable symbol(s) added
  'struct tracepoint __tracepoint_android_vh_binder_del_ref'
  'struct tracepoint __tracepoint_android_vh_binder_new_ref'
  'struct tracepoint __tracepoint_android_vh_binder_proc_transaction'

Bug: 283132152
Change-Id: Ie02a5f234e7f7ce2be313d3770d574151eccfc99
Signed-off-by: xieliujie <xieliujie@oppo.com>
2023-05-30 21:51:17 +00:00
zhengding chen
4952744d12 ANDROID: vendor_hooks: Add hooks for binder proc transaction
When servicemanager process added service proxy from other process
register the service, we want to know the matching relation between
handle in the process and service name. When binder transaction
happened, We want to know what process calls what method on what service.

Bug: 186604985
Signed-off-by: zhengding chen <chenzhengding@oppo.com>
Change-Id: I813d1cde10294d8665f899f7fef0d444ec1f1f5e
2023-05-30 21:51:17 +00:00
Alexander Potapenko
843caf6daa UPSTREAM: mm: kmsan: handle alloc failures in kmsan_ioremap_page_range()
commit fdea03e12a upstream.

Similarly to kmsan_vmap_pages_range_noflush(), kmsan_ioremap_page_range()
must also properly handle allocation/mapping failures.  In the case of
such, it must clean up the already created metadata mappings and return an
error code, so that the error can be propagated to ioremap_page_range().
Without doing so, KMSAN may silently fail to bring the metadata for the
page range into a consistent state, which will result in user-visible
crashes when trying to access them.

Link: https://lkml.kernel.org/r/20230413131223.4135168-2-glider@google.com
Fixes: b073d7f8ae ("mm: kmsan: maintain KMSAN metadata for page operations")
Change-Id: Iae12299853f5f39b473c509d0ad63ac20d0425e7
Signed-off-by: Alexander Potapenko <glider@google.com>
Reported-by: Dipanjan Das <mail.dipanjan.das@gmail.com>
  Link: https://lore.kernel.org/linux-mm/CANX2M5ZRrRA64k0hOif02TjmY9kbbO2aCBPyq79es34RXZ=cAw@mail.gmail.com/
Reviewed-by: Marco Elver <elver@google.com>
Cc: Christoph Hellwig <hch@infradead.org>
Cc: Dmitry Vyukov <dvyukov@google.com>
Cc: Uladzislau Rezki (Sony) <urezki@gmail.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 433a7ecaed)
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2023-05-30 17:15:55 +00:00
Naoya Horiguchi
ac51e1f090 UPSTREAM: mm/huge_memory.c: warn with pr_warn_ratelimited instead of VM_WARN_ON_ONCE_FOLIO
commit 4737edbbdd upstream.

split_huge_page_to_list() WARNs when called for huge zero pages, which
sounds to me too harsh because it does not imply a kernel bug, but just
notifies the event to admins.  On the other hand, this is considered as
critical by syzkaller and makes its testing less efficient, which seems to
me harmful.

So replace the VM_WARN_ON_ONCE_FOLIO with pr_warn_ratelimited.

Link: https://lkml.kernel.org/r/20230406082004.2185420-1-naoya.horiguchi@linux.dev
Fixes: 478d134e95 ("mm/huge_memory: do not overkill when splitting huge_zero_page")
Change-Id: Ib41a08bf87cc55ce240a63eddf5609aa7c8976ef
Signed-off-by: Naoya Horiguchi <naoya.horiguchi@nec.com>
Reported-by: syzbot+07a218429c8d19b1fb25@syzkaller.appspotmail.com
  Link: https://lore.kernel.org/lkml/000000000000a6f34a05e6efcd01@google.com/
Reviewed-by: Yang Shi <shy828301@gmail.com>
Cc: Miaohe Lin <linmiaohe@huawei.com>
Cc: Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>
Cc: Xu Yu <xuyu@linux.alibaba.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit e8a7bdb6f7)
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2023-05-30 17:15:55 +00:00
David Hildenbrand
12132bd611 UPSTREAM: mm/userfaultfd: fix uffd-wp handling for THP migration entries
commit 24bf08c437 upstream.

Looks like what we fixed for hugetlb in commit 44f86392bd ("mm/hugetlb:
fix uffd-wp handling for migration entries in
hugetlb_change_protection()") similarly applies to THP.

Setting/clearing uffd-wp on THP migration entries is not implemented
properly.  Further, while removing migration PMDs considers the uffd-wp
bit, inserting migration PMDs does not consider the uffd-wp bit.

We have to set/clear independently of the migration entry type in
change_huge_pmd() and properly copy the uffd-wp bit in
set_pmd_migration_entry().

Verified using a simple reproducer that triggers migration of a THP, that
the set_pmd_migration_entry() no longer loses the uffd-wp bit.

Link: https://lkml.kernel.org/r/20230405160236.587705-2-david@redhat.com
Fixes: f45ec5ff16 ("userfaultfd: wp: support swap and page migration")
Change-Id: I263a9fd8a6695f546fe5c5279a439f4f1c151c48
Signed-off-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
Cc: <stable@vger.kernel.org>
Cc: Muhammad Usama Anjum <usama.anjum@collabora.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit cc647e05db)
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2023-05-30 17:15:55 +00:00
Peter Xu
ab721b09b1 UPSTREAM: mm/khugepaged: check again on anon uffd-wp during isolation
commit dd47ac428c upstream.

Khugepaged collapse an anonymous thp in two rounds of scans.  The 2nd
round done in __collapse_huge_page_isolate() after
hpage_collapse_scan_pmd(), during which all the locks will be released
temporarily.  It means the pgtable can change during this phase before 2nd
round starts.

It's logically possible some ptes got wr-protected during this phase, and
we can errornously collapse a thp without noticing some ptes are
wr-protected by userfault.  e1e267c792 wanted to avoid it but it only
did that for the 1st phase, not the 2nd phase.

Since __collapse_huge_page_isolate() happens after a round of small page
swapins, we don't need to worry on any !present ptes - if it existed
khugepaged will already bail out.  So we only need to check present ptes
with uffd-wp bit set there.

This is something I found only but never had a reproducer, I thought it
was one caused a bug in Muhammad's recent pagemap new ioctl work, but it
turns out it's not the cause of that but an userspace bug.  However this
seems to still be a real bug even with a very small race window, still
worth to have it fixed and copy stable.

Link: https://lkml.kernel.org/r/20230405155120.3608140-1-peterx@redhat.com
Fixes: e1e267c792 ("khugepaged: skip collapse if uffd-wp detected")
Change-Id: Iab7f0ac5b9b6d055485ca244b2fa1e13f0dbc570
Signed-off-by: Peter Xu <peterx@redhat.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Yang Shi <shy828301@gmail.com>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: Axel Rasmussen <axelrasmussen@google.com>
Cc: Mike Rapoport <rppt@linux.vnet.ibm.com>
Cc: Nadav Amit <nadav.amit@gmail.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 519dbe737f)
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2023-05-30 14:32:04 +00:00
Jiachen Zhang
c0f5b9920f UPSTREAM: fuse: always revalidate rename target dentry
commit ccc031e26a upstream.

The previous commit df8629af29 ("fuse: always revalidate if exclusive
create") ensures that the dentries are revalidated on O_EXCL creates.  This
commit complements it by also performing revalidation for rename target
dentries.  Otherwise, a rename target file that only exists in kernel
dentry cache but not in the filesystem will result in EEXIST if
RENAME_NOREPLACE flag is used.

Change-Id: I3500c168b37469e0fcf5664a3deb4d54e45b926d
Signed-off-by: Jiachen Zhang <zhangjiachen.jaycee@bytedance.com>
Signed-off-by: Zhang Tianci <zhangtianci.1997@bytedance.com>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Signed-off-by: Yang Bo <yb203166@antfin.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 7ca973d830)
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2023-05-30 14:31:59 +00:00
wangshuai12
1464eaee1b ANDROID: GKI: update xiaomi symbol list
ABI DIFFERENCES HAVE BEEN DETECTED!
12 function symbol(s) added
  'u64 __blkg_prfill_rwstat(struct seq_file*, struct blkg_policy_data*, const struct blkg_rwstat_sample*)'
  'u64 __blkg_prfill_u64(struct seq_file*, struct blkg_policy_data*, u64)'
  'const char* bdi_dev_name(struct backing_dev_info*)'
  'void blkcg_print_blkgs(struct seq_file*, struct blkcg*, u64(*)(struct seq_file*, struct blkg_policy_data*, int), const struct blkcg_policy*, int, bool)'
  'void blkg_conf_finish(struct blkg_conf_ctx*)'
  'int blkg_conf_prep(struct blkcg*, const struct blkcg_policy*, char*, struct blkg_conf_ctx*)'
  'u64 blkg_prfill_rwstat(struct seq_file*, struct blkg_policy_data*, int)'
  'void blkg_rwstat_exit(struct blkg_rwstat*)'
  'int blkg_rwstat_init(struct blkg_rwstat*, gfp_t)'
  'void blkg_rwstat_recursive_sum(struct blkcg_gq*, struct blkcg_policy*, int, struct blkg_rwstat_sample*)'
  'struct io_cq* ioc_lookup_icq(struct request_queue*)'
  'void percpu_counter_add_batch(struct percpu_counter*, s64, s32)'

1 variable symbol(s) added
  'struct static_key_true io_cgrp_subsys_on_dfl_key'

Bug: 284828333

Change-Id: I7536f25b8d22a25518b8a3426b6b069689054dcf
Signed-off-by: wangshuai12 <wangshuai12@xiaomi.corp-partner.google.com>
2023-05-29 17:28:25 +00:00
Kalesh Singh
500484f5be BACKPORT: FROMGIT: Multi-gen LRU: fix workingset accounting
On Android app cycle workloads, MGLRU showed a significant reduction in
workingset refaults although pgpgin/pswpin remained relatively unchanged.
This indicated MGLRU may be undercounting workingset refaults.

This has impact on userspace programs, like Android's LMKD, that monitor
workingset refault statistics to detect thrashing.

It was found that refaults were only accounted if the MGLRU shadow entry
was for a recently evicted folio.  However, recently evicted folios should
be accounted as workingset activation, and refaults should be accounted
regardless of recency.

Fix MGLRU's workingset refault and activation accounting to more closely
match that of the conventional active/inactive LRU.

Link: https://lkml.kernel.org/r/20230523205922.3852731-1-kaleshsingh@google.com
Fixes: ac35a49023 ("mm: multi-gen LRU: minimal implementation")
Signed-off-by: Kalesh Singh <kaleshsingh@google.com>
Reported-by: Charan Teja Kalla <quic_charante@quicinc.com>
Acked-by: Yu Zhao <yuzhao@google.com>
Cc: Brian Geffon <bgeffon@google.com>
Cc: Jan Alexander Steffens (heftig) <heftig@archlinux.org>
Cc: Oleksandr Natalenko <oleksandr@natalenko.name>
Cc: Suren Baghdasaryan <surenb@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
(cherry picked from commit 02ad728453d2ddb09d7ce5e59854ebb27544d488 https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-unstable)
Bug: 284043217
[ Kalesh Singh - Fix conflicts in mm/workingset.c ]
Signed-off-by: Kalesh Singh <kaleshsingh@google.com>
Change-Id: I6d42cca9064e66099fbbc20aa2143961f84b2003
2023-05-27 00:38:36 +00:00
Ajay Agarwal
80d7019423 BACKPORT: FROMGIT: PCI: dwc: Wait for link up only if link is started
In dw_pcie_host_init() regardless of whether the link has been
started or not, the code waits for the link to come up. Even in
cases where start_link() is not defined the code ends up spinning
in a loop for 1 second. Since in some systems dw_pcie_host_init()
gets called during probe, this one second loop for each pcie
interface instance ends up extending the boot time.

Wait for the link up in only if the start_link() is defined.

Bug: 270085637
Link: https://lore.kernel.org/r/20230412093425.3659088-1-ajayagarwal@google.com
Tested-by: Will McVicker <willmcvicker@google.com>
Signed-off-by: Sajid Dalvi <sdalvi@google.com>
Signed-off-by: Ajay Agarwal <ajayagarwal@google.com>
Signed-off-by: Lorenzo Pieralisi <lpieralisi@kernel.org>
(cherry picked from commit da56a1bfba
 https://git.kernel.org/pub/scm/linux/kernel/git/pci/pci.git controller/dwc)
[willmcvicker: fixed trivial merge conflicts]
Signed-off-by: Will McVicker <willmcvicker@google.com>
Change-Id: Ia4d9b41b2a15cb077025f6250d8fa07c495a17a9
2023-05-26 23:16:15 +00:00
SEO HOYOUNG
4439750641 ANDROID: ABI: update symbol list for exynos
2 function symbol(s) added
  'int __traceiter_android_vh_ufs_mcq_abort(void*, struct ufs_hba*, struct scsi_cmnd*, int*)'
  'int __traceiter_android_vh_ufs_use_mcq_hooks(void*, struct ufs_hba*, bool*)'

Bug: 280041543
Change-Id: Ibd3413dd89db1a0e68d98102fc27d0a852051593
Signed-off-by: SEO HOYOUNG <hy50.seo@samsung.com>
2023-05-26 18:14:14 +00:00
SEO HOYOUNG
e5b77cd49a ANDROID: ufs: Improve MCQ err handling
- Add android vendor hook:
 android_vh_ufs_mcq_abort
 android_vh_ufs_use_mcq_hooks

Bug: 280041543
Change-Id: I9cd4372c20fc179804e26391e2cb758fb02e5b72
Signed-off-by: SEO HOYOUNG <hy50.seo@samsung.com>
2023-05-26 18:14:14 +00:00
xieliujie
0dec547282 ANDROID: ABI: Update oplus symbol list
1 function symbol(s) added
  'int __traceiter_android_rvh_post_init_entity_util_avg(void*, struct sched_entity*)'

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

Bug: 283132152
Change-Id: I0a98c23c0582312cbb375b2d598662b9611e4cd2
Signed-off-by: xieliujie <xieliujie@oppo.com>
2023-05-26 17:58:14 +08:00
Choonghoon Park
ca0b1abfc5 ANDROID: GKI: sched: add rvh for new cfs task util
A vendor hook is added in post_init_entity_util_avg before
a new cfs task's util is attached to cfs_rq's util so that
vendors can gather and modify se's information to modify
scheduling behavior and DVFS as they want.

trace_android_rvh_new_task_stats is not a proper hook because
it is called after the task's util is attached to cfs_rq's util,
which means updating cfs_rq's sched_avg and DVFS request are done.

Bug: 184219858

Signed-off-by: Choonghoon Park <choong.park@samsung.com>
Change-Id: I2deaa93297f8464895978496c9838cdffaa35b7f
(cherry picked from commit 1eea1cbdd3)
2023-05-26 17:36:43 +08:00
Todd Kjos
07efa91ae9 ANDROID: Disable BTI_KERNEL, enable UNWIND_PATCH_PAC_INTO_SCS
Disable CONFIG_ARM64_BTI_KERNEL since significant overhead has been observed
on systems that don't have BTI/PAC hardware support due to increased number
of NOPs added by these features.

BTI is not as important in kernels that have CFI enabled because the protection
these features offer overlap.

Keep PAC enabled and also enable dynamic SCS (CONFIG_UNWIND_PATCH_PAC_INTO_SCS)
which is available starting in v6.2. This removes SCS overhead on systems that
support PAC, and PAC overhead on systems that need SCS instead. This feature uses
runtime code patching, so it won't have the overhead of additional NOPs.

Bug: 267119345
Change-Id: Ifc7d5e502940bd15d13e7f89c5facd10b6c7b8a8
Signed-off-by: Todd Kjos <tkjos@google.com>
2023-05-25 15:37:15 -07:00
Ard Biesheuvel
d8d33ccbaf BACKPORT: arm64: implement dynamic shadow call stack for Clang
Implement dynamic shadow call stack support on Clang, by parsing the
unwind tables at init time to locate all occurrences of PACIASP/AUTIASP
instructions, and replacing them with the shadow call stack push and pop
instructions, respectively.

This is useful because the overhead of the shadow call stack is
difficult to justify on hardware that implements pointer authentication
(PAC), and given that the PAC instructions are executed as NOPs on
hardware that doesn't, we can just replace them without breaking
anything. As PACIASP/AUTIASP are guaranteed to be paired with respect to
manipulations of the return address, replacing them 1:1 with shadow call
stack pushes and pops is guaranteed to result in the desired behavior.

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Reviewed-by: Sami Tolvanen <samitolvanen@google.com>
Tested-by: Sami Tolvanen <samitolvanen@google.com>
Link: https://lore.kernel.org/r/20221027155908.1940624-4-ardb@kernel.org
Signed-off-by: Will Deacon <will@kernel.org>

(cherry picked from commit 3b619e22c4)
Bug: 283954062
Change-Id: Idca66f03315191a9fb18ed17d5b79c5bfacc51b8
Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
2023-05-25 15:37:15 -07:00
Ard Biesheuvel
d44a32aa2c UPSTREAM: scs: add support for dynamic shadow call stacks
In order to allow arches to use code patching to conditionally emit the
shadow stack pushes and pops, rather than always taking the performance
hit even on CPUs that implement alternatives such as stack pointer
authentication on arm64, add a Kconfig symbol that can be set by the
arch to omit the SCS codegen itself, without otherwise affecting how
support code for SCS and compiler options (for register reservation, for
instance) are emitted.

Also, add a static key and some plumbing to omit the allocation of
shadow call stack for dynamic SCS configurations if SCS is disabled at
runtime.

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Sami Tolvanen <samitolvanen@google.com>
Tested-by: Sami Tolvanen <samitolvanen@google.com>
Link: https://lore.kernel.org/r/20221027155908.1940624-3-ardb@kernel.org
Signed-off-by: Will Deacon <will@kernel.org>

(cherry picked from commit 9beccca098)
Bug: 283954062
Change-Id: I71ed23533124b071bd6bf5ab91b2af3bbf03b42b
Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
2023-05-25 15:37:14 -07:00
Ard Biesheuvel
e8d9375e53 BACKPORT: arm64: unwind: add asynchronous unwind tables to kernel and modules
Enable asynchronous unwind table generation for both the core kernel as
well as modules, and emit the resulting .eh_frame sections as init code
so we can use the unwind directives for code patching at boot or module
load time.

This will be used by dynamic shadow call stack support, which will rely
on code patching rather than compiler codegen to emit the shadow call
stack push and pop instructions.

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Reviewed-by: Sami Tolvanen <samitolvanen@google.com>
Tested-by: Sami Tolvanen <samitolvanen@google.com>
Link: https://lore.kernel.org/r/20221027155908.1940624-2-ardb@kernel.org
Signed-off-by: Will Deacon <will@kernel.org>

(cherry picked from commit 68c76ad4a9)
Bug: 283954062
Change-Id: I2e17c7171295dc3859ff385b11a10048f6c87ec5
Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
2023-05-25 15:37:14 -07:00
lvwenhuan
925158c959 ANDROID: ABI: Update oplus symbol list
2 function symbol(s) added
  'int __traceiter_android_vh_shrink_node_memcgs(void*, struct mem_cgroup*, bool*)'
  'int is_ashmem_file(struct file*)'

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

Bug: 226482420
Change-Id: Idcba13c7575d0430c70c03188fb911203c816122
Signed-off-by: lvwenhuan <lvwenhuan@oppo.com>
2023-05-25 21:44:09 +00:00
Liujie Xie
6f3353ca09 ANDROID: vendor_hooks: Add hook in shrink_node_memcgs
Add vendor hook in shrink_node_memcgs to adjust whether
to skip memory reclamation of memcg.

Bug: 226482420
Signed-off-by: Liujie Xie <xieliujie@oppo.com>
(cherry picked from commit b7ea1c4987)

Change-Id: I925856353e63c5a821027de4f8476c833e21b982
Signed-off-by: lvwenhuan <lvwenhuan@oppo.com>
2023-05-25 21:44:09 +00:00
Liujie Xie
6e8132f790 ANDROID: ashmem: Export is_ashmem_file
Export is_ashmem_file function which will be used
by the minidump module to get ashmem info.

Bug: 193397560
Change-Id: I5b7816ad4775e5cf2c4f41c28b1c8dacc2c85b7e
Signed-off-by: liuhailong <liuhailong@oppo.com>
Signed-off-by: Liujie Xie <xieliujie@oppo.com>
(cherry picked from commit 7bcfde2601)
(cherry picked from commit 77064627fb)
2023-05-25 21:44:09 +00:00
Hyesoo Yu
f298afd5ba ANDROID: ABI: update symbol list related to show_mem for Exynos
Update symbols for mm vendorhook

1 function symbol(s) added
  'int __traceiter_android_vh_show_mem(void*, unsigned int, nodemask_t*)'

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

Bug: 277799025

Change-Id: Ic21db591c52fb173f928526e48cb74e2ffc7c919
Signed-off-by: Hyesoo Yu <hyesoo.yu@samsung.com>
2023-05-25 21:06:40 +00:00
Liujie Xie
573ba7b6e6 ANDROID: vendor_hooks: Add hooks for memory when debug
Add vendors hooks for recording memory used

Vendor modules allocate and manages the memory itself.

These memories might not be included in kernel memory
statistics. Also, detailed references and vendor-specific
information are managed only inside modules. When
various problems such as memory leaks occurs, these
information should be showed in real-time.

Bug: 182443489
Bug: 234407991
Bug: 277799025

Signed-off-by: Liujie Xie <xieliujie@oppo.com>
Change-Id: I62d8bb2b6650d8b187b433f97eb833ef0b784df1
Signed-off-by: Hyesoo Yu <hyesoo.yu@samsung.com>
2023-05-25 21:06:40 +00:00
Dezhi Huang
9266b0d1be ANDROID: GKI: Update symbol list for honor
INFO: ABI DIFFERENCES HAVE BEEN DETECTED!
INFO: 1 function symbol(s) added
  'int __traceiter_android_vh_mutex_init(void*, struct mutex*)'

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

Bug: 231527236
Change-Id: Ice6a33f8f67509a6844701f12a09e27a6a291bd7
Signed-off-by: Dezhi Huang <huangdezhi@hihonor.com>
2023-05-25 21:01:19 +00:00
Dezhi Huang
bcf27b22e4 ANDROID: mutex: Add vendor hook to init mutex oem data.
Add hooks to init oem data of mutex.

Bug: 231527236
Signed-off-by: Dezhi Huang <huangdezhi@hihonor.com>
Change-Id: Id0aeac168e81bd3d88051657c32ba709c329dbdd
2023-05-25 21:01:19 +00:00
Peifeng Li
07b9faefd4 ANDROID: ABI: Update oplus symbol list
2 function symbol(s) added
  'int __traceiter_android_vh_cleanup_old_buffers_bypass(void*, unsigned long, unsigned long*, bool*)'
  'int __traceiter_android_vh_dm_bufio_shrink_scan_bypass(void*, unsigned long, bool*)'

2 variable symbol(s) added
  'struct tracepoint __tracepoint_android_vh_cleanup_old_buffers_bypass'
  'struct tracepoint __tracepoint_android_vh_dm_bufio_shrink_scan_bypass'

Bug: 281467813
Change-Id: Ic2d7e8f0e898f324a010cf0c8b4b32241aba3803
Signed-off-by: Peifeng Li <lipeifeng@oppo.com>
2023-05-25 05:10:30 +00:00
Peifeng Li
0df40fbf03 ANDROID: vendor_hook: add hooks in dm_bufio.c
1. android_vh_dm_bufio_shrink_scan_bypass
To adjust dm_bufio-buffer shrinker's policy in some cases.
2. cleanup_old_buffers_bypass
To adjust the policy of dm_bufio-buffer periodic eviction
in some cases.

Bug: 281467813

Signed-off-by: Peifeng Li <lipeifeng@oppo.com>
Change-Id: I29a9d91d18d2e279170533db83b59cfc3b17ebe2
2023-05-25 05:10:22 +00:00
Harsh Jain
a154119473 ANDROID: abi_gki_aarch64_qcom: update QCOM symbol list
following symbols are added to abi symbol list.
	sysfs_update_group

Symbols added:
   sysfs_update_group

Bug: 281970901
Change-Id: I045fd322d8ae8d590105351ab19ea25776d4e345
Signed-off-by: Harsh Jain <quic_harshj@quicinc.com>
2023-05-25 00:48:57 +00:00
Dezhi Huang
50191081d8 ANDROID: ABI: Update honor symbol list
2 function symbol(s) added
  'int __traceiter_android_vh_do_shrink_slab(void*, struct shrinker*, long*)'
  'int __traceiter_android_vh_shrink_slab_bypass(gfp_t, int, struct mem_cgroup*, int, bool*)'

2 variable symbol(s) added
  'struct tracepoint __tracepoint_android_vh_do_shrink_slab'
  'struct tracepoint __tracepoint_android_vh_shrink_slab_bypass'

Bug: 279793370
Change-Id: Ie0caa6124f819500a4d6de448da13cc4aa454a4f
Signed-off-by: Dezhi Huang <huangdezhi@hihonor.com>
2023-05-24 21:12:43 +00:00