Commit Graph

976884 Commits

Author SHA1 Message Date
Changheun Lee
9458fa0dda BACKPORT: bio: limit bio max size
bio size can grow up to 4GB when muli-page bvec is enabled.
but sometimes it would lead to inefficient behaviors.
in case of large chunk direct I/O, - 32MB chunk read in user space -
all pages for 32MB would be merged to a bio structure if the pages
physical addresses are contiguous. it makes some delay to submit
until merge complete. bio max size should be limited to a proper size.

When 32MB chunk read with direct I/O option is coming from userspace,
kernel behavior is below now in do_direct_IO() loop. it's timeline.

 | bio merge for 32MB. total 8,192 pages are merged.
 | total elapsed time is over 2ms.
 |------------------ ... ----------------------->|
                                                 | 8,192 pages merged a bio.
                                                 | at this time, first bio submit is done.
                                                 | 1 bio is split to 32 read request and issue.
                                                 |--------------->
                                                  |--------------->
                                                   |--------------->
                                                              ......
                                                                   |--------------->
                                                                    |--------------->|
                          total 19ms elapsed to complete 32MB read done from device. |

If bio max size is limited with 1MB, behavior is changed below.

 | bio merge for 1MB. 256 pages are merged for each bio.
 | total 32 bio will be made.
 | total elapsed time is over 2ms. it's same.
 | but, first bio submit timing is fast. about 100us.
 |--->|--->|--->|---> ... -->|--->|--->|--->|--->|
      | 256 pages merged a bio.
      | at this time, first bio submit is done.
      | and 1 read request is issued for 1 bio.
      |--------------->
           |--------------->
                |--------------->
                                      ......
                                                 |--------------->
                                                  |--------------->|
        total 17ms elapsed to complete 32MB read done from device. |

As a result, read request issue timing is faster if bio max size is limited.
Current kernel behavior with multipage bvec, super large bio can be created.
And it lead to delay first I/O request issue.

Signed-off-by: Changheun Lee <nanich.lee@samsung.com>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20210503095203.29076-1-nanich.lee@samsung.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Bug: 182716953
(cherry picked from commit cd2c7545ae)
Change-Id: Ie3876daa495535dc7f856ed9a281e65d72a437c1
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2021-05-07 07:14:07 -07:00
Manish Varma
f9d86ad18a ANDROID: i2c: Add vendor hook to allow assign dev_name to I2C devices
"dev_name" for I2C devices won't have any value set, unless they are
instantiated thru ACPI interface. As a result of this, I2C driver will
assign some dynamic name in the format "%d-%04x" (e.g. 1-001f), and
further this device names are used for kernel wakelocks.

This dynamic names are difficult to associate with actual device and
hence it will help to have an ability where vendor can assign the
device name through vendor hooks.

Bug: 147496295

Signed-off-by: Manish Varma <varmam@google.com>
Change-Id: Idb417ef5330002063a9763544f9f0364f9581276
2021-05-07 07:13:22 -07:00
Hang Lu
0493c72d6d UPSTREAM: binder: tell userspace to dump current backtrace when detected oneway spamming
When async binder buffer got exhausted, some normal oneway transactions
will also be discarded and may cause system or application failures. By
that time, the binder debug information we dump may not be relevant to
the root cause. And this issue is difficult to debug if without the
backtrace of the thread sending spam.

This change will send BR_ONEWAY_SPAM_SUSPECT to userspace when oneway
spamming is detected, request to dump current backtrace. Oneway spamming
will be reported only once when exceeding the threshold (target process
dips below 80% of its oneway space, and current process is responsible
for either more than 50 transactions, or more than 50% of the oneway
space). And the detection will restart when the async buffer has
returned to a healthy state.

Acked-by: Todd Kjos <tkjos@google.com>
Signed-off-by: Hang Lu <hangl@codeaurora.org>
Link: https://lore.kernel.org/r/1617961246-4502-3-git-send-email-hangl@codeaurora.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Bug: 181190340
Change-Id: Id3d2526099bc89f04d8ad3ad6e48141b2a8f2515
(cherry picked from commit a7dc1e6f99)
Signed-off-by: Hang Lu <hangl@codeaurora.org>
2021-05-07 07:13:22 -07:00
Ard Biesheuvel
f0e99852cb ANDROID: arm64: module: add RELA metadata for FIPS140 use
The fips140.ko module relies on ELF metadata that is normally discarded
by the module loader. In order to reduce the impact of the associated
changes on non-FIPS140 kernels, the module loader will be modified to
simply copy this metadata if it encounters a module whose name is
'fips140'. For this to work, we need a couple of fields in struct
mod_arch_specific so that this module can find this data at module init
time.

Adding these fields will change the type signature of struct module, and
hence affect the stable ABI. The FIPS140 module build depends on LTO,
and so its Kconfig symbol can only be enabled if LTO is enabled as well.
This implies that adding these mod_arch_specific fields conditionally,
based on CONFIG_CRYPTO_FIPS140_INTEGRITY_CHECK, would result in an ABI
fork between LTO and !LTO builds, which is obviously undesirable.

So let's just add these fields unconditionally. This will take 24 bytes
of kernel memory per module, but given that the size of struct module
(which is the only place where struct mod_arch_specific is allocated) is
rounded up to cacheline size (128 bytes on arm64), and this change does
not push it over the edge, the net result is that no additional memory
is used (struct module is currently 1 KiB)

