Commit Graph

991964 Commits

Author SHA1 Message Date
Michael Grzeschik
d53fb78733 UPSTREAM: usb: dwc3: gadget: conditionally remove requests
The functions stop_active_transfers and ep_disable are both calling
remove_requests. This functions in both cases will giveback the requests
with status ESHUTDOWN, which also represents an physical disconnection.
For ep_disable this is not true. This patch adds the status parameter to
remove_requests and sets the status to ECONNRESET on ep_disable.

Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
Link: https://lore.kernel.org/r/20220720213523.1055897-1-m.grzeschik@pengutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

(cherry picked from commit b44c0e7fef)

Bug: 263189538
Change-Id: I1bd7a42e6f2f99a0ce021ef3c94dc630ae9260df
Signed-off-by: Krishna Kurapati <quic_kriskura@quicinc.com>
2023-01-18 23:47:19 +00:00
Wesley Cheng
75a4f0b5e1 UPSTREAM: usb: dwc3: ep0: Properly handle setup_packet_pending scenario in data stage
During a 3 stage SETUP transfer, if the host sends another SETUP token
before completing the status phase, it signifies that the host has aborted
the current control transfer.  Currently, if a setup_packet_pending is
received, there are no subsequent calls to dwc3_ep0_out_start() to fetch
the new SETUP packet.  This leads to a stall on EP0, as host does not
expect another STATUS phase as it has aborted the current transfer.

Fix this issue by explicitly stalling and restarting EP0, as well as
resetting the trb_enqueue indexes.  (without this, there is a chance the
SETUP TRB is set up on trb_endqueue == 1)

Signed-off-by: Wesley Cheng <quic_wcheng@quicinc.com>
Link: https://lore.kernel.org/r/20220712014403.2977-1-quic_wcheng@quicinc.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

(cherry picked from commit 5e76ee96be)

Bug: 263189538
Change-Id: Ia0cc555ca8cd94048308406d975b3b4f4aa6ca54
Signed-off-by: Krishna Kurapati <quic_kriskura@quicinc.com>
2023-01-18 23:47:19 +00:00
Wesley Cheng
767a360826 UPSTREAM: usb: dwc3: gadget: Fix IN endpoint max packet size allocation
The current logic to assign the max packet limit for IN endpoints attempts
to take the default HW value and apply the optimal endpoint settings based
on it.  However, if the default value reports a TxFIFO size large enough
for only one max packet, it will divide the value and assign a smaller ep
max packet limit.

For example, if the default TxFIFO size fits 1024B, current logic will
assign 1024/3 = 341B to ep max packet size.  If function drivers attempt to
request for an endpoint with a wMaxPacketSize of 1024B (SS BULK max packet
size) then it will fail, as the gadget is unable to find an endpoint which
can fit the requested size.

Functionally, if the TxFIFO has enough space to fit one max packet, it will
be sufficient, at least when initializing the endpoints.

Fixes: d94ea53198 ("usb: dwc3: gadget: Properly set maxpacket limit")
Cc: stable <stable@kernel.org>
Signed-off-by: Wesley Cheng <quic_wcheng@quicinc.com>
Link: https://lore.kernel.org/r/20220523213948.22142-1-quic_wcheng@quicinc.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

(cherry picked from commit 9c1e916960)

Bug: 263189538
Change-Id: I56995b3d5bbfa8dc61a0e4084d6109d90951244d
Signed-off-by: Krishna Kurapati <quic_kriskura@quicinc.com>
2023-01-18 23:47:19 +00:00
Thinh Nguyen
7b90f7b05e UPSTREAM: usb: dwc3: gadget: Delay issuing End Transfer
If the controller hasn't DMA'ed the Setup data from its fifo, it won't
process the End Transfer command. Polling for the command completion may
block the driver from servicing the Setup phase and cause a timeout.
Previously we only check and delay issuing End Transfer in the case of
endpoint dequeue. Let's do that for all End Transfer scenarios.

Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Link: https://lore.kernel.org/r/2fcf3b5d90068d549589a57a27a79f76c6769b04.1650593829.git.Thinh.Nguyen@synopsys.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

(cherry picked from commit f66eef8fb8)

Bug: 263189538
Change-Id: I58dc40ff7defdd03f52da900ee0b179ffe55d2cc
Signed-off-by: Krishna Kurapati <quic_kriskura@quicinc.com>
2023-01-18 23:47:19 +00:00
Thinh Nguyen
4678fabb6e UPSTREAM: usb: dwc3: gadget: Only End Transfer for ep0 data phase
The driver shouldn't be able to issue End Transfer to the control
endpoint at anytime. Typically we should only do so in error cases such
as invalid/unexpected direction of Data Phase as described in the
control transfer flow of the programming guide. It _may_ end started
data phase during controller deinitialization from soft disconnect or
driver removal. However, that should not happen because the driver
should be maintained in EP0_SETUP_PHASE during driver tear-down. On
soft-connect, the controller should be reset from a soft-reset and there
should be no issue starting the control endpoint.

Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Link: https://lore.kernel.org/r/3c6643678863a26702e4115e9e19d7d94a30d49c.1650593829.git.Thinh.Nguyen@synopsys.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

(cherry picked from commit ace17b6ee4)

