Skip to content

Commit

Permalink
ANDROID: Fix suspicious RCU usage warning
Browse files Browse the repository at this point in the history
The hooks added in the suspend path can be called in a
state where RCU locking is not safe. Change the hooks
to restricted hooks which are safe in this context.

Bug: 232468327
Fixes: ace93ca ("ANDROID: GKI: psci: add hook to check if cpu is allowed to power off")
Signed-off-by: Todd Kjos <tkjos@google.com>
Change-Id: I5b887d34ca05e995030ef0c8f39488d932c52770
  • Loading branch information
toddkjos committed May 17, 2022
1 parent 7a2101d commit 949edf7
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
12 changes: 6 additions & 6 deletions android/abi_gki_aarch64_unisoc
Original file line number Diff line number Diff line change
Expand Up @@ -1180,8 +1180,8 @@
__traceiter_android_vh_mmc_check_status
__traceiter_android_vh_modify_thermal_request_freq
__traceiter_android_vh_modify_thermal_target_freq
__traceiter_android_vh_psci_cpu_suspend
__traceiter_android_vh_psci_tos_resident_on
__traceiter_android_rvh_psci_cpu_suspend
__traceiter_android_rvh_psci_tos_resident_on
__traceiter_android_vh_scheduler_tick
__traceiter_android_vh_set_wake_flags
__traceiter_android_vh_thermal_power_cap
Expand Down Expand Up @@ -1250,8 +1250,8 @@
__tracepoint_android_vh_mmc_check_status
__tracepoint_android_vh_modify_thermal_request_freq
__tracepoint_android_vh_modify_thermal_target_freq
__tracepoint_android_vh_psci_cpu_suspend
__tracepoint_android_vh_psci_tos_resident_on
__tracepoint_android_rvh_psci_cpu_suspend
__tracepoint_android_rvh_psci_tos_resident_on
__tracepoint_android_vh_scheduler_tick
__tracepoint_android_vh_set_wake_flags
__tracepoint_android_vh_thermal_power_cap
Expand Down Expand Up @@ -1541,8 +1541,8 @@
__traceiter_android_vh_printk_ext_header
__traceiter_android_rvh_report_bug
__tracepoint_android_vh_dma_buf_release
__tracepoint_android_vh_psci_tos_resident_on
__tracepoint_android_vh_psci_cpu_suspend
__tracepoint_android_rvh_psci_tos_resident_on
__tracepoint_android_rvh_psci_cpu_suspend
__tracepoint_android_vh_regmap_update
__tracepoint_android_vh_usb_new_device_added
__traceiter_android_rvh_tk_based_time_sync
Expand Down
4 changes: 2 additions & 2 deletions drivers/android/vendor_hooks.c
Original file line number Diff line number Diff line change
Expand Up @@ -289,8 +289,8 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_audio_usb_offload_disconnect);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_atomic_remove_fb);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_drm_atomic_check_modeset);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_get_thermal_zone_device);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_psci_tos_resident_on);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_psci_cpu_suspend);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_psci_tos_resident_on);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_psci_cpu_suspend);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_usb_new_device_added);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_force_compatible_pre);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_force_compatible_post);
Expand Down
4 changes: 2 additions & 2 deletions drivers/firmware/psci/psci.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ bool psci_tos_resident_on(int cpu)
{
bool resident = false;

trace_android_vh_psci_tos_resident_on(cpu, &resident);
trace_android_rvh_psci_tos_resident_on(cpu, &resident);
if (resident)
return resident;

Expand Down Expand Up @@ -178,7 +178,7 @@ static int __psci_cpu_suspend(u32 fn, u32 state, unsigned long entry_point)
int err;
bool deny = false;

trace_android_vh_psci_cpu_suspend(state, &deny);
trace_android_rvh_psci_cpu_suspend(state, &deny);
if (deny)
return -EPERM;

Expand Down
8 changes: 4 additions & 4 deletions include/trace/hooks/psci.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@

#include <trace/hooks/vendor_hooks.h>

DECLARE_HOOK(android_vh_psci_tos_resident_on,
DECLARE_RESTRICTED_HOOK(android_rvh_psci_tos_resident_on,
TP_PROTO(int cpu, bool *resident),
TP_ARGS(cpu, resident));
TP_ARGS(cpu, resident), 1);

DECLARE_HOOK(android_vh_psci_cpu_suspend,
DECLARE_RESTRICTED_HOOK(android_rvh_psci_cpu_suspend,
TP_PROTO(u32 state, bool *deny),
TP_ARGS(state, deny));
TP_ARGS(state, deny), 1);

/* macro versions of hooks are no longer required */

Expand Down

0 comments on commit 949edf7

Please sign in to comment.