Commit Graph

1156027 Commits

Author SHA1 Message Date
Rafael J. Wysocki
e1a20dd9ff UPSTREAM: async: Introduce async_schedule_dev_nocall()
In preparation for subsequent changes, introduce a specialized variant
of async_schedule_dev() that will not invoke the argument function
synchronously when it cannot be scheduled for asynchronous execution.

The new function, async_schedule_dev_nocall(), will be used for fixing
possible deadlocks in the system-wide power management core code.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com> for the series.
Tested-by: Youngmin Nam <youngmin.nam@samsung.com>
Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
Bug: 319759660
Change-Id: I497f1a9655d80c2d9710c3c814f6a99a31bcf019
(cherry picked from commit 7d4b5d7a37bdd63a5a3371b988744b060d5bb86f)
Signed-off-by: Youngmin Nam <youngmin.nam@samsung.com>
2024-01-19 09:02:31 +00:00
Rafael J. Wysocki
e4b0e14f83 UPSTREAM: async: Split async_schedule_node_domain()
In preparation for subsequent changes, split async_schedule_node_domain()
in two pieces so as to allow the bottom part of it to be called from a
somewhat different code path.

No functional impact.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com>
Tested-by: Youngmin Nam <youngmin.nam@samsung.com>
Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
Bug: 319759660
Change-Id: I6405b388d9a0286208b48f7a321b0042d85abb4b
(cherry picked from commit 6aa09a5bccd8e224d917afdb4c278fc66aacde4d)
Signed-off-by: Youngmin Nam <youngmin.nam@samsung.com>
2024-01-19 09:02:31 +00:00
Carlos Galo
6b4c816d17 FROMGIT: BACKPORT: mm: update mark_victim tracepoints fields
The current implementation of the mark_victim tracepoint provides only the
process ID (pid) of the victim process.  This limitation poses challenges
for userspace tools that need additional information about the OOM victim.
The association between pid and the additional data may be lost after the
kill, making it difficult for userspace to correlate the OOM event with
the specific process.

In order to mitigate this limitation, add the following fields:

- UID
   In Android each installed application has a unique UID. Including
   the `uid` assists in correlating OOM events with specific apps.

- Process Name (comm)
   Enables identification of the affected process.

- OOM Score
   Allows userspace to get additional insights of the relative kill
   priority of the OOM victim.

Link: https://lkml.kernel.org/r/20240111210539.636607-1-carlosgalo@google.com
Change-Id: Icc3ed013a9dfff9bb09f1d7588757e6028c17069
Signed-off-by: Carlos Galo <carlosgalo@google.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Suren Baghdasaryan <surenb@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
(cherry picked from commit 649ffb4cbb90a7f60f17dd74e57d814e762ea01d mm-unstable)
[ carlosgalo: Manually added struct cred change in mark_oom_victim function ]

Bug: 315560026
Change-Id: I81fb6f3447f432100ad4cd25e22db23768003388
Signed-off-by: Carlos Galo <carlosgalo@google.com>
2024-01-19 00:27:34 +00:00
Qais Yousef
d97ea65296 ANDROID: Enable CONFIG_LAZY_RCU in arm64 gki_defconfig
It is still disabled by default. Must specify
rcutree.android_enable_rcu_lazy and rcu_nocbs=all in boot time parameter
to actually enable it.

Bug: 258241771
Change-Id: I11c920aa5edde2fc42ab54245cd198eb8cb47616
Signed-off-by: Qais Yousef <qyousef@google.com>
2024-01-19 00:10:44 +00:00
Qais Yousef
90d68cedd1 FROMLIST: rcu: Provide a boot time parameter to control lazy RCU
To allow more flexible arrangements while still provide a single kernel
for distros, provide a boot time parameter to enable/disable lazy RCU.

Specify:

	rcutree.enable_rcu_lazy=[y|1|n|0]

Which also requires

	rcu_nocbs=all

at boot time to enable/disable lazy RCU.

To disable it by default at build time when CONFIG_RCU_LAZY=y, the new
CONFIG_RCU_LAZY_DEFAULT_OFF can be used.

Bug: 258241771
Signed-off-by: Qais Yousef (Google) <qyousef@layalina.io>
Tested-by: Andrea Righi <andrea.righi@canonical.com>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Link: https://lore.kernel.org/lkml/20231203011252.233748-1-qyousef@layalina.io/
[Fix trivial conflicts rejecting newer code that doesn't exist on 6.1]
Signed-off-by: Qais Yousef <qyousef@google.com>
Change-Id: Ib5585ae717a2ba7749f2802101b785c4e5de8a90
2024-01-19 00:10:44 +00:00
Joel Fernandes (Google)
a079cc5876 ANDROID: rcu: Add a minimum time for marking boot as completed
On many systems, a great deal of boot (in userspace) happens after the
kernel thinks the boot has completed. It is difficult to determine if
the system has really booted from the kernel side. Some features like
lazy-RCU can risk slowing down boot time if, say, a callback has been
added that the boot synchronously depends on. Further expedited callbacks
can get unexpedited way earlier than it should be, thus slowing down
boot (as shown in the data below).

For these reasons, this commit adds a config option
'CONFIG_RCU_BOOT_END_DELAY' and a boot parameter rcupdate.boot_end_delay.
Userspace can also make RCU's view of the system as booted, by writing the
time in milliseconds to: /sys/module/rcupdate/parameters/rcu_boot_end_delay
Or even just writing a value of 0 to this sysfs node.
However, under no circumstance will the boot be allowed to end earlier
than just before init is launched.

The default value of CONFIG_RCU_BOOT_END_DELAY is chosen as 15s. This
suites ChromeOS and also a PREEMPT_RT system below very well, which need
no config or parameter changes, and just a simple application of this patch. A
system designer can also choose a specific value here to keep RCU from marking
boot completion.  As noted earlier, RCU's perspective of the system as booted
will not be marker until at least rcu_boot_end_delay milliseconds have passed
or an update is made via writing a small value (or 0) in milliseconds to:
/sys/module/rcupdate/parameters/rcu_boot_end_delay.

One side-effect of this patch is, there is a risk that a real-time workload
launched just after the kernel boots will suffer interruptions due to expedited
RCU, which previous ended just before init was launched. However, to mitigate
such an issue (however unlikely), the user should either tune
CONFIG_RCU_BOOT_END_DELAY to a smaller value than 15 seconds or write a value
of 0 to /sys/module/rcupdate/parameters/rcu_boot_end_delay, once userspace
boots, and before launching the real-time workload.

Qiuxu also noted impressive boot-time improvements with earlier version
of patch. An excerpt from the data he shared:

1) Testing environment:
    OS            : CentOS Stream 8 (non-RT OS)
    Kernel     : v6.2
    Machine : Intel Cascade Lake server (2 sockets, each with 44 logical threads)
    Qemu  args  : -cpu host -enable-kvm, -smp 88,threads=2,sockets=2, …

2) OS boot time definition:
    The time from the start of the kernel boot to the shell command line
    prompt is shown from the console. [ Different people may have
    different OS boot time definitions. ]

3) Measurement method (very rough method):
    A timer in the kernel periodically prints the boot time every 100ms.
    As soon as the shell command line prompt is shown from the console,
    we record the boot time printed by the timer, then the printed boot
    time is the OS boot time.

4) Measured OS boot time (in seconds)
   a) Measured 10 times w/o this patch:
        8.7s, 8.4s, 8.6s, 8.2s, 9.0s, 8.7s, 8.8s, 9.3s, 8.8s, 8.3s
        The average OS boot time was: ~8.7s

   b) Measure 10 times w/ this patch:
        8.5s, 8.2s, 7.6s, 8.2s, 8.7s, 8.2s, 7.8s, 8.2s, 9.3s, 8.4s
        The average OS boot time was: ~8.3s.

(CHROMIUM tag rationale: Submitted upstream but got lots of pushback as
it may harm a PREEMPT_RT system -- the concern is VERY theoretical and
this improves things for ChromeOS. Plus we are not a PREEMPT_RT system.
So I am strongly suggesting this mostly simple change for ChromeOS.)