Bug: 153614920
Change-Id: Ia617762f37c0bf7324e899b72fd317e382e39c03
Signed-off-by: Ard Biesheuvel <ardb@google.com>
2021-05-07 07:12:43 -07:00
Greg Kroah-Hartman
85f86ef6a8 ANDROID: GKI: rename filp_open to filp_open_block in symbol lists
A number of systems want access to the zram flip_open functionality,
which is now called filp_open_block() to remove any possiblity of bad
drivers trying to access filesystems directly.

Fix up the two symbol lists that were referring to the wrong symbol.

Bug: 157965270
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I368da14ca739b6048dd88a38fca4af8b7f02714d
2021-05-07 07:12:43 -07:00
Greg Kroah-Hartman
81ab760224 ANDROID: GKI: dwc3: add Android ABI padding to some structures
Try to mitigate potential future driver core api changes by adding
padding to a number of dwc3 structures.

Bug: 151154716
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I1826d885e3acf1f378d0e30b1ca2ddc56b16a9e4
2021-05-07 07:12:43 -07:00
Thinh Nguyen
866797c77d FROMGIT: usb: dwc3: gadget: Handle DEV_TXF_FLUSH_BYPASS capability
DWC_usb32 IP introduces a new behavior when handling NoStream event for
IN endpoints. If the controller is capable of DEV_TXF_FLUSH_BYPASS, then
the driver does not need to force to restart stream for IN endpoints.
The controller will generate ERDY and restart the stream periodically.

Acked-by: Felipe Balbi <balbi@kernel.org>
Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Link: https://lore.kernel.org/r/65c3070c666cd6b8beeee62d7f8e3e704ebf2d32.1619134559.git.Thinh.Nguyen@synopsys.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 16710380d3
 https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-next)
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I9271d4cfb20cfe0fd35c4886911fc7fa9bbc7b95
2021-05-07 07:12:42 -07:00
Thinh Nguyen
e275019d8c FROMGIT: usb: dwc3: Capture new capability register GHWPARAMS9
DWC_usb32 introduces a new HW capability register GHWPARAMS9. Capture
this in the dwc->hwparams.hwparams9 field.

Acked-by: Felipe Balbi <balbi@kernel.org>
Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Link: https://lore.kernel.org/r/f76cc4a9c8c4ab325f5babe03c57b039166360b0.1619134559.git.Thinh.Nguyen@synopsys.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit ddae7979cd
 https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-next)
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I8816e8ad4a7ba5eb136c25d0d778b814eb4efa5d
2021-05-07 07:12:42 -07:00
John Stultz
b48bcb27ae FROMGIT: usb: dwc3: core: Do core softreset when switch mode
According to the programming guide, to switch mode for DRD controller,
the driver needs to do the following.

To switch from device to host:
1. Reset controller with GCTL.CoreSoftReset
2. Set GCTL.PrtCapDir(host mode)
3. Reset the host with USBCMD.HCRESET
4. Then follow up with the initializing host registers sequence

To switch from host to device:
1. Reset controller with GCTL.CoreSoftReset
2. Set GCTL.PrtCapDir(device mode)
3. Reset the device with DCTL.CSftRst
4. Then follow up with the initializing registers sequence

Currently we're missing step 1) to do GCTL.CoreSoftReset and step 3) of
switching from host to device. John Stult reported a lockup issue seen
with HiKey960 platform without these steps[1]. Similar issue is observed
with Ferry's testing platform[2].

So, apply the required steps along with some fixes to Yu Chen's and John
Stultz's version. The main fixes to their versions are the missing wait
for clocks synchronization before clearing GCTL.CoreSoftReset and only
apply DCTL.CSftRst when switching from host to device.

[1] https://lore.kernel.org/linux-usb/20210108015115.27920-1-john.stultz@linaro.org/
[2] https://lore.kernel.org/linux-usb/0ba7a6ba-e6a7-9cd4-0695-64fc927e01f1@gmail.com/

Fixes: 41ce1456e1 ("usb: dwc3: core: make dwc3_set_mode() work properly")
Cc: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Ferry Toth <fntoth@gmail.com>
Cc: Wesley Cheng <wcheng@codeaurora.org>
Cc: <stable@vger.kernel.org>
Tested-by: John Stultz <john.stultz@linaro.org>
Tested-by: Wesley Cheng <wcheng@codeaurora.org>
Signed-off-by: Yu Chen <chenyu56@huawei.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Link: https://lore.kernel.org/r/374440f8dcd4f06c02c2caf4b1efde86774e02d9.1618521663.git.Thinh.Nguyen@synopsys.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit f88359e158
 https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-next)
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I1a7726f207adbcb96b9693d77605282fd00fe151
2021-05-07 07:12:42 -07:00
Vijayanand Jitta
bc1dd753bd ANDROID: android: Add symbols to debug_symbols driver
Add symbols which will be used by the minidump module to
the debug symbol driver.

Bug: 184707701
Change-Id: I4cfdc59e0fcab89ad4df4fcb4de4a706a9c84cf8
Signed-off-by: Vijayanand Jitta <vjitta@codeaurora.org>
2021-05-07 07:12:41 -07:00
Peng Fan
0cf9435352 BACKPORT: FROMGIT: remoteproc: add is_iomem to da_to_va
Introduce an extra parameter is_iomem to da_to_va, then the caller
could take the memory as normal memory or io mapped memory.

Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Reviewed-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
Link: https://lore.kernel.org/r/1615029865-23312-5-git-send-email-peng.fan@oss.nxp.com
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>