Bug: 263189538
Change-Id: Ifd58ee4b1f213db72d6bcc7137c96ee2a399e21c
Signed-off-by: Krishna Kurapati <quic_kriskura@quicinc.com>
2023-01-18 23:47:19 +00:00
Krishna Kurapati
a79e848e52 UPSTREAM: usb: dwc3: ep0: Don't prepare beyond Setup stage
Since we can't guarantee that the host won't send new Setup packet
before going through the device-initiated disconnect, don't prepare
beyond the Setup stage and keep the device in EP0_SETUP_PHASE. This
ensures that the device-initated disconnect sequence can go through
gracefully. Note that the controller won't service the End Transfer
command if it can't DMA out the Setup packet.

Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Link: https://lore.kernel.org/r/6bacec56ecabb2c6e49a09cedfcac281fdc97de0.16505938
29.git.Thinh.Nguyen@synopsys.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

(cherry picked from commit c96683798e)

Bug: 263189538
Change-Id: Ice2d6837acebd312e732527504f4013f33a8fe6d
Signed-off-by: Krishna Kurapati <quic_kriskura@quicinc.com>
2023-01-18 23:47:19 +00:00
Krishna Kurapati
802b4745f7 UPSTREAM: usb: dwc3: gadget: move cmd_endtransfer to extra function
This patch adds the extra function __dwc3_stop_active_transfer to
consolidate the same codepath.

Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
Link: https://lore.kernel.org/r/20220306211251.2281335-3-m.grzeschik@pengutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

(cherry picked from commit e192cc7b52)

Bug: 263189538
Change-Id: Icbc4c63e380e2a88973e739b5513528cc5dbde66
Signed-off-by: Krishna Kurapati <quic_kriskura@quicinc.com>
2023-01-18 23:47:19 +00:00
Michael Grzeschik
33b5613a43 UPSTREAM: usb: dwc3: gadget: ep_queue simplify isoc start condition
To improve reading the code this patch moves the cases to start_isoc or
return the function under one common condition check.

Reviewed-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
Link: https://lore.kernel.org/r/20220306211251.2281335-2-m.grzeschik@pengutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

(cherry picked from commit 26d27a1080)

Bug: 263189538
Change-Id: I60ada6edcc6f1a505f2a3d86fc4a6d8b7d22f089
Signed-off-by: Krishna Kurapati <quic_kriskura@quicinc.com>
2023-01-18 23:47:19 +00:00
Thinh Nguyen
d099b9a70e UPSTREAM: usb: dwc3: gadget: Skip reading GEVNTSIZn
The driver knows what it needs to set for GEVNTSIZn, and the controller
doesn't modify this register unless there's a hard reset. To save a few
microseconds of register read in read-modify-write operation, simply do
register write with the expected values. This can improve performance
when there are many interrupts generated, which the driver needs to
check and handle.

Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Link: https://lore.kernel.org/r/efddf4ee5821c4bc5ae7ad90d629ec7a0ebcbf9a.1638240306.git.Thinh.Nguyen@synopsys.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

(cherry picked from commit 76c4c95dac)

Bug: 263189538
Change-Id: I7dec7b568f12b1529ab1e52a600056be98910f02
Signed-off-by: Krishna Kurapati <quic_kriskura@quicinc.com>
2023-01-18 23:47:19 +00:00
Thinh Nguyen
15b61c98d6 UPSTREAM: usb: dwc3: gadget: Ignore Update Transfer cmd params
The controller doesn't check for Update Transfer command parameters
DEPCMDPAR{0,1,2}. Writing to these registers is unnecessary. Ignoring
this improves performance slightly by removing the register write
delay.

Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Link: https://lore.kernel.org/r/997d9ebf38c6bba920d4ee77bd8c77bf81978a55.1638240306.git.Thinh.Nguyen@synopsys.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

(cherry picked from commit a02a26eb0a)

Bug: 263189538
Change-Id: Ie30380e71dfd7febb71eb0c3c725f336f4d6da9a
Signed-off-by: Krishna Kurapati <quic_kriskura@quicinc.com>
2023-01-18 23:47:19 +00:00
Thinh Nguyen
0761373d2f UPSTREAM: usb: dwc3: gadget: Skip checking Update Transfer status
If we're not setting CMDACT (from "No Response" Update Transfer
command), then there's no point in checking for the command status. So
skip it. This can reduce a register read delay and improve performance.

Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Link: https://lore.kernel.org/r/3dc31cf11581ae3ee82d9202dda3fc17d897d786.1638240306.git.Thinh.Nguyen@synopsys.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

(cherry picked from commit bc27117c7c)

Bug: 263189538
Change-Id: Ia06408ffeeb561683662f00938bd9ab2f866eb89
Signed-off-by: Krishna Kurapati <quic_kriskura@quicinc.com>
2023-01-18 23:47:19 +00:00
Luca Stefani
7d1d982f57 UPSTREAM: pstore: Properly assign mem_type property
If mem-type is specified in the device tree
it would end up overriding the record_size
field instead of populating mem_type.

As record_size is currently parsed after the
improper assignment with default size 0 it
continued to work as expected regardless of the
value found in the device tree.

Simply changing the target field of the struct
is enough to get mem-type working as expected.

Fixes: 9d843e8faf ("pstore: Add mem_type property DT parsing support")
Cc: stable@vger.kernel.org
Signed-off-by: Luca Stefani <luca@osomprivacy.com>
Signed-off-by: Kees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/20221222131049.286288-1-luca@osomprivacy.com

Fixes: 1c4893edfe ("FROMGIT: pstore: Add mem_type property DT parsing support")
Change-Id: Iea62cd7b26effc158500f097474d4df316285ac4
(cherry picked from commit beca3e311a )
Signed-off-by: Luca Stefani <luca@osomprivacy.com>
2023-01-15 12:14:49 +01:00
Ye Bin
c83ab50b6e BACKPORT: ext4: fix use-after-free in ext4_rename_dir_prepare
commit 0be698ecbe upstream.