Bug: 258241771
Tested-by: Qiuxu Zhuo <qiuxu.zhuo@intel.com>
Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/4350228
Commit-Queue: Joel Fernandes <joelaf@google.com>
Commit-Queue: Vineeth Pillai <vineethrp@google.com>
Tested-by: Vineeth Pillai <vineethrp@google.com>
Tested-by: Joel Fernandes <joelaf@google.com>
Reviewed-by: Vineeth Pillai <vineethrp@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/4909180
Signed-off-by: Qais Yousef <qyousef@google.com>
Change-Id: Ibd262189d7f92dbcc57f1508efe90fcfba95a6cc
2024-01-19 00:10:44 +00:00
Joel Fernandes (Google)
ffe09c06a8 UPSTREAM: rcu: Disable laziness if lazy-tracking says so
During suspend, we see failures to suspend 1 in 300-500 suspends.
Looking closer, it appears that asynchronous RCU callbacks are being
queued as lazy even though synchronous callbacks are expedited. These
delays appear to not be very welcome by the suspend/resume code as
evidenced by these occasional suspend failures.

This commit modifies call_rcu() to check if rcu_async_should_hurry(),
which will return true if we are in suspend or in-kernel boot.

[ paulmck: Alphabetize local variables. ]

Ignoring the lazy hint makes the 3000 suspend/resume cycles pass
reliably on a 12th gen 12-core Intel CPU, and there is some evidence
that it also slightly speeds up boot performance.

Fixes: 3cb278e73b ("rcu: Make call_rcu() lazy to save power")
Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
(cherry picked from commit cf7066b97e)

Bug: 258241771
Signed-off-by: Joel Fernandes <joelaf@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/4909179
Reviewed-by: Vineeth Pillai <vineethrp@google.com>
Reviewed-by: Ross Zwisler <zwisler@google.com>
Reviewed-by: Sean Paul <sean@poorly.run>
Signed-off-by: Qais Yousef <qyousef@google.com>
Change-Id: I4cfe6f43de8bae9a6c034831c79d9773199d6d29
2024-01-19 00:10:44 +00:00
Joel Fernandes (Google)
d07488d26e UPSTREAM: rcu: Track laziness during boot and suspend
Boot and suspend/resume should not be slowed down in kernels built with
CONFIG_RCU_LAZY=y.  In particular, suspend can sometimes fail in such
kernels.

This commit therefore adds rcu_async_hurry(), rcu_async_relax(), and
rcu_async_should_hurry() functions that track whether or not either
a boot or a suspend/resume operation is in progress.  This will
enable a later commit to refrain from laziness during those times.

Export rcu_async_should_hurry(), rcu_async_hurry(), and rcu_async_relax()
for later use by rcutorture.

[ paulmck: Apply feedback from Steve Rostedt. ]

Fixes: 3cb278e73b ("rcu: Make call_rcu() lazy to save power")
Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
(cherry picked from commit 6efdda8bec)

Bug: 258241771
Signed-off-by: Joel Fernandes <joelaf@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/4909178
Reviewed-by: Ross Zwisler <zwisler@google.com>
Reviewed-by: Sean Paul <sean@poorly.run>
Reviewed-by: Vineeth Pillai <vineethrp@google.com>
Signed-off-by: Qais Yousef <qyousef@google.com>
Change-Id: Ieb2f2d484a33cfbd71f71c8e3dbcfc05cd7efe8c
2024-01-19 00:10:44 +00:00
Joel Fernandes (Google)
4316bd568b UPSTREAM: net: Use call_rcu_hurry() for dst_release()
In a networking test on ChromeOS, kernels built with the new
CONFIG_RCU_LAZY=y Kconfig option fail a networking test in the teardown
phase.

This failure may be reproduced as follows: ip netns del <name>

The CONFIG_RCU_LAZY=y Kconfig option was introduced by earlier commits
in this series for the benefit of certain battery-powered systems.
This Kconfig option causes call_rcu() to delay its callbacks in order
to batch them.  This means that a given RCU grace period covers more
callbacks, thus reducing the number of grace periods, in turn reducing
the amount of energy consumed, which increases battery lifetime which
can be a very good thing.  This is not a subtle effect: In some important
use cases, the battery lifetime is increased by more than 10%.

This CONFIG_RCU_LAZY=y option is available only for CPUs that offload
callbacks, for example, CPUs mentioned in the rcu_nocbs kernel boot
parameter passed to kernels built with CONFIG_RCU_NOCB_CPU=y.

Delaying callbacks is normally not a problem because most callbacks do
nothing but free memory.  If the system is short on memory, a shrinker
will kick all currently queued lazy callbacks out of their laziness,
thus freeing their memory in short order.  Similarly, the rcu_barrier()
function, which blocks until all currently queued callbacks are invoked,
will also kick lazy callbacks, thus enabling rcu_barrier() to complete
in a timely manner.

However, there are some cases where laziness is not a good option.
For example, synchronize_rcu() invokes call_rcu(), and blocks until
the newly queued callback is invoked.  It would not be a good for
synchronize_rcu() to block for ten seconds, even on an idle system.
Therefore, synchronize_rcu() invokes call_rcu_hurry() instead of
call_rcu().  The arrival of a non-lazy call_rcu_hurry() callback on a
given CPU kicks any lazy callbacks that might be already queued on that
CPU.  After all, if there is going to be a grace period, all callbacks
might as well get full benefit from it.

Yes, this could be done the other way around by creating a
call_rcu_lazy(), but earlier experience with this approach and
feedback at the 2022 Linux Plumbers Conference shifted the approach
to call_rcu() being lazy with call_rcu_hurry() for the few places
where laziness is inappropriate.

Returning to the test failure, use of ftrace showed that this failure
cause caused by the aadded delays due to this new lazy behavior of
call_rcu() in kernels built with CONFIG_RCU_LAZY=y.

Therefore, make dst_release() use call_rcu_hurry() in order to revert
to the old test-failure-free behavior.

[ paulmck: Apply s/call_rcu_flush/call_rcu_hurry/ feedback from Tejun Heo. ]

Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>
Cc: David Ahern <dsahern@kernel.org>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Paolo Abeni <pabeni@redhat.com>
Cc: <netdev@vger.kernel.org>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
(cherry picked from commit 483c26ff63)

Bug: 258241771
Signed-off-by: Joel Fernandes <joelaf@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/4909041
Reviewed-by: Sean Paul <sean@poorly.run>
Reviewed-by: Ross Zwisler <zwisler@google.com>
Reviewed-by: Vineeth Pillai <vineethrp@google.com>
Signed-off-by: Qais Yousef <qyousef@google.com>
Change-Id: Ifd64083bd210a9dfe94c179152f27d310c179507
2024-01-19 00:10:44 +00:00
Uladzislau Rezki
b9427245f0 UPSTREAM: workqueue: Make queue_rcu_work() use call_rcu_hurry()
Earlier commits in this series allow battery-powered systems to build
their kernels with the default-disabled CONFIG_RCU_LAZY=y Kconfig option.
This Kconfig option causes call_rcu() to delay its callbacks in order
to batch them.  This means that a given RCU grace period covers more
callbacks, thus reducing the number of grace periods, in turn reducing
the amount of energy consumed, which increases battery lifetime which
can be a very good thing.  This is not a subtle effect: In some important
use cases, the battery lifetime is increased by more than 10%.

This CONFIG_RCU_LAZY=y option is available only for CPUs that offload
callbacks, for example, CPUs mentioned in the rcu_nocbs kernel boot
parameter passed to kernels built with CONFIG_RCU_NOCB_CPU=y.

Delaying callbacks is normally not a problem because most callbacks do
nothing but free memory.  If the system is short on memory, a shrinker
will kick all currently queued lazy callbacks out of their laziness,
thus freeing their memory in short order.  Similarly, the rcu_barrier()
function, which blocks until all currently queued callbacks are invoked,
will also kick lazy callbacks, thus enabling rcu_barrier() to complete
in a timely manner.

