Commit Graph

1153699 Commits

Author SHA1 Message Date
Yi-De Wu
3ee517981d FROMLIST: virt: geniezone: Add memory relinquish support
Unpin the pages when VM relinquish the pages or is destroyed.

Change-Id: I9729f6ea93fee50a812dd43016754fdf812daa74
Signed-off-by: Jerry Wang <ze-yu.wang@mediatek.com>
Signed-off-by: Yingshiuan Pan <yingshiuan.pan@mediatek.com>
Signed-off-by: Liju-Clr Chen <liju-clr.chen@mediatek.com>
Signed-off-by: Yi-De Wu <yi-de.wu@mediatek.com>
Bug: 301179926
Link: https://lore.kernel.org/all/20231116152756.4250-17-yi-de.wu@mediatek.com/
2023-11-27 19:03:01 +00:00
Biswarup Pal
c57b152c45 FROMGIT: Input: uinput - allow injecting event times
Currently, uinput doesn't use the input_set_timestamp API, so any
event injected using uinput is not accurately timestamped in terms of
measuring when the actual event happened. Hence, call the
input_set_timestamp API from uinput in order to provide a more
accurate sense of time for the event. Propagate only the timestamps
which are a) positive, b) within a pre-defined offset (10 secs) from
the current time, and c) not in the future.

