android_kernel_xiaomi_sm8450/kernel/trace/trace_preemptirq.c
Greg Kroah-Hartman ef2aee5cec This is the 5.10.145 stable release
-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEZH8oZUiU471FcZm+ONu9yGCSaT4FAmMto+IACgkQONu9yGCS
 aT7jWBAAqGiqfyv/vQYZdmTDd674Jt47cwP+FI0FAMzBvJVLr7LmsBGQ5N4Xxo1F
 uTnpPHvl8q13gbYVidd4d4rahg7mRi364IiO/SsQftzxUzOty7rji5fhoMBHYpyk
 HgneuVCkVKRVdG/7jTbCp01hNoyIohM7XzGmZStPC487UcVW8ipeMoWIGr1Hcx6l
 k7tIVJQjb9Hg5FJKyLLRAKgst5jVZq5jRxojPKET07Rj1CBbJOFyrz6Hkov3xi5p
 tVxiVw91zT7OpmxwaSuiPrmFeok/gfy8FIWvo8qTfWoI8sZEskwsH+Wl/ONjp+tg
 GVJsWGaSeoPRwmgAV6oV/AQe0gUoi+XoyYuTBLLsDDaOHfBs6XWbRxq53pXkAREG
 gT1/dczmBPcB6d5HlzL+xxHMnwsRHfYCNRvw5mKzxpfK0ne8zNt2IvqN3+MCXJtk
 QTuSEQlzdajDSOvQvFHkfPIoikFrOyjF0QYok3iYD6OtqQ70hLBYCTht1gQYSAEe
 CAQ+XtB0xRZK0pILoGnz0HF1TtSq4mufVtLqPnqv0Oq5LkDgtPTU9B1RLOyPJEEA
 Z4zTOqSVjN8s2GGSq+j08kn/R8oD4ioeEadRyoKh4wjCHjgfXetFLRHtpp7lExi6
 u+ZTBdgezoZhMGBTxl3o0dPNV2L1jo68J+jAU4Vgkj++dXYzthI=
 =rmN3
 -----END PGP SIGNATURE-----

Merge 5.10.145 into android12-5.10-lts

Changes in 5.10.145
	KVM: PPC: Book3S HV: Context tracking exit guest context before enabling irqs
	KVM: PPC: Tick accounting should defer vtime accounting 'til after IRQ handling
	serial: 8250: Fix reporting real baudrate value in c_ospeed field
	parisc: Optimize per-pagetable spinlocks
	parisc: Flush kernel data mapping in set_pte_at() when installing pte for user page
	dmaengine: bestcomm: fix system boot lockups
	powerpc/pseries/mobility: refactor node lookup during DT update
	powerpc/pseries/mobility: ignore ibm, platform-facilities updates
	usb: cdns3: gadget: fix new urb never complete if ep cancel previous requests
	platform/x86/intel: hid: add quirk to support Surface Go 3
	net: dsa: mv88e6xxx: allow use of PHYs on CPU and DSA ports
	of: fdt: fix off-by-one error in unflatten_dt_nodes()
	pinctrl: sunxi: Fix name for A100 R_PIO
	NFSv4: Turn off open-by-filehandle and NFS re-export for NFSv4.0
	gpio: mpc8xxx: Fix support for IRQ_TYPE_LEVEL_LOW flow_type in mpc85xx
	drm/meson: Correct OSD1 global alpha value
	drm/meson: Fix OSD1 RGB to YCbCr coefficient
	parisc: ccio-dma: Add missing iounmap in error path in ccio_probe()
	tracing: hold caller_addr to hardirq_{enable,disable}_ip
	of/device: Fix up of_dma_configure_id() stub
	cifs: revalidate mapping when doing direct writes
	cifs: don't send down the destination address to sendmsg for a SOCK_STREAM
	tools/include/uapi: Fix <asm/errno.h> for parisc and xtensa
	video: fbdev: i740fb: Error out if 'pixclock' equals zero
	Revert "serial: 8250: Fix reporting real baudrate value in c_ospeed field"
	ASoC: nau8824: Fix semaphore unbalance at error paths
	regulator: pfuze100: Fix the global-out-of-bounds access in pfuze100_regulator_probe()
	rxrpc: Fix local destruction being repeated
	rxrpc: Fix calc of resend age
	wifi: mac80211_hwsim: check length for virtio packets
	ALSA: hda/sigmatel: Keep power up while beep is enabled
	ALSA: hda/tegra: Align BDL entry to 4KB boundary
	net: usb: qmi_wwan: add Quectel RM520N
	afs: Return -EAGAIN, not -EREMOTEIO, when a file already locked
	MIPS: OCTEON: irq: Fix octeon_irq_force_ciu_mapping()
	mksysmap: Fix the mismatch of 'L0' symbols in System.map
	video: fbdev: pxa3xx-gcu: Fix integer overflow in pxa3xx_gcu_write
	cgroup: Add missing cpus_read_lock() to cgroup_attach_task_all()
	ALSA: hda/sigmatel: Fix unused variable warning for beep power change
	Linux 5.10.145

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I93aa581c488160ed80c8092688fcae115f960143
2022-09-24 09:54:08 +02:00

158 lines
4.2 KiB
C