We got issue as follows:
EXT4-fs (loop0): mounted filesystem without journal. Opts: ,errors=continue
ext4_get_first_dir_block: bh->b_data=0xffff88810bee6000 len=34478
ext4_get_first_dir_block: *parent_de=0xffff88810beee6ae bh->b_data=0xffff88810bee6000
ext4_rename_dir_prepare: [1] parent_de=0xffff88810beee6ae
==================================================================
BUG: KASAN: use-after-free in ext4_rename_dir_prepare+0x152/0x220
Read of size 4 at addr ffff88810beee6ae by task rep/1895

CPU: 13 PID: 1895 Comm: rep Not tainted 5.10.0+ #241
Call Trace:
 dump_stack+0xbe/0xf9
 print_address_description.constprop.0+0x1e/0x220
 kasan_report.cold+0x37/0x7f
 ext4_rename_dir_prepare+0x152/0x220
 ext4_rename+0xf44/0x1ad0
 ext4_rename2+0x11c/0x170
 vfs_rename+0xa84/0x1440
 do_renameat2+0x683/0x8f0
 __x64_sys_renameat+0x53/0x60
 do_syscall_64+0x33/0x40
 entry_SYSCALL_64_after_hwframe+0x44/0xa9
RIP: 0033:0x7f45a6fc41c9
RSP: 002b:00007ffc5a470218 EFLAGS: 00000246 ORIG_RAX: 0000000000000108
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f45a6fc41c9
RDX: 0000000000000005 RSI: 0000000020000180 RDI: 0000000000000005
RBP: 00007ffc5a470240 R08: 00007ffc5a470160 R09: 0000000020000080
R10: 00000000200001c0 R11: 0000000000000246 R12: 0000000000400bb0
R13: 00007ffc5a470320 R14: 0000000000000000 R15: 0000000000000000

The buggy address belongs to the page:
page:00000000440015ce refcount:0 mapcount:0 mapping:0000000000000000 index:0x1 pfn:0x10beee
flags: 0x200000000000000()
raw: 0200000000000000 ffffea00043ff4c8 ffffea0004325608 0000000000000000
raw: 0000000000000001 0000000000000000 00000000ffffffff 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff88810beee580: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ffff88810beee600: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
>ffff88810beee680: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
                                  ^
 ffff88810beee700: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ffff88810beee780: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
==================================================================
Disabling lock debugging due to kernel taint
ext4_rename_dir_prepare: [2] parent_de->inode=3537895424
ext4_rename_dir_prepare: [3] dir=0xffff888124170140
ext4_rename_dir_prepare: [4] ino=2
ext4_rename_dir_prepare: ent->dir->i_ino=2 parent=-757071872

Reason is first directory entry which 'rec_len' is 34478, then will get illegal
parent entry. Now, we do not check directory entry after read directory block
in 'ext4_get_first_dir_block'.
To solve this issue, check directory entry in 'ext4_get_first_dir_block'.

[ Trigger an ext4_error() instead of just warning if the directory is
  missing a '.' or '..' entry.   Also make sure we return an error code
  if the file system is corrupted.  -TYT ]

Signed-off-by: Ye Bin <yebin10@huawei.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Link: https://lore.kernel.org/r/20220414025223.4113128-1-yebin10@huawei.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Cc: stable@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[ta: Adapt patch to cope with the android specific changes introduced in
commit 705a3e5b18 ("ANDROID: ext4: Handle casefolding with encryption").
Pass zero value for lblk when calling ext4_check_dir_entry().]
Cc: Daniel Rosenberg <drosen@google.com>
Reported-and-tested-by: syzbot+a07b88e6427ec1c97aa5@syzkaller.appspotmail.com
Signed-off-by: Tudor Ambarus <tudor.ambarus@linaro.org>
Change-Id: I9d4218ffa0ddae2aa75aa4755221ef7f856b04e9
2023-01-13 08:55:46 +00:00
Kever Yang
ab89185ddb ANDROID: GKI: rockchip: Update symbols
Leaf changes summary: 0 artifacts changed
Changed leaf types summary: 0 leaf type changed
Removed/Changed/Added functions summary: 0 Removed, 0 Changed, 2 Added functions
Removed/Changed/Added variables summary: 0 Removed, 0 Changed, 0 Added variable

2 Added functions:

  [A] 'function void drm_hdcp_update_content_protection(drm_connector*, u64)'
  [A] 'function void sdhci_reset_tuning(sdhci_host*)'

Bug: 239396464
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Change-Id: I9d15fb674c1bd308e88ad34352092deef60eafcc
2023-01-10 20:58:10 +00:00
Jaegeuk Kim
6e50bbff17 BACKPORT: f2fs: let's avoid panic if extent_tree is not created
This patch avoids the below panic.

