From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 12F36606A31A for ; Tue, 1 Dec 2026 04:22:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=egGTHPeR; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=am6xU/4q DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Unsubscribe-Post: List-Owner; bh=VcwvTsj3/glsrfgIACODE8Svddmnw7BUNBjQyKrLehs=; b=egGTHPeR1pNqPz RkOkCLjB/u+zL/zSVIVvIcdFEkKWjrDwAt5vrdBELh4/XN+fgd006UmHdXO0jlqtmSid4wiAM0LhU 8IS7NZABkcZJ6qJFF96yMyBgQmSk/hetUEkSIdiwxo3ShGTIPXNnxyDgQibEyJpJMi/dKkyYmmiz8 ZAjz3lYEkImpj49adlJfFWnwdEPA9lrc4S26qCMiY8lbfjN/v8xEW+tR7ENR7hHJ2V4sdrBmTjyDG BX3shcAdzRaJg1ujgebZVAZ0SbKFvwvbryF7+cz71YoggOUvcdNXL8+VZKVtI/JZem2FMKzKnO6SC 3vQ2rYDPSGxCp7PHEdQw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xYFO8-00000006WAQ-2N8o; Tue, 01 Dec 2026 04:22:44 +0000 Received: from tor.source.kernel.org ([172.105.4.254]) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xYFO7-00000006W9m-04lU; Tue, 01 Dec 2026 04:22:43 +0000 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by tor.source.kernel.org (Postfix) with ESMTP id A3158618D3; Tue, 1 Dec 2026 04:22:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F31BF1F00899; Tue, 1 Dec 2026 04:22:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796098961; bh=VcwvTsj3/glsrfgIACODE8Svddmnw7BUNBjQyKrLehs=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=am6xU/4qL3ELRQLfZ7b+WFbm8jD+8iAEwoIkmd7Httd//6F2eADLIKFDhReTNzDQw LpjfpJxvLMmoIK/izros/8VUMLnwTMkZ5MKqIUBXmDY9EjRhfMUddqgpj/6M+OXQlC /HEMGv2WBkkD0/9J85f9yW9HtCcR3bPEDXugFZpjppdcQEfSx8T8MHdh7QziMjDk9h c8rDnHQwJd8rzShZgxnHzCJUbHd3v6VD90VsHBB4Mp9JnUV2Ch0QSGBY8F7JomnWCc 4amYRZljc6WSXY6yqp9n6VB6EfXi9ddcK2sfw4UURw3stNmA7d0aeZwwUDMHIXIm9F Nh+qZEbS5P7JA== From: Song Liu To: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, live-patching@vger.kernel.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, bpf@vger.kernel.org Cc: rostedt@goodmis.org, mhiramat@kernel.org, mark.rutland@arm.com, peterz@infradead.org, tglx@kernel.org, frederic@kernel.org, paulmck@kernel.org, catalin.marinas@arm.com, will@kernel.org, maddy@linux.ibm.com, mpe@ellerman.id.au, npiggin@gmail.com, chleroy@kernel.org, pjw@kernel.org, palmer@dabbelt.com, aou@eecs.berkeley.edu, alex@ghiti.fr, ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org, ojeda@kernel.org, kernel-team@meta.com, Song Liu Subject: [PATCH v3 01/22] x86/paravirt: Mark native pv_ops helpers notrace Date: Mon, 30 Nov 2026 20:21:40 -0800 Message-ID: <20261201042201.3199928-2-song@kernel.org> X-Mailer: git-send-email 2.53.1 In-Reply-To: <20261201042201.3199928-1-song@kernel.org> References: <20261201042201.3199928-1-song@kernel.org> X-Archived-By: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" X-Spam-Status: No, score=-18.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 The native implementations of several pv_ops are static inline functions in headers. pv_ops stores their address, so with CONFIG_PARAVIRT_XXL the compiler emits an out-of-line copy of each one, and pv_ops calls go to that copy. Today these copies are not traced only because the inline macro implies notrace. Some callers of these helpers must not be traced: restore_processor_state() is notrace and runs during resume, __switch_to() is __notrace_funcgraph, and arch/x86/kernel/cpu/common.c and arch/x86/kernel/tsc.c, which call several of them, are built without -pg. Mark these helpers notrace explicitly, like native_write_msr() and native_write_msr_safe() already are, so they stay untraced if inline no longer implies notrace. No functional change. Assisted-by: Claude:claude-opus-5 Signed-off-by: Song Liu --- arch/x86/include/asm/cpuid/api.h | 4 ++-- arch/x86/include/asm/desc.h | 17 +++++++++-------- arch/x86/include/asm/gsseg.h | 2 +- arch/x86/include/asm/io_bitmap.h | 2 +- arch/x86/include/asm/msr.h | 6 +++--- arch/x86/include/asm/pgalloc.h | 2 +- arch/x86/include/asm/pgtable_64.h | 10 +++++----- arch/x86/include/asm/processor.h | 2 +- arch/x86/include/asm/special_insns.h | 2 +- include/linux/pgtable.h | 12 ++++++------ 10 files changed, 30 insertions(+), 29 deletions(-) diff --git a/arch/x86/include/asm/cpuid/api.h b/arch/x86/include/asm/cpuid/api.h index 759b12d94bbf..f2f921f1b810 100644 --- a/arch/x86/include/asm/cpuid/api.h +++ b/arch/x86/include/asm/cpuid/api.h @@ -23,8 +23,8 @@ static inline bool cpuid_feature(void) } #endif -static inline void native_cpuid(u32 *eax, u32 *ebx, - u32 *ecx, u32 *edx) +static inline void notrace native_cpuid(u32 *eax, u32 *ebx, + u32 *ecx, u32 *edx) { /* ecx is often an input as well as an output. */ asm volatile("cpuid" diff --git a/arch/x86/include/asm/desc.h b/arch/x86/include/asm/desc.h index 00aeae843529..9a01dc9c191a 100644 --- a/arch/x86/include/asm/desc.h +++ b/arch/x86/include/asm/desc.h @@ -134,17 +134,18 @@ static inline void paravirt_free_ldt(struct desc_struct *ldt, unsigned entries) #define store_ldt(ldt) asm("sldt %0" : "=m"(ldt)) -static inline void native_write_idt_entry(gate_desc *idt, int entry, const gate_desc *gate) +static inline void notrace native_write_idt_entry(gate_desc *idt, int entry, const gate_desc *gate) { memcpy(&idt[entry], gate, sizeof(*gate)); } -static inline void native_write_ldt_entry(struct desc_struct *ldt, int entry, const void *desc) +static inline void notrace +native_write_ldt_entry(struct desc_struct *ldt, int entry, const void *desc) { memcpy(&ldt[entry], desc, 8); } -static inline void +static inline void notrace native_write_gdt_entry(struct desc_struct *gdt, int entry, const void *desc, int type) { unsigned int size; @@ -189,7 +190,7 @@ static inline void __set_tss_desc(unsigned cpu, unsigned int entry, struct x86_h #define set_tss_desc(cpu, addr) __set_tss_desc(cpu, GDT_ENTRY_TSS, addr) -static inline void native_set_ldt(const void *addr, unsigned int entries) +static inline void notrace native_set_ldt(const void *addr, unsigned int entries) { if (likely(entries == 0)) asm volatile("lldt %w0"::"q" (0)); @@ -205,7 +206,7 @@ static inline void native_set_ldt(const void *addr, unsigned int entries) } } -static inline void native_load_gdt(const struct desc_ptr *dtr) +static inline void notrace native_load_gdt(const struct desc_ptr *dtr) { asm volatile("lgdt %0"::"m" (*dtr)); } @@ -251,7 +252,7 @@ static inline void native_idt_invalidate(void) * original writeable version when needed. */ #ifdef CONFIG_X86_64 -static inline void native_load_tr_desc(void) +static inline void notrace native_load_tr_desc(void) { struct desc_ptr gdt; int cpu = raw_smp_processor_id(); @@ -280,7 +281,7 @@ static inline void native_load_tr_desc(void) } #endif -static inline unsigned long native_store_tr(void) +static inline unsigned long notrace native_store_tr(void) { unsigned long tr; @@ -289,7 +290,7 @@ static inline unsigned long native_store_tr(void) return tr; } -static inline void native_load_tls(struct thread_struct *t, unsigned int cpu) +static inline void notrace native_load_tls(struct thread_struct *t, unsigned int cpu) { struct desc_struct *gdt = get_cpu_gdt_rw(cpu); unsigned int i; diff --git a/arch/x86/include/asm/gsseg.h b/arch/x86/include/asm/gsseg.h index ab6a595cea70..14596425f36a 100644 --- a/arch/x86/include/asm/gsseg.h +++ b/arch/x86/include/asm/gsseg.h @@ -25,7 +25,7 @@ static inline void native_lkgs(unsigned int selector) : [sel] "+D" (sel)); } -static inline void native_load_gs_index(unsigned int selector) +static inline void notrace native_load_gs_index(unsigned int selector) { if (cpu_feature_enabled(X86_FEATURE_LKGS)) { native_lkgs(selector); diff --git a/arch/x86/include/asm/io_bitmap.h b/arch/x86/include/asm/io_bitmap.h index 7f080f5c7def..af3b08a685e6 100644 --- a/arch/x86/include/asm/io_bitmap.h +++ b/arch/x86/include/asm/io_bitmap.h @@ -19,7 +19,7 @@ struct task_struct; void io_bitmap_share(struct task_struct *tsk); void io_bitmap_exit(struct task_struct *tsk); -static inline void native_tss_invalidate_io_bitmap(void) +static inline void notrace native_tss_invalidate_io_bitmap(void) { /* * Invalidate the I/O bitmap by moving io_bitmap_base outside the diff --git a/arch/x86/include/asm/msr.h b/arch/x86/include/asm/msr.h index 2f41a9289d79..ca138498a00b 100644 --- a/arch/x86/include/asm/msr.h +++ b/arch/x86/include/asm/msr.h @@ -101,7 +101,7 @@ static __always_inline u64 native_rdmsrq(u32 msr) #define native_wrmsrq(msr, val) \ __wrmsrq((msr), (val)) -static inline u64 native_read_msr(u32 msr) +static inline u64 notrace native_read_msr(u32 msr) { u64 val; @@ -113,7 +113,7 @@ static inline u64 native_read_msr(u32 msr) return val; } -static inline int native_read_msr_safe(u32 msr, u64 *p) +static inline int notrace native_read_msr_safe(u32 msr, u64 *p) { int err; EAX_EDX_DECLARE_ARGS(val, low, high); @@ -159,7 +159,7 @@ static inline int notrace native_write_msr_safe(u32 msr, u64 val) extern int rdmsr_safe_regs(u32 regs[8]); extern int wrmsr_safe_regs(u32 regs[8]); -static inline u64 native_read_pmc(int counter) +static inline u64 notrace native_read_pmc(int counter) { EAX_EDX_DECLARE_ARGS(val, low, high); diff --git a/arch/x86/include/asm/pgalloc.h b/arch/x86/include/asm/pgalloc.h index c88691b15f3c..8d233e2e72bf 100644 --- a/arch/x86/include/asm/pgalloc.h +++ b/arch/x86/include/asm/pgalloc.h @@ -12,7 +12,7 @@ #define __HAVE_ARCH_PGD_FREE #include -static inline int __paravirt_pgd_alloc(struct mm_struct *mm) { return 0; } +static inline int notrace __paravirt_pgd_alloc(struct mm_struct *mm) { return 0; } #ifdef CONFIG_PARAVIRT_XXL #include diff --git a/arch/x86/include/asm/pgtable_64.h b/arch/x86/include/asm/pgtable_64.h index c861f3832bed..092e5f65f68e 100644 --- a/arch/x86/include/asm/pgtable_64.h +++ b/arch/x86/include/asm/pgtable_64.h @@ -40,7 +40,7 @@ static inline bool mm_p4d_folded(struct mm_struct *mm) void set_pte_vaddr_p4d(p4d_t *p4d_page, unsigned long vaddr, pte_t new_pte); void set_pte_vaddr_pud(pud_t *pud_page, unsigned long vaddr, pte_t new_pte); -static inline void native_set_pte(pte_t *ptep, pte_t pte) +static inline void notrace native_set_pte(pte_t *ptep, pte_t pte) { WRITE_ONCE(*ptep, pte); } @@ -56,7 +56,7 @@ static inline void native_set_pte_atomic(pte_t *ptep, pte_t pte) native_set_pte(ptep, pte); } -static inline void native_set_pmd(pmd_t *pmdp, pmd_t pmd) +static inline void notrace native_set_pmd(pmd_t *pmdp, pmd_t pmd) { WRITE_ONCE(*pmdp, pmd); } @@ -92,7 +92,7 @@ static inline pmd_t native_pmdp_get_and_clear(pmd_t *xp) #endif } -static inline void native_set_pud(pud_t *pudp, pud_t pud) +static inline void notrace native_set_pud(pud_t *pudp, pud_t pud) { WRITE_ONCE(*pudp, pud); } @@ -117,7 +117,7 @@ static inline pud_t native_pudp_get_and_clear(pud_t *xp) #endif } -static inline void native_set_p4d(p4d_t *p4dp, p4d_t p4d) +static inline void notrace native_set_p4d(p4d_t *p4dp, p4d_t p4d) { pgd_t pgd; @@ -137,7 +137,7 @@ static inline void native_p4d_clear(p4d_t *p4d) native_set_p4d(p4d, native_make_p4d(0)); } -static inline void native_set_pgd(pgd_t *pgdp, pgd_t pgd) +static inline void notrace native_set_pgd(pgd_t *pgdp, pgd_t pgd) { WRITE_ONCE(*pgdp, pti_set_user_pgtbl(pgdp, pgd)); } diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h index 77488ff5eb8c..f1a0d99ddd22 100644 --- a/arch/x86/include/asm/processor.h +++ b/arch/x86/include/asm/processor.h @@ -548,7 +548,7 @@ static inline void arch_thread_struct_whitelist(unsigned long *offset, fpu_thread_struct_whitelist(offset, size); } -static inline void +static inline void notrace native_load_sp0(unsigned long sp0) { this_cpu_write(cpu_tss_rw.x86_tss.sp0, sp0); diff --git a/arch/x86/include/asm/special_insns.h b/arch/x86/include/asm/special_insns.h index 6c80f69cf62b..f39891c94e7b 100644 --- a/arch/x86/include/asm/special_insns.h +++ b/arch/x86/include/asm/special_insns.h @@ -12,7 +12,7 @@ void native_write_cr0(unsigned long val); -static inline unsigned long native_read_cr0(void) +static inline unsigned long notrace native_read_cr0(void) { unsigned long val; asm volatile("mov %%cr0,%0" : "=r" (val)); diff --git a/include/linux/pgtable.h b/include/linux/pgtable.h index 66d369870a74..09cf1831bf48 100644 --- a/include/linux/pgtable.h +++ b/include/linux/pgtable.h @@ -1607,9 +1607,9 @@ static inline int pmd_none_or_clear_bad(pmd_t *pmd) return 0; } -static inline pte_t __ptep_modify_prot_start(struct vm_area_struct *vma, - unsigned long addr, - pte_t *ptep) +static inline pte_t notrace __ptep_modify_prot_start(struct vm_area_struct *vma, + unsigned long addr, + pte_t *ptep) { /* * Get the current pte state, but zero it out to make it @@ -1619,9 +1619,9 @@ static inline pte_t __ptep_modify_prot_start(struct vm_area_struct *vma, return ptep_get_and_clear(vma->vm_mm, addr, ptep); } -static inline void __ptep_modify_prot_commit(struct vm_area_struct *vma, - unsigned long addr, - pte_t *ptep, pte_t pte) +static inline void notrace __ptep_modify_prot_commit(struct vm_area_struct *vma, + unsigned long addr, + pte_t *ptep, pte_t pte) { /* * The pte is non-present, so there's no hardware state to -- 2.53.1-Meta