Files
kernel_arpi/kernel/trace/trace_preemptirq.c
Greg Kroah-Hartman a449b299e8 Merge 5.15.69 into android14-5.15
Changes in 5.15.69
	NFS: Fix WARN_ON due to unionization of nfs_inode.nrequests
	ACPI: resource: skip IRQ override on AMD Zen platforms
	ARM: dts: imx: align SPI NOR node name with dtschema
	ARM: dts: imx6qdl-kontron-samx6i: fix spi-flash compatible
	ARM: dts: at91: fix low limit for CPU regulator
	ARM: dts: at91: sama7g5ek: specify proper regulator output ranges
	lockdep: Fix -Wunused-parameter for _THIS_IP_
	x86/mm: Force-inline __phys_addr_nodebug()
	task_stack, x86/cea: Force-inline stack helpers
	tracing: hold caller_addr to hardirq_{enable,disable}_ip
	tracefs: Only clobber mode/uid/gid on remount if asked
	iommu/vt-d: Fix kdump kernels boot failure with scalable mode
	Input: goodix - add support for GT1158
	platform/surface: aggregator_registry: Add support for Surface Laptop Go 2
	drm/msm/rd: Fix FIFO-full deadlock
	dt-bindings: iio: gyroscope: bosch,bmg160: correct number of pins
	HID: ishtp-hid-clientHID: ishtp-hid-client: Fix comment typo
	hid: intel-ish-hid: ishtp: Fix ishtp client sending disordered message
	tg3: Disable tg3 device on system reboot to avoid triggering AER
	gpio: mockup: remove gpio debugfs when remove device
	ieee802154: cc2520: add rc code in cc2520_tx()
	Input: iforce - add support for Boeder Force Feedback Wheel
	nvmet-tcp: fix unhandled tcp states in nvmet_tcp_state_change()
	drm/amd/amdgpu: skip ucode loading if ucode_size == 0
	net: dsa: hellcreek: Print warning only once
	perf/arm_pmu_platform: fix tests for platform_get_irq() failure
	platform/x86: acer-wmi: Acer Aspire One AOD270/Packard Bell Dot keymap fixes
	usb: storage: Add ASUS <0x0b05:0x1932> to IGNORE_UAS
	mm: Fix TLB flush for not-first PFNMAP mappings in unmap_region()
	soc: fsl: select FSL_GUTS driver for DPIO
	usb: gadget: f_uac2: clean up some inconsistent indenting
	usb: gadget: f_uac2: fix superspeed transfer
	RDMA/irdma: Use s/g array in post send only when its valid
	Input: goodix - add compatible string for GT1158
	Linux 5.15.69

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: Ifcadf79f34eb6093489fb3faf5e42c9739e56522
2022-09-24 14:14: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();
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();
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