However, there are some cases where laziness is not a good option.
For example, synchronize_rcu() invokes call_rcu(), and blocks until
the newly queued callback is invoked.  It would not be a good for
synchronize_rcu() to block for ten seconds, even on an idle system.
Therefore, synchronize_rcu() invokes call_rcu_hurry() instead of
call_rcu().  The arrival of a non-lazy call_rcu_hurry() callback on a
given CPU kicks any lazy callbacks that might be already queued on that
CPU.  After all, if there is going to be a grace period, all callbacks
might as well get full benefit from it.

Yes, this could be done the other way around by creating a
call_rcu_lazy(), but earlier experience with this approach and
feedback at the 2022 Linux Plumbers Conference shifted the approach
to call_rcu() being lazy with call_rcu_hurry() for the few places
where laziness is inappropriate.

And another call_rcu() instance that cannot be lazy is the one
in queue_rcu_work(), given that callers to queue_rcu_work() are
not necessarily OK with long delays.

Therefore, make queue_rcu_work() use call_rcu_hurry() in order to revert
to the old behavior.

[ paulmck: Apply s/call_rcu_flush/call_rcu_hurry/ feedback from Tejun Heo. ]

Signed-off-by: Uladzislau Rezki <urezki@gmail.com>
Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>
Acked-by: Tejun Heo <tj@kernel.org>
Cc: Lai Jiangshan <jiangshanlai@gmail.com>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
(cherry picked from commit a7e30c0e9a)

Bug: 258241771
Signed-off-by: Joel Fernandes <joelaf@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/4909040
Reviewed-by: Sean Paul <sean@poorly.run>
Reviewed-by: Ross Zwisler <zwisler@google.com>
Reviewed-by: Vineeth Pillai <vineethrp@google.com>
Signed-off-by: Qais Yousef <qyousef@google.com>
Change-Id: I1dd4cedd1fb02626fa47f88a7fbaa7cacfa95d11
2024-01-19 00:10:44 +00:00
Joel Fernandes (Google)
72fdf7f606 UPSTREAM: percpu-refcount: Use call_rcu_hurry() for atomic switch
Earlier commits in this series allow battery-powered systems to build
their kernels with the default-disabled CONFIG_RCU_LAZY=y Kconfig option.
This Kconfig option causes call_rcu() to delay its callbacks in order to
batch callbacks.  This means that a given RCU grace period covers more
callbacks, thus reducing the number of grace periods, in turn reducing
the amount of energy consumed, which increases battery lifetime which
can be a very good thing.  This is not a subtle effect: In some important
use cases, the battery lifetime is increased by more than 10%.

This CONFIG_RCU_LAZY=y option is available only for CPUs that offload
callbacks, for example, CPUs mentioned in the rcu_nocbs kernel boot
parameter passed to kernels built with CONFIG_RCU_NOCB_CPU=y.

Delaying callbacks is normally not a problem because most callbacks do
nothing but free memory.  If the system is short on memory, a shrinker
will kick all currently queued lazy callbacks out of their laziness,
thus freeing their memory in short order.  Similarly, the rcu_barrier()
function, which blocks until all currently queued callbacks are invoked,
will also kick lazy callbacks, thus enabling rcu_barrier() to complete
in a timely manner.

However, there are some cases where laziness is not a good option.
For example, synchronize_rcu() invokes call_rcu(), and blocks until
the newly queued callback is invoked.  It would not be a good for
synchronize_rcu() to block for ten seconds, even on an idle system.
Therefore, synchronize_rcu() invokes call_rcu_hurry() instead of
call_rcu().  The arrival of a non-lazy call_rcu_hurry() callback on a
given CPU kicks any lazy callbacks that might be already queued on that
CPU.  After all, if there is going to be a grace period, all callbacks
might as well get full benefit from it.

Yes, this could be done the other way around by creating a
call_rcu_lazy(), but earlier experience with this approach and
feedback at the 2022 Linux Plumbers Conference shifted the approach
to call_rcu() being lazy with call_rcu_hurry() for the few places
where laziness is inappropriate.

And another call_rcu() instance that cannot be lazy is the one on the
percpu refcounter's "per-CPU to atomic switch" code path, which
uses RCU when switching to atomic mode.  The enqueued callback
wakes up waiters waiting in the percpu_ref_switch_waitq.  Allowing
this callback to be lazy would result in unacceptable slowdowns for
users of per-CPU refcounts, such as blk_pre_runtime_suspend().

Therefore, make __percpu_ref_switch_to_atomic() use call_rcu_hurry()
in order to revert to the old behavior.

[ paulmck: Apply s/call_rcu_flush/call_rcu_hurry/ feedback from Tejun Heo. ]

Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>
Acked-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Cc: Dennis Zhou <dennis@kernel.org>
Cc: Christoph Lameter <cl@linux.com>
Cc: <linux-mm@kvack.org>
(cherry picked from commit 343a72e5e3)

Bug: 258241771
Signed-off-by: Joel Fernandes <joelaf@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/4909039
Reviewed-by: Sean Paul <sean@poorly.run>
Reviewed-by: Vineeth Pillai <vineethrp@google.com>
Reviewed-by: Ross Zwisler <zwisler@google.com>
Signed-off-by: Qais Yousef <qyousef@google.com>
Change-Id: Icc325f69d0df1a37b6f1de02a284e1fabf20e366
2024-01-19 00:10:44 +00:00
Dylan Yudaken
ced65a053b UPSTREAM: io_uring: use call_rcu_hurry if signaling an eventfd
io_uring uses call_rcu in the case it needs to signal an eventfd as a
result of an eventfd signal, since recursing eventfd signals are not
allowed. This should be calling the new call_rcu_hurry API to not delay
the signal.

Signed-off-by: Dylan Yudaken <dylany@meta.com>

Cc: Joel Fernandes (Google) <joel@joelfernandes.org>
Cc: Paul E. McKenney <paulmck@kernel.org>
Acked-by: Paul E. McKenney <paulmck@kernel.org>
Reviewed-by: Joel Fernandes (Google) <joel@joelfernandes.org>
Link: https://lore.kernel.org/r/20221215184138.795576-1-dylany@meta.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
(cherry picked from commit 44a84da452)

Bug: 258241771
Signed-off-by: Joel Fernandes <joelaf@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/4909038
Reviewed-by: Vineeth Pillai <vineethrp@google.com>
Reviewed-by: Ross Zwisler <zwisler@google.com>
Reviewed-by: Sean Paul <sean@poorly.run>
Signed-off-by: Qais Yousef <qyousef@google.com>
Change-Id: Iec189c9ce0a95ccacda81f58bf7d49a575a6ab3f
2024-01-19 00:10:44 +00:00
Paul E. McKenney
84c8157d06 UPSTREAM: rcu: Update synchronize_rcu_mult() comment for call_rcu_hurry()
Those who have worked with RCU for some time will naturally think in
terms of the long-standing call_rcu() API rather than the much newer
call_rcu_hurry() API.  But it is call_rcu_hurry() that you should normally
pass to synchronize_rcu_mult().  This commit therefore updates the header
comment to point this out.

Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Reviewed-by: Joel Fernandes (Google) <joel@joelfernandes.org>
(cherry picked from commit 6716f4d39c)

Bug: 258241771
Signed-off-by: Joel Fernandes <joelaf@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/4909037
Reviewed-by: Ross Zwisler <zwisler@google.com>
Reviewed-by: Sean Paul <sean@poorly.run>
Reviewed-by: Vineeth Pillai <vineethrp@google.com>
Signed-off-by: Qais Yousef <qyousef@google.com>
Change-Id: I0d701825ddd7e15cebd92190388fbf78c04d26fb
2024-01-19 00:10:44 +00:00
Uladzislau Rezki
3751416eeb UPSTREAM: scsi/scsi_error: Use call_rcu_hurry() instead of call_rcu()
Earlier commits in this series allow battery-powered systems to build
their kernels with the default-disabled CONFIG_RCU_LAZY=y Kconfig option.
This Kconfig option causes call_rcu() to delay its callbacks in order
to batch them.  This means that a given RCU grace period covers more
callbacks, thus reducing the number of grace periods, in turn reducing
the amount of energy consumed, which increases battery lifetime which
can be a very good thing.  This is not a subtle effect: In some important
use cases, the battery lifetime is increased by more than 10%.