Bug: 271946580
Bug: 277040837
Change-Id: I928be61d0114b78e2098995ee49eeb0376bef2a3
(cherry picked from commit 3a2df60200
https://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git master)
Signed-off-by: Biswarup Pal <biswarupp@google.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Siarhei Vishniakou <svv@google.com>
Link: https://lore.kernel.org/r/20230427000152.1407471-1-biswarupp@google.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
(cherry picked from commit ee1f5fc55cc7bf1bca78edbb8a1f9d989d4ea03e)
2023-11-27 17:31:12 +00:00
Pavankumar Kondeti
df6e6fc38f UPSTREAM: PM: hibernate: Fix copying the zero bitmap to safe pages
The following crash is observed 100% of the time during resume from
the hibernation on a x86 QEMU system.

[   12.931887]  ? __die_body+0x1a/0x60
[   12.932324]  ? page_fault_oops+0x156/0x420
[   12.932824]  ? search_exception_tables+0x37/0x50
[   12.933389]  ? fixup_exception+0x21/0x300
[   12.933889]  ? exc_page_fault+0x69/0x150
[   12.934371]  ? asm_exc_page_fault+0x26/0x30
[   12.934869]  ? get_buffer.constprop.0+0xac/0x100
[   12.935428]  snapshot_write_next+0x7c/0x9f0
[   12.935929]  ? submit_bio_noacct_nocheck+0x2c2/0x370
[   12.936530]  ? submit_bio_noacct+0x44/0x2c0
[   12.937035]  ? hib_submit_io+0xa5/0x110
[   12.937501]  load_image+0x83/0x1a0
[   12.937919]  swsusp_read+0x17f/0x1d0
[   12.938355]  ? create_basic_memory_bitmaps+0x1b7/0x240
[   12.938967]  load_image_and_restore+0x45/0xc0
[   12.939494]  software_resume+0x13c/0x180
[   12.939994]  resume_store+0xa3/0x1d0

The commit being fixed introduced a bug in copying the zero bitmap
to safe pages. A temporary bitmap is allocated with PG_ANY flag in
prepare_image() to make a copy of zero bitmap after the unsafe pages
are marked. Freeing this temporary bitmap with PG_UNSAFE_KEEP later
results in an inconsistent state of unsafe pages. Since free bit is
left as is for this temporary bitmap after free, these pages are
treated as unsafe pages when they are allocated again. This results
in incorrect calculation of the number of pages pre-allocated for the
image.

nr_pages = (nr_zero_pages + nr_copy_pages) - nr_highmem - allocated_unsafe_pages;

The allocate_unsafe_pages is estimated to be higher than the actual
which results in running short of pages in safe_pages_list. Hence the
crash is observed in get_buffer() due to NULL pointer access of
safe_pages_list.

Fix this issue by creating the temporary zero bitmap from safe pages
(free bit not set) so that the corresponding free bits can be cleared
while freeing this bitmap.

Bug: 311131385
(cherry picked from commit b21f18ef96
 git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master)
Fixes: 005e8dddd4 ("PM: hibernate: don't store zero pages in the image file")
Suggested-by:: Brian Geffon <bgeffon@google.com>
Signed-off-by: Pavankumar Kondeti <quic_pkondeti@quicinc.com>
Reviewed-by: Brian Geffon <bgeffon@google.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Change-Id: Id68699710e40c5e8eec227bfe0d8311c1e788d5e
Signed-off-by: Pavankumar Kondeti <quic_pkondeti@quicinc.com>
Signed-off-by: Mukesh Pilaniya <quic_mpilaniy@quicinc.com>
2023-11-27 17:04:26 +00:00
Brian Geffon
7181d45e36 UPSTREAM: PM: hibernate: don't store zero pages in the image file
On ChromeOS we've observed a considerable number of in-use pages filled with
zeros. Today with hibernate it's entirely possible that saveable pages are just
zero filled. Since we're already copying pages word-by-word in do_copy_page it
becomes almost free to determine if a page was completely filled with zeros.

This change introduces a new bitmap which will track these zero pages. If a page
is zero it will not be included in the saved image, instead to track these zero
pages in the image file we will introduce a new flag which we will set on the
packed PFN list. When reading back in the image file we will detect these zero
page PFNs and rebuild the zero page bitmap.

When the image is being loaded through calls to write_next_page if we encounter
a zero page we will silently memset it to 0 and then continue on to the next
page. Given the implementation in snapshot_read_next/snapshot_write_next this
change  will be transparent to non-compressed/compressed and swsusp modes of
operation.

To provide some concrete numbers from simple ad-hoc testing, on a device which
was lightly in use we saw that:

PM: hibernation: Image created (964408 pages copied, 548304 zero pages)

Of the approximately 6.2GB of saveable pages 2.2GB (36%) were just zero filled
and could be tracked entirely within the packed PFN list. The savings would
obviously be much lower for lzo compressed images, but even in the case of
compression not copying pages across to the compression threads will still
speed things up. It's also possible that we would see better overall compression
ratios as larger regions of "real data" would improve the compressibility.

Finally, such an approach could dramatically improve swsusp performance
as each one of those zero pages requires a write syscall to reload, by
handling it as part of the packed PFN list we're able to fully avoid
that.

Bug: 311131385
(cherry picked from commit 005e8dddd4
 git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master)
Signed-off-by: Brian Geffon <bgeffon@google.com>
[ rjw: Whitespace adjustments, removal of redundant parentheses ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Change-Id: Ia42a965d10e3a9e3760c29eb1a31b48c575297b9
Signed-off-by: Pavankumar Kondeti <quic_pkondeti@quicinc.com>
Signed-off-by: Mukesh Pilaniya <quic_mpilaniy@quicinc.com>
2023-11-27 17:04:26 +00:00
Xueqin Luo
7385b83107 UPSTREAM: PM: hibernate: Complain about memory map mismatches during resume
The system memory map can change over a hibernation-restore cycle due
to a defect in the platform firmware, and some of the page frames used
by the kernel before hibernation may not be available any more during
the subsequent restore which leads to the error below.

[  T357] PM: Image loading progress:   0%
[  T357] PM: Read 2681596 kbytes in 0.03 seconds (89386.53 MB/s)
[  T357] PM: Error -14 resuming
[  T357] PM: Failed to load hibernation image, recovering.
[  T357] PM: Basic memory bitmaps freed
[  T357] OOM killer enabled.
[  T357] Restarting tasks ... done.
[  T357] PM: resume from hibernation failed (-14)
[  T357] PM: Hibernation image not present or could not be loaded.

Add an error message to the unpack() function to allow problematic
page frames to be identified and the source of the problem to be
diagnosed more easily. This can save developers quite a bit of
debugging time.

Bug: 311131385
(cherry picked from commit 3363e0adb3
  git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git)
Signed-off-by: Xueqin Luo <luoxueqin@kylinos.cn>
[ rjw: New subject, edited changelog ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Change-Id: I8283510db3d3217f679e3cda0c0991f3b9437c18
Signed-off-by: Pavankumar Kondeti <quic_pkondeti@quicinc.com>
Signed-off-by: Mukesh Pilaniya <quic_mpilaniy@quicinc.com>
2023-11-27 17:04:26 +00:00
Mukesh Ojha
d2c0f4c450 FROMLIST: devcoredump: Send uevent once devcd is ready
dev_coredumpm() creates a devcoredump device and adds it
to the core kernel framework which eventually end up
sending uevent to the user space and later creates a
symbolic link to the failed device. An application
running in userspace may be interested in this symbolic
link to get the name of the failed device.

In a issue scenario, once uevent sent to the user space
it start reading '/sys/class/devcoredump/devcdX/failing_device'
to get the actual name of the device which might not been
created and it is in its path of creation.

To fix this, suppress sending uevent till the failing device
symbolic link gets created and send uevent once symbolic
link is created successfully.

Bug: 311580372
Link: https://lore.kernel.org/lkml/1700232572-25823-1-git-send-email-quic_mojha@quicinc.com
Change-Id: Iee739e29492056df9d664ef2294a7e0cdcc4458e
Fixes: 833c95456a ("device coredump: add new device coredump class")
Signed-off-by: Mukesh Ojha <quic_mojha@quicinc.com>
Cc: stable@vger.kernel.org
Signed-off-by: Naman Jain <quic_namajain@quicinc.com>
2023-11-24 19:28:43 +00:00
Robin Murphy
95307ec5c8 FROMLIST: iommu: Avoid more races around device probe
It turns out there are more subtle races beyond just the main part of
__iommu_probe_device() itself running in parallel - the dev_iommu_free()
on the way out of an unsuccessful probe can still manage to trip up
concurrent accesses to a device's fwspec. Thus, extend the scope of
iommu_probe_device_lock() to also serialise fwspec creation and initial
retrieval.

Reported-by: Zhenhua Huang <quic_zhenhuah@quicinc.com>
Link: https://lore.kernel.org/linux-iommu/e2e20e1c-6450-4ac5-9804-b0000acdf7de@quicinc.com/
Fixes: 01657bc14a ("iommu: Avoid races around device probe")
Signed-off-by: Robin Murphy <robin.murphy@arm.com>
Bug: 308940593
Link: https://lore.kernel.org/all/16f433658661d7cadfea51e7c65da95826112a2b.1700071477.git.robin.murphy@arm.com/
Change-Id: I461df05b03644cb93bc93599cb9f5464bf893923
Signed-off-by: André Draszik <draszik@google.com>
2023-11-23 09:00:10 +00:00
Claire Chang
5c8e593916 ANDROID: Update the ABI symbol list
Adding the following symbols:
  - anon_inode_getfile

Bug: 312619042
Change-Id: I48be67c5fcaf441ad74793ab7e02b39ca284d528
Signed-off-by: Claire Chang <tientzu@google.com>
2023-11-22 13:53:07 +08:00
Peter Wang
94ddfc9ce4 FROMLIST: ufs: core: clear cmd if abort success in mcq mode
In mcq mode, if cmd is pending in device and abort success, response
will not return from device. So we need clear this cmd right now,
else command timeout happen and next time use same tag will have
warning. WARN_ON(lrbp->cmd).

Below is error log:
<3>[ 2277.447611][T21376] ufshcd-mtk 112b0000.ufshci: ufshcd_try_to_abort_task: cmd pending in the device. tag = 7
<3>[ 2277.476954][T21376] ufshcd-mtk 112b0000.ufshci: Aborting tag 7 / CDB 0x2a succeeded
<6>[ 2307.551263][T30974] ufshcd-mtk 112b0000.ufshci: ufshcd_abort: Device abort task at tag 7
<4>[ 2307.623264][  T327] WARNING: CPU: 5 PID: 327 at source/drivers/ufs/core/ufshcd.c:3021 ufshcd_queuecommand+0x66c/0xe34

Bug: 311330965
Link: https://lore.kernel.org/all/20231115131024.15829-1-peter.wang@mediatek.com/
[Peter: Resolved minor conflict in drivers/ufs/core/ufshcd.c ]
Change-Id: I8e5ed6774a68faa4a663cc602dac56faf5e3317c
Signed-off-by: Peter Wang <peter.wang@mediatek.com>
2023-11-21 22:04:42 +00:00
Vinayak Yadawad
8f46c34931 BACKPORT: wifi: cfg80211: Allow AP/P2PGO to indicate port authorization to peer STA/P2PClient
In 4way handshake offload, cfg80211_port_authorized enables driver
to indicate successful 4way handshake to cfg80211 layer. Currently
this path of port authorization is restricted to interface type
NL80211_IFTYPE_STATION and NL80211_IFTYPE_P2P_CLIENT. This patch
extends the support for NL80211_IFTYPE_AP and NL80211_IFTYPE_P2P_GO
interfaces to authorize peer STA/P2P_CLIENT, whenever authentication
is offloaded on the AP/P2P_GO interface.

Signed-off-by: Vinayak Yadawad <vinayak.yadawad@broadcom.com>
Link: https://lore.kernel.org/r/dee3b0a2b4f617e932c90bff4504a89389273632.1695721435.git.vinayak.yadawad@broadcom.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Bug: 301410304
(cherry picked from commit e4e7e3af73694380f0d9a742d13b80598a3393e9)
[chenpaul: adjust the format by checkpatch]
Signed-off-by: Paul Chen <chenpaul@google.com>
Change-Id: Id9704d7b412396f45e888895e42ba161ecb0ab56
2023-11-20 22:25:18 +00:00
Vinayak Yadawad
b3ccd8f092 BACKPORT: wifi: cfg80211: OWE DH IE handling offload
Introduce new feature flags for OWE offload that driver can
advertise to indicate kernel/application space to avoid DH IE
handling. When this flag is advertised, the driver/device will
take care of DH IE inclusion and processing of peer DH IE to
generate PMK.

Signed-off-by: Vinayak Yadawad <vinayak.yadawad@broadcom.com>
Link: https://lore.kernel.org/r/f891cce4b52c939dfc6b71bb2f73e560e8cad287.1695374530.git.vinayak.yadawad@broadcom.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Bug: 301410304
(cherry picked from commit 5482c0a28b2634e7a7d8ddaca7feac183e74b528)
[chenpaul: use reserved fields instead of adding new one]
Signed-off-by: Paul Chen <chenpaul@google.com>
Change-Id: I8322e53b74d995471411967aba846a2b712e5d85
2023-11-20 22:25:18 +00:00
Vincent Donnefort
daa7a3d95d ANDROID: KVM: arm64: mount procfs for pKVM module loading
modprobe needs /proc/cmdline to pass module arguments to the module
loader. Sadly, so early in the boot, nothing mounts that FS.

Bug: 301483379
Change-Id: Iaab3000e3b7f908fc81f7f36adf2f73c7d3129a4
Signed-off-by: Vincent Donnefort <vdonnefort@google.com>
2023-11-20 08:41:13 +00:00
Seiya Wang
1b639e97b8 ANDROID: GKI: Update symbol list for mtk
Add following symbols

bitmap_alloc
cpufreq_cpu_get_raw
cpufreq_get_driver_data
cpufreq_update_policy
cpufreq_update_util_data
devm_clk_get_optional_enabled
devm_gpiod_get_array
devm_pwmchip_add
dev_pm_opp_adjust_voltage
dev_pm_opp_disable
dev_pm_opp_enable
dev_set_threaded
dma_vmap_noncontiguous
drm_connector_set_panel_orientation
drm_panel_of_backlight
_find_first_and_bit
gpiod_set_array_value_cansleep
hid_debug
hid_driver_reset_resume
hid_driver_suspend
i2c_smbus_read_byte
irq_find_matching_fwspec
memdup_user_nul
mipi_dsi_dcs_enter_sleep_mode
mipi_dsi_dcs_set_display_off
mmc_pwrseq_register
mmc_pwrseq_unregister
of_drm_get_panel_orientation
pm_suspend_target_state
return_address
serial8250_do_pm
snd_vendor_set_ops
_trace_android_vh_record_pcpu_rwsem_time_early
__traceiter_android_rvh_cpufreq_transition
__traceiter_android_rvh_post_init_entity_util_avg
__traceiter_android_vh_binder_trans
__traceiter_android_vh_check_uninterrupt_tasks
__traceiter_android_vh_dump_throttled_rt_tasks
__traceiter_android_vh_setscheduler_uclamp
__tracepoint_android_rvh_cpufreq_transition
__tracepoint_android_rvh_post_init_entity_util_avg
__tracepoint_android_vh_binder_trans
__tracepoint_android_vh_check_uninterrupt_tasks
__tracepoint_android_vh_dump_throttled_rt_tasks
__tracepoint_android_vh_setscheduler_uclamp
ufshcd_mcq_poll_cqe_lock
ufshcd_mcq_write_cqis
unpin_user_pages_dirty_lock

Bug: 311514694
Signed-off-by: Seiya Wang <seiya.wang@mediatek.com>
Change-Id: Ibda780725c05cbd5fccf2716f107ba6fa308a1cb
2023-11-17 17:44:26 +00:00
liujing40
b496cc3115 ANDROID: fuse-bpf: Add NULL pointer check in fuse_release_in
If open request sent to classic fuse, backing_file is null.
In fuse_release_initialize, fput will trigger a crash.

Bug: 297831741
Change-Id: I2d54d99d62b54c39a6dc9064f8f62488433aff6f
Signed-off-by: liujing40 <liujing40@xiaomi.corp-partner.google.com>
2023-11-16 21:27:17 +00:00
Andy Shevchenko
8431e524d6 UPSTREAM: serial: 8250_port: Check IRQ data before use
In case the leaf driver wants to use IRQ polling (irq = 0) and
IIR register shows that an interrupt happened in the 8250 hardware
the IRQ data can be NULL. In such a case we need to skip the wake
event as we came to this path from the timer interrupt and quite
likely system is already awake.

Without this fix we have got an Oops:

    serial8250: ttyS0 at I/O 0x3f8 (irq = 0, base_baud = 115200) is a 16550A
    ...
    BUG: kernel NULL pointer dereference, address: 0000000000000010
    RIP: 0010:serial8250_handle_irq+0x7c/0x240
    Call Trace:
     ? serial8250_handle_irq+0x7c/0x240
     ? __pfx_serial8250_timeout+0x10/0x10

Fixes: 0ba9e3a13c ("serial: 8250: Add missing wakeup event reporting")
Cc: stable <stable@kernel.org>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
Link: https://lore.kernel.org/r/20230831222555.614426-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Bug: 311265203
Change-Id: I36cdceb31da5a000f336a96347e99119df308064
(cherry picked from commit cce7fc8b29)
Signed-off-by: Yuan-Jen Cheng <cyuanjen@google.com>
2023-11-16 21:07:48 +00:00
Keir Fraser
825c17428a ANDROID: KVM: arm64: Fix error path in pkvm_mem_abort()
On one error path, pin_user_pages has succeeded and should be
undone.

Bug: 310131277
Change-Id: I92fe0c54bb5b8005f848491f5e9be1090b61fbd1
Signed-off-by: Keir Fraser <keirf@google.com>
2023-11-16 11:32:03 +00:00
Harshdeep Dhatt
22e9166465 ANDROID: abi_gki_aarch64_qcom: Update symbol list
The adreno graphics driver requires these two symbols
to enhance debugging.

Symbols added:
   trace_array_get_by_name
   trace_array_set_clr_event

Bug: 310950241
Change-Id: I232237983b19cbf9d0874913a11fdc2d6f5261cc
Signed-off-by: Harshdeep Dhatt <quic_hdhatt@quicinc.com>
2023-11-15 23:56:51 +00:00
Hang Wei
ca06bb1e93 ANDROID: GKI: add allowed list for Exynosauto SoC
This patch adds GKI symbol list for Exynosauto SoC. We need to add
below 3 function symbols and it required by VLX driver.

3 function symbol(s) added
  'struct work_struct* current_work()'
  'int sigprocmask(int, sigset_t*, sigset_t*)'
  'struct thermal_zone_device* thermal_of_zone_register(struct device_node*, int, void*, const struct thermal_zone_device_ops*)'

Bug: 310831391
Change-Id: Ibc0405f9e72eb1cc11095eab715130f4ec1ec0ee
Signed-off-by: Hang Wei <hang01.wei@samsung.com>
2023-11-15 22:28:41 +00:00
Chungkai Mei
fb91717581 ANDROID: Update the ABI symbol list
Adding the following symbols:
  - __traceiter_android_rvh_util_fits_cpu
  - __tracepoint_android_rvh_util_fits_cpu

Bug: 261704404
Change-Id: I3f3f42796c02b8403156d24faf3d3e4c45b7a1dc
Signed-off-by: Chungkai Mei <chungkai@google.com>
2023-11-15 22:01:23 +00:00
Chungkai Mei
ec3c9a1702 ANDROID: sched: Add vendor hook for util_fits_cpu
vendor may have the need to implement their own util_fits_cpu
function

Bug: 261704404
Change-Id: I0318f6cadd5c45a37f1acafdded479b25e520e6b
Signed-off-by: Chungkai Mei <chungkai@google.com>
2023-11-15 22:01:23 +00:00
Haonan Wang
c47043d65f ANDROID: update symbol for unisoc vendor_hooks
Add slab_folio_alloced

1 function symbol(s) added
  'int __traceiter_android_vh_slab_folio_alloced(void*, unsigned int, gfp_t)'

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

Bug: 302090264
Change-Id: I65c1e0e01b4140f39fae673a1b4a08e1a0d2d0c1
Signed-off-by: Haonan Wang <haonan.wang@unisoc.com>
2023-11-14 23:07:42 +00:00
Haonan Wang
6e881bf034 ANDROID: vendor_hooks: mm: add hook to count the number pages
allocated for each slab

We want to add an interface that can detect the number of pages
allocated by the slab, and if exceeds a threshold, trigger a
panic or other actions.

Bug: 302090264
Change-Id: I8fcae6a97046806376b95b66085dd5b852c2d1e8
Signed-off-by: Haonan Wang <haonan.wang@unisoc.com>
2023-11-14 23:07:42 +00:00
Krishna Kurapati
a59b32866c UPSTREAM: usb: gadget: udc: Handle gadget_connect failure during bind operation
In the event gadget_connect call (which invokes pullup) fails,
propagate the error to udc bind operation which in turn sends the
error to configfs. The userspace can then retry enumeration if
it chooses to.

Signed-off-by: Krishna Kurapati <quic_kriskura@quicinc.com>
Reviewed-by: Alan Stern <stern@rowland.harvard.edu>
Link: https://lore.kernel.org/r/20230927073027.27952-1-quic_kriskura@quicinc.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

(cherry picked from commit 0ea39e030a80be2b1b5f98d6b330a8b97dcf3342
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/ master)

Bug: 309886715
Change-Id: I454616a38e3eba1c358da0056057b585416af68c
Signed-off-by: Krishna Kurapati <quic_kriskura@quicinc.com>
2023-11-13 20:05:51 +00:00
Rick Yiu
7a33209b36 ANDROID: Update the ABI symbol list
Adding the following symbols:
  - __traceiter_softirq_entry
  - __traceiter_softirq_exit
  - __tracepoint_softirq_entry
  - __tracepoint_softirq_exit

Bug: 297343949
Change-Id: Ie0e3a8b891c1a3fbb764d18f54d0117e2162efc3
Signed-off-by: Rick Yiu <rickyiu@google.com>
2023-11-13 06:49:48 +00:00
Ziyi Cui
69b689971a ANDROID: softirq: Add EXPORT_SYMBOL_GPL for softirq and tasklet
The purpose of these symbols is for getting irq/softirq latency. Currently we only have symbols for irq_handler_entry and irq_handler_exit. We would use these latency for further monitoring and debugging.

The related tracepoints were defined in trace/events/irq.h. We would use these tracepoints in vendor kernel module.

Bug: 227809911
Signed-off-by: Ziyi Cui <ziyic@google.com>
Change-Id: Idf4ccdede5232689b2752283539aee54a5f67866
2023-11-13 06:49:41 +00:00
Lyon Wang
48c6c901fe ANDROID: fs/passthrough: Fix compatibility with R/O file system
Look at the passthrough file and check to see if its mount is read-only.

Bug: 297482438
Signed-off-by: Lyon Wang <lyon.wang@mediatek.com>
Change-Id: I0f483c6bcb1effe395eee07b6d721f343840d115
(cherry picked from commit dbeed23196)
2023-11-10 17:58:48 +00:00
Badhri Jagan Sridharan
abcd4c51e7 FROMLIST: usb: typec: tcpm: Fix sink caps op current check
TCPM checks for sink caps operational current even when PD is disabled.
This incorrectly sets tcpm_set_charge() when PD is disabled.
Check for sink caps only when PD is enabled.

[   97.572342] Start toggling
[   97.578949] CC1: 0 -> 0, CC2: 0 -> 0 [state TOGGLING, polarity 0, disconnected]
[   99.571648] CC1: 0 -> 0, CC2: 0 -> 4 [state TOGGLING, polarity 0, connected]
[   99.571658] state change TOGGLING -> SNK_ATTACH_WAIT [rev3 NONE_AMS]
[   99.571673] pending state change SNK_ATTACH_WAIT -> SNK_DEBOUNCED @ 170 ms [rev3 NONE_AMS]
[   99.741778] state change SNK_ATTACH_WAIT -> SNK_DEBOUNCED [delayed 170 ms]
[   99.789283] CC1: 0 -> 0, CC2: 4 -> 5 [state SNK_DEBOUNCED, polarity 0, connected]
[   99.789306] state change SNK_DEBOUNCED -> SNK_DEBOUNCED [rev3 NONE_AMS]
[   99.903584] VBUS on
[   99.903591] state change SNK_DEBOUNCED -> SNK_ATTACHED [rev3 NONE_AMS]
[   99.903600] polarity 1
[   99.910155] enable vbus discharge ret:0
[   99.910160] Requesting mux state 1, usb-role 2, orientation 2
[   99.946791] state change SNK_ATTACHED -> SNK_STARTUP [rev3 NONE_AMS]
[   99.946798] state change SNK_STARTUP -> SNK_DISCOVERY [rev3 NONE_AMS]
[   99.946800] Setting voltage/current limit 5000 mV 500 mA
[   99.946803] vbus=0 charge:=1
[  100.027139] state change SNK_DISCOVERY -> SNK_READY [rev3 NONE_AMS]
[  100.027145] Setting voltage/current limit 5000 mV 3000 mA
[  100.466830] VBUS on

Bug: 307718635
Bug: 304820253
Link: https://lore.kernel.org/all/20231101012845.2701348-1-badhri@google.com/
Cc: stable@vger.kernel.org
Fixes: 803b1c8a0c ("usb: typec: tcpm: not sink vbus if operational current is 0mA")
Change-Id: Id780b77a37b4c9d6cde286ae089ac41852633800
Signed-off-by: Badhri Jagan Sridharan <badhri@google.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Acked-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Tested-by: Will McVicker <willmcvicker@google.com>
Signed-off-by: Will McVicker <willmcvicker@google.com>
2023-11-09 13:10:48 +00:00
Bean Huo
9d6ac9dc6a UPSTREAM: scsi: ufs: core: Add advanced RPMB support where UFSHCI 4.0 does not support EHS length in UTRD
According to UFSHCI 4.0 specification:

5.2 Host Controller Capabilities Registers
5.2.1 Offset 00h: CAP – Controller Capabilities:

 "EHS Length in UTRD Supported (EHSLUTRDS): Indicates whether the host
  controller supports EHS Length field in UTRD.

  0 – Host controller takes EHS length from CMD UPIU, and SW driver use EHS
  Length field in CMD UPIU.

  1 – HW controller takes EHS length from UTRD, and SW driver use EHS
  Length field in UTRD.

  NOTE Recommend Host controllers move to taking EHS length from UTRD, and
  in UFS-5, it will be mandatory."

So, when UFSHCI 4.0 doesn't support EHS Length field in UTRD, we could use
EHS Length field in CMD UPIU. Remove the limitation that advanced RPMB only
works when EHS length is supported in UTRD.

Bug: 254441685
Fixes: 6ff265fc5e ("scsi: ufs: core: bsg: Add advanced RPMB support in ufs_bsg")
Co-developed-by: "jonghwi.rha" <jonghwi.rha@samsung.com>
Signed-off-by: "jonghwi.rha" <jonghwi.rha@samsung.com>
Signed-off-by: Bean Huo <beanhuo@micron.com>
Link: https://lore.kernel.org/r/20230809181847.102123-2-beanhuo@iokpp.de
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit c91e585cfb)
Signed-off-by: Lee Jones <joneslee@google.com>
Change-Id: I10ec989b7d02bed7d828d756fd11078cf73ff371
2023-11-09 08:23:35 +00:00
Browse Zhang
beea09533d ANDROID: ABI: Update symbol list for MediatTek
Add android_vh_mmc_update_mmc_queue to MTK symbol list

1 function symbol(s) added
  'int __traceiter_android_vh_mmc_update_mmc_queue(void*, struct mmc_card*, struct mmc_queue*)'

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

Bug: 306334321
Change-Id: I4bf1ab86b273eaa4910f76d7deb7d8ddf5ded5cb
Signed-off-by: Qilin Tan <qilin.tan@mediatek.com>
Signed-off-by: Browse Zhang <browse.zhang@mediatek.com>
2023-11-07 20:48:00 +00:00
Browse Zhang
5683c2b460 ANDROID: vendor_hooks: Add hook for mmc queue
Add a mmc hook to support customizing mmc queue by vendor host
requirements

Bug: 306334321
Change-Id: I737485c3fc0438ef221cd3ffe81a66f7e3b66500
Signed-off-by: Qilin Tan <qilin.tan@mediatek.com>
Signed-off-by: Browse Zhang <browse.zhang@mediatek.com>
2023-11-07 19:16:27 +00:00
Todd Kjos
43a07d84da Revert "proc: allow pid_revalidate() during LOOKUP_RCU"
This reverts commit da4d6b9cf8.

Appears to cause stale dcache entries for inodes in /proc/$pid
filesystem resulting in ESRCH failures on access to files
under /proc/self

Bug: 305682813
Bug: 306055483
Signed-off-by: Todd Kjos <tkjos@google.com>
Change-Id: I004338c043d7e777fdfef343e45ccb20ff4d503b
2023-11-07 15:27:33 +00:00
Neil Armstrong
230d34da33 UPSTREAM: scsi: ufs: ufs-qcom: Clear qunipro_g4_sel for HW major version > 5
The qunipro_g4_sel clear is also needed for new platforms with major
version > 5. Fix the version check to take this into account.

Bug: 254441685
Fixes: 9c02aa24bf ("scsi: ufs: ufs-qcom: Clear qunipro_g4_sel for HW version major 5")
Acked-by: Manivannan Sadhasivam <mani@kernel.org>
Reviewed-by: Nitin Rawat <quic_nitirawa@quicinc.com>
Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
Link: https://lore.kernel.org/r/20230821-topic-sm8x50-upstream-ufs-major-5-plus-v2-1-f42a4b712e58@linaro.org
Reviewed-by: "Bao D. Nguyen" <quic_nguyenb@quicinc.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit c422fbd5cb)
Signed-off-by: Lee Jones <joneslee@google.com>
Change-Id: I1c67c49441d710b6e762d73ff87077febdee8f25
2023-11-07 08:29:16 +00:00
Oven
0920d4de75 ANDROID: GKI: Update symbols to symbol list
7 function symbol(s) added
  'int __traceiter_android_vh_free_unref_page_bypass(void*, struct page*, int, int, bool*)'
  'int __traceiter_android_vh_kvmalloc_node_use_vmalloc(void*, size_t, gfp_t*, bool*)'
  'int __traceiter_android_vh_ra_tuning_max_page(void*, struct readahead_control*, unsigned long*)'
  'int __traceiter_android_vh_rmqueue_bulk_bypass(void*, unsigned int, struct per_cpu_pages*, int, struct list_head*)'
  'int __traceiter_android_vh_should_alloc_pages_retry(void*, gfp_t, int, int*, int, struct zone*, struct page**, bool*)'
  'int __traceiter_android_vh_tune_mmap_readaround(void*, unsigned int, unsigned long, unsigned long*, unsigned int*, unsigned int*)'
  'int __traceiter_android_vh_unreserve_highatomic_bypass(void*, bool, struct zone*, bool*)'

7 variable symbol(s) added
  'struct tracepoint __tracepoint_android_vh_free_unref_page_bypass'
  'struct tracepoint __tracepoint_android_vh_kvmalloc_node_use_vmalloc'
  'struct tracepoint __tracepoint_android_vh_ra_tuning_max_page'
  'struct tracepoint __tracepoint_android_vh_rmqueue_bulk_bypass'
  'struct tracepoint __tracepoint_android_vh_should_alloc_pages_retry'
  'struct tracepoint __tracepoint_android_vh_tune_mmap_readaround'
  'struct tracepoint __tracepoint_android_vh_unreserve_highatomic_bypass'

Bug: 288216516
Change-Id: I85abefd786a0c7aadfe730f5c3485117e38d0a86
Signed-off-by: Oven <liyangouwen1@oppo.com>
2023-11-06 23:07:00 +00:00
Oven
019393a917 ANDROID: vendor_hook: Add hook to tune readaround size
In some situations, we want to decrease readaround size for better
performance. So we add this hook.

Bug: 288216516
Change-Id: If2f5f75976c99ff1f82ce29d370f9216926055ab
Signed-off-by: Oven <liyangouwen1@oppo.com>
2023-11-06 23:07:00 +00:00
liang zhang
0c859c2180 ANDROID: add for tuning readahead size
Tune ReadAhead size for better memory usage and performance.
accordding to Read-Ahead Efficiency on Mobile Devices: Observation,
Characterization, and Optimization form IEEE

Bug: 229839032
Change-Id: I91656bde5e616e181fd7557554d55e7ce1858136
Signed-off-by: liang zhang <liang.zhang@transsion.com>
Signed-off-by: Oven <liyangouwen1@oppo.com>
2023-11-06 23:07:00 +00:00
Oven
a8206e3023 ANDROID: vendor_hooks: Add hooks to avoid key threads stalled in
memory allocations

We add these hooks to avoid key threads blocked in memory allocation
path.
-android_vh_free_unref_page_bypass  ----We create a memory pool for the
key threads. This hook determines whether a page should be free to the
pool or to buddy freelist. It works with a existing hook
`android_vh_alloc_pages_reclaim_bypass`, which takes pages out of the
pool.

-android_vh_kvmalloc_node_use_vmalloc  ----For key threads, we perfer
not to run into direct reclaim. So we clear __GFP_DIRECT_RECLAIM flag.
For threads which are not that important, we perfer use vmalloc.

-android_vh_should_alloc_pages_retry  ----Before key threads run into
direct reclaim, we want to retry with a lower watermark.

-android_vh_unreserve_highatomic_bypass  ----We want to keep more
highatomic pages when unreserve them to avoid highatomic allocation
failures.

-android_vh_rmqueue_bulk_bypass  ----We found sometimes when key threads
run into rmqueue_bulk,  it took several milliseconds spinning at
zone->lock or filling per-cpu pages. We use this hook to take pages from
the mempool mentioned above,  rather than grab zone->lock and fill a
batch of pages to per-cpu.

Bug: 288216516
Change-Id: I1656032d6819ca627723341987b6094775bc345f
Signed-off-by: Oven <liyangouwen1@oppo.com>
2023-11-06 23:07:00 +00:00
liwei1234
ad9947dc8d ANDROID: GKI: Update oplus symbol list
1 function symbol(s) added
  'int __traceiter_android_vh_adjust_kvmalloc_flags(void*, unsigned int, gfp_t*)'

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

Bug: 300857012
Change-Id: Ifdcdd36ff47a0e0e3ecaa33b158d5b83ccb912a2
Signed-off-by: liwei <liwei1234@oppo.com>
2023-11-06 20:48:16 +00:00
liwei
71f3b61ee4 ANDROID: vendor_hooks: add hooks for adjust kvmalloc_node alloc_flags
since we can't control all kvmalloc_node callsite's gfp_flags, we add
a vendor hook in kvmalloc_node to tune the reclaim behavior for some
really high-order allocation

Bug: 300857012

Change-Id: I5f0c4c2921d204289911704e3a205f6a1dc50d04
Signed-off-by: liwei <liwei1234@oppo.com>
2023-11-06 20:48:16 +00:00
Kyle Zeng
fef66e8544 UPSTREAM: netfilter: ipset: add the missing IP_SET_HASH_WITH_NET0 macro for ip_set_hash_netportnet.c
commit 050d91c03b upstream.

The missing IP_SET_HASH_WITH_NET0 macro in ip_set_hash_netportnet can
lead to the use of wrong `CIDR_POS(c)` for calculating array offsets,
which can lead to integer underflow. As a result, it leads to slab
out-of-bound access.
This patch adds back the IP_SET_HASH_WITH_NET0 macro to
ip_set_hash_netportnet to address the issue.

Bug: 302199939
Fixes: 886503f34d ("netfilter: ipset: actually allow allowable CIDR 0 in hash:net,port,net")
Suggested-by: Jozsef Kadlecsik <kadlec@netfilter.org>
Signed-off-by: Kyle Zeng <zengyhkyle@gmail.com>
Acked-by: Jozsef Kadlecsik <kadlec@netfilter.org>
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit a9e6142e5f)
Signed-off-by: Lee Jones <joneslee@google.com>
Change-Id: I11cc1650e7df9d54041164b6bdb01f3a0de46de4
2023-11-06 18:59:19 +00:00
Zhipeng Wang
7bec8a8180 ANDROID: ABI: Update symbol list for imx
1 function symbol(s) added
  'int devm_regulator_get_enable_optional(struct device*, const char*)'

