Commit Graph

1068159 Commits

Author SHA1 Message Date
Chuang Zhang
5d4d5dbeab BACKPORT: FROMGIT: Binder: Add timestamp to transaction record
This patch adds a timestamp field to the binder_transaction
structure to track the time consumed during transmission
when reading binder_transaction records.

Signed-off-by: Chuang Zhang <zhangchuang3@xiaomi.com>
Acked-by: Carlos Llamas <cmllamas@google.com>
Link: https://lore.kernel.org/r/5ac8c0d09392290be789423f0dd78a520b830fab.1682333709.git.zhangchuang3@xiaomi.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Bug: 235773151
(cherry picked from commit 800936191a
 git: //git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git
 char-misc-next)
[cmllamas: resolved minor conflicts with local patches]
Change-Id: If6dab2e9b80c71f9ac3084dc8cf0e519976f55d8
Signed-off-by: Carlos Llamas <cmllamas@google.com>
2023-05-24 13:53:29 +00:00
Nick Desaulniers
9e8b2d8ee2 Revert "ANDROID: gki_config: use DWARFv5 rather than DWARFv4"
This reverts commit ad2bd67e07.

Qualcomm is reporting that internal debugging tools in addition to
Lauterbach Trace32 (T32) debugger (vLT_20230509_159359) are having
issues with DWARFv5.

Since the change to the DWARF debug info format was made after the
Android Feature Complete deadline, revert it from android14-* kernel
branches. We'll leave DWARFv5 for android-mainline and try again next
release in android15-*.

Bug: 281863640
Reported-by: Satya Durga Srinivasu Prabhala <quic_satyap@quicinc.com>
Change-Id: I5a1657bdf6785d23f3492dc12e6f3df0954b8deb
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
2023-05-24 13:53:29 +00:00
Tudor Ambarus
6c4ed97791 UPSTREAM: ext4: avoid a potential slab-out-of-bounds in ext4_group_desc_csum
commit 4f04351888 upstream.

When modifying the block device while it is mounted by the filesystem,
syzbot reported the following:

BUG: KASAN: slab-out-of-bounds in crc16+0x206/0x280 lib/crc16.c:58
Read of size 1 at addr ffff888075f5c0a8 by task syz-executor.2/15586

CPU: 1 PID: 15586 Comm: syz-executor.2 Not tainted 6.2.0-rc5-syzkaller-00205-gc96618275234 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/12/2023
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x1b1/0x290 lib/dump_stack.c:106
 print_address_description+0x74/0x340 mm/kasan/report.c:306
 print_report+0x107/0x1f0 mm/kasan/report.c:417
 kasan_report+0xcd/0x100 mm/kasan/report.c:517
 crc16+0x206/0x280 lib/crc16.c:58
 ext4_group_desc_csum+0x81b/0xb20 fs/ext4/super.c:3187
 ext4_group_desc_csum_set+0x195/0x230 fs/ext4/super.c:3210
 ext4_mb_clear_bb fs/ext4/mballoc.c:6027 [inline]
 ext4_free_blocks+0x191a/0x2810 fs/ext4/mballoc.c:6173
 ext4_remove_blocks fs/ext4/extents.c:2527 [inline]
 ext4_ext_rm_leaf fs/ext4/extents.c:2710 [inline]
 ext4_ext_remove_space+0x24ef/0x46a0 fs/ext4/extents.c:2958
 ext4_ext_truncate+0x177/0x220 fs/ext4/extents.c:4416
 ext4_truncate+0xa6a/0xea0 fs/ext4/inode.c:4342
 ext4_setattr+0x10c8/0x1930 fs/ext4/inode.c:5622
 notify_change+0xe50/0x1100 fs/attr.c:482
 do_truncate+0x200/0x2f0 fs/open.c:65
 handle_truncate fs/namei.c:3216 [inline]
 do_open fs/namei.c:3561 [inline]
 path_openat+0x272b/0x2dd0 fs/namei.c:3714
 do_filp_open+0x264/0x4f0 fs/namei.c:3741
 do_sys_openat2+0x124/0x4e0 fs/open.c:1310
 do_sys_open fs/open.c:1326 [inline]
 __do_sys_creat fs/open.c:1402 [inline]
 __se_sys_creat fs/open.c:1396 [inline]
 __x64_sys_creat+0x11f/0x160 fs/open.c:1396
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7f72f8a8c0c9
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 f1 19 00 00 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f72f97e3168 EFLAGS: 00000246 ORIG_RAX: 0000000000000055
RAX: ffffffffffffffda RBX: 00007f72f8bac050 RCX: 00007f72f8a8c0c9
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000020000280
RBP: 00007f72f8ae7ae9 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007ffd165348bf R14: 00007f72f97e3300 R15: 0000000000022000

Replace
	le16_to_cpu(sbi->s_es->s_desc_size)
with
	sbi->s_desc_size

It reduces ext4's compiled text size, and makes the code more efficient
(we remove an extra indirect reference and a potential byte
swap on big endian systems), and there is no downside. It also avoids the
potential KASAN / syzkaller failure, as a bonus.

Reported-by: syzbot+fc51227e7100c9294894@syzkaller.appspotmail.com
Reported-by: syzbot+8785e41224a3afd04321@syzkaller.appspotmail.com
Link: https://syzkaller.appspot.com/bug?id=70d28d11ab14bd7938f3e088365252aa923cff42
Link: https://syzkaller.appspot.com/bug?id=b85721b38583ecc6b5e72ff524c67302abbc30f3
Link: https://lore.kernel.org/all/000000000000ece18705f3b20934@google.com/
Fixes: 717d50e497 ("Ext4: Uninitialized Block Groups")
Cc: stable@vger.kernel.org
Signed-off-by: Tudor Ambarus <tudor.ambarus@linaro.org>
Link: https://lore.kernel.org/r/20230504121525.3275886-1-tudor.ambarus@linaro.org
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Bug: 269155298
Bug: 270466805
Change-Id: Id14192ab0905c36e154d07d461afb56af7b61488
Signed-off-by: Tudor Ambarus <tudor.ambarus@linaro.org>
2023-05-24 06:37:40 +00:00
Kajetan Puchalski
0764d6d2f5 BACKPORT: cpuidle: teo: Introduce util-awareness
Modern interactive systems, such as recent Android phones, tend to have
power efficient shallow idle states. Selecting deeper idle states on a
device while a latency-sensitive workload is running can adversely
impact performance due to increased latency. Additionally, if the CPU
wakes up from a deeper sleep before its target residency as is often the
case, it results in a waste of energy on top of that.

