From nobody Thu Dec 18 15:07:23 2025 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AE3F826980D; Wed, 23 Apr 2025 06:50:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745391049; cv=none; b=BNMWvSuswhUE7yIXPfn91qGKwE0XQ8uLV8ewGvgSnMGZYfi0f0351laxGWH9Aw0tXF9AHgEtRn5SCX+fhexa+604gVcUMeJs/I00NuMkKwUbShxZQAD3R/ps/zcLO3PEIKk7NGZI8u4b4yeXjlmWA3ZYh3hgC3rH4SJYezmhu2s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745391049; c=relaxed/simple; bh=ERsSHF6cveMP56swmamcYhe2qaD2zoqTzJM+wQ07ysg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=cFfzufy6uL6Coe9ojhXzyFrLb6ojiflZ7wuxb5yje7o80TSIxc/xYNn+h7TOMc4Oba6/bxsPFHu/8aiXVm8eyLUL8lD+jhpDJyCfsE22c/AoC+GCxfLNozFH84o4dk+Mo3bA0TBlAPRsIcPOWkE6ewd9qifcd4WEspU6ddcw++0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=xJkgIRFX; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=UHM9eaqs; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="xJkgIRFX"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="UHM9eaqs" From: Nam Cao DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1745391039; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=UPn4Z3qJtGRDNuo4zQemDZcbXpzyUcw6dR3h1cNGvUo=; b=xJkgIRFXSbaReH861qqfDY+ztwZ0wZqsfV2V6ejvzXThQJDrdqWPjeSppnPmamZ2JQ6IEG xg1EXtZFUbQHHAHuv14dle4AvWu5G+ZFqGQlvJKeLvaiRDBx9H6vQ97ZCbFfh/gHa8NImP +2SfmN436Ghttauypo/k+0q7v+Qak/cJh16nBYu5n2B1RYDP0Nit1wJhuSfqLlf7HS8+jN xB/B55pOzxRmbYMJLrvtzTJv9cDD55bXas0O2Au8Uc49+/FZFb0HJE20DRJN1FF/wtzZhN 9vNaJywxrS8lUMQCwI9dDUKAV36s5bLIsmlA5LvnKj8yNJ7pvZmvBhRoqPRmpg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1745391039; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=UPn4Z3qJtGRDNuo4zQemDZcbXpzyUcw6dR3h1cNGvUo=; b=UHM9eaqsn67trtwY6W81AvNK1og/S+zzrNC2mjhdOVd9LtU/s1NAeqZC/17bn8dSmk+SBk aTuAkvXFH7p6JBAw== To: Steven Rostedt , Gabriele Monaco , linux-trace-kernel@vger.kernel.org, linux-kernel@vger.kernel.org Cc: john.ogness@linutronix.de, Nam Cao , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H . Peter Anvin" , Andy Lutomirski , Peter Zijlstra Subject: [PATCH v4 15/22] x86/tracing: Remove redundant trace_pagefault_key Date: Wed, 23 Apr 2025 08:50:10 +0200 Message-Id: In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" trace_pagefault_key is used to optimize the pagefault tracepoints when it is disabled. However, tracepoints already have built-in static_key for this exact purpose. Remove this redundant key. Signed-off-by: Nam Cao --- Cc: Thomas Gleixner Cc: Ingo Molnar Cc: Borislav Petkov Cc: Dave Hansen Cc: x86@kernel.org Cc: H. Peter Anvin Cc: Andy Lutomirski Cc: Peter Zijlstra --- arch/x86/include/asm/trace/common.h | 12 ------------ arch/x86/include/asm/trace/exceptions.h | 18 ++++++------------ arch/x86/include/asm/trace/irq_vectors.h | 1 - arch/x86/kernel/Makefile | 1 - arch/x86/kernel/tracepoint.c | 21 --------------------- arch/x86/mm/fault.c | 3 --- 6 files changed, 6 insertions(+), 50 deletions(-) delete mode 100644 arch/x86/include/asm/trace/common.h delete mode 100644 arch/x86/kernel/tracepoint.c diff --git a/arch/x86/include/asm/trace/common.h b/arch/x86/include/asm/tra= ce/common.h deleted file mode 100644 index f0f9bcdb74d9..000000000000 --- a/arch/x86/include/asm/trace/common.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef _ASM_TRACE_COMMON_H -#define _ASM_TRACE_COMMON_H - -#ifdef CONFIG_TRACING -DECLARE_STATIC_KEY_FALSE(trace_pagefault_key); -#define trace_pagefault_enabled() \ - static_branch_unlikely(&trace_pagefault_key) -#else -static inline bool trace_pagefault_enabled(void) { return false; } -#endif - -#endif diff --git a/arch/x86/include/asm/trace/exceptions.h b/arch/x86/include/asm= /trace/exceptions.h index 6b1e87194809..34bc8214a2d7 100644 --- a/arch/x86/include/asm/trace/exceptions.h +++ b/arch/x86/include/asm/trace/exceptions.h @@ -6,10 +6,6 @@ #define _TRACE_PAGE_FAULT_H =20 #include -#include - -extern int trace_pagefault_reg(void); -extern void trace_pagefault_unreg(void); =20 DECLARE_EVENT_CLASS(x86_exceptions, =20 @@ -34,15 +30,13 @@ DECLARE_EVENT_CLASS(x86_exceptions, (void *)__entry->address, (void *)__entry->ip, __entry->error_code) ); =20 -#define DEFINE_PAGE_FAULT_EVENT(name) \ -DEFINE_EVENT_FN(x86_exceptions, name, \ - TP_PROTO(unsigned long address, struct pt_regs *regs, \ - unsigned long error_code), \ - TP_ARGS(address, regs, error_code), \ - trace_pagefault_reg, trace_pagefault_unreg); +DEFINE_EVENT(x86_exceptions, page_fault_user, + TP_PROTO(unsigned long address, struct pt_regs *regs, unsigned long error= _code), + TP_ARGS(address, regs, error_code)); =20 -DEFINE_PAGE_FAULT_EVENT(page_fault_user); -DEFINE_PAGE_FAULT_EVENT(page_fault_kernel); +DEFINE_EVENT(x86_exceptions, page_fault_kernel, + TP_PROTO(unsigned long address, struct pt_regs *regs, unsigned long error= _code), + TP_ARGS(address, regs, error_code)); =20 #undef TRACE_INCLUDE_PATH #undef TRACE_INCLUDE_FILE diff --git a/arch/x86/include/asm/trace/irq_vectors.h b/arch/x86/include/as= m/trace/irq_vectors.h index 88e7f0f3bf62..7408bebdfde0 100644 --- a/arch/x86/include/asm/trace/irq_vectors.h +++ b/arch/x86/include/asm/trace/irq_vectors.h @@ -6,7 +6,6 @@ #define _TRACE_IRQ_VECTORS_H =20 #include -#include =20 #ifdef CONFIG_X86_LOCAL_APIC =20 diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile index b43eb7e384eb..e8e33ec684ba 100644 --- a/arch/x86/kernel/Makefile +++ b/arch/x86/kernel/Makefile @@ -139,7 +139,6 @@ obj-$(CONFIG_OF) +=3D devicetree.o obj-$(CONFIG_UPROBES) +=3D uprobes.o =20 obj-$(CONFIG_PERF_EVENTS) +=3D perf_regs.o -obj-$(CONFIG_TRACING) +=3D tracepoint.o obj-$(CONFIG_SCHED_MC_PRIO) +=3D itmt.o obj-$(CONFIG_X86_UMIP) +=3D umip.o =20 diff --git a/arch/x86/kernel/tracepoint.c b/arch/x86/kernel/tracepoint.c deleted file mode 100644 index 03ae1caaa878..000000000000 --- a/arch/x86/kernel/tracepoint.c +++ /dev/null @@ -1,21 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* - * Copyright (C) 2013 Seiji Aguchi - */ -#include -#include - -#include - -DEFINE_STATIC_KEY_FALSE(trace_pagefault_key); - -int trace_pagefault_reg(void) -{ - static_branch_inc(&trace_pagefault_key); - return 0; -} - -void trace_pagefault_unreg(void) -{ - static_branch_dec(&trace_pagefault_key); -} diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c index 296d294142c8..7e3e51fa1f95 100644 --- a/arch/x86/mm/fault.c +++ b/arch/x86/mm/fault.c @@ -1455,9 +1455,6 @@ static __always_inline void trace_page_fault_entries(struct pt_regs *regs, unsigned long error_code, unsigned long address) { - if (!trace_pagefault_enabled()) - return; - if (user_mode(regs)) trace_page_fault_user(address, regs, error_code); else --=20 2.39.5