Commit Graph

37099 Commits

Author SHA1 Message Date
qctecmdr
1c69c974b4 Merge "sched: walt: fix rounding off error" 2022-01-23 09:12:42 -08:00
Ashay Jaiswal
447aa50989 sched: walt: fix rounding off error
Update variable type to ensure all the valid values can be
accomodated in variable.

Change-Id: Ieaf0301d6ad524bfb87ff019aec41063ebc4c4c4
Signed-off-by: Ashay Jaiswal <quic_ashayj@quicinc.com>
2022-01-21 23:21:00 +05:30
qctecmdr
f557e8a76b Merge "Merge keystone/android12-5.10-keystone-qcom-release.66+ (ee319c2) into msm-5.10" 2022-01-18 12:23:37 -08:00
Sivasri Kumar, Vanka
88a77d537f Merge keystone/android12-5.10-keystone-qcom-release.66+ (ee319c2) into msm-5.10
* refs/heads/tmp-ee319c2:
  UPSTREAM: f2fs: reduce the scope of setting fsck tag when de->name_len is zero
  ANDROID: GKI: Update symbols to abi_gki_aarch64_oplus
  ANDROID: Add initial ASUS symbol list
  ANDROID: configfs: add proper module namespace marking
  ANDROID: Configure out the macros in android_kabi and android_vendor
  ANDROID: kernel: fix debug_kinfo set twice crash issue
  ANDROID: GKI: set vfs-only exports into their own namespace
  ANDROID: consolidate.fragment: enable mem debug config
  UPSTREAM: net/packet: rx_owner_map depends on pg_vec
  ANDROID: GKI: Update symbols to symbol list
  FROMLIST: module.h: allow #define strings to work with MODULE_IMPORT_NS
  FROMLIST: export: fix string handling of namespace in EXPORT_SYMBOL_NS
  ANDROID: vendor_hooks: Add hooks for binder
  ANDROID: mm/oom_kill: allow process_mrelease reclaim memory in parallel with exit_mmap
  FROMLIST: mm/oom_kill: allow process_mrelease to run under mmap_lock protection
  FROMLIST: mm: protect free_pgtables with mmap_lock write lock in exit_mmap
  UPSTREAM: mm/oom_kill.c: prevent a race between process_mrelease and exit_mmap
  UPSTREAM: mm: wire up syscall process_mrelease
  UPSTREAM: mm: introduce process_mrelease system call

Change-Id: Ibb609b81e53f53a8bc3f45e753ef3fadbd623ea8
Signed-off-by: Sivasri Kumar, Vanka <quic_svanka@quicinc.com>
2022-01-17 13:52:03 +05:30
deyaoren@google.com
123191b0a8 Merge keystone/mirror-android12-5.10 into keystone/android12-5.10-keystone-qcom-dev
* keystone/mirror-android12-5.10:
  ANDROID: Configure out the macros in android_kabi and android_vendor
  ANDROID: kernel: fix debug_kinfo set twice crash issue

Signed-off-by: deyaoren@google.com <deyaoren@google.com>
Change-Id: I9b2b5e38f9d8920fc671fd74e68be34e0a3a7325
2022-01-12 17:35:32 +00:00
Qingqing Zhou
b7a6c15a6f ANDROID: Configure out the macros in android_kabi and android_vendor
Add one CONFIG to control removing the macros or not. On some platform,
configureing out the macros removes the associated members from the
structs, this reduces the object size of the slabs related with the
structs, therefore reduces the total slab memory consumption of system.

Besides, this also reduces vmlinux size a bit, therefore the total
kernel memory size increses a bit.

The macros are ANDROID_KABI_RESERVE, ANDROID_VENDOR_DATA,
ANDROID_VENDOR_DATA_ARRAY, ANDROID_OEM_DATA, ANDROID_OEM_DATA_ARRAY.

Bug: 206561931
Signed-off-by: Qingqing Zhou <quic_qqzhou@quicinc.com>
Change-Id: I0868d299ccce3c4b39f42af17916828500be6cc4
2022-01-12 16:49:39 +08:00
deyaoren@google.com
8687171d3f Merge keystone/mirror-android12-5.10 into keystone/android12-5.10-keystone-qcom-dev
* keystone/mirror-android12-5.10:
  ANDROID: mm/oom_kill: allow process_mrelease reclaim memory in parallel with exit_mmap
  FROMLIST: mm/oom_kill: allow process_mrelease to run under mmap_lock protection
  FROMLIST: mm: protect free_pgtables with mmap_lock write lock in exit_mmap
  UPSTREAM: mm/oom_kill.c: prevent a race between process_mrelease and exit_mmap
  UPSTREAM: mm: wire up syscall process_mrelease
  UPSTREAM: mm: introduce process_mrelease system call