This CONFIG_RCU_LAZY=y option is available only for CPUs that offload
callbacks, for example, CPUs mentioned in the rcu_nocbs kernel boot
parameter passed to kernels built with CONFIG_RCU_NOCB_CPU=y.

Delaying callbacks is normally not a problem because most callbacks do
nothing but free memory.  If the system is short on memory, a shrinker
will kick all currently queued lazy callbacks out of their laziness,
thus freeing their memory in short order.  Similarly, the rcu_barrier()
function, which blocks until all currently queued callbacks are invoked,
will also kick lazy callbacks, thus enabling rcu_barrier() to complete
in a timely manner.

However, there are some cases where laziness is not a good option.
For example, synchronize_rcu() invokes call_rcu(), and blocks until
the newly queued callback is invoked.  It would not be a good for
synchronize_rcu() to block for ten seconds, even on an idle system.
Therefore, synchronize_rcu() invokes call_rcu_hurry() instead of
call_rcu().  The arrival of a non-lazy call_rcu_hurry() callback on a
given CPU kicks any lazy callbacks that might be already queued on that
CPU.  After all, if there is going to be a grace period, all callbacks
might as well get full benefit from it.

Yes, this could be done the other way around by creating a
call_rcu_lazy(), but earlier experience with this approach and
feedback at the 2022 Linux Plumbers Conference shifted the approach
to call_rcu() being lazy with call_rcu_hurry() for the few places
where laziness is inappropriate.

And another call_rcu() instance that cannot be lazy is the one in the
scsi_eh_scmd_add() function.  Leaving this instance lazy results in
unacceptably slow boot times.

Therefore, make scsi_eh_scmd_add() use call_rcu_hurry() in order to
revert to the old behavior.

[ paulmck: Apply s/call_rcu_flush/call_rcu_hurry/ feedback from Tejun Heo. ]

Tested-by: Joel Fernandes (Google) <joel@joelfernandes.org>
Signed-off-by: Uladzislau Rezki <urezki@gmail.com>
Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>
Cc: "James E.J. Bottomley" <jejb@linux.ibm.com>
Cc: <linux-scsi@vger.kernel.org>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Acked-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
(cherry picked from commit 54d87b0a0c)

Bug: 258241771
Signed-off-by: Joel Fernandes <joelaf@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/4909036
Reviewed-by: Vineeth Pillai <vineethrp@google.com>
Reviewed-by: Sean Paul <sean@poorly.run>
Signed-off-by: Qais Yousef <qyousef@google.com>
Change-Id: I95bba865e582b0a12b1c09ba1f0bd4f897401c07
2024-01-19 00:10:44 +00:00
Joel Fernandes (Google)
52193e9489 UPSTREAM: rcu/rcutorture: Use call_rcu_hurry() where needed
call_rcu() changes to save power will change the behavior of rcutorture
tests. Use the call_rcu_hurry() API instead which reverts to the old
behavior.

[ paulmck: Apply s/call_rcu_flush/call_rcu_hurry/ feedback from Tejun Heo. ]

Reported-by: Paul E. McKenney <paulmck@kernel.org>
Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
(cherry picked from commit 405d8e91f0)

Bug: 258241771
Signed-off-by: Joel Fernandes <joelaf@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/4909035
Reviewed-by: Sean Paul <sean@poorly.run>
Reviewed-by: Vineeth Pillai <vineethrp@google.com>
Signed-off-by: Qais Yousef <qyousef@google.com>
Change-Id: I8008990dfe7e64f511aada006e736b15cdd0d61e
2024-01-19 00:10:44 +00:00
Joel Fernandes (Google)
83f8ba569f UPSTREAM: rcu/rcuscale: Use call_rcu_hurry() for async reader test
rcuscale uses call_rcu() to queue async readers. With recent changes to
save power, the test will have fewer async readers in flight. Use the
call_rcu_hurry() API instead to revert to the old behavior.

[ paulmck: Apply s/call_rcu_flush/call_rcu_hurry/ feedback from Tejun Heo. ]

Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
(cherry picked from commit 723df859d8)

Bug: 258241771
Signed-off-by: Joel Fernandes <joelaf@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/4909034
Reviewed-by: Sean Paul <sean@poorly.run>
Reviewed-by: Vineeth Pillai <vineethrp@google.com>
Signed-off-by: Qais Yousef <qyousef@google.com>
Change-Id: I680dacb44e81e210e2e4455f28e50b9b516222a8
2024-01-19 00:10:44 +00:00
Joel Fernandes (Google)
9b625f4978 UPSTREAM: rcu/sync: Use call_rcu_hurry() instead of call_rcu
call_rcu() changes to save power will slow down rcu sync. Use the
call_rcu_hurry() API instead which reverts to the old behavior.

[ paulmck: Apply s/call_rcu_flush/call_rcu_hurry/ feedback from Tejun Heo. ]

Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
(cherry picked from commit 7651d6b250)

Bug: 258241771
Signed-off-by: Joel Fernandes <joelaf@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/4909033
Reviewed-by: Vineeth Pillai <vineethrp@google.com>
Reviewed-by: Sean Paul <sean@poorly.run>
Signed-off-by: Qais Yousef <qyousef@google.com>
Change-Id: I5123ba52f47676305dbcfa1233bf3b41f140766c
2024-01-19 00:10:44 +00:00
Vineeth Pillai
c570c8fea3 BACKPORT: rcu: Shrinker for lazy rcu
The shrinker is used to speed up the free'ing of memory potentially held
by RCU lazy callbacks. RCU kernel module test cases show this to be
effective. Test is introduced in a later patch.

Signed-off-by: Vineeth Pillai <vineeth@bitbyteword.org>
Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
(cherry picked from commit c945b4da7a)

Conflicts:
   kernel/rcu/tree_nocb.h

Trivial conflict due to: "rcu/nocb: Add an option to offload all CPUs on boot"

Bug: 258241771
Signed-off-by: Joel Fernandes <joelaf@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/4909032
Reviewed-by: Vineeth Pillai <vineethrp@google.com>
Signed-off-by: Qais Yousef <qyousef@google.com>
Change-Id: I6a73a9dae79ff35feca37abe2663e55a0f46dda8
2024-01-19 00:10:44 +00:00
Joel Fernandes (Google)
4957579439 UPSTREAM: rcu: Refactor code a bit in rcu_nocb_do_flush_bypass()
This consolidates the code a bit and makes it cleaner. Functionally it
is the same.

Reported-by: Paul E. McKenney <paulmck@kernel.org>
Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>
Reviewed-by: Frederic Weisbecker <frederic@kernel.org>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
(cherry picked from commit 3d222a0c0c)

Bug: 258241771
Signed-off-by: Joel Fernandes <joelaf@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/4909031
Reviewed-by: Sean Paul <sean@poorly.run>
Reviewed-by: Vineeth Pillai <vineethrp@google.com>
Signed-off-by: Qais Yousef <qyousef@google.com>
Change-Id: I8422c7138edd6a476fc46374beefdf46dd76b8b0
2024-01-19 00:10:44 +00:00
Joel Fernandes (Google)
66a832fe38 UPSTREAM: rcu: Make call_rcu() lazy to save power
Implement timer-based RCU callback batching (also known as lazy
callbacks). With this we save about 5-10% of power consumed due
to RCU requests that happen when system is lightly loaded or idle.

By default, all async callbacks (queued via call_rcu) are marked
lazy. An alternate API call_rcu_hurry() is provided for the few users,
for example synchronize_rcu(), that need the old behavior.

The batch is flushed whenever a certain amount of time has passed, or
the batch on a particular CPU grows too big. Also memory pressure will
flush it in a future patch.

To handle several corner cases automagically (such as rcu_barrier() and
hotplug), we re-use bypass lists which were originally introduced to
address lock contention, to handle lazy CBs as well. The bypass list
length has the lazy CB length included in it. A separate lazy CB length
counter is also introduced to keep track of the number of lazy CBs.

[ paulmck: Fix formatting of inline call_rcu_lazy() definition. ]
[ paulmck: Apply Zqiang feedback. ]
[ paulmck: Apply s/call_rcu_flush/call_rcu_hurry/ feedback from Tejun Heo. ]