// SPDX-License-Identifier: GPL-2.0
/*
* preemptoff and irqoff tracepoints
*
* Copyright (C) Joel Fernandes (Google) <joel@joelfernandes.org>
*/
#include <linux/kallsyms.h>
#include <linux/uaccess.h>
#include <linux/module.h>
#include <linux/ftrace.h>
#include <linux/kprobes.h>
#include "trace.h"
#define CREATE_TRACE_POINTS
#include <trace/events/preemptirq.h>
#undef CREATE_TRACE_POINTS
#include <trace/hooks/preemptirq.h>
#ifdef CONFIG_TRACE_IRQFLAGS
/* Per-cpu variable to prevent redundant calls when IRQs already off */
static DEFINE_PER_CPU(int, tracing_irq_cpu);
/*
* Like trace_hardirqs_on() but without the lockdep invocation. This is
* used in the low level entry code where the ordering vs. RCU is important
* and lockdep uses a staged approach which splits the lockdep hardirq
* tracking into a RCU on and a RCU off section.
*/
void trace_hardirqs_on_prepare(void)
{
if (this_cpu_read(tracing_irq_cpu)) {
if (!in_nmi()) {
trace_irq_enable(CALLER_ADDR0, CALLER_ADDR1);
trace_android_rvh_irqs_enable(CALLER_ADDR0,
CALLER_ADDR1);
}
tracer_hardirqs_on(CALLER_ADDR0, CALLER_ADDR1);
this_cpu_write(tracing_irq_cpu, 0);
}
}
EXPORT_SYMBOL(trace_hardirqs_on_prepare);
NOKPROBE_SYMBOL(trace_hardirqs_on_prepare);
void trace_hardirqs_on(void)
{
if (this_cpu_read(tracing_irq_cpu)) {
if (!in_nmi()) {
trace_irq_enable_rcuidle(CALLER_ADDR0, CALLER_ADDR1);
trace_android_rvh_irqs_enable(CALLER_ADDR0,
CALLER_ADDR1);
}
tracer_hardirqs_on(CALLER_ADDR0, CALLER_ADDR1);
this_cpu_write(tracing_irq_cpu, 0);
}
lockdep_hardirqs_on_prepare(CALLER_ADDR0);
lockdep_hardirqs_on(CALLER_ADDR0);
}
EXPORT_SYMBOL(trace_hardirqs_on);
NOKPROBE_SYMBOL(trace_hardirqs_on);
/*
* Like trace_hardirqs_off() but without the lockdep invocation. This is
* used in the low level entry code where the ordering vs. RCU is important
* and lockdep uses a staged approach which splits the lockdep hardirq
* tracking into a RCU on and a RCU off section.
*/
void trace_hardirqs_off_finish(void)
{
if (!this_cpu_read(tracing_irq_cpu)) {
this_cpu_write(tracing_irq_cpu, 1);
tracer_hardirqs_off(CALLER_ADDR0, CALLER_ADDR1);
if (!in_nmi()) {
trace_irq_disable(CALLER_ADDR0, CALLER_ADDR1);
trace_android_rvh_irqs_disable(CALLER_ADDR0,
CALLER_ADDR1);
}
}
}
EXPORT_SYMBOL(trace_hardirqs_off_finish);
NOKPROBE_SYMBOL(trace_hardirqs_off_finish);
void trace_hardirqs_off(void)
{
lockdep_hardirqs_off(CALLER_ADDR0);
if (!this_cpu_read(tracing_irq_cpu)) {
this_cpu_write(tracing_irq_cpu, 1);
tracer_hardirqs_off(CALLER_ADDR0, CALLER_ADDR1);
if (!in_nmi()) {
trace_irq_disable_rcuidle(CALLER_ADDR0, CALLER_ADDR1);
trace_android_rvh_irqs_disable(CALLER_ADDR0,
CALLER_ADDR1);
}
}
}
EXPORT_SYMBOL(trace_hardirqs_off);
NOKPROBE_SYMBOL(trace_hardirqs_off);
__visible void trace_hardirqs_on_caller(unsigned long caller_addr)
{
if (this_cpu_read(tracing_irq_cpu)) {
if (!in_nmi()) {
trace_irq_enable_rcuidle(CALLER_ADDR0, caller_addr);
trace_android_rvh_irqs_enable(CALLER_ADDR0,
caller_addr);
}
tracer_hardirqs_on(CALLER_ADDR0, caller_addr);
this_cpu_write(tracing_irq_cpu, 0);
}
lockdep_hardirqs_on_prepare(caller_addr);
lockdep_hardirqs_on(caller_addr);
}
EXPORT_SYMBOL(trace_hardirqs_on_caller);
NOKPROBE_SYMBOL(trace_hardirqs_on_caller);
__visible void trace_hardirqs_off_caller(unsigned long caller_addr)
{
lockdep_hardirqs_off(caller_addr);
if (!this_cpu_read(tracing_irq_cpu)) {
this_cpu_write(tracing_irq_cpu, 1);
tracer_hardirqs_off(CALLER_ADDR0, caller_addr);
if (!in_nmi()) {
trace_irq_disable_rcuidle(CALLER_ADDR0, caller_addr);
trace_android_rvh_irqs_enable(CALLER_ADDR0,
caller_addr);
}
}
}
EXPORT_SYMBOL(trace_hardirqs_off_caller);
NOKPROBE_SYMBOL(trace_hardirqs_off_caller);
#endif /* CONFIG_TRACE_IRQFLAGS */
#ifdef CONFIG_TRACE_PREEMPT_TOGGLE
void trace_preempt_on(unsigned long a0, unsigned long a1)
{
if (!in_nmi()) {
trace_preempt_enable_rcuidle(a0, a1);
trace_android_rvh_preempt_enable(a0, a1);
}
tracer_preempt_on(a0, a1);
}
void trace_preempt_off(unsigned long a0, unsigned long a1)
{
if (!in_nmi()) {
trace_preempt_disable_rcuidle(a0, a1);
trace_android_rvh_preempt_disable(a0, a1);
}
tracer_preempt_off(a0, a1);
}
#endif