Bug: 159736148
(cherry picked from commit 40df0a91b2
 https://git.kernel.org/pub/scm/linux/kernel/git/andersson/remoteproc.git for-next)
Link: https://lore.kernel.org/r/1615029865-23312-5-git-send-email-peng.fan@oss.nxp.com
(Add bool *is_iomem to scp_da_to_va())
Signed-off-by: Jindong Yue <jindong.yue@nxp.com>
Change-Id: I0be539c4550cdbd802723c56fd4385abe6ba23c4
2021-05-07 07:12:41 -07:00
Peng Fan
775d6f9faf FROMGIT: remoteproc: introduce is_iomem to rproc_mem_entry
Introduce is_iomem to indicate this piece memory is iomem or not.

Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Reviewed-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
Link: https://lore.kernel.org/r/1615029865-23312-4-git-send-email-peng.fan@oss.nxp.com
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>

Bug: 159736148
(cherry picked from commit 2cfc056ef2
 https://git.kernel.org/pub/scm/linux/kernel/git/andersson/remoteproc.git for-next)
Link: https://lore.kernel.org/r/1615029865-23312-4-git-send-email-peng.fan@oss.nxp.com
Signed-off-by: Jindong Yue <jindong.yue@nxp.com>
Change-Id: I3e78b7cdf4ca9d76d7465dd03f09764bdd0404dd
2021-05-07 07:12:41 -07:00
Neeraj Upadhyay
f6fdbe9edc ANDROID: abi_gki_aarch64_qcom: Add __bitmap_andnot and cpumask_any_but
Add __bitmap_andnot and cpumask_any_but to symbol list.

Bug: 187463586
Change-Id: I936ee9778040ba96a3937e21da0c886b2929df7c
Signed-off-by: Neeraj Upadhyay <neeraju@codeaurora.org>
2021-05-07 11:40:45 +00:00
Siddharth Gupta
188186232a ANDROID: abi_gki_aarch64_qcom: Add __kfifo_free
To free the fifo buffer allocated by __kfifo_alloc we need to use
__kfifo_free. This change adds the __kfifo_free symbol to the
qcom symbol list.

Bug: 184180643
Change-Id: I2d8a719be61af59cd0c7fd59b8d6957a0e5050e0
Signed-off-by: Siddharth Gupta <quic_sidgup@quicinc.com>
2021-05-07 09:47:52 +00:00
Elliot Berman
75a0e03539 ANDROID: abi_gki_aarch64_qcom: Add __page_pinner_migration_failed
Add symbols for CONFIG_PAGE_PINNER from commit 94acc25d0e ("ANDROID:
GKI: Enable CONFIG_PAGE_PINNER").

Bug: 187458519
Change-Id: If022a564ecaa3db3d751c5ebf58b92812672ae56
Signed-off-by: Elliot Berman <quic_eberman@quicinc.com>
2021-05-07 06:08:37 +00:00
JINHO LIM
8219786218 ANDROID: vendor_hooks: set debugging data when rt_mutex is working
We already applied the 'vendor hook' for Dtask Debugging Information
in below issue.
(https://issuetracker.google.com/issues/162776704)

There are vendor hook call in mutex and rw_semaphore, but not for rt_mutex
Please refer to description in details as below,

1. Description
This feature writes rt mutex lock waiting information
on the task_struct structure. We can check mutex information and
mutex owner through the kernel log and custom analysis tools.
Like the previous feature in mutex and rw semaphore,
added data can be checked by ramdump analysis.

2. Vendor Hook Position
1) VENDOR_DATA
  - struct task_struct in sched.h

    VENDOR_DATA_ARRAY(2)

    [0] : type   // RTmutex (Mutex, Rwsem, ...)
    [1] : pointer   // address of lock
2) VENDOR_HOOKs
  - __rt_mutex_slowlock() in kernel/locking/rtmutex.c

3. Example
 - SysRq-w in kernel log
...
[   54.164463] [3:  kworker/u16:3:  253] kworker/3:2     D12736   418      2 0x00000228
[   54.164497] [3:  kworker/u16:3:  253] RTmutex: 0xffffffc051fa3ae8: owner[sh :9003]

[   54.167812] [3:  kworker/u16:3:  253] sh              D12848  9003   6900 0x04000200
[   54.167824] [3:  kworker/u16:3:  253] RTmutex: 0xffffffc051fa3b08: owner[kworker/3:2 :418]
...

Bug: 186567468

Signed-off-by: JINHO LIM <jordan.lim@samsung.com>
Change-Id: I93f9753be0b2c1fa1a6eaea09379d54c31d1ebcf
(cherry picked from commit e289faa9f1)
2021-05-07 00:12:54 +00:00
Neeraj Upadhyay
938dc2b9b0 ANDROID: abi_gki_aarch64_qcom: Add irq_do_set_affinity
Add irq_do_set_affinity to qcom symbol list.

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 irq_do_set_affinity(irq_data*, const cpumask*, bool)'

Bug: 187157600
Change-Id: I2bcac61301c45acca711ff7ba0dbbf4d365431b7
Signed-off-by: Neeraj Upadhyay <neeraju@codeaurora.org>
2021-05-06 20:32:22 +00:00
Wei Wang
32b8d85352 ANDROID: Update the ABI xml and symbol list
Leaf changes summary: 2 artifacts 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, 1 Added variable

1 Added function:

  [A] 'function int __traceiter_android_rvh_post_init_entity_util_avg(void*, sched_entity*)'

1 Added variable:

  [A] 'tracepoint __tracepoint_android_rvh_post_init_entity_util_avg'

Bug: 186564130
Test: Build
Signed-off-by: Wei Wang <wvw@google.com>
Change-Id: Icc8fa41ed94caf637348724a28a9212f1ab38bea
2021-05-06 10:55:57 -07:00
Wei Wang
99fdfd2fa3 ANDROID: ABI: Update the generic symbol list
Add new symbols.

Bug: 186564130
Test: Build
Signed-off-by: Wei Wang <wvw@google.com>
Change-Id: I805cd5f29d6a69914c6f82e47fbc04ea709b1a65
2021-05-06 10:55:57 -07:00
Neeraj Upadhyay
d88c1e77fd ANDROID: irq: manage: Export irq_do_set_affinity symbol
Vendor kernel modules may implement irq balancers, which could
take irq desc lock of an irq and then based on current affinity
mask or affinity hint, reconfigure the affinity of that irq.
For example : For an irq, for which affinity is broken i.e. all
the cpus in its affinity mask have gone offline. For such irqs,
we might want to reset the affinity, when the original set of
affined cpus, come back online. desc->affinity_hint can be used
for figuring out the original affinity. So, the sequence for doing
this becomes:

desc = irq_to_desc(i);
raw_spin_lock(&desc->lock);
affinity = desc->affinity_hint;
raw_spin_unlock(&desc->lock);
irq_set_affinity_hint(i, affinity);

Here, we need to release the desc lock before calling the exported
api irq_set_affinity_hint(). This creates a window where, after
unlocking desc lock and before calling irq_set_affinity_hint(),
where this setting can race with other irq_set_affinity_hint()
callers. So, export irq_do_set_affinity() symbol to provide an
api, which can be called with desc lock held.

Bug: 187157600
Change-Id: Ifad88bfaa1e7eec09c3fe5a9dd7d1d421362b41e
Signed-off-by: Neeraj Upadhyay <neeraju@codeaurora.org>
2021-05-06 14:58:19 +00:00
Kyle Tso
8c32ea7937 FROMLIST: usb: typec: tcpm: Fix wrong handling in GET_SINK_CAP
After receiving Sink Capabilities Message in GET_SINK_CAP AMS, it is
incorrect to call tcpm_pd_handle_state because the Message is expected
and the current state is not Ready states. The result of this incorrect
operation ends in Soft Reset which is definitely wrong. Simply
forwarding to Ready States is enough to finish the AMS.

Link: https://lore.kernel.org/r/20210503171849.2605302-1-kyletso@google.com
Fixes: 8dea75e113 ("usb: typec: tcpm: Protocol Error handling")
Signed-off-by: Kyle Tso <kyletso@google.com>
Acked-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I031881099f5386dd0c7f3f4efca2aadda5bae70e
2021-05-06 12:00:34 +00:00
Jack Pham
44a71750f2 ANDROID: GKI: Enable CONFIG_USB_CONFIGFS_F_UAC2
Enable the UAC2 function driver to allow USB gadgets
to connect as a standard audio device to a host.

Bug: 187332233
Change-Id: If8c92892163dc08b270d9c9b1c120012ba9851a6
Signed-off-by: Jack Pham <jackp@codeaurora.org>
2021-05-06 00:47:17 -07:00
Victor Liu
03cd19b0ae ANDROID: Update the ABI xml and symbol list
Leaf changes summary: 2 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 int crypto_aead_decrypt(aead_request*)'
  [A] 'function int crypto_shash_finup(shash_desc*, const u8*, unsigned int, u8*)'

Bug: 187102861
Signed-off-by: Victor Liu <victorliu@google.com>
Change-Id: I2505f5790174d6631e3412fae3f16b194e63a76d
2021-05-05 21:26:50 +00:00
Jindong Yue
2b223f9af1 UPSTREAM: remoteproc: core: Remove casting to rproc_handle_resource_t
There are four different callback functions that are used for the
rproc_handle_resource_t callback that all have different second
parameter types.

rproc_handle_vdev -> struct fw_rsc_vdev
rproc_handle_trace -> struct fw_rsc_trace
rproc_handle_devmem -> struct fw_rsc_devmem
rproc_handle_carveout -> struct fw_rsc_carveout

These callbacks are cast to rproc_handle_resource_t so that there is no
error about incompatible pointer types. Unfortunately, this is a Clang's
Control-Flow Integrity checking violation, which verifies that the
callback function's types match the prototypes exactly before jumping.

[    7.275750] Kernel panic - not syncing: CFI failure (target: rproc_handle_vdev+0x0/0x4)
[    7.283763] CPU: 2 PID: 1 Comm: init Tainted: G         C O      5.4.70-03301-g527af2c96672 #17
[    7.292463] Hardware name: NXP i.MX8MPlus EVK board (DT)
[    7.297779] Call trace:
[    7.300232]  dump_backtrace.cfi_jt+0x0/0x4
[    7.304337]  show_stack+0x18/0x24
[    7.307660]  dump_stack+0xb8/0x114
[    7.311069]  panic+0x164/0x3d4
[    7.314130]  __ubsan_handle_cfi_check_fail_abort+0x0/0x14
[    7.319533]  perf_proc_update_handler+0x0/0xcc
[    7.323983]  __cfi_check+0x63278/0x6a290
[    7.327913]  rproc_boot+0x3f8/0x738
[    7.331404]  rproc_add+0x68/0x110
[    7.334738]  imx_rproc_probe+0x5e4/0x708 [imx_rproc]
[    7.339711]  platform_drv_probe+0xac/0xf0
[    7.343726]  really_probe+0x260/0x65c
[    7.347393]  driver_probe_device+0x64/0x100
[    7.351580]  device_driver_attach+0x6c/0xac
[    7.355766]  __driver_attach+0xdc/0x184
[    7.359609]  bus_for_each_dev+0x98/0x104
[    7.363537]  driver_attach+0x24/0x30
[    7.367117]  bus_add_driver+0x100/0x1e0
[    7.370958]  driver_register+0x78/0x114
[    7.374800]  __platform_driver_register+0x44/0x50
[    7.379514]  init_module+0x20/0xfe8 [imx_rproc]
[    7.384049]  do_one_initcall+0x190/0x348
[    7.387979]  do_init_module+0x5c/0x210
[    7.391731]  load_module+0x2fbc/0x3590
[    7.395485]  __arm64_sys_finit_module+0xb8/0xec
[    7.400025]  el0_svc_common+0xb4/0x19c
[    7.403777]  el0_svc_handler+0x74/0x98
[    7.407531]  el0_svc+0x8/0xc
[    7.410419] SMP: stopping secondary CPUs
[    7.414648] Kernel Offset: disabled
[    7.418142] CPU features: 0x00010002,2000200c
[    7.422501] Memory Limit: none

To fix this, change the second parameter of all functions to void * and
use a local variable with the correct type so that everything works
properly. With this, we can remove casting to rproc_handle_resource_t
for these functions.

Signed-off-by: Jindong Yue <jindong.yue@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Sami Tolvanen <samitolvanen@google.com>
Reviewed-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Link: https://lore.kernel.org/r/20210224055825.7417-1-jindong.yue@nxp.com
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>

(cherry picked from commit 2bf2346159)
Bug: 187234877
Reported-by: Joy-mi Huang <joy-mi.huang@mediatek.com>
Signed-off-by: Lecopzer Chen <lecopzer.chen@mediatek.com>
Change-Id: Icc7adeaf98f779fc46a979ff7e9f2ab5f963f636
2021-05-05 14:57:25 +00:00
Chun-Hung Wu
14d632886f ANDROID: GKI: enable CONFIG_MTK_TIMER
It's needed by MTK board for reasons below:
After working with built-in mtk timer(timer-mediatek) as
tick-broadcast devices for few weeks, we found some issues caused
by linux timer framework:
1. tick broadcast installed by insmod cannot switch to oneshot
   mode correctly (BUG: 161822795)
2. rcu warning will be shown if we force to re-enabled tick-broadcast
for each cpu when new tick broadcast device is added by insmod
(timer-mediatek.c in our case)

Bug: 161675989
Change-Id: If3056df11d8256f2af4a6928820faed9f690b3db
Signed-off-by: Freddy Hsin <freddy.hsin@mediatek.com>
Signed-off-by: Chun-Hung Wu <chun-hung.wu@mediatek.com>
(cherry picked from commit b995c14df40ff1c8d66525eb1133e3f28a759f54)
2021-05-05 12:14:32 +00:00
Abhijeet Dharmapurikar
f7128c7533 ANDROID: sched: Add vendor hooks for update_topology
Add a vendor hook for modules to know when the topology
code has determined the max capacity of cpus.

Bug: 187234873
Change-Id: Ia3e22479059d2e57500cbdd46504aa4773af6e4a
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
2021-05-05 09:06:55 +00:00
Sandeep Patil
26e61ea36d ANDROID: GKI: Enable CONFIG_EXFAT_FS in gki_defconfig
Bug: 186473897
Test: build/build.sh

Signed-off-by: Sandeep Patil <sspatil@google.com>
Change-Id: I6c97e858e8f1eac0658a46313a71dac73653d63c
2021-05-04 16:05:39 -07:00
Pavankumar Kondeti
29203f8c8f ANDROID: cgroup: Add android_rvh_cgroup_force_kthread_migration
In Android GKI, CONFIG_FAIR_GROUP_SCHED is enabled [1] to help
prioritize important work. Given that CPU shares of root cgroup
can't be changed, leaving the tasks inside root cgroup will give
them higher share compared to the other tasks inside important
cgroups. This is mitigated by moving all tasks inside root cgroup to
a different cgroup after Android is booted. However, there are many
kernel tasks stuck in the root cgroup after the boot.

It is possible to relax kernel threads and kworkers migrations under
certain scenarios. However the patch [2] posted at upstream is not
accepted. Hence add a restricted vendor hook to notify modules when a
kernel thread is requested for cgroup migration. The modules can relax
the restrictions forced by the kernel and allow the cgroup migration.

[1] f08f049de1
[2] https://lore.kernel.org/lkml/1617714261-18111-1-git-send-email-pkondeti@codeaurora.org

Bug: 184594949
Change-Id: I445a170ba797c8bece3b4b59b7a42cdd85438f1f
Signed-off-by: Pavankumar Kondeti <quic_pkondeti@quicinc.com>
2021-05-04 20:13:09 +00:00
Redick Lin
7fe4b54bf0 ANDROID: Update the ABI xml and symbol list
Leaf changes summary: 2 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 int cpufreq_driver_target(cpufreq_policy*, unsigned int, unsigned int)'
  [A] 'function unsigned int cpufreq_get(unsigned int)'

Bug: 175347194
Signed-off-by: Redick Lin <redicklin@google.com>
Change-Id: Id3cafed6b47960bf03e03bd4ce35d1c59a94b2d7
2021-05-04 18:54:19 +00:00
Quentin Perret
2bb3e44126 FROMLIST: sched: Fix out-of-bound access in uclamp
Util-clamp places tasks in different buckets based on their clamp values
for performance reasons. However, the size of buckets is currently
computed using a rounding division, which can lead to an off-by-one
error in some configurations.

For instance, with 20 buckets, the bucket size will be 1024/20=51. A
task with a clamp of 1024 will be mapped to bucket id 1024/51=20. Sadly,
correct indexes are in range [0,19], hence leading to an out of bound
memory access.

Clamp the bucket id to fix the issue.

Bug: 186415778
Fixes: 69842cba9a ("sched/uclamp: Add CPU's clamp buckets refcounting")
Suggested-by: Qais Yousef <qais.yousef@arm.com>
Signed-off-by: Quentin Perret <qperret@google.com>
Reviewed-by: Vincent Guittot <vincent.guittot@linaro.org>
Reviewed-by: Dietmar Eggemann <dietmar.eggemann@arm.com>
Link: https://lore.kernel.org/r/20210430151412.160913-1-qperret@google.com
Change-Id: Ibc28662de5554f80f97533b60e747f8a6e871c56
2021-05-04 09:07:38 +00:00
Minchan Kim
458e81ecf7 ANDROID: mm: spf: fix task fault accounting
SPF has missed per-process fault account logic.
Fix it.

Bug: 187072626
Signed-off-by: Minchan Kim <minchan@google.com>
Change-Id: Ibd854bf350721917ef0be1af65055691d16b52f0
2021-05-03 12:08:04 -07:00
Puma Hsu
348fb920cf ANDROID: Update the ABI xml and symbol list
Leaf changes summary: 2 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 int xhci_bus_resume(usb_hcd*)'
  [A] 'function int xhci_bus_suspend(usb_hcd*)'

Bug: 184595177
Bug: 184608982
Signed-off-by: Puma Hsu <pumahsu@google.com>
Change-Id: I51b52ae0f38a147172c3246d65f5e576f7a2a5ce
2021-05-03 10:59:43 +00:00
Greg Kroah-Hartman
e765451bf1 Merge 5.10.34 into android12-5.10
Changes in 5.10.34
	iwlwifi: Fix softirq/hardirq disabling in iwl_pcie_gen2_enqueue_hcmd()
	mei: me: add Alder Lake P device id.
	Linux 5.10.34

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I05dd0ce2038c3fc8c928e7be9e804584cc4d1e75
2021-05-03 10:27:39 +02:00
Alexander Potapenko
15d55f1f0a Revert "ANDROID: gki_defconfig: temporarily disable KFENCE in GKI"
This reverts commit ef4ff626b3.
Picking  "kfence: await for allocation using wait_event" resulted in
KFENCE spinning no more in toggle_allocation_gate(), which reportedly
fixed the power regression.

Bug: 185280916
Test: power team confirmed there's no regression
Signed-off-by: Alexander Potapenko <glider@google.com>
Change-Id: I65d4206ff9199b06c879e506fd38129df50b393e
2021-05-02 15:58:57 +00:00
Greg Kroah-Hartman
0aa66717f6 Linux 5.10.34
Tested-by: Jon Hunter <jonathanh@nvidia.com>
Tested-by: Fox Chen <foxhlchen@gmail.com>
Tested-by: Linux Kernel Functional Testing <lkft@linaro.org>
Tested-by: Guenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/r/20210430141910.693887691@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-05-02 11:06:09 +02:00
Tomas Winkler
47d54b9901 mei: me: add Alder Lake P device id.
commit 0df74278fa upstream.

Add Alder Lake P device ID.

Cc: <stable@vger.kernel.org>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Link: https://lore.kernel.org/r/20210414045200.3498241-1-tomas.winkler@intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-05-02 11:06:09 +02:00
Jiri Kosina
2a442f1140 iwlwifi: Fix softirq/hardirq disabling in iwl_pcie_gen2_enqueue_hcmd()
commit e7020bb068 upstream.

Analogically to what we did in 2800aadc18 ("iwlwifi: Fix softirq/hardirq
disabling in iwl_pcie_enqueue_hcmd()"), we must apply the same fix to
iwl_pcie_gen2_enqueue_hcmd(), as it's being called from exactly the same
contexts.

Reported-by: Heiner Kallweit <hkallweit1@gmail.com
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/nycvar.YFH.7.76.2104171112390.18270@cbobk.fhfr.pm
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-05-02 11:06:08 +02:00
Adrian Salido
f423a39522 ANDROID: Update the ABI xml and symbol list
Leaf changes summary: 4 artifacts changed
Changed leaf types summary: 0 leaf type changed
Removed/Changed/Added functions summary: 0 Removed, 0 Changed, 4 Added functions
Removed/Changed/Added variables summary: 0 Removed, 0 Changed, 0 Added variable

4 Added functions:

  [A] 'function void __drm_crtc_commit_free(kref*)'
  [A] 'function drm_connector* drm_atomic_get_old_connector_for_encoder(drm_atomic_state*, drm_encoder*)'
  [A] 'function int drm_atomic_nonblocking_commit(drm_atomic_state*)'
  [A] 'function void drm_self_refresh_helper_alter_state(drm_atomic_state*)'

Bug: 186804461
Signed-off-by: Adrian Salido <salidoa@google.com>
Change-Id: I131ef83705661b99e36f40265caabba9882f0577
2021-04-30 21:25:11 +00:00
Pradeep P V K
514f06c0b0 FROMGIT: mmc: sdhci: Check for reset prior to DMA address unmap
For data read commands, SDHC may initiate data transfers even before it
completely process the command response. In case command itself fails,
driver un-maps the memory associated with data transfer but this memory
can still be accessed by SDHC for the already initiated data transfer.
This scenario can lead to un-mapped memory access error.

To avoid this scenario, reset SDHC (when command fails) prior to
un-mapping memory. Resetting SDHC ensures that all in-flight data
transfers are either aborted or completed. So we don't run into this
scenario.

Swap the reset, un-map steps sequence in sdhci_request_done().

Bug: 186781699
(cherry picked from commit 21e35e898a
git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc.git remotes/origin/next)
Link: https://lore.kernel.org/r/1614760331-43499-1-git-send-email-pragalla@qti.qualcomm.com

Suggested-by: Veerabhadrarao Badiganti <vbadigan@codeaurora.org>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Link: https://lore.kernel.org/r/1614760331-43499-1-git-send-email-pragalla@qti.qualcomm.com
Cc: stable@vger.kernel.org # v4.9+
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Pradeep P V K <pragalla@codeaurora.org>
Signed-off-by: Bao D. Nguyen <nguyenb@codeaurora.org>
Change-Id: I547ea7c1b3e2b9026313d6e17b09851eef520c22
2021-04-30 21:19:40 +00:00
Minchan Kim
25a0835d5e ANDROID: ABI: Add symbols for CONFIG_PAGE_PINNER
Add symbols for CONFIG_PAGE_PINNER.

Leaf changes summary: 2 artifacts 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, 1 Added variable

1 Added function:

  [A] 'function void __page_pinner_migration_failed(page*)'

1 Added variable:

  [A] 'static_key_true failure_tracking'

Bug: 183414571
Signed-off-by: Minchan Kim <minchan@google.com>
Change-Id: I2e92636115d1b52137d8019401d487c6fb48407a
2021-04-30 09:13:35 -07:00
Minchan Kim
94acc25d0e ANDROID: GKI: Enable CONFIG_PAGE_PINNER
Enable CONFIG_PAGE_PINNER to help CMA allocation failure debugging.

Bug: 183414571
Signed-off-by: Minchan Kim <minchan@google.com>
Change-Id: Icfa8db8be71acfda0268fffa6f4431f8484b6938
2021-04-30 09:13:35 -07:00
Minchan Kim
d600eedfb6 ANDROID: mm: page_pinner: use put_user_page at unstable_tree_search_insert
KSM uses follow_page with FOLL_GET at several places so they should
use put_user_page to avoid page_pinner false positive.

Bug: 183414571
Signed-off-by: Minchan Kim <minchan@kernel.org>
Signed-off-by: Minchan Kim <minchan@google.com>
Change-Id: I0234eeb5db7d801e70c4884146c3029582b715c1
2021-04-30 09:13:35 -07:00
Minchan Kim
c2b7c24bc1 ANDROID: mm: page_pinner: unattribute follow_page in munlock_vma_pages_range
munlock_vma_pages_range uses follow_page(FOLL_GET) so we need to use
put_user_page to avoid false positive. However, munlock path is quite
complicated to attribute them. At this point, do not make the muck.
Instead just unattribute them to avoid false positive.

Bug: 183414571
Signed-off-by: Minchan Kim <minchan@kernel.org>
Signed-off-by: Minchan Kim <minchan@google.com>
Change-Id: I4776bd1a94247e226b29fceb3879c338e8c7323a
2021-04-30 09:13:35 -07:00
Minchan Kim
ec1dbc10ad ANDROID: mm: page_pinner: use put_user_page at add_page_for_migration
add_page_for_migration uses follow_page with FOLL_GET. Thus,
close the page_pinner false positive by using put_user_page.

Bug: 183414571
Signed-off-by: Minchan Kim <minchan@kernel.org>
Signed-off-by: Minchan Kim <minchan@google.com>
Change-Id: I655b5610bafad86172dcb291573c33176989d94b
2021-04-30 09:13:35 -07:00
Minchan Kim
67668f721b ANDROID: mm: page_pinner: use put_user_page at dump_user_range
dump_user_range uses __get_user_pages_locked with FOLL_GET. Thus,
close the page-pinner false positive using put_user_page.

Bug: 183414571
Signed-off-by: Minchan Kim <minchan@google.com>
Signed-off-by: Minchan Kim <minchan@kernel.org>
Change-Id: Ib343a9f61303655b108d60575edae1249ef687df
2021-04-30 09:13:35 -07:00
Minchan Kim
d14850835c ANDROID: mm: page_pinner: use put_user_page at seq_print_vma_name
seq_print_vma_name uses get_user_pages_remote so it should
use put_user_page to close false positive of page_pinner.

Page pinned via pid 930, ts 38241618218 ns
PFN 10351665 Block 10109 type CMA Flags 0x8000000000080034(uptodate|lru|active|swapbacked)
 __set_page_pinner+0x34/0xb4
 try_grab_page+0x18c/0x1a0
 follow_page_pte+0x2b4/0x4a8
 follow_pmd_mask+0x180/0x4a4
 __get_user_pages+0x1a0/0x434
 __get_user_pages_remote+0xa4/0x28c
 get_user_pages_remote+0x20/0x48
 seq_print_vma_name+0xa4/0x1f4
 show_smap+0x114/0x25c
 seq_read_iter+0x2e8/0x3e8
 seq_read+0xec/0x124
 vfs_read+0xe0/0x2dc
 ksys_read+0x7c/0xec
 __arm64_sys_read+0x20/0x30
 el0_svc_common+0xa4/0x180
 do_el0_svc+0x28/0x88

Bug: 183414571
Signed-off-by: Minchan Kim <minchan@kernel.org>
Signed-off-by: Minchan Kim <minchan@google.com>
Change-Id: Ib81ccbc486877aab5e561ef516cedcbb172736f1
2021-04-30 09:13:35 -07:00
Minchan Kim
2de28a0bdd ANDROID: mm: page_pinner: use put_user_page at fuse_copy_finish
fuse could use get_user_pages_fast by iov_iter_get_pages at
fuse_copy_fill so close the false positive by attributing
it by put_user_page.

Page pinned via pid 670, ts 4554195916 ns
PFN 83125 Block 162 type Movable Flags 0xfffffc008001e(referenced|uptodate|dirty|lru|swapbacked)
 try_grab_compound_head+0x1e8/0x240
 internal_get_user_pages_fast+0x66d/0xca0
 iov_iter_get_pages+0xd4/0x3a0
 fuse_copy_fill+0x197/0x200
 fuse_copy_one+0x6e/0xf0
 fuse_dev_do_read.constprop.0+0x435/0x7e0
 fuse_dev_read+0x5d/0x90
 new_sync_read+0x115/0x1a0
 vfs_read+0xf4/0x180
 ksys_read+0x5f/0xe0
 do_syscall_64+0x33/0x80
 entry_SYSCALL_64_after_hwframe+0x44/0xae

Bug: 183414571
Signed-off-by: Minchan Kim <minchan@kernel.org>
Signed-off-by: Minchan Kim <minchan@google.com>
Change-Id: Idc80d4a34b546f25e8f6dbc68313d39586e914d9
2021-04-30 09:13:35 -07:00
Minchan Kim
f8d9ffe242 ANDROID: mm: page_pinner: use put_user_page at get_futex_key
get_futex_key uses get_user_pages_fast so close the false positive
by using pin_user_page.

Page pinned via pid 686, ts 20096178239 ns
PFN 86760 Block 169 type Movable Flags 0xfffffc0080016(referenced|uptodate|lru|swapbacked)
 try_grab_compound_head+0x1e8/0x240
 internal_get_user_pages_fast+0x66d/0xca0
 get_futex_key+0x8e/0x440
 futex_wake+0x67/0x180
 do_futex+0x7c5/0xb20
 mm_release+0xb6/0xc0
 do_exit+0x1dc/0xa40
 __x64_sys_exit+0x17/0x20
 do_syscall_64+0x33/0x80
 entry_SYSCALL_64_after_hwframe+0x44/0xae

Bug: 183414571
Signed-off-by: Minchan Kim <minchan@kernel.org>
Signed-off-by: Minchan Kim <minchan@google.com>
Change-Id: I217b2712782eb571e68191d201e3781f57caf4d9
2021-04-30 09:13:34 -07:00
Minchan Kim
d3b077bc15 ANDROID: mm: page_pinner: use put_user_page at copy_string
copy_string calls __get_user_pages by copy_strings. Thus,
let's use put_user_page to close the false positive.

Page pinned via pid 905, ts 13725666111 ns
PFN 104188 Block 203 type Movable Flags 0xfffffc0080036(referenced|uptodate|lru|active|swapbacked)
 try_grab_page+0x144/0x160
 follow_page_mask+0x4a1/0x630
 __get_user_pages+0x24e/0x760
 __get_user_pages_remote+0xd4/0x320
 get_arg_page+0x3e/0xa0
 copy_strings.isra.0+0x201/0x380
 do_execveat_common+0x17a/0x1c0
 __x64_sys_execve+0x39/0x50
 do_syscall_64+0x33/0x80
 entry_SYSCALL_64_after_hwframe+0x44/0xae

Bug: 183414571
Signed-off-by: Minchan Kim <minchan@google.com>
Change-Id: I4c515d12f75496741cd80a24cf6ea971006f0bce
2021-04-30 09:13:34 -07:00
Minchan Kim
df9a9d821c ANDROID: mm: page_pinner: use put_user_page at access_remote_vm
/proc/<pid>/cmdline calls __get_user_pages_remote indirectly
so close the false positive reporting by using put_user_page.

Page pinned via pid 792, ts 11450624760 ns
PFN 220828 Block 431 type Movable Flags 0xfffffc0080036(referenced|uptodate|lru|active|swapbacked)
 try_grab_page+0x144/0x160
 follow_page_mask+0x4a1/0x630
 __get_user_pages+0x24e/0x760
 __get_user_pages_remote+0xd4/0x320
 __access_remote_vm+0x110/0x390
 proc_pid_cmdline_read+0x16a/0x3f0
 vfs_read+0x98/0x180
 ksys_read+0x5f/0xe0
 do_syscall_64+0x33/0x80
 entry_SYSCALL_64_after_hwframe+0x44/0xae

Bug: 183414571
Signed-off-by: Minchan Kim <minchan@kernel.org>
Signed-off-by: Minchan Kim <minchan@google.com>
Change-Id: I88625af49600b82f6f96157d69988fbda455d819
2021-04-30 09:13:34 -07:00