Bug: 307653069
Change-Id: I1e26da9575327170e50deedd95df605ef9d65714
Signed-off-by: Zhipeng Wang <zhipeng.wang_1@nxp.com>
2023-11-03 11:19:23 +00:00
Subash Abhinov Kasiviswanathan
af888bd2a1 ANDROID: abi_gki_aarch64_qcom: Add __netif_rx
Add the symbol __netif_rx which is needed by rmnet modules.

Symbols added:
   __netif_rx

Bug: 308756580
Change-Id: I26dfad610739a18764c9ac6dbd6edb798ba295b6
Signed-off-by: Subash Abhinov Kasiviswanathan <quic_subashab@quicinc.com>
2023-11-03 11:03:06 +00:00
Keita Aihara
131de563f6 ANDROID: ABI: Update sony symbol list and stg
2 function symbol(s) added
  'int __traceiter_android_vh_mmc_blk_mq_rw_recovery(void*, struct mmc_card*)'
  'int __traceiter_android_vh_sd_update_bus_speed_mode(void*, struct mmc_card*)'

2 variable symbol(s) added
  'struct tracepoint __tracepoint_android_vh_mmc_blk_mq_rw_recovery'
  'struct tracepoint __tracepoint_android_vh_sd_update_bus_speed_mode'