pc : __lookup_extent_tree+0xd8/0x760
lr : f2fs_do_write_data_page+0x104/0x87c
sp : ffffffc010cbb3c0
x29: ffffffc010cbb3e0 x28: 0000000000000000
x27: ffffff8803e7f020 x26: ffffff8803e7ed40
x25: ffffff8803e7f020 x24: ffffffc010cbb460
x23: ffffffc010cbb480 x22: 0000000000000000
x21: 0000000000000000 x20: ffffffff22e90900
x19: 0000000000000000 x18: ffffffc010c5d080
x17: 0000000000000000 x16: 0000000000000020
x15: ffffffdb1acdbb88 x14: ffffff888759e2b0
x13: 0000000000000000 x12: ffffff802da49000
x11: 000000000a001200 x10: ffffff8803e7ed40
x9 : ffffff8023195800 x8 : ffffff802da49078
x7 : 0000000000000001 x6 : 0000000000000000
x5 : 0000000000000006 x4 : ffffffc010cbba28
x3 : 0000000000000000 x2 : ffffffc010cbb480
x1 : 0000000000000000 x0 : ffffff8803e7ed40
Call trace:
 __lookup_extent_tree+0xd8/0x760
 f2fs_do_write_data_page+0x104/0x87c
 f2fs_write_single_data_page+0x420/0xb60
 f2fs_write_cache_pages+0x418/0xb1c
 __f2fs_write_data_pages+0x428/0x58c
 f2fs_write_data_pages+0x30/0x40
 do_writepages+0x88/0x190
 __writeback_single_inode+0x48/0x448
 writeback_sb_inodes+0x468/0x9e8
 __writeback_inodes_wb+0xb8/0x2a4
 wb_writeback+0x33c/0x740
 wb_do_writeback+0x2b4/0x400
 wb_workfn+0xe4/0x34c
 process_one_work+0x24c/0x5bc
 worker_thread+0x3e8/0xa50
 kthread+0x150/0x1b4

Bug: 264453689
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
(cherry picked from commit 24af2f08d60039427995f78150963743dcb080de)
Change-Id: I7594e80fb7df0dff3f494e79be763a9870c8f063
2023-01-10 18:49:35 +00:00
Jaegeuk Kim
39b8fee3c0 BACKPORT: f2fs: should use a temp extent_info for lookup
Otherwise, __lookup_extent_tree() will override the given extent_info which will
be used by caller.

Bug: 264453689
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
(cherry picked from commit db640d99b1ed4745eaf3af9ea1910996cddaf30c)
Change-Id: Ib37a9ec57c24cfe303ee23a5e90618e6e0dabe61
2023-01-10 18:49:35 +00:00
Jaegeuk Kim
937ed4edda BACKPORT: f2fs: don't mix to use union values in extent_info
Let's explicitly use the defined values in block_age case only.

Bug: 264453689
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
(cherry picked from commit 354a326851a615c7fd8f5a6bda72afc9f051c264)
Change-Id: I4011cbf10117a9023ef6fc507726020159ead72d
2023-01-10 18:49:35 +00:00
Jaegeuk Kim
073b997b02 BACKPORT: f2fs: initialize extent_cache parameter
This can avoid confusing tracepoint values.

Bug: 264453689
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
(cherry picked from commit b5825de803e7cf56262f5b3a8bc692d61acfe653)
Change-Id: Ia43e2c1fd405a11fc4122b68f05f40c10f47f263
2023-01-10 18:49:35 +00:00
Jaegeuk Kim
aa064914fd BACKPORT: f2fs: add block_age-based extent cache
This patch introduces a runtime hot/cold data separation method
for f2fs, in order to improve the accuracy for data temperature
classification, reduce the garbage collection overhead after
long-term data updates.

Enhanced hot/cold data separation can record data block update
frequency as "age" of the extent per inode, and take use of the age
info to indicate better temperature type for data block allocation:
 - It records total data blocks allocated since mount;
 - When file extent has been updated, it calculate the count of data
blocks allocated since last update as the age of the extent;
 - Before the data block allocated, it searches for the age info and
chooses the suitable segment for allocation.

Test and result:
 - Prepare: create about 30000 files
  * 3% for cold files (with cold file extension like .apk, from 3M to 10M)
  * 50% for warm files (with random file extension like .FcDxq, from 1K
to 4M)
  * 47% for hot files (with hot file extension like .db, from 1K to 256K)
 - create(5%)/random update(90%)/delete(5%) the files
  * total write amount is about 70G
  * fsync will be called for .db files, and buffered write will be used
for other files

The storage of test device is large enough(128G) so that it will not
switch to SSR mode during the test.

Benefit: dirty segment count increment reduce about 14%
 - before: Dirty +21110
 - after:  Dirty +18286

Bug: 264453689
Signed-off-by: qixiaoyu1 <qixiaoyu1@xiaomi.com>
Signed-off-by: xiongping1 <xiongping1@xiaomi.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
(cherry picked from commit 729055d7f1e665c57c1c90b093501cb3eb47a876)
Change-Id: I8a62846bd3d44f7243300fa9653dbb623b46a96c
2023-01-10 18:49:35 +00:00
Jaegeuk Kim
d6ba4dceab BACKPORT: f2fs: allocate the extent_cache by default
Let's allocate it to remove the runtime complexity.

Bug: 264453689
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
(cherry picked from commit 693658e0c0eca25087c1ffb318d85f8d392d6d27)
Change-Id: Ib46b6edd4f4a6232f3451498ee5c2f246dd37682
2023-01-10 18:49:35 +00:00
Jaegeuk Kim
72e9dd90cf BACKPORT: f2fs: refactor extent_cache to support for read and more
This patch prepares extent_cache to be ready for addition.

Bug: 264453689
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
(cherry picked from commit 7cf42d77c7242d23988215297bdd2d215e208b6f)
Change-Id: I5ca06c274529187b804ddd4b0834dc44fe6aa8ad
2023-01-10 18:49:35 +00:00
Jaegeuk Kim
561e9febb3 BACKPORT: f2fs: remove unnecessary __init_extent_tree
Added into the caller.

Bug: 264453689
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
(cherry picked from commit 0b461f459f0f53ff29b0ff98d4c18808b4248dcc)
Change-Id: Ic52ba22c00055bfe85bb789e6fd057d5fa84c00f
2023-01-10 18:49:35 +00:00
Jaegeuk Kim
bf3cafe7f1 BACKPORT: f2fs: move internal functions into extent_cache.c
No functional change.