Suggested-by: Paul McKenney <paulmck@kernel.org>
Acked-by: Frederic Weisbecker <frederic@kernel.org>
Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
(cherry picked from commit 3cb278e73b)

Bug: 258241771
Signed-off-by: Joel Fernandes <joelaf@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/4909030
Reviewed-by: Vineeth Pillai <vineethrp@google.com>
Signed-off-by: Qais Yousef <qyousef@google.com>
Change-Id: I557d5af2a5d317bd66e9ec55ed40822bb5c54390
2024-01-19 00:10:44 +00:00
Frederic Weisbecker
4fb09fb4f7 UPSTREAM: rcu: Fix missing nocb gp wake on rcu_barrier()
In preparation for RCU lazy changes, wake up the RCU nocb gp thread if
needed after an entrain.  This change prevents the RCU barrier callback
from waiting in the queue for several seconds before the lazy callbacks
in front of it are serviced.

Reported-by: Joel Fernandes (Google) <joel@joelfernandes.org>
Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
(cherry picked from commit b8f7aca3f0)

Bug: 258241771
Signed-off-by: Joel Fernandes <joelaf@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/4909029
Reviewed-by: Sean Paul <sean@poorly.run>
Reviewed-by: Vineeth Pillai <vineethrp@google.com>
Signed-off-by: Qais Yousef <qyousef@google.com>
Change-Id: Ib55c5886764b74df22531eca35f076ef7acc08dd
2024-01-19 00:10:44 +00:00
Joel Fernandes (Google)
64c59ad2c3 UPSTREAM: rcu: Fix late wakeup when flush of bypass cblist happens
When the bypass cblist gets too big or its timeout has occurred, it is
flushed into the main cblist. However, the bypass timer is still running
and the behavior is that it would eventually expire and wake the GP
thread.

Since we are going to use the bypass cblist for lazy CBs, do the wakeup
soon as the flush for "too big or too long" bypass list happens.
Otherwise, long delays can happen for callbacks which get promoted from
lazy to non-lazy.

This is a good thing to do anyway (regardless of future lazy patches),
since it makes the behavior consistent with behavior of other code paths
where flushing into the ->cblist makes the GP kthread into a
non-sleeping state quickly.

[ Frederic Weisbecker: Changes to avoid unnecessary GP-thread wakeups plus
		    comment changes. ]

Reviewed-by: Frederic Weisbecker <frederic@kernel.org>
Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
(cherry picked from commit b50606f35f)

Bug: 258241771
Signed-off-by: Joel Fernandes <joelaf@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/4909028
Reviewed-by: Vineeth Pillai <vineethrp@google.com>
Reviewed-by: Sean Paul <sean@poorly.run>
Signed-off-by: Qais Yousef <qyousef@google.com>
Change-Id: If8da96d7ba6ed90a2a70f7d56f7bb03af44fd649
2024-01-19 00:10:44 +00:00
Vamsidhar reddy Gaddam
0799ace265 ANDROID: Update the ABI symbol list
Adding the following symbols:
 - dma_buf_map_attachment_unlocked
 - dma_buf_unmap_attachment_unlocked
 - register_kretprobe
 - unregister_kretprobe

Bug: 315267052
Change-Id: I676d5634d8e7903a12bfa2c036ce938272382aef
Signed-off-by: Vamsidhar reddy Gaddam <gvamsi@google.com>
2024-01-18 23:58:21 +00:00
dae.seo
65db2f8ed3 ANDROID: GKI: add GKI symbol list for Exynosauto SoC
This patch adds GKI symbol list for Exynosauto Soc.
We need to add 1 function(flush_signals) symbol to send buffer
to other domains.

1 function symbol(s) added
  'void flush_signals(struct task_struct*)'

Bug: 320368458
Signed-off-by: Daehyun Seo <dae.seo@samsung.com>
Change-Id: I66a9264b70dc24f30029b413077363996b3339cd
2024-01-18 23:42:51 +00:00
Yabin Cui
cfe8cce4e8 UPSTREAM: coresight: tmc: Don't enable TMC when it's not ready.
If TMC ETR is enabled without being ready, in later use we may
see AXI bus errors caused by accessing invalid addresses.

Bug: 256184860
Change-Id: I9c0b8c7af63a2e2e7469a8537bc721ec6ae6679c
Signed-off-by: Yabin Cui <yabinc@google.com>
[ Tweak error message ]
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Link: https://lore.kernel.org/r/20230127231001.1920947-1-yabinc@google.com
(cherry picked from commit 669c461423)
2024-01-17 15:07:33 -08:00
Pablo Neira Ayuso
899194d7e9 UPSTREAM: netfilter: nf_tables: bail out on mismatching dynset and set expressions
[ Upstream commit 3701cd390fd731ee7ae8b8006246c8db82c72bea ]

If dynset expressions provided by userspace is larger than the declared
set expressions, then bail out.

Bug: 316085841
Fixes: 48b0ae046e ("netfilter: nftables: netlink support for several set element expressions")
Reported-by: Xingyuan Mo <hdthky0@gmail.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit cf5f113c41)
Signed-off-by: Lee Jones <joneslee@google.com>
Change-Id: I4bd3f7e9148d4bc12bbc67ecdd605c2957eb8010
2024-01-17 16:48:40 +00:00
songfeng
e6712ed4f0 ANDROID: ABI: Update oplus symbol list
5 function symbol(s) added
  'int __traceiter_android_vh_binder_has_special_work_ilocked(void*, struct binder_thread*, bool, bool*)'
  'int __traceiter_android_vh_binder_ioctl_end(void*, struct task_struct*, unsigned int, unsigned long, struct binder_thread*, struct binder_proc*, int*)'
  'int __traceiter_android_vh_binder_looper_exited(void*, struct binder_thread*, struct binder_proc*)'
  'int __traceiter_android_vh_binder_spawn_new_thread(void*, struct binder_thread*, struct binder_proc*, bool*)'
  'int __traceiter_android_vh_binder_select_special_worklist(void*, struct list_head**, struct binder_thread*, struct binder_proc*, int, bool*)'

5 variable symbol(s) added
  'struct tracepoint __tracepoint_android_vh_binder_has_special_work_ilocked'
  'struct tracepoint __tracepoint_android_vh_binder_ioctl_end'
  'struct tracepoint __tracepoint_android_vh_binder_looper_exited'
  'struct tracepoint __tracepoint_android_vh_binder_spawn_new_thread'
  'struct tracepoint __tracepoint_android_vh_binder_select_special_worklist'

Bug: 318782978
Change-Id: I0598a329a4d4c455450c9d47973103f04f9e3790
Signed-off-by: songfeng <songfeng@oppo.com>
2024-01-17 02:22:48 +00:00
songfeng
24bb8fc82e ANDROID: vendor_hooks: add hooks in driver/android/binder.c
Add hooks to support oem's binder feature of improving certain
scenarios sched priority by moving these scenarios' work to
a fixed binder thread.

Add the following new vendor hooks to drivers/android/binder.c:
1 trace_android_vh_binder_spawn_new_thread
	in our os, some binder_transaction will be marked as vip flag,
	it can be named vip transaction, the binder_work within the vip
	transaction can be named vip work.
	here will force a thread (named vip thread) to be spawned and
	skip the normal conditions to spawn a thread. vip thread will
	just select vip transaction to process.
2 trace_android_vh_binder_ioctl_end
	in our os, in binder_proc, about binder threads,special thread
	(called vip thread) will work for special binder_transaction
	(called vip transaction).
	here  will expand one ioctl cmd for binder driver, it will
	set the max count about special thread (called vip thread) in
	binder_proc, and if it has vip thread in the binder_proc.
3 trace_android_vh_binder_looper_exited
	while BC_REGISTER_LOOPER cmd, will set special thread as vip
	thread. the flag saved in binder_thread:looper
	here will unset the vip flag saved in binder_thread,
	while BC_EXIT_LOOPER cmd,  if the thread is vip thread(reference
	above about vip thread)
4 trace_android_vh_binder_has_special_work_ilocked
	for special binder thread(called vip thread), it will deal with
	special binder_work (called vip work) within special transaction
	(call vip transaction),
	here, if the thread is vip thread, it will check the vip work if
	exist or not.