Signed-off-by: deyaoren@google.com <deyaoren@google.com>
Change-Id: I5757d752480939e1880f5f2d6553ccc5fb353ee7
2022-01-07 17:23:59 +00:00
Tengfei Fan
ee302dc562 sched/walt: get rcu lock before use task's cgroups
uclamp_latency_sensitive() function will use struct
task_struct's member of cgroups, but rcu lock should
be got before use it.

Change-Id: I1988ed7fe836f9f1ba99d59c5d46f26f3418b51e
Signed-off-by: Tengfei Fan <quic_tengfan@quicinc.com>
2022-01-07 09:29:42 +08:00
Suren Baghdasaryan
fe50dcab7a UPSTREAM: mm: wire up syscall process_mrelease
Split off from prev patch in the series that implements the syscall.

Link: https://lkml.kernel.org/r/20210809185259.405936-2-surenb@google.com
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Christian Brauner <christian.brauner@ubuntu.com>
Cc: Christoph Hellwig <hch@infradead.org>
Cc: David Hildenbrand <david@redhat.com>
Cc: David Rientjes <rientjes@google.com>
Cc: Florian Weimer <fweimer@redhat.com>
Cc: Jan Engelhardt <jengelh@inai.de>
Cc: Jann Horn <jannh@google.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Rik van Riel <riel@surriel.com>
Cc: Roman Gushchin <guro@fb.com>
Cc: Shakeel Butt <shakeelb@google.com>
Cc: Tim Murray <timmurray@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

(cherry picked from commit dce49103962840dd61423d7627748d6c558d58c5)

Bug: 189803002
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Change-Id: I6f02c1ec136a7e102f133ee46a7070a151781345
2022-01-06 17:37:36 +00:00
qctecmdr
4ad62d8b1f Merge "sched/walt: Fix frequent frequency updates" 2022-01-05 14:03:44 -08:00
Tengfei Fan
227966dfb1 sched/walt: update the condition of judge one task if it is mvp task
Due to walt_get_mvp_task_prio() function still may return mvp prio
after mvp task deactivate via walt_cfs_deactivate_mvp_task() function,
so update the condition of judge one task if it is mvp task.

Change-Id: Iae5d6e420213111acd0b0e71095e0a6caffbe0aa
Signed-off-by: Tengfei Fan <quic_tengfan@quicinc.com>
2022-01-05 00:41:10 -08:00
qctecmdr
05d7f75bea Merge "Merge keystone/android12-5.10-keystone-qcom-release.66+ (a2fed74) into msm-5.10" 2021-12-30 04:44:15 -08:00
Sivasri Kumar, Vanka
46c2c0e323 Merge keystone/android12-5.10-keystone-qcom-release.66+ (a2fed74) into msm-5.10
* refs/heads/tmp-a2fed74:
  FROMGIT: iommu/io-pgtable-arm-v7s: Add error handle for page table allocation failure
  UPSTREAM: sctp: add param size validation for SCTP_PARAM_SET_PRIMARY
  UPSTREAM: sctp: validate chunk size in __rcv_asconf_lookup
  UPSTREAM: bpf: Fix integer overflow in prealloc_elems_and_freelist()
  ANDROID: GKI: Update symbol list
  ANDROID: ABI: update allowed list for galaxy

Change-Id: If09a540f15ce1afee4f09da61778d8488a370b4b
Signed-off-by: Sivasri Kumar, Vanka <quic_svanka@quicinc.com>
2021-12-28 02:57:26 +05:30
deyaoren@google.com
b0de5d3c49 Merge keystone/mirror-android12-5.10 into keystone/android12-5.10-keystone-qcom-dev
* keystone/mirror-android12-5.10:
  FROMGIT: iommu/io-pgtable-arm-v7s: Add error handle for page table allocation failure
  UPSTREAM: sctp: add param size validation for SCTP_PARAM_SET_PRIMARY
  UPSTREAM: sctp: validate chunk size in __rcv_asconf_lookup
  UPSTREAM: bpf: Fix integer overflow in prealloc_elems_and_freelist()

Signed-off-by: deyaoren@google.com <deyaoren@google.com>
Change-Id: I18920814ef001a271dbd8df7974b36f5b90a31bc
2021-12-23 17:55:52 +00:00
qctecmdr
20fbd1abd0 Merge "Merge keystone/android12-5.10-keystone-qcom-release.66+ (698fa19) into msm-5.10" 2021-12-23 06:08:30 -08:00
Tatsuhiko Yasumatsu
fef7dba3a7 UPSTREAM: bpf: Fix integer overflow in prealloc_elems_and_freelist()
[ Upstream commit 30e29a9a2bc6a4888335a6ede968b75cd329657a ]