Bug: 303549480
Change-Id: I753ab0d7b4c2742eab63f56712e13260ee0e5e0e
Signed-off-by: Keita Aihara <keita.aihara@sony.com>
2023-11-02 22:52:08 +00:00
Keita Aihara
977770ec27 ANDROID: mmc: Add vendor hooks for sdcard failure diagnostics
For sdcard failure diagnostics, add vendor hooks to monitor the sdcard
bus speed mode change and the sdcard reset failure in the request
recovery handling.

Bug: 303549480
Change-Id: Id40337ffb09a31199335cdb8a273d76618415649
Signed-off-by: Keita Aihara <keita.aihara@sony.com>
2023-11-02 22:52:08 +00:00
Chun-Hung Wu
f8d3b450e9 ANDROID: Update symbol list for mtk
3 function symbol(s) added
  'void add_wait_queue_priority(struct wait_queue_head*, struct wait_queue_entry*)'
  'int get_user_pages_fast_only(unsigned long, int, unsigned int, struct page**)'
  'long get_user_pages_unlocked(unsigned long, unsigned long, struct page**, unsigned int)'

Bug: 308742956
Change-Id: I4147320c5efa1c8dcc1949b753587a3705675e7a
Signed-off-by: Chun-Hung Wu <chun-hung.wu@mediatek.com>
2023-11-02 16:04:09 +00:00
Bao D. Nguyen
2799026a28 UPSTREAM: scsi: ufs: mcq: Fix the search/wrap around logic
The search and wrap around logic in the ufshcd_mcq_sqe_search() function
does not work correctly when the hwq's queue depth is not a power of two
number. Correct it so that any queue depth with a positive integer value
within the supported range would work.

