Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 25451dc1 authored by Wooyeon Kim's avatar Wooyeon Kim Committed by Todd Kjos
Browse files

ANDROID: vendor_hooks: FPSIMD save/restore by using vendor_hooks



 - To use fpsimd in kernel task, vendor_hook call is needed to
   save/restore fpsimd at scheduling time.
 - ANDROID_VENDOR_DATA added to thread_struct.
 - Vendor_hooks is called when thread is switching for save/restore
   fpsimd states.
  (trace_android_vh_is_fpsimd_save(prev, next))

Bug: 149632552
Bug: 165161482

Signed-off-by: default avatarWooyeon Kim <wooy88.kim@samsung.com>
Change-Id: I853e1b6a9a51e24f770423bbc39fdd84265d78fc
parent 2f0f512e
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@
#include <linux/init.h>
#include <linux/stddef.h>
#include <linux/string.h>
#include <linux/android_vendor.h>

#include <vdso/processor.h>

@@ -138,6 +139,8 @@ struct thread_struct {
		struct user_fpsimd_state fpsimd_state;
	} uw;

	ANDROID_VENDOR_DATA(1);

	unsigned int		fpsimd_cpu;
	void			*sve_state;	/* SVE registers, if any */
	unsigned int		sve_vl;		/* SVE vector length */
+3 −0
Original line number Diff line number Diff line
@@ -41,6 +41,7 @@
#include <linux/percpu.h>
#include <linux/thread_info.h>
#include <linux/prctl.h>
#include <trace/hooks/fpsimd.h>

#include <asm/alternative.h>
#include <asm/arch_gicv3.h>
@@ -520,6 +521,8 @@ __notrace_funcgraph struct task_struct *__switch_to(struct task_struct *prev,
	 */
	dsb(ish);

	trace_android_vh_is_fpsimd_save(prev, next);

	/* the actual thread switch */
	last = cpu_switch_to(prev, next);

+2 −0
Original line number Diff line number Diff line
@@ -14,6 +14,7 @@
#include <trace/hooks/binder.h>
#include <trace/hooks/rwsem.h>
#include <trace/hooks/futex.h>
#include <trace/hooks/fpsimd.h>

/*
 * Export tracepoints that act as a bare tracehook (ie: have no trace event
@@ -42,3 +43,4 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_rwsem_wake);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_rwsem_write_finished);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_alter_rwsem_list_add);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_alter_futex_plist_add);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_is_fpsimd_save);
+26 −0
Original line number Diff line number Diff line
/* SPDX-License-Identifier: GPL-2.0 */
#undef TRACE_SYSTEM
#define TRACE_SYSTEM fpsimd

#define TRACE_INCLUDE_PATH trace/hooks

#if !defined(_TRACE_HOOK_FPSIMD_H) || defined(TRACE_HEADER_MULTI_READ)
#define _TRACE_HOOK_FPSIMD_H

#include <linux/tracepoint.h>
#include <trace/hooks/vendor_hooks.h>

#if defined(CONFIG_TRACEPOINTS) && defined(CONFIG_ANDROID_VENDOR_HOOKS)
struct task_struct;

DECLARE_HOOK(android_vh_is_fpsimd_save,
	TP_PROTO(struct task_struct *prev, struct task_struct *next),
	TP_ARGS(prev, next))
#else

#define trace_android_vh_is_fpsimd_save(prev, next)
#endif

#endif /* _TRACE_HOOK_FPSIMD_H */
/* This part must be outside protection */
#include <trace/define_trace.h>