In prealloc_elems_and_freelist(), the multiplication to calculate the
size passed to bpf_map_area_alloc() could lead to an integer overflow.
As a result, out-of-bounds write could occur in pcpu_freelist_populate()
as reported by KASAN:

[...]
[   16.968613] BUG: KASAN: slab-out-of-bounds in pcpu_freelist_populate+0xd9/0x100
[   16.969408] Write of size 8 at addr ffff888104fc6ea0 by task crash/78
[   16.970038]
[   16.970195] CPU: 0 PID: 78 Comm: crash Not tainted 5.15.0-rc2+ #1
[   16.970878] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.13.0-1ubuntu1.1 04/01/2014
[   16.972026] Call Trace:
[   16.972306]  dump_stack_lvl+0x34/0x44
[   16.972687]  print_address_description.constprop.0+0x21/0x140
[   16.973297]  ? pcpu_freelist_populate+0xd9/0x100
[   16.973777]  ? pcpu_freelist_populate+0xd9/0x100
[   16.974257]  kasan_report.cold+0x7f/0x11b
[   16.974681]  ? pcpu_freelist_populate+0xd9/0x100
[   16.975190]  pcpu_freelist_populate+0xd9/0x100
[   16.975669]  stack_map_alloc+0x209/0x2a0
[   16.976106]  __sys_bpf+0xd83/0x2ce0
[...]

The possibility of this overflow was originally discussed in [0], but
was overlooked.

Fix the integer overflow by changing elem_size to u64 from u32.

  [0] https://lore.kernel.org/bpf/728b238e-a481-eb50-98e9-b0f430ab01e7@gmail.com/

Bug: 202511260
Fixes: 557c0c6e7d ("bpf: convert stackmap to pre-allocation")
Signed-off-by: Tatsuhiko Yasumatsu <th.yasumatsu@gmail.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/20210930135545.173698-1-th.yasumatsu@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Aaron Ding <aaronding@google.com>
Change-Id: I45de17135336ce329b539d3e9e95fdcddafb2b00
2021-12-22 17:19:46 +00:00
Sivasri Kumar, Vanka
4ea353ab3d Merge keystone/android12-5.10-keystone-qcom-release.66+ (698fa19) into msm-5.10
* refs/heads/tmp-698fa19:
  ANDROID: vendor_hooks: Add hooks for futex
  ANDROID: dma-contiguous: Add tracehook to allow subpage allocations in dma_alloc_contiguous
  ANDROID: Update the ABI xml and symbol list
  UPSTREAM: ALSA: memalloc: Align buffer allocations in page size
  ANDROID: Fix mmu_notifier_trylock definition for !CONFIG_MMU_NOTIFIER config
  FROMGIT: USB: gadget: bRequestType is a bitfield, not a enum
  ANDROID: qcom: Add flush_delayed_fput to ABI
  ANDROID: fix ABI breakage caused by mm_struct->mmu_notifier_lock addition
  ANDROID: fix ABI breakage caused by percpu_rw_semaphore changes
  ANDROID: fix mmu_notifier race caused by not taking mmap_lock during SPF
  ANDROID: percpu-rwsem: enable percpu_sem destruction in atomic context
  FROMLIST: virtio_mmio: pm: Add notification handlers for restore and freeze
  FROMLIST: virtio: do not reset stateful devices on resume
  FROMGIT: f2fs: avoid EINVAL by SBI_NEED_FSCK when pinning a file
  UPSTREAM: mm, slub: fix incorrect memcg slab count for bulk free
  UPSTREAM: mm, slub: fix potential use-after-free in slab_debugfs_fops
  UPSTREAM: mm, slub: fix potential memoryleak in kmem_cache_open()
  UPSTREAM: mm, slub: fix mismatch between reconstructed freelist depth and cnt
  UPSTREAM: mm, slub: fix two bugs in slab_debug_trace_open()
  UPSTREAM: mm, slub: allocate private object map for debugfs listings
  FROMGIT: dma-buf: remove restriction of IOCTL:DMA_BUF_SET_NAME
  UPSTREAM: usb: dwc3: core: balance phy init and exit
  UPSTREAM: xhci: Fix failure to give back some cached cancelled URBs.
  ANDROID: mm/memory_hotplug: Don't special case memory_block_size_bytes
  UPSTREAM: usb: gadget: uvc: fix multiple opens
  UPSTREAM: aio: fix use-after-free due to missing POLLFREE handling
  UPSTREAM: aio: keep poll requests on waitqueue until completed
  UPSTREAM: signalfd: use wake_up_pollfree()
  UPSTREAM: binder: use wake_up_pollfree()
  UPSTREAM: wait: add wake_up_pollfree()
  UPSTREAM: USB: gadget: zero allocate endpoint 0 buffers
  BACKPORT: scsi: ufs: Improve SCSI abort handling further
  FROMGIT: scsi: ufs: Introduce ufshcd_release_scsi_cmd()
  FROMGIT: scsi: ufs: Remove the 'update_scaling' local variable
  UPSTREAM: scsi: ufs: core: Fix another task management completion race
  BACKPORT: scsi: ufs: core: Fix task management completion timeout race
  ANDROID: qcom: Add android_rvh_do_ptrauth_fault to ABI
  UPSTREAM: USB: gadget: detect too-big endpoint 0 requests
  ANDROID: ABI: Add symbols used by frame buffer driver
  UPSTREAM: xhci: Add bus number to some debug messages
  UPSTREAM: xhci: Add additional dynamic debug to follow URBs in cancel and error cases.
  UPSTREAM: Revert "USB: xhci: fix U1/U2 handling for hardware with XHCI_INTEL_HOST quirk set"
  UPSTREAM: xhci: Fix failure to give back some cached cancelled URBs.
  UPSTREAM: HID: check for valid USB device for many HID drivers
  UPSTREAM: HID: wacom: fix problems when device is not a valid USB device
  UPSTREAM: HID: bigbenff: prevent null pointer dereference
  UPSTREAM: HID: add USB_HID dependancy on some USB HID drivers
  UPSTREAM: HID: add USB_HID dependancy to hid-chicony
  UPSTREAM: HID: add USB_HID dependancy to hid-prodikeys
  UPSTREAM: HID: add hid_is_usb() function to make it simpler for USB detection
  FROMGIT: clk: Don't parent clks until the parent is fully registered
  UPSTREAM: mm/gup: remove the vma allocation from gup_longterm_locked()
  BACKPORT: usb: typec: tcpm: Wait in SNK_DEBOUNCED until disconnect
  ANDROID: ABI: Add iio_write_channel_raw symbol
  ANDROID: GKI: Update symbols to symbol list