5 trace_android_vh_binder_select_special_worklist
	for special binder thread(called vip thread), it will select the
	worklist for special binder_work(called vip work) within special
	binder_transaction(called vip transaction)
	here, it will make sure the selected worklist, the head of it is
	vip work within vip transaction

Bug: 318782978

Change-Id: I8e544d9be2644a6144a9cfbd477e087d46b0073f
Signed-off-by: songfeng <songfeng@oppo.com>
2024-01-17 02:22:48 +00:00
Norihiko Hama
55930b39ca ANDROID: GKI: Update honda symbol list for xt_LOG
9 function symbol(s) added
  'int nf_log_buf_add(struct nf_log_buf*, const char*, ...)'
  'void nf_log_buf_close(struct nf_log_buf*)'
  'struct nf_log_buf* nf_log_buf_open()'
  'int nf_log_register(u_int8_t, struct nf_logger*)'
  'int nf_log_set(struct net*, u_int8_t, const struct nf_logger*)'
  'void nf_log_unregister(struct nf_logger*)'
  'void nf_log_unset(struct net*, const struct nf_logger*)'
  'int nf_logger_find_get(int, enum nf_log_type)'
  'void nf_logger_put(int, enum nf_log_type)'

Bug: 319451108

Change-Id: I300644b6a9221874e29ff97bd2937361c353af03
Signed-off-by: Norihiko Hama <Norihiko.Hama@alpsalpine.com>
2024-01-17 01:26:43 +00:00
Norihiko Hama
3160b69e20 ANDROID: GKI: Update honda symbol list for ebt filter
2 function symbol(s) added
  'void arp_send(int, int, __be32, struct net_device*, __be32, const unsigned char*, const unsigned char*, const unsigned char*)'
  'void nf_log_packet(struct net*, u_int8_t, unsigned int, const struct sk_buff*, const struct net_device*, const struct net_device*, const struct nf_loginfo*, const char*, ...)'

1 variable symbol(s) added
  'int sysctl_nf_log_all_netns'

Bug: 319451108

Change-Id: I5194eb32b01d66db1744c17e45ff1e1451a9f350
Signed-off-by: Norihiko Hama <Norihiko.Hama@alpsalpine.com>
2024-01-17 01:26:43 +00:00
Norihiko Hama
4dc7f98815 ANDROID: GKI: Update honda symbol list for ebtables
18 function symbol(s) added
  'void __audit_log_nfcfg(const char*, u8, unsigned int, enum audit_nfcfgop, gfp_t)'
  'int nf_register_sockopt(struct nf_sockopt_ops*)'
  'void nf_unregister_sockopt(struct nf_sockopt_ops*)'
  'void* vmalloc_node(unsigned long, int)'
  'int xt_check_match(struct xt_mtchk_param*, unsigned int, u16, bool)'
  'int xt_check_target(struct xt_tgchk_param*, unsigned int, u16, bool)'
  'int xt_compat_add_offset(u_int8_t, unsigned int, int)'
  'int xt_compat_calc_jump(u_int8_t, unsigned int)'
  'void xt_compat_flush_offsets(u_int8_t)'
  'int xt_compat_init_offsets(u8, unsigned int)'
  'void xt_compat_lock(u_int8_t)'
  'int xt_compat_match_offset(const struct xt_match*)'
  'int xt_compat_target_offset(const struct xt_target*)'
  'void xt_compat_unlock(u_int8_t)'
  'int xt_data_to_user(void*, const void*, int, int, int)'
  'struct xt_match* xt_find_match(u8, const char*, u8)'
  'struct xt_match* xt_request_find_match(uint8_t, const char*, uint8_t)'
  'struct xt_target* xt_request_find_target(u8, const char*, u8)'

1 variable symbol(s) added
  'u32 audit_enabled'

Bug: 319451108

Change-Id: I5e8b449b63100da21939b7f74c8db1df0eae1947
Signed-off-by: Norihiko Hama <Norihiko.Hama@alpsalpine.com>
2024-01-17 01:26:43 +00:00
Norihiko Hama
39a0823340 ANDROID: GKI: Update honda symbol list for net scheduler
31 function symbol(s) added
  'int __skb_vlan_pop(struct sk_buff*, u16*)'
  'struct flow_rule* flow_rule_alloc(unsigned int)'
  'clock_t jiffies_to_clock_t(unsigned long)'
  'int skb_eth_pop(struct sk_buff*)'
  'int skb_eth_push(struct sk_buff*, const unsigned char*, const unsigned char*)'
  'void skb_flow_dissect_ct(const struct sk_buff*, struct flow_dissector*, void*, u16*, size_t, bool, u16)'
  'void skb_flow_dissect_hash(const struct sk_buff*, struct flow_dissector*, void*)'
  'void skb_flow_dissect_meta(const struct sk_buff*, struct flow_dissector*, void*)'
  'void skb_flow_dissect_tunnel_info(const struct sk_buff*, struct flow_dissector*, void*)'
  'void skb_flow_dissector_init(struct flow_dissector*, const struct flow_dissector_key*, unsigned int)'
  'int skb_vlan_pop(struct sk_buff*)'
  'int skb_vlan_push(struct sk_buff*, __be16, u16)'
  'int tc_setup_cb_add(struct tcf_block*, struct tcf_proto*, enum tc_setup_type, void*, bool, u32*, unsigned int*, bool)'
  'int tc_setup_cb_call(struct tcf_block*, enum tc_setup_type, void*, bool, bool)'
  'int tc_setup_cb_destroy(struct tcf_block*, struct tcf_proto*, enum tc_setup_type, void*, bool, u32*, unsigned int*, bool)'
  'int tc_setup_cb_reoffload(struct tcf_block*, struct tcf_proto*, bool, flow_setup_cb_t*, enum tc_setup_type, void*, void*, u32*, unsigned int*)'
  'int tcf_action_check_ctrlact(int, struct tcf_proto*, struct tcf_chain**, struct netlink_ext_ack*)'
  'struct tcf_chain* tcf_action_set_ctrlact(struct tc_action*, int, struct tcf_chain*)'
  'void tcf_action_update_stats(struct tc_action*, u64, u64, u64, bool)'
  'void tcf_chain_put_by_act(struct tcf_chain*)'
  'unsigned int tcf_exts_num_actions(struct tcf_exts*)'
  'int tcf_exts_terse_dump(struct sk_buff*, struct tcf_exts*)'
  'int tcf_generic_walker(struct tc_action_net*, struct sk_buff*, struct netlink_callback*, int, const struct tc_action_ops*, struct netlink_ext_ack*)'
  'int tcf_idr_check_alloc(struct tc_action_net*, u32*, struct tc_action**, int)'
  'void tcf_idr_cleanup(struct tc_action_net*, u32)'
  'int tcf_idr_create_from_flags(struct tc_action_net*, u32, struct nlattr*, struct tc_action**, const struct tc_action_ops*, int, u32)'
  'int tcf_idr_release(struct tc_action*, bool)'
  'int tcf_idr_search(struct tc_action_net*, struct tc_action**, u32)'
  'void tcf_idrinfo_destroy(const struct tc_action_ops*, struct tcf_idrinfo*)'
  'int tcf_register_action(struct tc_action_ops*, struct pernet_operations*)'
  'int tcf_unregister_action(struct tc_action_ops*, struct pernet_operations*)'

Bug: 319451108

Change-Id: I8cd204b87577972e35d29c0a992c8b6c0adefd58
Signed-off-by: Norihiko Hama <Norihiko.Hama@alpsalpine.com>
2024-01-17 01:26:43 +00:00
Norihiko Hama
dd0098bdb4 ANDROID: GKI: Update honda symbol list for led-trigger
2 function symbol(s) added
  'void led_blink_set_oneshot(struct led_classdev*, unsigned long*, unsigned long*, int)'
  'void led_stop_software_blink(struct led_classdev*)'

Bug: 319451108

Change-Id: I25f44f730780d41dc68cfb8697844e12fb4ea189
Signed-off-by: Norihiko Hama <Norihiko.Hama@alpsalpine.com>
2024-01-17 01:26:43 +00:00
Norihiko Hama
66a20ed4b8 ANDROID: GKI: Add initial symbol list for honda
Initial add for oem specific symbol list