Bug: 264453689
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
(cherry picked from commit f458f39556cec5660a5508fbbeea4917bc46bc9c)
Change-Id: I6171ab293b214a2eeb3f420517216371ee29557e
2023-01-10 18:49:35 +00:00
Jaegeuk Kim
b29b3bd7e1 BACKPORT: f2fs: specify extent cache for read explicitly
Let's descrbie it's read extent cache.

Bug: 264453689
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
(cherry picked from commit 29539ed310a92b5eb1e6ce8906087536b6259d58)
Change-Id: I9cb258b7ee152ead1458ef8adb3e542532f152ce
2023-01-10 18:49:35 +00:00
Zhang Qilong
02cb04cb05 BACKPORT: f2fs: add "c_len" into trace_f2fs_update_extent_tree_range for compressed file
The trace_f2fs_update_extent_tree_range could not record compressed
block length in the cluster of compress file and we just add it.

Bug: 264453689
Signed-off-by: Zhang Qilong <zhangqilong3@huawei.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
(cherry picked from commit a95694e33ce998e808b3a72164e8df3b5e0faf87)
Change-Id: Ic3702b2735be27cf1eab34191313b162805a010a
2023-01-10 18:49:35 +00:00
Zhang Qilong
f6b4d18df0 BACKPORT: f2fs: fix race condition on setting FI_NO_EXTENT flag
The following scenarios exist.
process A:               process B:
->f2fs_drop_extent_tree  ->f2fs_update_extent_cache_range
                          ->f2fs_update_extent_tree_range
                           ->write_lock
 ->set_inode_flag
                           ->is_inode_flag_set
                           ->__free_extent_tree // Shouldn't
                                                // have been
                                                // cleaned up
                                                // here
  ->write_lock

In this case, the "FI_NO_EXTENT" flag is set between
f2fs_update_extent_tree_range and is_inode_flag_set
by other process. it leads to clearing the whole exten
tree which should not have happened. And we fix it by
move the setting it to the range of write_lock.

Bug: 264453689
Fixes: 5f281fab9b ("f2fs: disable extent_cache for fcollapse/finsert inodes")
Signed-off-by: Zhang Qilong <zhangqilong3@huawei.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
(cherry picked from commit a597af3b5a967e810cc8155abaa49abf10d6c417)
Change-Id: If36c3556c9062d46509f704f0491a7e6ad652ae6
2023-01-10 18:49:35 +00:00
Chao Yu
3112d6f502 BACKPORT: f2fs: extent cache: support unaligned extent
Compressed inode may suffer read performance issue due to it can not
use extent cache, so I propose to add this unaligned extent support
to improve it.

Currently, it only works in readonly format f2fs image.

Unaligned extent: in one compressed cluster, physical block number
will be less than logical block number, so we add an extra physical
block length in extent info in order to indicate such extent status.

The idea is if one whole cluster blocks are contiguous physically,
once its mapping info was readed at first time, we will cache an
unaligned (or aligned) extent info entry in extent cache, it expects
that the mapping info will be hitted when rereading cluster.

Merge policy:
- Aligned extents can be merged.
- Aligned extent and unaligned extent can not be merged.

Bug: 264453689
Signed-off-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
(cherry picked from commit 627371ed31)
Change-Id: I106279145558f38dfa295c3e99fa03f6fcd306f4
2023-01-10 18:49:35 +00:00
Jens Axboe
25280f263d UPSTREAM: io_uring: kill goto error handling in io_sqpoll_wait_sq()
Hunk extracted from commit 70aacfe661
upstream.

If the sqpoll thread has died, the out condition doesn't remove the
waiting task from the waitqueue. The goto and check are not needed, just
make it a break condition after setting the error value. That ensures
that we always remove ourselves from sqo_sq_wait waitqueue.

Bug: 259534862
Reported-by: Xingyuan Mo <hdthky0@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 0f544353fe)
Signed-off-by: Lee Jones <joneslee@google.com>
Change-Id: I453c3e23a2f0c5ce6a8dd73dac020ec6f32994ca
2023-01-10 09:44:08 +00:00
Greg Kroah-Hartman
7c31ae524c ANDROID: allmodconfig: disable WERROR
-Werror still fails on some arm and arm64 code due to clang issues
(works on gcc!), so disable it when building allmodconfig builds for
now.

Hopefully the clang developers will work on this...

Bug: 199872592
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I6ccc856773c40e3c0f541a1316b20e9ae3de4380
(cherry picked from commit eb57c31115)
Signed-off-by: Alistair Delva <adelva@google.com>
2023-01-09 19:34:08 +00:00
Linus Torvalds
824c55581d UPSTREAM: Enable '-Werror' by default for all kernel builds
... but make it a config option so that broken environments can disable
it when required.

We really should always have a clean build, and will disable specific
over-eager warnings as required, if we can't fix them.  But while I
fairly religiously enforce that in my own tree, it doesn't get enforced
by various build robots that don't necessarily report warnings.

So this just makes '-Werror' a default compiler flag, but allows people
to disable it for their configuration if they have some particular
issues.

Occasionally, new compiler versions end up enabling new warnings, and it
can take a while before we have them fixed (or the warnings disabled if
that is what it takes), so the config option allows for that situation.

Hopefully this will mean that I get fewer pull requests that have new
warnings that were not noticed by various automation we have in place.