Change-Id: Ifed5ad941e4e34594c49336c1a6556c8cb665cba
Signed-off-by: Sivasri Kumar, Vanka <quic_svanka@quicinc.com>
2021-12-22 11:22:24 +05:30
deyaoren@google.com
5902807367 Merge keystone/mirror-android12-5.10 into keystone/android12-5.10-keystone-qcom-dev
* keystone/mirror-android12-5.10:
  ANDROID: vendor_hooks: Add hooks for futex
  ANDROID: dma-contiguous: Add tracehook to allow subpage allocations in dma_alloc_contiguous

Signed-off-by: deyaoren@google.com <deyaoren@google.com>
Change-Id: I1d788924eab8b4b6261dcce0eefdf66b3b6600e9
2021-12-20 18:09:36 +00:00
Liujie Xie
a7ab784f60 ANDROID: vendor_hooks: Add hooks for futex
We want to use this hook to record the sleeping time due to Futex

Bug: 210947226

Signed-off-by: Liujie Xie <xieliujie@oppo.com>
Change-Id: I637f889dce42937116d10979e0c40fddf96cd1a2
2021-12-20 04:23:00 +00:00
Chris Goldsworthy
84fc3abca0 ANDROID: dma-contiguous: Add tracehook to allow subpage allocations in dma_alloc_contiguous
Add a tracehook to allow callers into dma_alloc_contiguous() to make
use of the built-in CMA area if the caller has addressing limitations;
this provides a means of allocating from memory whose bounds are
restricted to the lower 4 GB of memory, without having to enable DMA32
(assuming the default CMA area has been restricted to the appropriate
address ranges).

Leaf changes summary: 1 artifact changed
Changed leaf types summary: 0 leaf type changed
Removed/Changed/Added functions summary: 0 Removed, 0 Changed, 0 Added function
Removed/Changed/Added variables summary: 0 Removed, 0 Changed, 1 Added variable

1 Added variable:

  [A] 'tracepoint __tracepoint_android_vh_subpage_dma_contig_alloc'