2 function symbol(s) added
  'void* devres_find(struct device*, dr_release_t, dr_match_t, void*)'
  'bool input_device_enabled(struct input_dev*)'

Bug: 319451108

Change-Id: I09d922aa61b7c50ad6a6c8e22f8798f0bc786832
Signed-off-by: Norihiko Hama <Norihiko.Hama@alpsalpine.com>
2024-01-17 01:26:43 +00:00
Lianjun Huang
28dbe4d613 ANDROID: GKI: add symbols to ABI
After demand paging is captured during APP launch,
we can do it in advance before next launch.
Add the symbols for it here.

INFO: 4 function symbol(s) added
  'unsigned int filemap_get_folios(struct address_space*, unsigned long*, unsigned long, struct folio_batch*)'
  'unsigned int find_get_pages_range_tag(struct address_space*, unsigned long*, unsigned long, xa_mark_t, unsigned int, struct page**)'
  'void page_cache_async_ra(struct readahead_control*, struct folio*, unsigned long)'
  'void page_cache_sync_ra(struct readahead_control*, unsigned long)'

Bug: 315913896
Signed-off-by: Lianjun Huang <huanglianjun@xiaomi.com>
Signed-off-by: Lianjun Huang <huanglianjun@xiaomi.corp-partner.google.com>
Change-Id: I3f42c39c6432303e69f1fbae56fabf620381d8c5
2024-01-16 22:07:39 +00:00
Uttkarsh Aggarwal
97100e867e FROMGIT: usb: dwc: ep0: Update request status in dwc3_ep0_stall_restart
Current implementation blocks the running operations when Plug-out and
Plug-In is performed continuously, process gets stuck in
dwc3_thread_interrupt().

Code Flow:

	CPU1

	->Gadget_start
	->dwc3_interrupt
	->dwc3_thread_interrupt
	->dwc3_process_event_buf
	->dwc3_process_event_entry
	->dwc3_endpoint_interrupt
	->dwc3_ep0_interrupt
	->dwc3_ep0_inspect_setup
	->dwc3_ep0_stall_and_restart

By this time if pending_list is not empty, it will get the next request
on the given list and calls dwc3_gadget_giveback which will unmap request
and call its complete() callback to notify upper layers that it has
completed. Currently dwc3_gadget_giveback status is set to -ECONNRESET,
whereas it should be -ESHUTDOWN based on condition if not dwc->connected
is true.

Cc:  <stable@vger.kernel.org>
Fixes: d742220b35 ("usb: dwc3: ep0: giveback requests on stall_and_restart")
Signed-off-by: Uttkarsh Aggarwal <quic_uaggarwa@quicinc.com>
Link: https://lore.kernel.org/r/20231222094704.20276-1-quic_uaggarwa@quicinc.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Bug: 320413810
(cherry picked from commit e9d40b215e38480fd94c66b06d79045717a59e9c
https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git/ usb-next)

Change-Id: I7f0afebbcfa88b6b4e622a708b9838dd461661fc
Signed-off-by: Sriram Dash <quic_sriramd@quicinc.com>
2024-01-16 19:39:36 +00:00
Frank Wang
36248a15a7 FROMGIT: usb: dwc3: set pm runtime active before resume common
For device mode, if PM runtime autosuspend feature enabled, the
runtime power status of dwc3 may be suspended when run dwc3_resume(),
and dwc3 gadget would not be configured in dwc3_gadget_run_stop().
It would cause gadget connected failed if USB cable has been plugged
before PM resume. So move forward pm_runtime_set_active() to fix it.

Bug: 300024866
Change-Id: I53d07c7bfb86d4ae8d60e07096dff0fd68e30eff
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
Link: https://lore.kernel.org/r/20231206065939.16958-1-frank.wang@rock-chips.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 68c26fe58182f5af56bfa577d1cc0c949740baab https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-next)
2024-01-16 19:39:12 +00:00
Qian-Hao Huang
df1cdb0a70 ANDROID: Update the pixel symbol list
These symbols are needed as part of an upgrade to v6.1:
- add_uevent_var
- aes_encrypt
- aes_expandkey
- alloc_skb_with_frags
- cpufreq_quick_get_max
- cpuidle_governor_latency_req
- cpu_topology
- crypto_shash_final
- datagram_poll
- debugfs_create_blob
- dev_pm_qos_add_notifier
- dev_pm_qos_add_request
- dev_pm_qos_remove_notifier
- dev_pm_qos_remove_request
- dma_direct_alloc
- dma_direct_free
- dma_get_sgtable_attrs
- firmware_request_nowarn
- idr_alloc_cyclic
- in_egroup_p
- init_user_ns
- iov_iter_revert
- __ipv6_addr_type
- kernel_bind
- kernel_connect
- kernel_getsockname
- kernel_recvmsg
- kernel_sendmsg
- kmem_cache_create_usercopy
- ksize
- lock_sock_nested
- mempool_alloc
- mempool_alloc_slab
- mempool_create
- mempool_destroy
- mempool_free
- mempool_free_slab
- napi_gro_flush
- netif_tx_lock
- netif_tx_unlock
- ns_capable_noaudit
- param_get_string
- param_set_copystring
- param_set_int
- pci_disable_msi
- pcie_capability_read_word
- pci_iomap
- pci_iounmap
- pci_irq_vector
- pci_release_region
- pci_request_region
- pm_system_wakeup
- proto_register
- proto_unregister
- radix_tree_iter_delete
- radix_tree_next_chunk
- _raw_read_lock_irq
- _raw_read_unlock_irq
- _raw_write_lock_bh
- _raw_write_unlock_bh
- refcount_dec_not_one
- register_netevent_notifier
- regulator_set_load
- release_sock
- seq_vprintf
- sk_alloc
- skb_coalesce_rx_frag
- skb_copy_datagram_iter
- skb_free_datagram
- __skb_pad
- skb_recv_datagram
- skb_set_owner_w
- skb_store_bits
- sk_free
- sock_alloc_send_pskb
- sock_create_kern
- sock_gettstamp
- sock_init_data
- sock_no_accept
- sock_no_listen
- sock_no_mmap
- sock_no_sendpage
- sock_no_shutdown
- sock_no_socketpair
- sock_queue_rcv_skb_reason
- sock_register
- sock_setsockopt
- sock_unregister
- strchrnul
- unregister_netevent_notifier
- vscnprintf
- wait_for_completion_killable
- wireless_send_event
- __xa_insert
- xa_store

Bug: 303533633
Bug: 308924989
Change-Id: Ifbc09d5025f1bd3416f136fabd344ef2452390a8
Signed-off-by: Qian-Hao Huang <qhhuang@google.com>
2024-01-15 16:11:44 +00:00
Stephen Boyd
66cd99ccdb BACKPORT: UPSTREAM: phy: qcom-qmp: Introduce Kconfig symbols for discrete drivers
Introduce a config option for each QMP PHY driver now that the QMP PHY
mega-driver has been split up into different modules. This allows kernel
configurators to limit the binary size of the kernel by only compiling
in the QMP PHY driver that they need.

Leave the old config QCOM_QMP in place and make it into a menuconfig so
that 'make olddefconfig' continues to work. Furthermore, set the default
of the new Kconfig symbols to be QCOM_QMP so that the transition is
smooth.

Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Reviewed-by: Johan Hovold <johan+linaro@kernel.org>
Signed-off-by: Stephen Boyd <swboyd@chromium.org>

Link: https://lore.kernel.org/all/20230202215330.2152726-1-swboyd@chromium.org/

Bug: 319064658
Change-Id: I633e6e1bbc3e79292bfde927e46f84219f0178ae
(cherry picked from commit d1abd69534)
[quic_kuruva: Resolved minor conflict in drivers/phy/qualcomm/Kconfig ]
Signed-off-by: Rajashekar kuruva <quic_kuruva@quicinc.com>
2024-01-12 22:16:42 +00:00
Lianjun Huang
a70d3b7bdd ANDROID: GKI: add symbols of vendor hooks to ABI for swapping in ahead
Add symbols of vendor hooks to capture demand paging during APP launch,
so we can do it in advance in next launch.
INFO: 1 function symbol(s) added
  'int __traceiter_android_vh_read_pages(void*, struct readahead_control*)'

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