Knock wood.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
(cherry picked from commit 3fe617ccaf)
Signed-off-by: Alistair Delva <adelva@google.com>
Change-Id: If981f26ebe668be7c727661fede10215c4ee5bc5
2023-01-09 19:34:08 +00:00
Wu Bo
447ba7ae75 ANDROID: GKI: VIVO: Add a symbol to symbol list
Add 'dentry_path_raw' symbol to support some monitoring tools.
This patch does not add or remove symbol from xml file.

Bug: 264831214
Change-Id: I2b5aaa2945c5fd0ebe4062915b53407251a6ab77
Signed-off-by: Wu Bo <bo.wu@vivo.com>
2023-01-09 10:56:55 +00:00
Eric Biggers
91e4675508 ANDROID: fips140: add crypto_memneq() back to the module
crypto_memneq() is one of the utility functions that was intentionally
included in the fips140 module, out of concerns that it would be seen as
"cryptographic" and thus would be required to be included the module for
the FIPS certification.  It should not have been removed from the
module, so add it back.

Bug: 188620248
Fixes: 18cd39b706 ("Merge tag 'android12-5.10.136_r00' into android12-5.10")
Change-Id: I8a19dfd73390f8c1348885f97fa42d900e47b82b
Signed-off-by: Eric Biggers <ebiggers@google.com>
2023-01-09 10:55:19 +00:00
Kever Yang
b460d3c09a ANDROID: GKI: rockchip: Update module fragment and symbol list
Add fragment need by rockchip platform and sync the symbol list to the
latest source code.
This patch does not add or remove symbol from xml file.

Bug: 239396464
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Change-Id: I54e37e865124cbc7f70646481ca798e27fcc4706
2023-01-07 02:53:56 +00:00
Kever Yang
91e760f1f2 ANDROID: GKI: rockchip: Enable symbols for HDMIRX
Leaf changes summary: 1 artifact changed
Changed leaf types summary: 0 leaf type changed
Removed/Changed/Added functions summary: 0 Removed, 0 Changed, 1 Added function
Removed/Changed/Added variables summary: 0 Removed, 0 Changed, 0 Added variable

1 Added function:

  [A] 'function bool v4l2_find_dv_timings_cap(v4l2_dv_timings*, const v4l2_dv_timings_cap*, unsigned int, v4l2_check_dv_timings_fnc*, void*)'

Bug: 239396464
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Change-Id: I45009e2791f99b65476daafaff343df33af72433
2023-01-07 02:53:56 +00:00
Kever Yang
1960d4cfad ANDROID: GKI: rockchip: Enable symbols for Ethernet
Leaf changes summary: 28 artifacts changed
Changed leaf types summary: 0 leaf type changed
Removed/Changed/Added functions summary: 0 Removed, 0 Changed, 28 Added functions
Removed/Changed/Added variables summary: 0 Removed, 0 Changed, 0 Added variable

28 Added functions:

  [A] 'function void ethtool_convert_legacy_u32_to_link_mode(unsigned long int*, u32)'
  [A] 'function bool ethtool_convert_link_mode_to_legacy_u32(unsigned int*, const unsigned long int*)'
  [A] 'function int flow_block_cb_setup_simple(flow_block_offload*, list_head*, flow_setup_cb_t*, void*, void*, bool)'
  [A] 'function void flow_rule_match_basic(const flow_rule*, flow_match_basic*)'
  [A] 'function void flow_rule_match_ipv4_addrs(const flow_rule*, flow_match_ipv4_addrs*)'
  [A] 'function void flow_rule_match_ports(const flow_rule*, flow_match_ports*)'
  [A] 'function void netdev_rss_key_fill(void*, size_t)'
  [A] 'function page* page_pool_alloc_pages(page_pool*, gfp_t)'
  [A] 'function page_pool* page_pool_create(const page_pool_params*)'
  [A] 'function void page_pool_destroy(page_pool*)'
  [A] 'function void page_pool_put_page(page_pool*, page*, unsigned int, bool)'
  [A] 'function void page_pool_release_page(page_pool*, page*)'
  [A] 'function void phylink_disconnect_phy(phylink*)'
  [A] 'function int phylink_ethtool_get_eee(phylink*, ethtool_eee*)'
  [A] 'function void phylink_ethtool_get_pauseparam(phylink*, ethtool_pauseparam*)'
  [A] 'function void phylink_ethtool_get_wol(phylink*, ethtool_wolinfo*)'
  [A] 'function int phylink_ethtool_ksettings_get(phylink*, ethtool_link_ksettings*)'
  [A] 'function int phylink_ethtool_ksettings_set(phylink*, const ethtool_link_ksettings*)'
  [A] 'function int phylink_ethtool_nway_reset(phylink*)'
  [A] 'function int phylink_ethtool_set_eee(phylink*, ethtool_eee*)'
  [A] 'function int phylink_ethtool_set_pauseparam(phylink*, ethtool_pauseparam*)'
  [A] 'function int phylink_ethtool_set_wol(phylink*, ethtool_wolinfo*)'
  [A] 'function int phylink_get_eee_err(phylink*)'
  [A] 'function void phylink_mac_change(phylink*, bool)'
  [A] 'function int phylink_mii_ioctl(phylink*, ifreq*, int)'
  [A] 'function int phylink_speed_down(phylink*, bool)'
  [A] 'function int phylink_speed_up(phylink*)'
  [A] 'function void phylink_stop(phylink*)'