Bug: 199917449
Change-Id: Ia86fb416376bca231405b06ab27b0674c8fe3e14
Signed-off-by: Chris Goldsworthy <quic_cgoldswo@quicinc.com>
2021-12-17 02:31:49 -08:00
deyaoren@google.com
d878f18944 Merge keystone/mirror-android12-5.10 into keystone/android12-5.10-keystone-qcom-dev
* keystone/mirror-android12-5.10:
  FROMGIT: USB: gadget: bRequestType is a bitfield, not a enum
  ANDROID: qcom: Add flush_delayed_fput to ABI
  ANDROID: fix ABI breakage caused by mm_struct->mmu_notifier_lock addition
  ANDROID: fix ABI breakage caused by percpu_rw_semaphore changes
  ANDROID: fix mmu_notifier race caused by not taking mmap_lock during SPF
  ANDROID: percpu-rwsem: enable percpu_sem destruction in atomic context
  FROMLIST: virtio_mmio: pm: Add notification handlers for restore and freeze
  FROMLIST: virtio: do not reset stateful devices on resume
  FROMGIT: f2fs: avoid EINVAL by SBI_NEED_FSCK when pinning a file

Signed-off-by: deyaoren@google.com <deyaoren@google.com>
Change-Id: I19107ef2650f3c2cb0622c251d131cff75450e9a
2021-12-16 18:50:32 +00:00
qctecmdr
54c0c4127a Merge "Merge keystone/android12-5.10-keystone-qcom-release.66+ (40160d2) into msm-5.10" 2021-12-15 21:32:23 -08:00
Suren Baghdasaryan
a4d26b9a4b ANDROID: fix ABI breakage caused by percpu_rw_semaphore changes
percpu_rw_semaphore changes to allow calling percpu_free_rwsem in atomic
context cause ABI breakage. Introduce percpu_free_rwsem_atomic wrapper
and change percpu_rwsem_destroy to use it in order to keep
percpu_rw_semaphore struct intact and fix ABI breakage.

Bug: 161210518
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Change-Id: I198a6381fb48059f2aaa2ec38b8c1e5e5e936bb0
2021-12-15 21:45:19 +00:00
Suren Baghdasaryan
6971350406 ANDROID: fix mmu_notifier race caused by not taking mmap_lock during SPF
When pagefaults are handled speculatively,the pair of
mmu_notifier_invalidate_range_start/mmu_notifier_invalidate_range_end
calls happen without mmap_lock being taken. This enables the following
race:

mmu_notifier_invalidate_range_start
                                       mmap_write_lock
                                       mmu_notifier_register
                                       mmap_write_unlock
mmu_notifier_invalidate_range_end

In this case mmu_notifier_invalidate_range_end will see a new
subscriber not seen at the time of mmu_notifier_invalidate_range_start
and will call ops->invalidate_range_end for that subscriber without
the matching ops->invalidate_range_start, creating imbalance.
Fix this by introducing a new mm->mmu_notifier_lock percpu_rw_semaphore
to synchronize mmu_notifier_invalidate_range_start/
mmu_notifier_invalidate_range_end with mmu_notifier_register when
handling pagefaults speculatively without holding mmap_lock.
percpu_rw_semaphore is used instead of rw_semaphore to prevent cache
line bouncing in the pagefault path.

Fixes: 86ee4a531e ("FROMLIST: x86/mm: add speculative pagefault handling")

Bug: 161210518
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Change-Id: I9c363b2348efcad19818f93b010abf956870ab55
2021-12-15 21:44:56 +00:00
Suren Baghdasaryan
2fc2c66b9c ANDROID: percpu-rwsem: enable percpu_sem destruction in atomic context
Calling percpu_free_rwsem in atomic context results in "scheduling while
atomic" bug being triggered:

BUG: scheduling while atomic: klogd/158/0x00000002
...
  __schedule_bug+0x191/0x290
  schedule_debug+0x97/0x180
  __schedule+0xdc/0xba0
  schedule+0xda/0x250
  schedule_timeout+0x92/0x2d0
  __wait_for_common+0x25b/0x430
  wait_for_completion+0x1f/0x30
  rcu_barrier+0x440/0x4f0
  rcu_sync_dtor+0xaa/0x190
  percpu_free_rwsem+0x41/0x80

Introduce percpu_rwsem_destroy function to perform semaphore destruction
in a worker thread.

Bug: 161210518
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Change-Id: I74ac65c2a9962492cd5002d7a019d2aa13a21a8c
2021-12-15 21:44:50 +00:00
qctecmdr
15f1f7aca6 Merge "Revert "sched: walt: Improve the Scheduler"" 2021-12-14 09:36:20 -08:00
deyaoren@google.com
61d28a4c6d Merge keystone/mirror-android12-5.10 into keystone/android12-5.10-keystone-qcom-dev
* keystone/mirror-android12-5.10:
  UPSTREAM: aio: fix use-after-free due to missing POLLFREE handling
  UPSTREAM: aio: keep poll requests on waitqueue until completed
  UPSTREAM: signalfd: use wake_up_pollfree()
  UPSTREAM: binder: use wake_up_pollfree()
  UPSTREAM: wait: add wake_up_pollfree()
  UPSTREAM: USB: gadget: zero allocate endpoint 0 buffers
  BACKPORT: scsi: ufs: Improve SCSI abort handling further
  FROMGIT: scsi: ufs: Introduce ufshcd_release_scsi_cmd()
  FROMGIT: scsi: ufs: Remove the 'update_scaling' local variable
  UPSTREAM: scsi: ufs: core: Fix another task management completion race
  BACKPORT: scsi: ufs: core: Fix task management completion timeout race
  ANDROID: qcom: Add android_rvh_do_ptrauth_fault to ABI