Bug: 315913896
Signed-off-by: Lianjun Huang <huanglianjun@xiaomi.com>
Signed-off-by: Lianjun Huang <huanglianjun@xiaomi.corp-partner.google.com>
Change-Id: Ibb1e31b6912f7b6b92b76727f7e5043897434def
2024-01-12 18:47:42 +00:00
Lianjun Huang
d4db0d5d08 ANDROID: GKI: add vendor hooks for swapping in ahead
Add vendor hooks to capture demand paging during APP launch,
so we can do it in advance in next launch.

Bug: 315913896
Signed-off-by: Lianjun Huang <huanglianjun@xiaomi.com>
Signed-off-by: Lianjun Huang <huanglianjun@xiaomi.corp-partner.google.com>
Change-Id: I2698fefd347745fb4ff84b111caedbb3bb365ce3
2024-01-12 18:47:42 +00:00
Nikita Ioffe
fd40c1d901 ANDROID: add 16k targets for Microdroid kernel
Bug: 317201718
Test: tools/bazel run //common:kernel_aarch64_microdroid_16k_dist

Change-Id: I542f07d1d0b4f2b6a3c4c58185eee16b2b7f1667
Signed-off-by: Nikita Ioffe <ioffe@google.com>
2024-01-12 09:14:09 +00:00
Kalesh Singh
82bf9e7625 FROMGIT: BACKPORT: mm/cma: fix placement of trace_cma_alloc_start/finish
The current placement of trace_cma_alloc_start/finish misses the fail
cases: !cma || !cma->count || !cma->bitmap.

trace_cma_alloc_finish is also not emitted for the failure case
where bitmap_count > bitmap_maxno.

Fix these missed cases by moving the start event before the failure
checks and moving the finish event to the out label.

Link: https://lkml.kernel.org/r/20240110012234.3793639-1-kaleshsingh@google.com
Fixes: 7bc1aec5e2 ("mm: cma: add trace events for CMA alloc perf testing")
Change-Id: I61153fe078da4f9f3338147f1fbb7697a5554078
Signed-off-by: Kalesh Singh <kaleshsingh@google.com>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Liam Mark <lmark@codeaurora.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
(cherry picked from commit 3b08ab9a811caebe1327f25f51557f95200d94bf https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-unstable)
Bug: 315897033
[ Remove ret arg from trace_cma_alloc_finish - Kalesh Singh ]
Signed-off-by: Kalesh Singh <kaleshsingh@google.com>
2024-01-11 17:56:51 +00:00
Vinayak Yadawad
800cac4b33 FROMGIT: wifi: nl80211: Extend del pmksa support for SAE and OWE security
Current handling of del pmksa with SSID is limited to FILS
security. In the current change the del pmksa support is extended
to SAE/OWE security offloads as well. For OWE/SAE offloads, the
PMK is generated and cached at driver/FW, so user app needs the
capability to request cache deletion based on SSID for drivers
supporting SAE/OWE offload.

Signed-off-by: Vinayak Yadawad <vinayak.yadawad@broadcom.com>
Link: https://msgid.link/ecdae726459e0944c377a6a6f6cb2c34d2e057d0.1701262123.git.vinayak.yadawad@broadcom.com
[drop whitespace-damaged rdev_ops pointer completely, enabling tracing]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Bug: 301410304
(cherry picked from commit aa0887c4f18e280f8c2aa6964af602bd16c37f54
https://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless-next.git main)
Change-Id: Ia665b9760279eb77347e79c97d177cba3beaa107
Signed-off-by: Paul Chen <chenpaul@google.com>
2024-01-11 05:46:54 +00:00
liangjlee
a41a4ee370 ANDROID: Update the ABI symbol list
Adding the following symbols:
  - dump_tasks

Bug: 316372318
Change-Id: Iddaed980a227d8beb966cf0fae24947f5bf8b473
Signed-off-by: liangjlee <liangjlee@google.com>
2024-01-10 23:50:22 +00:00
liangjlee
0801d8a89d ANDROID: mm: export dump_tasks symbol.
Export dump_tasks to dump per-task memory status when ramdump.

Bug: 316372318
Change-Id: Ie0dd1a4c7ada280dc0c7696781b4b9a5e2a100ab
Signed-off-by: liangjlee <liangjlee@google.com>
2024-01-10 23:50:22 +00:00
Bart Van Assche
7c91752f5d FROMLIST: scsi: ufs: Remove the ufshcd_hba_exit() call from ufshcd_async_scan()
Calling ufshcd_hba_exit() from a function that is called asynchronously
from ufshcd_init() is wrong because this triggers multiple race
conditions. Instead of calling ufshcd_hba_exit(), log an error message.

Reported-by: Daniel Mentz <danielmentz@google.com>
Closes: https://b.corp.google.com/issues/310401362
Fixes: 1d337ec2f3 ("ufs: improve init sequence")
Change-Id: I1c056c2e42889301f69107468f2b3eb38bf3d734
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Bug: 310401362
Link: https://lore.kernel.org/linux-scsi/20231218225229.2542156-3-bvanassche@acm.org/
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2024-01-10 23:15:00 +00:00
Bart Van Assche
28154afe74 FROMLIST: scsi: ufs: Simplify power management during async scan
ufshcd_init() calls pm_runtime_get_sync() before it calls
async_schedule(). ufshcd_async_scan() calls pm_runtime_put_sync()
directly or indirectly from ufshcd_add_lus(). Simplify
ufshcd_async_scan() by always calling pm_runtime_put_sync() from
ufshcd_async_scan().

Cc: stable@vger.kernel.org
Change-Id: I4b6ede95360c665594963fff0962742728064fb0
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Bug: 310401362
Link: https://lore.kernel.org/linux-scsi/20231218225229.2542156-2-bvanassche@acm.org/
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2024-01-10 23:14:57 +00:00
Aran Dalton
febcf1429f ANDROID: gki_defconfig: Set CONFIG_IDLE_INJECT and CONFIG_CPU_IDLE_THERMAL into y
Under certain circumstances a SoC can reach a critical temperaturelimit
and is unable to stabilize the temperature around a temperaturecontrol.
The system may ask for a specific power budget butbecause of the OPP
density, we can only choose an OPP with a powerbudget lower than the
requested one and under-utilize the CPU, thuslosing performance. In
other words, one OPP under-utilizes the CPUwith a power less than the
requested power budget and the next OPPexceeds the power budget. The
cpu idle cooling can solve this problem.

Bug: 299411923
Signed-off-by: Aran Dalton <arda@allwinnertech.com>
Change-Id: I1c17b340617e88be075097dc47f30ce94be2a4d7
2024-01-10 00:12:51 +00:00
Norihiko Hama
bc4d82ee40 ANDROID: KMI workaround for CONFIG_NETFILTER_FAMILY_BRIDGE
Enabling CONFIG_NETFILTER_FAMILY_BRIDGE causes the new element,
hooks_bridge[] to be added to netns_nf. Since the KMI is frozen
this could not be added.

The only instantiation of struct netns_nf is as an embedded field
of struct net. So instead of adding the field to struct netns_nf,
a new "struct ext_net" is added that contains struct net and
the new hooks_bridge[] field. An accessor function,
get_nf_hooks_bridge() is added to get a pointer to the new
field.

There is a global init_net of type struct net which must be special
cased since it is not a member of a struct ext_net. All other
instances of struct net are allocated via net_alloc() which now
allocates a struct ext_net.

Since CONFIG_NETFILTER_FAMILY_BRIDGE is a hidden config that is
needed for vendor modules, it is enabled via init/Kconfig.gki.

Bug: 316040984
Fixes: 0145780bfc78 ("fix KASAN-related kernel crash by KMI W/A for NETFILTER_FAMILY_BRIDGE")

Change-Id: I2c7384e3df9b88f12464dc0138986fed12ca626a
Signed-off-by: Norihiko Hama <Norihiko.Hama@alpsalpine.com>
2024-01-09 23:37:43 +00:00