Bug: 239396464
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Change-Id: I6adf45c9a7159ef07a1913222248128afc0dcccb
2023-01-07 02:53:56 +00:00
Kalesh Singh
529351c4c8 ANDROID: Re-enable fast mremap and fix UAF with SPF
SPF attempts page faults without taking the mmap lock, but takes the
PTL. If there is a concurrent fast mremap (at PMD/PUD level), this
can lead to a UAF as fast mremap will only take the PTL locks at the
PMD/PUD level. SPF cannot take the PTL locks at the larger subtree
granularity since this introduces much contention in the page fault
paths.

To address the race:
  1) Only try fast mremaps if there are no users of the VMA. Android
     is concerned with this optimization in the context of
     GC stop-the-world pause. So there are no other threads active
     and this should almost always succeed.
  2) Speculative faults detect ongoing fast mremaps and fallback
     to conventional fault handling (taking mmap read lock).

Bug: 263177905
Change-Id: I23917e493ddc8576de19883cac053dfde9982b7f
Signed-off-by: Kalesh Singh <kaleshsingh@google.com>
2023-01-06 13:08:36 -08:00
Kalesh Singh
c67f268c84 Revert "ANDROID: Make SPF aware of fast mremaps"
This reverts commit 134c1aae43.

Reason for revert: vts_linux_kselftest_arm_64 timeout

Bug: 263479421
Bug: 263177905
Change-Id: I123c56741c982d1539ceebd8bfde2443871aa1de
Signed-off-by: Kalesh Singh <kaleshsingh@google.com>
2023-01-06 13:07:18 -08:00
Wei Liu
1351459097 ANDROID: GKI: Update symbols to symbol list
Update symbols to symbol list externed by oppo network group.

1 Added function:

  [A] 'function int __rtnl_link_register(rtnl_link_ops*)'

Bug: 193384408

Signed-off-by: Wei Liu <liuwei.a@oppo.com>
Change-Id: Ibd8f74fa1f3b68047f6fed9b5c4154c51f23b821
2023-01-06 19:41:17 +00:00
Eric Biggers
fe60669d03 ANDROID: fips140: add dump_jitterentropy command to fips140_lab_util
For the entropy analysis, we must provide some output from the Jitter
RNG: a large amount of output from one instance, and a smaller amount of
output from each of a certain number of instances.

The original plan was to use a build of the userspace jitterentropy
library that matches the kernel's jitterentropy_rng as closely as
possible.  However, it's now being requested that the output be gotten
from the kernel instead.

Now that fips140_lab_util depends on AF_ALG anyway, it's straightforward
to dump output from jitterentropy_rng instances using AF_ALG.
Therefore, add a command dump_jitterentropy which supports this.

Bug: 188620248
Change-Id: I78eb26250e88f2fc28fc44aa201acbe5b84df8bb
Signed-off-by: Eric Biggers <ebiggers@google.com>
(cherry picked from commit dc01503266)
2023-01-06 19:08:16 +00:00
Bing-Jhong Billy Jheng
6d015667ce UPSTREAM: io_uring: add missing item types for splice request
Splice is like read/write and should grab current->nsproxy, denoted by
IO_WQ_WORK_FILES as it refers to current->files as well

Change-Id: I94a99fdef5764e7eda5da778b5b52a150b9fe5eb
Signed-off-by: Bing-Jhong Billy Jheng <billy@starlabs.sg>
Reviewed-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 75454b4bbf)
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2023-01-06 09:35:59 +00:00
xiaofeng
ad1f2eebad ANDROID: GKI: update xiaomi symbol list
Leaf changes summary: 6 artifacts changed
Changed leaf types summary: 0 leaf type changed
Removed/Changed/Added functions summary: 0 Removed, 0 Changed, 3 Added functions
Removed/Changed/Added variables summary: 0 Removed, 0 Changed, 3 Added variables

3 Added functions:

  [A] 'function int __traceiter_android_vh_alloc_pages_failure_bypass(void*, gfp_t, int, int, int, page**)'
  [A] 'function int __traceiter_android_vh_alloc_pages_reclaim_bypass(void*, gfp_t, int, int, int, page**)'
  [A] 'function int __traceiter_android_vh_mmput(void*, mm_struct*)'

3 Added variables:

  [A] 'tracepoint __tracepoint_android_vh_alloc_pages_failure_bypass'
  [A] 'tracepoint __tracepoint_android_vh_alloc_pages_reclaim_bypass'
  [A] 'tracepoint __tracepoint_android_vh_mmput'

Bug:262486564
Change-Id: I7c78cc3c5fde8a15c8a30073fcb1cb01708d9d37
Signed-off-by: xiaofeng <xiaofeng5@xiaomi.com>
2022-12-24 15:20:22 -08:00
Suren Baghdasaryan
f677efbea1 Revert "Revert "ANDROID: vendor_hooks:vendor hook for mmput""
This reverts commit 501063ce66.

Reason for revert: The vendor hook is actually needed by a partner

Bug: 238821038
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Change-Id: I1c19add348792967975369a10ec9cb41fa268236
2022-12-24 12:34:20 -08:00
Suren Baghdasaryan
a43cd1f2bb Revert "Revert "ANDROID: vendor_hooks:vendor hook for __alloc_pages_slowpath.""
This reverts commit cc51dcbc60.

Reason for revert: The vendor hooks were reverted but they are needed.

Bug: 243629905
Signed-off-by: xiaofeng <xiaofeng5@xiaomi.com>
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Change-Id: I4b2eab1a9bf3bbbb200f9d09f2c57fb4d9f2c143
2022-12-24 12:30:22 -08:00
Kever Yang
9e6fb5ac72 ANDROID: GKI: rockchip: Add symbol clk_hw_set_parent
Leaf changes summary: 1 artifact changed
Changed leaf types summary: 0 leaf type changed
Removed/Changed/Added functions summary: 0 Removed, 0 Changed, 1 Added function
Removed/Changed/Added variables summary: 0 Removed, 0 Changed, 0 Added variable