Bug: 307782690
Change-Id: I4350ac71da051db24923a587db435be2f7b7eebb
(cherry picked from commit d0c89af313)
Signed-off-by: "Bao D. Nguyen" <quic_nguyenb@quicinc.com>
Link: https://lore.kernel.org/r/ff49c15be205135ed3ec186f3086694c02867dbd.1692149603.git.quic_nguyenb@quicinc.com
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Fixes: 8d72903489 ("scsi: ufs: mcq: Add supporting functions for MCQ abort")
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2023-11-02 19:16:56 +08:00
zhanghui
7350783e67 UPSTREAM: scsi: ufs: core: Fix ufshcd_inc_sq_tail() function bug
When qdepth is not power of 2, not every bit of the mask is 1, so
in sq_tail_slot some bits will be cleared unexpectedly.

Bug: 307782690
Change-Id: I7acb5f08f6af87cb5057464827658197047d8641
(cherry picked from commit e01d05bbf6)
Signed-off-by: zhanghui <zhanghui31@xiaomi.com>
Link: https://lore.kernel.org/r/20230601124613.1446-1-zhanghui31@xiaomi.com
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Reviewed-by: Stanley Chu <stanley.chu@mediatek.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2023-11-02 19:14:26 +08:00
Chun-Hung Wu
ff5fa0b7bd FROMLIST: ufs: core: Expand MCQ queue slot to DeviceQueueDepth + 1
Allow UFSHCI 4.0 controllers to fully utilize MCQ queue slots.