Signed-off-by: deyaoren@google.com <deyaoren@google.com>
Change-Id: Iab06d997e2f94ac3b20002033894fbc02ad4c749
2021-12-14 17:30:34 +00:00
Eric Biggers
e50fe1de2f UPSTREAM: wait: add wake_up_pollfree()
commit 42288cb44c4b5fff7653bc392b583a2b8bd6a8c0 upstream.

Several ->poll() implementations are special in that they use a
waitqueue whose lifetime is the current task, rather than the struct
file as is normally the case.  This is okay for blocking polls, since a
blocking poll occurs within one task; however, non-blocking polls
require another solution.  This solution is for the queue to be cleared
before it is freed, using 'wake_up_poll(wq, EPOLLHUP | POLLFREE);'.

However, that has a bug: wake_up_poll() calls __wake_up() with
nr_exclusive=1.  Therefore, if there are multiple "exclusive" waiters,
and the wakeup function for the first one returns a positive value, only
that one will be called.  That's *not* what's needed for POLLFREE;
POLLFREE is special in that it really needs to wake up everyone.

Considering the three non-blocking poll systems:

- io_uring poll doesn't handle POLLFREE at all, so it is broken anyway.

- aio poll is unaffected, since it doesn't support exclusive waits.
  However, that's fragile, as someone could add this feature later.

- epoll doesn't appear to be broken by this, since its wakeup function
  returns 0 when it sees POLLFREE.  But this is fragile.

Although there is a workaround (see epoll), it's better to define a
function which always sends POLLFREE to all waiters.  Add such a
function.  Also make it verify that the queue really becomes empty after
all waiters have been woken up.

Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20211209010455.42744-2-ebiggers@kernel.org
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Bug: 185125206
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I4f69da5bbbad53975024d027fa1bbe22522c6efe
2021-12-14 13:54:22 +01:00
Sivasri Kumar, Vanka
db6a123100 Merge keystone/android12-5.10-keystone-qcom-release.66+ (40160d2) into msm-5.10
* refs/heads/tmp-40160d2:
  UPSTREAM: ASoC: dapm: use component prefix when checking widget names
  ANDROID: ABI: Add symbols used by clocksource driver
  ANDROID: GKI: Export clocksource_mmio_init
  ANDROID: GKI: Export sched_clock_register
  FROMGIT: f2fs: show number of pending discard commands
  ANDROID: workqueue: export symbol of the function wq_worker_comm()
  ANDROID: GKI: Update symbols to symbol list
  ANDROID: vendor_hooks: Add hooks for binder proc transaction