At the moment, none of the available idle governors take any scheduling
information into account. They also tend to overestimate the idle
duration quite often, which causes them to select excessively deep idle
states, thus leading to increased wakeup latency and lower performance
with no power saving. For 'menu' while web browsing on Android for
instance, those types of wakeups ('too deep') account for over 24% of
all wakeups.

At the same time, on some platforms idle state 0 can be power efficient
enough to warrant wanting to prefer it over idle state 1. This is
because the power usage of the two states can be so close that
sufficient amounts of too deep state 1 sleeps can completely offset the
state 1 power saving to the point where it would've been more power
efficient to just use state 0 instead. This is, of course, for systems
where state 0 is not a polling state, such as arm-based devices.

Sleeps that happened in state 0 while they could have used state 1 ('too
shallow') only save less power than they otherwise could have. Too deep
sleeps, on the other hand, harm performance and nullify the potential
power saving from using state 1 in the first place. While taking this
into account, it is clear that on balance it is preferable for an idle
governor to have more too shallow sleeps instead of more too deep sleeps
on those kinds of platforms.

This patch specifically tunes TEO to prefer shallower idle states in
order to reduce wakeup latency and achieve better performance.

To this end, before selecting the next idle state it uses the avg_util
signal of a CPU's runqueue in order to determine to what extent the CPU
is being utilized. This util value is then compared to a threshold
defined as a percentage of the CPU's capacity (capacity >> 6 ie. ~1.5%
in the current implementation). If the util is above the threshold, the
index of the idle state selected by TEO metrics will be reduced by 1,
thus selecting a shallower state. If the util is below the threshold,
the governor defaults to the TEO metrics mechanism to try to select the
deepest available idle state based on the closest timer event and its
own correctness.

The main goal of this is to reduce latency and increase performance for
some workloads. Under some workloads it will result in an increase in
power usage (Geekbench 5) while for other workloads it will also result
in a decrease in power usage compared to TEO (PCMark Web, Jankbench,
Speedometer).

It can provide drastically decreased latency and performance benefits in
certain types of workloads that are sensitive to latency.

Example test results:

1. GB5 (better score, latency & more power usage)

| metric                                | menu           | teo               | teo-util-aware    |
| ------------------------------------- | -------------- | ----------------- | ----------------- |
| gmean score                           | 2826.5 (0.0%)  | 2764.8 (-2.18%)   | 2865 (1.36%)      |
| gmean power usage [mW]                | 2551.4 (0.0%)  | 2606.8 (2.17%)    | 2722.3 (6.7%)     |
| gmean too deep %                      | 14.99%         | 9.65%             | 4.02%             |
| gmean too shallow %                   | 2.5%           | 5.96%             | 14.59%            |
| gmean task wakeup latency (asynctask) | 78.16μs (0.0%) | 61.60μs (-21.19%) | 54.45μs (-30.34%) |

2. Jankbench (better score, latency & less power usage)

| metric                                | menu           | teo               | teo-util-aware    |
| ------------------------------------- | -------------- | ----------------- | ----------------- |
| gmean frame duration                  | 13.9 (0.0%)    | 14.7 (6.0%)       | 12.6 (-9.0%)      |
| gmean jank percentage                 | 1.5 (0.0%)     | 2.1 (36.99%)      | 1.3 (-17.37%)     |
| gmean power usage [mW]                | 144.6 (0.0%)   | 136.9 (-5.27%)    | 121.3 (-16.08%)   |
| gmean too deep %                      | 26.00%         | 11.00%            | 2.54%             |
| gmean too shallow %                   | 4.74%          | 11.89%            | 21.93%            |
| gmean wakeup latency (RenderThread)   | 139.5μs (0.0%) | 116.5μs (-16.49%) | 91.11μs (-34.7%)  |
| gmean wakeup latency (surfaceflinger) | 124.0μs (0.0%) | 151.9μs (22.47%)  | 87.65μs (-29.33%) |