Bug: 307782690
Link: https://lore.kernel.org/all/20231101082402.20856-1-naomi.chu@mediatek.com/T/
Change-Id: Ib78db763ae5ff875c337774354de86e67f5017b8
Signed-off-by: Alice Chao <alice.chao@mediatek.com>
Signed-off-by: Naomi Chu <naomi.chu@mediatek.com>
Signed-off-by: Chun-Hung Wu <chun-hung.wu@mediatek.com>
2023-11-01 22:05:42 +00:00
Will Deacon
4bbeaddf9a Revert "ANDROID: KVM: arm64: Don't allocate from handle_host_mem_abort"
This reverts commit 5d0225cdf0.

Reason for revert: b/306244914

Change-Id: Iaf2bda1b0844cfce134c78598af0fca083f32947
Signed-off-by: Will Deacon <willdeacon@google.com>
2023-11-01 11:11:46 +00:00
RD Babiera
9d38c0bc65 BACKPORT: usb: typec: altmodes/displayport: Signal hpd when configuring pin assignment
When connecting to some DisplayPort partners, the initial status update
after entering DisplayPort Alt Mode notifies that the DFP_D/UFP_D is not in
the connected state. This leads to sending a configure message that keeps
the device in USB mode. The port partner then sets DFP_D/UFP_D to the
connected state and HPD to high in the same Attention message. Currently,
the HPD signal is dropped in order to handle configuration.