Change-Id: Iefc600dfe7e110fa001e7c6c9f88e15008382b2d
Signed-off-by: Sivasri Kumar, Vanka <quic_svanka@quicinc.com>
2021-12-13 11:52:48 +05:30
qctecmdr
a0bd2e3d47 Merge "sched/walt: Improve the scheduler" 2021-12-09 01:10:39 -08:00
qctecmdr
bc19c757d1 Merge "sched/walt: make cmt aware of boosted/colocated task" 2021-12-08 22:56:57 -08:00
Sai Harshini Nimmala
1d79f055ff sched/walt: Fix frequent frequency updates
As a side effect of commit f64fafbec5 ("sched/walt: Fix caching freq
earlier than down rate limit check"), the check to skip frequency update
if the same frequency as the previous frequency is being applied,
got removed.
Restore this check at the appropriate place.

Change-Id: I7aee7f84f0a64747b01ac31c2fdcbb4440908deb
Signed-off-by: Sai Harshini Nimmala <quic_snimmala@quicinc.com>
2021-12-08 22:44:52 -08:00
qctecmdr
01db1e93d6 Merge "Merge keystone/android12-5.10-keystone-qcom-release.66+ (ca0e930) into msm-5.10" 2021-12-07 22:43:16 -08:00
Abhijeet Dharmapurikar
8e284cd5b7 sched/walt: make cmt aware of boosted/colocated task
This change is for general scheduler improvement.

Change-Id: I6235ca8fce3d0c2ab3bcab1ecee0d97c6d0a9942
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
Signed-off-by: Shaleen Agrawal <shalagra@codeaurora.org>
2021-12-07 19:43:15 -08:00
qctecmdr
8644491bb9 Merge "sched/walt: kick Gold if farthest cluster needs help" 2021-12-07 16:10:21 -08:00
Abhijeet Dharmapurikar
37c81cdfea sched/walt: kick Gold if farthest cluster needs help
This change is for general scheduler improvement.

Change-Id: I997827d143a370e49e43ecba8494ee8e69652b57
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
Signed-off-by: Shaleen Agrawal <shalagra@codeaurora.org>
2021-12-07 11:45:53 -08:00
deyaoren@google.com
f6ad259f28 Merge keystone/mirror-android12-5.10 into keystone/android12-5.10-keystone-qcom-dev
* keystone/mirror-android12-5.10:
  ANDROID: ABI: Add symbols used by clocksource driver
  ANDROID: GKI: Export clocksource_mmio_init
  ANDROID: GKI: Export sched_clock_register
  FROMGIT: f2fs: show number of pending discard commands
  ANDROID: workqueue: export symbol of the function wq_worker_comm()

Signed-off-by: deyaoren@google.com <deyaoren@google.com>
Change-Id: I3dbd0461e35bf842cc714a4c997e4996383ed3a8
2021-12-07 17:57:50 +00:00
Jindong Yue
84881c68b1 ANDROID: GKI: Export sched_clock_register
clocksource driver may use sched_clock_register
to resigter itself as a sched_clock source.
Export it to support building such driver
as module, like timer-imx-tpm.c

Bug: 194108974
Signed-off-by: Jindong Yue <jindong.yue@nxp.com>
Change-Id: Id23f3da624a1e70fc1a44daf6f827c03dc1d053d
2021-12-07 00:47:04 +00:00
Stephen Dickey
6b814579db sched/walt: improve preemptirq template based tracepoints
To determine why a particular long preemption or long irqs off
period has happened, without crashing the device, the tracepoints
need improvement. The callers should be included.

Change-Id: If147969717517563e56cd20d3c036f51835a5c73
Signed-off-by: Stephen Dickey <quic_dickey@quicinc.com>
2021-12-06 14:58:09 -08:00
zhengding chen
28de741861 ANDROID: workqueue: export symbol of the function wq_worker_comm()
Export symbol of the function wq_worker_comm() in kernel/workqueue.c for dlkm to get the description of the kworker process.

Bug: 208394207
Signed-off-by: zhengding chen <chenzhengding@oppo.com>
Change-Id: I2e7ddd52a15e22e99e6596f16be08243af1bb473
2021-12-06 17:11:59 +00:00
Sivasri Kumar, Vanka
c2b96bff82 Merge keystone/android12-5.10-keystone-qcom-release.66+ (ca0e930) into msm-5.10
* refs/heads/tmp-ca0e930:
  ANDROID: GKI: Add symbols abi for USB IP kernel modules.
  ANDROID: GKI: Fix file mode on mtk abi file
  UPSTREAM: erofs: fix deadlock when shrink erofs slab
  ANDROID: init_task: Init android vendor and oem data

Change-Id: I7a5fc8cf9ab70e60cd693a12a1e19cf8fa6ba535
Signed-off-by: Sivasri Kumar, Vanka <quic_svanka@quicinc.com>
2021-12-06 20:41:42 +05:30
qctecmdr
cc85c3a846 Merge "Merge keystone/android12-5.10-keystone-qcom-release.66+ (26ea52b) into msm-5.10" 2021-12-06 00:12:42 -08:00
qctecmdr
9088a4cd1f Merge "sched/walt: remove task from mvp list if task in yield" 2021-12-05 17:26:35 -08:00
Daniel Norman
45fc1d52ff Merge keystone/mirror-android12-5.10 into keystone/android12-5.10-keystone-qcom-dev
* keystone/mirror-android12-5.10:
  ANDROID: GKI: Fix file mode on mtk abi file
  UPSTREAM: erofs: fix deadlock when shrink erofs slab
  ANDROID: init_task: Init android vendor and oem data

Signed-off-by: Daniel Norman <danielnorman@google.com>
Change-Id: I6dd077bbaccc784efb63caa8ec4cf005ea696b77
2021-12-02 08:59:09 -08:00
Sivasri Kumar, Vanka
eea17f79f4 Merge keystone/android12-5.10-keystone-qcom-release.66+ (26ea52b) into msm-5.10
* refs/heads/tmp-26ea52b:
  UPSTREAM: sched/core: Mitigate race cpus_share_cache()/update_top_cache_domain()
  ANDROID: Update symbol list for mtk
  UPSTREAM: erofs: fix unsafe pagevec reuse of hooked pclusters
  UPSTREAM: erofs: remove the occupied parameter from z_erofs_pagevec_enqueue()
  UPSTREAg: usb: dwc3: gadget: Fix null pointer exception
  ANDROID: fips140: support "evaluation testing" builds via build.sh
  FROMGIT: sched/scs: Reset task stack state in bringup_cpu()
  ANDROID: dma-buf: heaps: fix dma-buf heap pool pages stat

Change-Id: I6a1e6ded5547917de20a040c7df866405ddd37d0
Signed-off-by: Sivasri Kumar, Vanka <quic_svanka@quicinc.com>
2021-12-02 12:05:34 +05:30
qctecmdr
70562fcbfe Merge "Merge keystone/android12-5.10-keystone-qcom-release.66+ (ecb09e2) into msm-5.10" 2021-12-01 10:42:34 -08:00
Daniel Norman
43670409b2 Merge keystone/mirror-android12-5.10 into keystone/android12-5.10-keystone-qcom-dev
* keystone/mirror-android12-5.10:
  UPSTREAM: sched/core: Mitigate race cpus_share_cache()/update_top_cache_domain()
  ANDROID: Update symbol list for mtk
  UPSTREAM: erofs: fix unsafe pagevec reuse of hooked pclusters
  UPSTREAM: erofs: remove the occupied parameter from z_erofs_pagevec_enqueue()
  UPSTREAM: usb: dwc3: gadget: Fix null pointer exception
  ANDROID: fips140: support "evaluation testing" builds via build.sh

Signed-off-by: Daniel Norman <danielnorman@google.com>
Change-Id: I453444f15db78d1a6b6b93ed2bcd24d6f661e3ad
2021-12-01 09:11:34 -08:00
Maria Yu
898e7ec950 ANDROID: init_task: Init android vendor and oem data
Without initialization, it will be random data and hard for
vendor hook to decide.

Bug: 207739506
Change-Id: I278772d87eea38c03a40d4f0bef20ac8644e2ecd
Signed-off-by: Maria Yu <quic_aiquny@quicinc.com>
2021-12-01 15:38:18 +00:00
Jing-Ting Wu
3c54070823 UPSTREAM: sched/core: Mitigate race cpus_share_cache()/update_top_cache_domain()
Nothing protects the access to the per_cpu variable sd_llc_id. When testing
the same CPU (i.e. this_cpu == that_cpu), a race condition exists with
update_top_cache_domain(). One scenario being:

              CPU1                            CPU2
  ==================================================================

  per_cpu(sd_llc_id, CPUX) => 0
                                    partition_sched_domains_locked()
      				      detach_destroy_domains()
  cpus_share_cache(CPUX, CPUX)          update_top_cache_domain(CPUX)
    per_cpu(sd_llc_id, CPUX) => 0
                                          per_cpu(sd_llc_id, CPUX) = CPUX
    per_cpu(sd_llc_id, CPUX) => CPUX
    return false

ttwu_queue_cond() wouldn't catch smp_processor_id() == cpu and the result
is a warning triggered from ttwu_queue_wakelist().

Avoid a such race in cpus_share_cache() by always returning true when
this_cpu == that_cpu.

Fixes: 518cd62341 ("sched: Only queue remote wakeups when crossing cache boundaries")
Reported-by: Jing-Ting Wu <jing-ting.wu@mediatek.com>
Signed-off-by: Vincent Donnefort <vincent.donnefort@arm.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Valentin Schneider <valentin.schneider@arm.com>
Reviewed-by: Vincent Guittot <vincent.guittot@linaro.org>
Link: https://lore.kernel.org/r/20211104175120.857087-1-vincent.donnefort@arm.com
Bug: 204726704
Change-Id: Ib6e59187b6d7d7dcabae84e3541d5fbe0dfc400a
(cherry picked from commit 42dc938a590c96eeb429e1830123fef2366d9c80)
Signed-off-by: Jing-Ting Wu <Jing-Ting.Wu@mediatek.com>
2021-12-01 11:10:58 +00:00
Tengfei Fan
dc0365a216 sched/walt: remove task from mvp list if task in yield
When a task yields, it relinquishes the cpu and scheduler
is tasked to find another task.
However he MVP implementation could return the same task
leading to a loop where the yielded task gets to run back.
To fix this, drop the MVP status of tasks that yield
themselves. The MVP status is restored the next time they
actually get enqueued - -likely because of a wakeup from
sleep or task migration.

Change-Id: Ia2a2074f18c4de56e0695ee2c5f1daf8a4eb5980
Signed-off-by: Tengfei Fan <tengfeif@codeaurora.org>
2021-11-30 17:40:59 -08:00