Bug: 258723112
Change-Id: Ifea46051fb4b0554349aa50145130e38efa5f163
Signed-off-by: Kajetan Puchalski <kajetan.puchalski@arm.com>
[ rjw: Comment edits and white space adjustments ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
(cherry picked from commit 9ce0f7c4bc)
[Build error due to different signature of sched_cpu_util()]
Signed-off-by: Qais Yousef <qyousef@google.com>
2023-05-23 22:11:47 +00:00
Kajetan Puchalski
d52ad10640 UPSTREAM: cpuidle: teo: Optionally skip polling states in teo_find_shallower_state()
Add a no_poll flag to teo_find_shallower_state() that will let the
function optionally not consider polling states.

This allows the caller to guard against the function inadvertently
resulting in TEO putting the CPU in a polling state when that
behaviour is undesirable.

Bug: 258723112
Change-Id: Ic3879fd4428dd4c7b19caaee6f9fd847cdb58483
Signed-off-by: Kajetan Puchalski <kajetan.puchalski@arm.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
(cherry picked from commit 27f8508801)
Signed-off-by: Qais Yousef <qyousef@google.com>
2023-05-23 22:11:47 +00:00
Qais Yousef
d9a7607f56 ANDROID: Update the ABI symbol list
Adding the following symbols:
  - __traceiter_android_vh_uclamp_validate
  - __tracepoint_android_vh_uclamp_validate

Bug: 283761535
Change-Id: I74fdbf3162ba5b64696b5ac708e0c429e5a41fd9
Signed-off-by: Qais Yousef <qyousef@google.com>
2023-05-23 20:40:47 +00:00
Qais Yousef
10bca2e53c ANDROID: Add new hook to enable overriding uclamp_validate()
We want to add more special values, specifically for uclamp_max so that
it can be set automatically to the most efficient value based on the
core it's running on.

Bug: 283761535
Signed-off-by: Qais Yousef <qyousef@google.com>
Change-Id: I57343c4544f6cac621c855cbb94de0b8d80c51fa
2023-05-23 20:40:47 +00:00
Mostafa Saleh
01ec18c52f ANDROID: KVM: arm64: iommu: Erase pvmfw from EL1 if possible
Kernel IOMMU drivers can report system misconfiguration through
pkvm_iommu_finalize().
Then EL2 can take the proper response, for example if there are missing
IOMMUs, and DMA isolation can't be ensured, it would clear pvmfw so
PVMs can't be launched.
However, this is not clean as userspace can still query pvmfw info
and launch PVMs that loops in undefined instruction aborts as pvmfw
is cleared.
To fix this, before deprivilege, the kernel will erase pvmfw if the
IOMMUs are not finalised.

Bug: 268607700
Test: Launch PVM with missing S2MPU => Fail immediately with -8
Test: Launch PVM with all S2MPU => Pass
Change-Id: I9fd2440805f6b2f2ad4395ce61df5b272ed84fef
Signed-off-by: Mostafa Saleh <smostafa@google.com>
2023-05-23 13:36:51 +00:00
Bart Van Assche
c44534436f BACKPORT: FROMGIT: block: BFQ: Add several invariant checks
If anything goes wrong with the counters that track the number of
requests, I/O locks up. Make such scenarios easier to debug by adding
invariant checks for the request counters. Additionally, check that
BFQ queues are empty before these are freed.

Cc: Jan Kara <jack@suse.cz>
Cc: Yu Kuai <yukuai3@huawei.com>
Change-Id: I566e972e4c9c5c3e8bb256e6be39f5bb6bec7256
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20230516223853.1385255-1-bvanassche@acm.org
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Bug: 275581839
(cherry picked from commit 3e49c1e4a6 https://git.kernel.dk/cgit/linux/)
[ bvanassche: backported to kernel v5.15 ]
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2023-05-19 23:13:26 +00:00
Bart Van Assche
5db3a9fa14 FROMGIT: block: mq-deadline: Fix handling of at-head zoned writes
Before dispatching a zoned write from the FIFO list, check whether there
are any zoned writes in the RB-tree with a lower LBA for the same zone.
This patch ensures that zoned writes happen in order even if at_head is
set for some writes for a zone and not for others.

Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Cc: Ming Lei <ming.lei@redhat.com>
Change-Id: I51a3faf0f2dbca7f860cb7fdc103d077a6a97d0a
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20230517174230.897144-12-bvanassche@acm.org
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Bug: 275581839
(cherry picked from commit a036e698c2 https://git.kernel.dk/cgit/linux/)
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2023-05-19 23:13:26 +00:00
Bart Van Assche
499e313515 FROMGIT: block: mq-deadline: Handle requeued requests correctly
Start dispatching from the start of a zone instead of from the starting
position of the most recently dispatched request.

If a zoned write is requeued with an LBA that is lower than already
inserted zoned writes, make sure that it is submitted first.

Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Cc: Damien Le Moal <dlemoal@kernel.org>
Cc: Ming Lei <ming.lei@redhat.com>
Change-Id: I7920302d8996d366efe251805005f9e7170044bb
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Link: https://lore.kernel.org/r/20230517174230.897144-11-bvanassche@acm.org
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Bug: 275581839
(cherry picked from commit 0effb390c4 https://git.kernel.dk/cgit/linux/)
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2023-05-19 23:13:26 +00:00
Bart Van Assche
2b9a4dc9df FROMGIT: block: mq-deadline: Track the dispatch position
Track the position (sector_t) of the most recently dispatched request
instead of tracking a pointer to the next request to dispatch. This
patch is the basis for patch "Handle requeued requests correctly".
Without this patch it would be significantly more complicated to make
sure that zoned writes are dispatched in LBA order per zone.

Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Cc: Ming Lei <ming.lei@redhat.com>
Change-Id: I7ea38c43ae4e80b3a2257b631b58754c60aff4df
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20230517174230.897144-10-bvanassche@acm.org
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Bug: 275581839
(cherry picked from commit 83c46ed675 https://git.kernel.dk/cgit/linux/)
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2023-05-19 23:13:26 +00:00
Bart Van Assche
1d129b2b1b BACKPORT: FROMGIT: block: mq-deadline: Reduce lock contention
blk_mq_free_requests() calls dd_finish_request() indirectly. Prevent
nested locking of dd->lock and dd->zone_lock by moving the code for
freeing requests.

Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Cc: Ming Lei <ming.lei@redhat.com>
Change-Id: Ib5709f236308f229e35da690ab4cad25f3fcf94d
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20230517174230.897144-9-bvanassche@acm.org
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Bug: 275581839
(cherry picked from commit b2097bd24b https://git.kernel.dk/cgit/linux/)
[ bvanassche: resolved cherry-picking conflicts ]
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2023-05-19 23:13:26 +00:00
Bart Van Assche
9a3b2e6468 FROMGIT: block: mq-deadline: Simplify deadline_skip_seq_writes()
Make the deadline_skip_seq_writes() code shorter without changing its
functionality.

Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Cc: Ming Lei <ming.lei@redhat.com>
Change-Id: I3d6fa65ccf9af3bc54742acf2ca2a67bd6b13dc1
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20230517174230.897144-8-bvanassche@acm.org
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Bug: 275581839
(cherry picked from commit 3b463cbea9 https://git.kernel.dk/cgit/linux/)
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2023-05-19 23:13:26 +00:00
Bart Van Assche
0d84365099 FROMGIT: block: mq-deadline: Clean up deadline_check_fifo()
Change the return type of deadline_check_fifo() from 'int' into 'bool'.
Use time_is_before_eq_jiffies() instead of time_after_eq(). No
functionality has been changed.

Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Cc: Damien Le Moal <dlemoal@kernel.org>
Cc: Ming Lei <ming.lei@redhat.com>
Change-Id: Ie1ace1db1f1c78246fee60cd9a301cf0d6ad1f89
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Link: https://lore.kernel.org/r/20230517174230.897144-7-bvanassche@acm.org
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Bug: 275581839
(cherry picked from commit e0d85cde95 https://git.kernel.dk/cgit/linux/)
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2023-05-19 23:13:26 +00:00
Bart Van Assche
435b2eda27 FROMGIT: block: mq-deadline: Add a word in a source code comment
Add the missing word "and".

Cc: Damien Le Moal <dlemoal@kernel.org>
Suggested-by: Damien Le Moal <dlemoal@kernel.org>
Fixes: 945ffb60c1 ("mq-deadline: add blk-mq adaptation of the deadline IO scheduler")
Change-Id: Ic8e16b13886815418a7d60d310a040ce48d5ebe7
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Tested-by: Damien Le Moal <dlemoal@kernel.org>
Link: https://lore.kernel.org/r/20230517174230.897144-2-bvanassche@acm.org
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Bug: 275581839
(cherry picked from commit 45b46b6f15 https://git.kernel.dk/cgit/linux/)
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2023-05-19 23:13:26 +00:00
Bart Van Assche
57f7c5ce85 ANDROID: block: Rename blk_rq_is_seq_zone_write()
Rename this function to align the function name with the function name
used in the upstream Linux kernel.

Bug: 275581839
Change-Id: I085ffacf535e65d8afbb9935a2cca26c4fec0d80
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2023-05-19 23:13:26 +00:00
Zheng Liang
5925446e48 UPSTREAM: block, bfq: fix UAF problem in bfqg_stats_init()
In bfq_pd_alloc(), the function bfqg_stats_init() init bfqg. If
blkg_rwstat_init() init bfqg_stats->bytes successful and init
bfqg_stats->ios failed, bfqg_stats_init() return failed, bfqg will
be freed. But blkg_rwstat->cpu_cnt is not deleted from the list of
percpu_counters. If we traverse the list of percpu_counters, It will
have UAF problem.

we should use blkg_rwstat_exit() to cleanup bfqg_stats bytes in the
above scenario.

Fixes: commit fd41e60331 ("bfq-iosched: stop using blkg->stat_bytes and ->stat_ios")
Change-Id: I133bae6a318a8ddc4f10a8ee8e63595a1219ea1e
Signed-off-by: Zheng Liang <zhengliang6@huawei.com>
Acked-by: Tejun Heo <tj@kernel.org>
Link: https://lore.kernel.org/r/20211018024225.1493938-1-zhengliang6@huawei.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
(cherry picked from commit 2fc428f6b7)
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2023-05-19 23:13:26 +00:00
Varad Gokhale
87c5ca81c3 ANDROID: Update the ABI symbol list
Adding the following symbols:
 - i3c_driver_unregister
 - i3c_driver_register_with_owner
 - i3c_device_do_priv_xfers

Bug: 283490069

Change-Id: I5e000dcbadfd23e69f07e189556576bd2cf08e4f
Signed-off-by: Varad Gokhale <gokv@google.com>
2023-05-19 19:53:18 +00:00
Thierry Strudel
7c5cae80c9 ANDROID: power: wakeup_reason: change abort log
Logging callback symbolic name is generating too many different
messages making Abort analysis miss big trends.
Stick to console reported message providing sufficient information.

Bug: 280678242
Signed-off-by: Thierry Strudel <tstrudel@google.com>
(cherry picked from https://android-review.googlesource.com/q/commit:9f8f2ea03ede21d8928793c4be87eeb76d81bc7f)
Merged-In: Ic0ea662a60919454060e3a085aeabd8a4099e0b4
Change-Id: Ic0ea662a60919454060e3a085aeabd8a4099e0b4
2023-05-19 06:56:57 +00:00
Mark Brown
d3197e212f UPSTREAM: regmap: Don't warn about cache only mode for devices with no cache
For devices with no cache it can make sense to use cache only mode as a
mechanism for trapping writes to hardware which is inaccessible but since
no cache is equivalent to cache bypass we force such devices into bypass
mode. This means that our check that bypass and cache only mode aren't both
enabled simultanously is less sensible for devices without a cache so relax
it.

Signed-off-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20220622171723.1235749-1-broonie@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>

Bug: 274730214
Change-Id: I85f9ba5343f28b24c2b0588e8a1487d31b654283
(cherry picked from commit 3d0afe9cf1)
Signed-off-by: Chunyan Zhang <chunyan.zhang@unisoc.com>
(cherry picked from commit b099f1eb0b330487fcc77e8a991919608fd07189)
2023-05-18 22:41:13 +00:00
Chris Lu
f0371f5dad ANDROID: Update the ABI symbol list
Adding the following symbols:
  - thermal_zone_get_zone_by_name

Bug: 269389888
Change-Id: I5f06af2b802f36369f2392320a7fe17e16fc406c
Signed-off-by: Chris Lu <luchris@google.com>
2023-05-18 21:54:18 +00:00
Theodore Ts'o
aa0deedfe1 UPSTREAM: ext4: fix invalid free tracking in ext4_xattr_move_to_block()
commit b87c7cdf2b upstream.

In ext4_xattr_move_to_block(), the value of the extended attribute
which we need to move to an external block may be allocated by
kvmalloc() if the value is stored in an external inode.  So at the end
of the function the code tried to check if this was the case by
testing entry->e_value_inum.

However, at this point, the pointer to the xattr entry is no longer
valid, because it was removed from the original location where it had
been stored.  So we could end up calling kvfree() on a pointer which
was not allocated by kvmalloc(); or we could also potentially leak
memory by not freeing the buffer when it should be freed.  Fix this by
storing whether it should be freed in a separate variable.

Cc: stable@kernel.org
Link: https://lore.kernel.org/r/20230430160426.581366-1-tytso@mit.edu
Link: https://syzkaller.appspot.com/bug?id=5c2aee8256e30b55ccf57312c16d88417adbd5e1
Link: https://syzkaller.appspot.com/bug?id=41a6b5d4917c0412eb3b3c3c604965bed7d7420b
Reported-by: syzbot+64b645917ce07d89bde5@syzkaller.appspotmail.com
Reported-by: syzbot+0d042627c4f2ad332195@syzkaller.appspotmail.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Bug: 281332515
Bug: 281333738
Change-Id: Id1fbcc337821d66df53c2826bf3158963f8b0673
Signed-off-by: Tudor Ambarus <tudor.ambarus@linaro.org>
2023-05-18 21:47:21 +00:00
wang qiankun
fb96bf701a ANDROID: GKI: add ABI symbol list for xiaomi
INFO: ABI DIFFERENCES HAVE BEEN DETECTED!
INFO: 19 function symbol(s) added
  'int __traceiter_android_rvh_after_dequeue_task(void*, struct rq*, struct task_struct*, int)'
  'int __traceiter_android_rvh_after_enqueue_task(void*, struct rq*, struct task_struct*, int)'
  'int __traceiter_android_rvh_cpuset_fork(void*, struct task_struct*, bool*)'
  'int __traceiter_android_rvh_entity_tick(void*, struct cfs_rq*, struct sched_entity*)'
  'int __traceiter_android_rvh_refrigerator(void*, bool)'
  'int __traceiter_android_rvh_set_cpus_allowed_comm(void*, struct task_struct*, const struct cpumask*)'
  'int __traceiter_android_vh_binder_alloc_new_buf_locked(void*, size_t, size_t*, int)'
  'int __traceiter_android_vh_binder_reply(void*, struct binder_proc*, struct binder_proc*, struct binder_thread*, str
uct binder_transaction_data*)'
  'int __traceiter_android_vh_binder_trans(void*, struct binder_proc*, struct binder_proc*, struct binder_thread*, str
uct binder_transaction_data*)'
  'int __traceiter_android_vh_freq_qos_add_request(void*, struct freq_constraints*, struct freq_qos_request*, enum fre
q_qos_req_type, int, int)'
  'int __traceiter_android_vh_freq_qos_remove_request(void*, struct freq_qos_request*)'
  'int __traceiter_android_vh_freq_qos_update_request(void*, struct freq_qos_request*, int)'
  'int __traceiter_android_vh_map_util_freq(void*, unsigned long, unsigned long, unsigned long, unsigned long*)'
  'int __traceiter_android_vh_rwsem_read_wait_start(void*, struct rw_semaphore*)'
  'int __traceiter_android_vh_rwsem_write_wait_start(void*, struct rw_semaphore*)'
  'int __traceiter_android_vh_sched_setaffinity_early(void*, struct task_struct*, const struct cpumask*, bool*)'
  'void cpuset_cpus_allowed(struct task_struct*, struct cpumask*)'
  'struct user_struct* find_user(kuid_t)'
  'void free_uid(struct user_struct*)'

17 variable symbol(s) added
  'struct tracepoint __tracepoint_android_rvh_after_dequeue_task'
  'struct tracepoint __tracepoint_android_rvh_after_enqueue_task'
  'struct tracepoint __tracepoint_android_rvh_cpuset_fork'
  'struct tracepoint __tracepoint_android_rvh_entity_tick'
  'struct tracepoint __tracepoint_android_rvh_refrigerator'
  'struct tracepoint __tracepoint_android_rvh_set_cpus_allowed_comm'
  'struct tracepoint __tracepoint_android_vh_binder_alloc_new_buf_locked'
  'struct tracepoint __tracepoint_android_vh_binder_reply'
  'struct tracepoint __tracepoint_android_vh_binder_trans'
  'struct tracepoint __tracepoint_android_vh_freq_qos_add_request'
  'struct tracepoint __tracepoint_android_vh_freq_qos_remove_request'
  'struct tracepoint __tracepoint_android_vh_freq_qos_update_request'
  'struct tracepoint __tracepoint_android_vh_map_util_freq'
  'struct tracepoint __tracepoint_android_vh_rwsem_read_wait_start'
  'struct tracepoint __tracepoint_android_vh_rwsem_write_wait_start'
  'struct tracepoint __tracepoint_android_vh_sched_setaffinity_early'
  'struct cgroup_subsys freezer_cgrp_subsys'

function symbol 'struct block_device* I_BDEV(struct inode*)' changed
  CRC changed from 0x5b8d1e5 to 0x5c732fed

function symbol 'void* PDE_DATA(const struct inode*)' changed
  CRC changed from 0x3c36f860 to 0x782fda7f

function symbol 'void __ClearPageMovable(struct page*)' changed
  CRC changed from 0x12b3b0b6 to 0xdf0d01db

... 3467 omitted; 3470 symbols have only CRC changes

type 'struct user_struct' changed
  byte size changed from 152 to 168
  member 'u64 android_oem_data1[2]' was added

Bug: 283222331

Change-Id: Iaefe36e430f2829fbc26e26cf93f621fd49e9b24
Signed-off-by: wang qiankun <wangqiankun3@xiaomi.com>
2023-05-18 17:58:04 +00:00
lijianzhong
0f5abf2375 ANDROID: sched: Add ANDROID_OEM_DATA_ARRAY in user_struct.
Add ANDROID_OEM_DATA_ARRAY to the struct user so that we can record the necessary data to implement the OEM's scheduling policy.

Bug: 183674818
Bug: 283222331

Signed-off-by: lijianzhong <lijianzhong@xiaomi.com>
Change-Id: I418293391bc62a68207eae51a79bd45a7f6cd2ed
(cherry picked from commit 77e791866b)
2023-05-18 13:30:37 +00:00
heshuai1
ca57d52a21 ANDROID: user: Add vendor hook to user for GKI purpose
In order to implement our scheduling tuning policy in certain cases, we need to initialize the variables that we have defined in the user_struct. To achieve this, we will add a vendor hook to user.c at alloc_uid, which will ensure that our own logic is executed during the initialization of the user_struct.

Bug: 187458531
Bug: 283222331

Signed-off-by: heshuai1 <heshuai1@xiaomi.com>
Change-Id: I078484aac2c3d396aba5971d6d0f491652f3781c
(cherry picked from commit c9b8fa644f)
(cherry picked from commit 9ac0923ef565e4de4e1f35edcba6fcb7e45948c9)
2023-05-18 13:30:37 +00:00
lijianzhong
dc3f95c564 ANDROID: export find_user() & free_uid()for GKI purpose.
Exporting the symbols find_user() & free_uid() to access user task information in ko module for monitoring and optimization purposes. This is a necessary component of our scheduling policy.

Bug: 183674818
Bug: 283222331

Signed-off-by: lijianzhong <lijianzhong@xiaomi.com>
Change-Id: I12135c0af312904dd21b6f074beda086ad5ece98
(cherry picked from commit 16350016d8)
(cherry picked from commit eec2cd3df3aa2d92136658d3619dc5142155c7d4)
2023-05-18 13:30:37 +00:00
lijianzhong
555f3fe563 ANDROID: sched: Add vendor hooks for cpu affinity.
Add vendor hooks for CPU affinity to support OEM's tuning policy, where
we can block or unblock a certain type of application's CPU affinity.

Bug: 183674818
Bug: 283222331

Signed-off-by: lijianzhong <lijianzhong@xiaomi.com>
Change-Id: I3402abec4d9faa08f564409bfb8db8d7902f3aa2
(cherry picked from commit 7cf9646c245fdc63e2a3c9fad457c11fabdd2dfc)
2023-05-18 13:30:37 +00:00
lijianzhong
53a5908faa ANDROID: cgroup: Add vendor hook for cpuset.
This hook allows us to capture information when a process is forked so
that we can stat and set some key task's CPU affinity in the ko module
later. This patch, along with aosp/2565450, is necessary for our
affinity settings.

Bug: 183674818
Bug: 283222331

Signed-off-by: lijianzhong <lijianzhong@xiaomi.com>
Change-Id: Ib93e05e5f6c338c5f7ada56bfebdd705f87f1f66
(cherry picked from commit a188361628461c58a4dfc72869d9acb1dfa2542f)
(cherry picked from commit 8947e06ff7)
2023-05-18 13:30:37 +00:00
lijianzhong
7d9c8f70d7 ANDROID: export cpuset_cpus_allowed()for GKI purpose.
Exporting the symbol cpuset_cpus_allowed() so that we can adjust a
certain type of application's CPU affinity in vendor hooks according
to our tuning policy.
Related commit: aosp/2565450

Bug: 189725786
Bug: 283222331

Signed-off-by: lijianzhong <lijianzhong@xiaomi.com>
Change-Id: I7919a893ab64bb441ab43cbb0b16825ed76d802d
(cherry picked from commit 5a7d01ed73e4fc812fda1d7288086dc73a283405)
2023-05-18 13:30:37 +00:00
Zhuguangqing
1174e45a7d ANDROID: Add vendor hooks for binder perf tuning
Add some hooks in the binder module so that we can do task dependency analysis and statistical work in OEM's module for further optimization.

Bug: 235925535
Bug: 283222331

Signed-off-by: Zhuguangqing <zhuguangqing@xiaomi.com>
Change-Id: Id47e59c4e3ccd07b26eef758ada147b98cd1964e
Signed-off-by: heshuai1 <heshuai1@xiaomi.com>
Signed-off-by: Carlos Llamas <cmllamas@google.com>
[ cmllamas: don't export complete private definition struct binder_alloc
  in vendor hooks, instead just pass member alloc->free_async_space as
  implemented by heshuai1 and squashed here ]
(cherry picked from commit 254fb1f4034fde523378ee58a501d212a59047b7)
2023-05-18 13:30:37 +00:00
heshuai1
e47455c5dd ANDROID: freezer: Add vendor hook to freezer for GKI purpose.
Add the vendor hook to freezer.c so that OEM's logic can be executed
when the process is about to be frozen. We need to clear the flag for
some tasks and rebind task dependencies for optimization purposes.

Bug: 187458531
Bug: 283222331

Signed-off-by: heshuai1 <heshuai1@xiaomi.com>
Change-Id: Iea42fd9604d6b33ccd6502425416f0dd28eecebb
(cherry picked from commit a1580311c3)
2023-05-18 13:30:37 +00:00
Zhuguangqing
4219a3afd4 ANDROID: freezer: export the freezer_cgrp_subsys for GKI purpose.
Exporting the symbol freezer_cgrp_subsys, in that vendor module can
add can_attach & cancel_attach member function. It is vendor-specific
tuning.

Bug: 182496370
Bug: 283222331

Signed-off-by: Zhuguangqing <zhuguangqing@xiaomi.com>
Change-Id: I153682b9d1015eed3f048b45ea6495ebb8f3c261
(cherry picked from commit 8a90e4d4e555dd5484213c6fec5061958016a194)
2023-05-18 13:30:37 +00:00
heshuai1
2d3899353a ANDROID: power: Add vendor hook to qos for GKI purpose.
Add vendor hooks in add/update/remove frequency QoS request process to
ensure that we can access the OEM's "frequency watchdog" logic for
abnormal frequency monitoring. This is necessary for our power tuning
policy.

Bug: 187458531
Bug: 283222331

Signed-off-by: heshuai1 <heshuai1@xiaomi.com>
Change-Id: I1fb8fd6134432ecfb44ad242c66ccd8280ab9b43
(cherry picked from commit c445fe4dc67ad74dacfa548bc78876a7ce057086)
(cherry picked from commit 0ea0d6a7a2)
2023-05-18 13:30:37 +00:00
Quentin Perret
7590636e68 ANDROID: arm64: Check FGT cap before touching HFGWTR_EL2
Writing to HFGWTR_EL2 is undefined on CPUs without the capability,
so make sure not to touch the register when that is the case.

Bug: 282917063
Bug: 282993310
Change-Id: I85211105d6b1fbee854b4f13f037b8573c5a211c
Signed-off-by: Quentin Perret <qperret@google.com>
2023-05-18 09:10:19 +00:00
Quentin Perret
71b068b4bb Revert "ANDROID: Partially Revert "ANDROID: KVM: arm64: Allow tweaking HFGWTR_EL2 from modules""
This reverts commit 6cf9fb4579. It was a
temporary workaround which will be replaced a proper fix shortly.

Bug: 282917063
Bug: 282993310
Change-Id: I0caec4a63aabaecbf3fa7ec5d5b4c6930ea6efcd
Signed-off-by: Quentin Perret <qperret@google.com>
2023-05-18 09:10:19 +00:00
Jaegeuk Kim
42f3bd5050 FROMGIT: f2fs: fix the wrong condition to determine atomic context
Should use !in_task for irq context.

Bug: 281085599
Cc: stable@vger.kernel.org
Fixes: 1aa161e431 ("f2fs: fix scheduling while atomic in decompression path")
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
(cherry picked from commit f063fa43995667dbdf5b46406774a0ad58310dae
 https://git://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs.git dev)
Change-Id: I5ce9286cc380309ee5e294f54ec357a4bfa47d6f
2023-05-17 19:17:33 -07:00
Giuliano Procida
2afee88822 ANDROID: GKI: refresh STG ABI to new version
prebuilts/kernel-build-tools/linux-x86/bin/stg \
  --stg common/android/abi_gki_aarch64.stg \
  --output common/android/abi_gki_aarch64.stg

Bug: 274744378
Change-Id: Id62cb08cdb66474a54dc249d1634e08563232fca
Signed-off-by: Giuliano Procida <gprocida@google.com>
2023-05-17 10:43:46 +00:00
xieliujie
bea77f23e7 ANDROID: ABI: Update oplus symbol list
1 function symbol(s) added
  'int __traceiter_task_rename(void*, struct task_struct*, const char*)'

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

Bug: 193384408
Change-Id: Id308aa1182ee597754ce78e0587a02b6820c8f39
Signed-off-by: xieliujie <xieliujie@oppo.com>
2023-05-17 10:10:35 +00:00
Liujie Xie
2b153a2359 ANDROID: vendor_hooks: Export the tracepoints task_rename
Export the tracepoint task_rename to identify specific new task,
to customize task's util for power and performance, or optimize
task schedule parameters.

Bug: 189985971

Change-Id: I3bb71eae316e3096d361e7b47012ba46ea4be509
Signed-off-by: Liujie Xie <xieliujie@oppo.com>
(cherry picked from commit 016d3f7b69)
(cherry picked from commit cfc14a391adb4d44d8186694b4884815bd85be6c)
2023-05-17 10:10:35 +00:00
Pierre-Louis Bossart
c0fd3ab764 UPSTREAM: ASoC: soc-pcm: fix BE handling of PAUSE_RELEASE
[ Upstream commit 3aa1e96a2b ]

A BE connected to more than one FE, e.g. in a mixer case, can go
through the following transitions.

play FE1    -> BE state is START
pause FE1   -> BE state is PAUSED
play FE2    -> BE state is START
stop FE2    -> BE state is STOP (see note [1] below)
release FE1 -> BE state is START
stop FE1    -> BE state is STOP

play FE1    -> BE state is START
pause FE1   -> BE state is PAUSED
play FE2    -> BE state is START
release FE1 -> BE state is START
stop FE2    -> BE state is START
stop FE1    -> BE state is STOP

play FE1    -> BE state is START
play FE2    -> BE state is START (no change)
pause FE1   -> BE state is START (no change)
pause FE2   -> BE state is PAUSED
release FE1 -> BE state is START
release FE2 -> BE state is START (no change)
stop FE1    -> BE state is START (no change)
stop FE2    -> BE state is STOP

The existing code for PAUSE_RELEASE only allows for the case where the
BE is paused, which clearly would not work in the sequences above.

Extend the allowed states to restart the BE when PAUSE_RELEASE is
received, and increase the refcount if the BE is already in START.

[1] the existing logic does not move the BE state back to PAUSED when
the FE2 is stopped. This patch does not change the logic; it would be
painful to keep a history of changes on the FE side, the state machine
is already rather complicated with transitions based on the last BE
state and the trigger type.

Reported-by: Bard Liao <bard.liao@intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20211207173745.15850-7-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Fixes: aa9ff6a495 ("ASoC: soc-compress: Reposition and add pcm_mutex")
Signed-off-by: Yixuan Jiang <yixuanjiang@google.com>
Cc: stable@vger.kernel.org # 5.15+

Bug: 277241308
Link: https://lore.kernel.org/all/20230511120841.2096524-7-yixuanjiang@google.com
Change-Id: I2b5af9448df27082b75365c45357235d2887f33c
Signed-off-by: Yixuan Jiang <yixuanjiang@google.com>
2023-05-17 10:08:04 +00:00
Pierre-Louis Bossart
b944772c3c UPSTREAM: ASoC: soc-pcm: test refcount before triggering
[ Upstream commit 848aedfdc6 ]

On start/pause_release/resume, when more than one FE is connected to
the same BE, it's possible that the trigger is sent more than
once. This is not desirable, we only want to trigger a BE once, which
is straightforward to implement with a refcount.

For stop/pause/suspend, the problem is more complicated: the check
implemented in snd_soc_dpcm_can_be_free_stop() may fail due to a
conceptual deadlock when we trigger the BE before the FE. In this
case, the FE states have not yet changed, so there are corner cases
where the TRIGGER_STOP is never sent - the dual case of start where
multiple triggers might be sent.

This patch suggests an unconditional trigger in all cases, without
checking the FE states, using a refcount protected by the BE PCM
stream lock.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20211207173745.15850-6-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Fixes: aa9ff6a495 ("ASoC: soc-compress: Reposition and add pcm_mutex")
Signed-off-by: Yixuan Jiang <yixuanjiang@google.com>
Cc: stable@vger.kernel.org # 5.15+

Bug: 277241308
Link: https://lore.kernel.org/all/20230511120841.2096524-6-yixuanjiang@google.com
Change-Id: I294e1f1b55cb1819e0510bff67db41b01c809210
Signed-off-by: Yixuan Jiang <yixuanjiang@google.com>
2023-05-17 10:08:04 +00:00
Takashi Iwai
9702a90b36 UPSTREAM: ASoC: soc-pcm: serialize BE triggers
[ Upstream commit b2ae806630 ]

When more than one FE is connected to a BE, e.g. in a mixing use case,
the BE can be triggered multiple times when the FE are opened/started
concurrently. This race condition is problematic in the case of
SoundWire BE dailinks, and this is not desirable in a general
case.

This patch relies on the existing BE PCM lock, which takes atomicity into
account. The locking model assumes that all interactions start with
the FE, so that there is no deadlock between FE and BE locks.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
[test, checkpatch fix and clarification of commit message by plbossart]
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20211207173745.15850-5-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Fixes: aa9ff6a495 ("ASoC: soc-compress: Reposition and add pcm_mutex")
Signed-off-by: Yixuan Jiang <yixuanjiang@google.com>
Cc: stable@vger.kernel.org # 5.15+

Bug: 277241308
Link: https://lore.kernel.org/all/20230511120841.2096524-5-yixuanjiang@google.com
Change-Id: I8581d910436c9e8f93ee8ef2d0c19d3e2d23dc09
Signed-off-by: Yixuan Jiang <yixuanjiang@google.com>
2023-05-17 10:08:04 +00:00
Takashi Iwai
ec8eab1e7c UPSTREAM: ASoC: soc-pcm: Fix and cleanup DPCM locking
[ Upstream commit b7898396f4 ]

The existing locking for DPCM has several issues
a) a confusing mix of card->mutex and card->pcm_mutex.
b) a dpcm_lock spinlock added inconsistently and on paths that could
be recursively taken. The use of irqsave/irqrestore was also overkill.

The suggested model is:

1) The pcm_mutex is the top-most protection of BE links in the FE. The
pcm_mutex is applied always on either the top PCM callbacks or the
external call from DAPM, not taken in the internal functions.

2) the FE stream lock is taken in higher levels before invoking
dpcm_be_dai_trigger()

3) when adding and deleting a BE, both the pcm_mutex and FE stream
lock are taken.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
[clarification of commit message by plbossart]
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20211207173745.15850-4-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Fixes: aa9ff6a495 ("ASoC: soc-compress: Reposition and add pcm_mutex")
Signed-off-by: Yixuan Jiang <yixuanjiang@google.com>
Cc: stable@vger.kernel.org # 5.15+

Bug: 277241308
Link: https://lore.kernel.org/all/20230511120841.2096524-4-yixuanjiang@google.com
Change-Id: Iae88cee86073874889591ea0619609d6d4103645
Signed-off-by: Yixuan Jiang <yixuanjiang@google.com>
2023-05-17 10:08:04 +00:00
Pierre-Louis Bossart
06e574fc9a UPSTREAM: ASoC: soc-pcm: align BE 'atomicity' with that of the FE
[ Upstream commit bbf7d3b1c4 ]

Since the flow for DPCM is based on taking a lock for the FE first, we
need to make sure during the connection between a BE and an FE that
they both use the same 'atomicity', otherwise we may sleep in atomic
context.

If the FE is nonatomic, this patch forces the BE to be nonatomic as
well. That should have no negative impact since the BE 'inherits' the
FE properties.

However, if the FE is atomic and the BE is not, then the configuration
is flagged as invalid.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
[ removed FE stream lock by tiwai ]
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20211207173745.15850-3-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Fixes: aa9ff6a495 ("ASoC: soc-compress: Reposition and add pcm_mutex")
Signed-off-by: Yixuan Jiang <yixuanjiang@google.com>
Cc: stable@vger.kernel.org # 5.15+

Bug: 277241308
Link: https://lore.kernel.org/all/20230511120841.2096524-3-yixuanjiang@google.com
Change-Id: I91c5894d2a22b86c2d8af2d19d9f4364210abd36
Signed-off-by: Yixuan Jiang <yixuanjiang@google.com>
2023-05-17 10:08:04 +00:00
Pierre-Louis Bossart
13344864f0 UPSTREAM: ASoC: soc-pcm: use GFP_ATOMIC for dpcm structure
[ Upstream commit d8a9c6e1f6 ]

We allocate a structure in dpcm_be_connect(), which may be called in
atomic context. Using GFP_KERNEL is not quite right, we have to use
GFP_ATOMIC to prevent the allocator from sleeping.

Suggested-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20211207173745.15850-2-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Fixes: aa9ff6a495 ("ASoC: soc-compress: Reposition and add pcm_mutex")
Signed-off-by: Yixuan Jiang <yixuanjiang@google.com>
Cc: stable@vger.kernel.org # 5.15+

Bug: 277241308
Link: https://lore.kernel.org/all/20230511120841.2096524-2-yixuanjiang@google.com
Change-Id: Id20dc271a73e1fc40d95bc39c367f9476b72c6f9
Signed-off-by: Yixuan Jiang <yixuanjiang@google.com>
2023-05-17 10:08:04 +00:00
Will McVicker
6cf9fb4579 ANDROID: Partially Revert "ANDROID: KVM: arm64: Allow tweaking HFGWTR_EL2 from modules"
This is a partial revert of commit 085255b984 in order to fix booting
this kernel on devices that don't support FEAT_FGT due to direct
accesses of HFGWTR_EL2 being UNDEFINED. We are retaining the KMI part of
the commit until the next KMI breakage window.

Bug: 282917063
Change-Id: I6c156ef40a5584dc41e4d9d09c80736e30348802
Signed-off-by: Will McVicker <willmcvicker@google.com>
2023-05-17 06:53:32 +00:00
Ray Chi
278999b347 UPSTREAM: usb: core: stop USB enumeration if too many retries
When a broken USB accessory connects to a USB host, usbcore might
keep doing enumeration retries. If the host has a watchdog mechanism,
the kernel panic will happen on the host.

This patch provides an attribute early_stop to limit the numbers of retries
for each port of a hub. If a port was marked with early_stop attribute,
unsuccessful connection attempts will fail quickly. In addition, if an
early_stop port has failed to initialize, it will ignore all future
connection events until early_stop attribute is clear.

Signed-off-by: Ray Chi <raychi@google.com>
Reviewed-by: Alan Stern <stern@rowland.harvard.edu>
Link: https://lore.kernel.org/r/20221107072754.3336357-1-raychi@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Bug: 282876796
Change-Id: I48eff1dbbc341ef893c8abc20953b7e9a62244da
(cherry picked from commit 430d57f53e)
Signed-off-by: Ray Chi <raychi@google.com>
2023-05-17 02:17:35 +00:00
Wanwei Jiang
d42d7aa8eb ANDROID: GKI: Update symbol list for Amlogic
1 function symbol(s) added
  'int __traceiter_android_vh_ftrace_format_check(void*, bool*)'

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

Bug: 282937935
Change-Id: I01faf716cef7ab9663d0a82d7da2e3b8bad029bf
Signed-off-by: Wanwei Jiang <wanwei.jiang@amlogic.com>
2023-05-17 00:37:07 +08:00
Edmond Chung
0e234fce30 ANDROID: Update the ABI symbol list
Adding the following symbols:
  - dma_buf_set_name

Bug: 258524438
Change-Id: I430eb773f216a0844864a3eb1393efe5a44651bd
Signed-off-by: Edmond Chung <edmondchung@google.com>
2023-05-16 15:12:15 +00:00