This patch saves changes to the HPD signal when the device chooses to
configure during dp_altmode_status_update, and invokes sysfs_notify if
necessary for HPD after configuring.

Fixes: 0e3bb7d689 ("usb: typec: Add driver for DisplayPort alternate mode")
Cc: stable@vger.kernel.org
Signed-off-by: RD Babiera <rdbabiera@google.com>
Acked-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Link: https://lore.kernel.org/all/20230726020903.1409072-1-rdbabiera@google.com/
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Bug: 288137625
(cherry picked from commit 5a5ccd61cf)
[rd: resolved minor conflict in displayport.c]
Signed-off-by: RD Babiera <rdbabiera@google.com>
(cherry picked from https://android-review.googlesource.com/q/commit:056a17677de932cccda77faf3f1c53a5b59c8cf5)
Merged-In: I26ef49949aa0681ea6b88d8c95f5ddd54fe84664
Change-Id: I26ef49949aa0681ea6b88d8c95f5ddd54fe84664
2023-10-31 18:31:12 +00:00
T.J. Mercier
e329419f70 UPSTREAM: mm: multi-gen LRU: don't spin during memcg release
When a memcg is in the process of being released mem_cgroup_tryget will
fail because its reference count has already reached 0.  This can happen
during reclaim if the memcg has already been offlined, and we reclaim all
remaining pages attributed to the offlined memcg.  shrink_many attempts to
skip the empty memcg in this case, and continue reclaiming from the
remaining memcgs in the old generation.  If there is only one memcg
remaining, or if all remaining memcgs are in the process of being released
then shrink_many will spin until all memcgs have finished being released.
The release occurs through a workqueue, so it can take a while before
kswapd is able to make any further progress.

This fix results in reductions in kswapd activity and direct reclaim in
a test where 28 apps (working set size > total memory) are repeatedly
launched in a random sequence:

                                       A          B      delta   ratio(%)
           allocstall_movable       5962       3539      -2423     -40.64
            allocstall_normal       2661       2417       -244      -9.17
kswapd_high_wmark_hit_quickly      53152       7594     -45558     -85.71
                   pageoutrun      57365      11750     -45615     -79.52

Bug: 254441685
Link: https://lkml.kernel.org/r/20230814151636.1639123-1-tjmercier@google.com
Fixes: e4dde56cd2 ("mm: multi-gen LRU: per-node lru_gen_folio lists")
Signed-off-by: T.J. Mercier <tjmercier@google.com>
Acked-by: Yu Zhao <yuzhao@google.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
(cherry picked from commit 6867c7a332)
Signed-off-by: Lee Jones <joneslee@google.com>
Change-Id: I37a874d87cf5f2f8fad742f175bc6f603134e660
2023-10-31 16:49:26 +00:00