1 Added function:

  [A] 'function int clk_hw_set_parent(clk_hw*, clk_hw*)'

Bug: 239396464
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Change-Id: Id24cdc739a6254f7676a1f60fd8ecbd0066ca4b0
2022-12-22 18:05:01 +00:00
Mayank Rana
7bc2b8c400 UPSTREAM: usb: dwc3: core: Add error log when core soft reset failed
DWC3 controller soft reset is important operation for USB functionality.
In case when it fails, currently there is no failure log. Hence add
error log when core soft reset failed.

Signed-off-by: Mayank Rana <quic_mrana@quicinc.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Bug: 235863377
(cherry picked from commit 859bdc3595)
Change-Id: I60500f66af47d93cf9d60bdecab32e6dc48d4b7c
Signed-off-by: Mayank Rana <quic_mrana@quicinc.com>
(cherry picked from commit d03bf01b43ff923e066938895a6867338778be7a)
2022-12-22 18:00:05 +00:00
Pradeep P V K
05a8f2c4d2 FROMLIST: fuse: give wakeup hints to the scheduler
The synchronous wakeup interface is available only for the
interruptible wakeup. Add it for normal wakeup and use this
synchronous wakeup interface to wakeup the userspace daemon.
Scheduler can make use of this hint to find a better CPU for
the waker task.

With this change the performance numbers for compress, decompress
and copy use-cases on /sdcard path has improved by ~30%.

Use-case details:
1. copy 10000 files of each 4k size into /sdcard path
2. use any File explorer application that has compress/decompress
support
3. start compress/decompress and capture the time.

-------------------------------------------------
| Default   | wakeup support | Improvement/Diff |
-------------------------------------------------
| 13.8 sec  | 9.9 sec        | 3.9 sec (28.26%) |
-------------------------------------------------

Co-developed-by: Pavankumar Kondeti <quic_pkondeti@quicinc.com>
Signed-off-by: Pradeep P V K <quic_pragalla@quicinc.com>

Bug: 216261533
Link: https://lore.kernel.org/lkml/1638780405-38026-1-git-send-email-quic_pragalla@quicinc.com/
Change-Id: I9ac89064e34b1e0605064bf4d2d3a310679cb605
Signed-off-by: Pradeep P V K <quic_pragalla@quicinc.com>
Signed-off-by: Alessio Balsini <balsini@google.com>
(cherry picked from commit 30d72758db)
2022-12-21 19:06:10 +00:00
Kalesh Singh
134c1aae43 ANDROID: Make SPF aware of fast mremaps
SPF attempts page faults without taking the mmap lock, but takes the
PTL. If there is a concurrent fast mremap (at PMD/PUD level), this
can lead to a UAF as fast mremap will only take the PTL locks at the
PMD/PUD level. SPF cannot take the PTL locks at the larger subtree
granularity since this introduces much contention in the page fault
paths.

To address the race:
  1) Fast mremaps wait until there are no users of the VMA.
  2) Speculative faults detect ongoing fast mremaps and fallback
    to conventional fault handling (taking mmap read lock).

Since this race condition is very rare the performance impact is
negligible.

Bug: 263177905
Change-Id: If9755aa4261337fe180e3093a3cefaae8ac9ff1a
Signed-off-by: Kalesh Singh <kaleshsingh@google.com>
2022-12-20 17:19:30 -08:00
Farid Chahla
16c03440df ANDROID: GKI: enable mulitcolor-led
To enable newer version of DualSense driver, i.e. hid-playstation, we
need to set LEDS_CLASS_MULTICOLOR to "y".

Bug: 260685629
Change-Id: I52b0b1b6a061457e009b62a6bd6b66a91c8c37a2
Signed-off-by: Farid Chahla <farid.chahla@sony.com>
2022-12-20 19:25:39 +00:00
Roderick Colenbrander
4aa3cab588 UPSTREAM: HID: playstation: support updated DualSense rumble mode.
Newer DualSense firmware supports a revised classic rumble mode,
which feels more similar to rumble as supported on previous PlayStation
controllers. It has been made the default on PlayStation and non-PlayStation
devices now (e.g. iOS and Windows). Default to this new mode when
supported.

Signed-off-by: Roderick Colenbrander <roderick.colenbrander@sony.com>
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Link: https://lore.kernel.org/r/20221010212313.78275-4-roderick.colenbrander@sony.com

Bug: 260685629
(cherry picked from commit 9fecab247e)
Change-Id: Icd330111a4d1b1e76a04cd11c623d0982ce3d66f
Signed-off-by: Farid Chahla <farid.chahla@sony.com>
2022-12-20 19:25:39 +00:00
Roderick Colenbrander
63b2567f9d UPSTREAM: HID: playstation: add initial DualSense Edge controller support
Provide initial support for the DualSense Edge controller. The brings
support up to the level of the original DualSense, but won't yet provide
support for new features (e.g. reprogrammable buttons).

Signed-off-by: Roderick Colenbrander <roderick.colenbrander@sony.com>
CC: stable@vger.kernel.org
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Link: https://lore.kernel.org/r/20221010212313.78275-3-roderick.colenbrander@sony.com

Bug: 260685629
(cherry picked from commit b8a968efab)
Change-Id: I5b95de806e823085d1144f016d8cfd76e4a933ef
Signed-off-by: Farid Chahla <farid.chahla@sony.com>
2022-12-20 19:25:39 +00:00