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 B13F3606A32E for ; Tue, 1 Dec 2026 04:23:16 +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=rhbs86gs; dkim=fail reason="signature verification failed" (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=hwzlzvoR DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Unsubscribe-Post:List-Owner; bh=UbpO/jTBIFe9bVMkPzdenFN7qMrbwMHB+f3al5syEhE=; b=rhbs86gs0gU3lGtCHQjVLr1tJO maYbEITp9hIzSvFcFkvO1OKHHORGqp/IvVhkl/g4zhM6q2VgaTMQ44snSfqvC77nnuEHI4BRwYZRk noCuvifjl3zfy189c9S8+FAoWwpnHYd4OUqM9EYoRIc13XmN5IOYc7nW1GuI4BpbUMzc8ljVa+0E2 x1EE0610TIEU8GqP1hqCAQfmghgVLcg5YSR+Dq0jDmt08Q5Nh12F/jfeUAbTzxrSRFr5FxNeqz38t Cv4GFfa9ArZqAqUMEQqHoL6mvqJ6nxt8ZgMSpDkup2cTFxhKjPMHy4g3rAtlcOHJZiZq9q90On8wn OApPQ9Eg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xYFOV-00000006WNg-06cH; Tue, 01 Dec 2026 04:23:07 +0000 Received: from sea.source.kernel.org ([172.234.252.31]) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xYFOM-00000006WJ8-2f4E; Tue, 01 Dec 2026 04:22:58 +0000 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by sea.source.kernel.org (Postfix) with ESMTP id 5424C43B4F; Tue, 1 Dec 2026 04:22:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6E9051F00927; Tue, 1 Dec 2026 04:22:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796098978; bh=k5Z8b2Zo3lDccwCgvLU5ZEALrOI8k28M68WCJC2y5fU=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=hwzlzvoRU9g6Ic5soWTDYXz1UjHP/BvSeyRhEIUISi5m0FLPjk4HSsJPJGAncuHz0 PH08SDIs6yDNegZZqb0IohVlInRHEelkt9wJKEsoNzEhHi0yZk2YSx45cSCv2I9qiU XA68qHyIqi1AD9ZiA6iLK56JTqK2F/BSaW2nLiQyahPXCTxBE2NUBhSBsiF516BfcM PbauJqOkHuaL+FowOpsG0l6FMhVzVrHvMZ1NN2B/ghSdxj4JxkhCkI3IGaxaRffU2O uC6O3/w5VL2HiZ+7ZrrYB8x+Le3neh4CjMrFsAQxa6jg5+JoMYSHCddExhIYc4d7gS CEPR6W2BmHBaA== 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 02/22] x86: Mark CPU state helpers used by resume and kexec notrace Date: Mon, 30 Nov 2026 20:21:41 -0800 Message-ID: <20261201042201.3199928-3-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 X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-riscv" X-Spam-Status: No, score=-16.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham 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 __restore_processor_state() is notrace because it starts running before %gs and the IDT are restored, when the function tracer cannot run yet. Before it restores MSR_GS_BASE, it calls wrmsrq(), __write_cr4(), write_cr3(), write_cr0(), load_idt() and loadsegment(), and after that it calls load_gs_index(). With CONFIG_PARAVIRT_XXL, wrmsrq() calls paravirt_write_msr(). machine_kexec() calls virt_to_phys() after load_segments() has reset %gs. All of these are plain inline functions. If the compiler emits one of them out of line, that copy is untraced only because inline implies notrace. Mark them notrace explicitly, together with the other paravirt MSR accessors, so they stay consistent with paravirt_write_msr(). No functional change. Assisted-by: Claude:claude-opus-5 Signed-off-by: Song Liu --- arch/x86/include/asm/gsseg.h | 2 +- arch/x86/include/asm/io.h | 2 +- arch/x86/include/asm/msr.h | 2 +- arch/x86/include/asm/paravirt.h | 20 ++++++++++---------- arch/x86/include/asm/segment.h | 4 ++-- arch/x86/include/asm/special_insns.h | 6 +++--- 6 files changed, 18 insertions(+), 18 deletions(-) diff --git a/arch/x86/include/asm/gsseg.h b/arch/x86/include/asm/gsseg.h index 14596425f36a..d46d6effb631 100644 --- a/arch/x86/include/asm/gsseg.h +++ b/arch/x86/include/asm/gsseg.h @@ -52,7 +52,7 @@ static inline void __init lkgs_init(void) #ifndef CONFIG_PARAVIRT_XXL -static inline void load_gs_index(unsigned int selector) +static inline void notrace load_gs_index(unsigned int selector) { #ifdef CONFIG_X86_64 native_load_gs_index(selector); diff --git a/arch/x86/include/asm/io.h b/arch/x86/include/asm/io.h index 7f4847b2b904..721ce7878966 100644 --- a/arch/x86/include/asm/io.h +++ b/arch/x86/include/asm/io.h @@ -126,7 +126,7 @@ extern int valid_mmap_phys_addr_range(unsigned long pfn, size_t size); * this function */ -static inline phys_addr_t virt_to_phys(volatile void *address) +static inline phys_addr_t notrace virt_to_phys(volatile void *address) { return __pa(address); } diff --git a/arch/x86/include/asm/msr.h b/arch/x86/include/asm/msr.h index ca138498a00b..7c311dbcd0bf 100644 --- a/arch/x86/include/asm/msr.h +++ b/arch/x86/include/asm/msr.h @@ -194,7 +194,7 @@ static inline void wrmsr(u32 msr, u32 low, u32 high) #define rdmsrq(msr, val) \ ((val) = native_read_msr((msr))) -static inline void wrmsrq(u32 msr, u64 val) +static inline void notrace wrmsrq(u32 msr, u64 val) { native_write_msr(msr, val); } diff --git a/arch/x86/include/asm/paravirt.h b/arch/x86/include/asm/paravirt.h index 0591aa38fd85..c30af937103b 100644 --- a/arch/x86/include/asm/paravirt.h +++ b/arch/x86/include/asm/paravirt.h @@ -98,7 +98,7 @@ static inline unsigned long read_cr0(void) return PVOP_CALL0(unsigned long, pv_ops, cpu.read_cr0); } -static inline void write_cr0(unsigned long x) +static inline void notrace write_cr0(unsigned long x) { PVOP_VCALL1(pv_ops, cpu.write_cr0, x); } @@ -120,32 +120,32 @@ static inline unsigned long __read_cr3(void) "mov %%cr3, %%rax", ALT_NOT_XEN); } -static inline void write_cr3(unsigned long x) +static inline void notrace write_cr3(unsigned long x) { PVOP_ALT_VCALL1(pv_ops, mmu.write_cr3, x, "mov %%rdi, %%cr3", ALT_NOT_XEN); } -static inline void __write_cr4(unsigned long x) +static inline void notrace __write_cr4(unsigned long x) { PVOP_VCALL1(pv_ops, cpu.write_cr4, x); } -static inline u64 paravirt_read_msr(u32 msr) +static inline u64 notrace paravirt_read_msr(u32 msr) { return PVOP_CALL1(u64, pv_ops, cpu.read_msr, msr); } -static inline void paravirt_write_msr(u32 msr, u64 val) +static inline void notrace paravirt_write_msr(u32 msr, u64 val) { PVOP_VCALL2(pv_ops, cpu.write_msr, msr, val); } -static inline int paravirt_read_msr_safe(u32 msr, u64 *val) +static inline int notrace paravirt_read_msr_safe(u32 msr, u64 *val) { return PVOP_CALL2(int, pv_ops, cpu.read_msr_safe, msr, val); } -static inline int paravirt_write_msr_safe(u32 msr, u64 val) +static inline int notrace paravirt_write_msr_safe(u32 msr, u64 val) { return PVOP_CALL2(int, pv_ops, cpu.write_msr_safe, msr, val); } @@ -167,7 +167,7 @@ do { \ val = paravirt_read_msr(msr); \ } while (0) -static inline void wrmsrq(u32 msr, u64 val) +static inline void notrace wrmsrq(u32 msr, u64 val) { paravirt_write_msr(msr, val); } @@ -215,7 +215,7 @@ static inline void load_gdt(const struct desc_ptr *dtr) { PVOP_VCALL1(pv_ops, cpu.load_gdt, dtr); } -static inline void load_idt(const struct desc_ptr *dtr) +static inline void notrace load_idt(const struct desc_ptr *dtr) { PVOP_VCALL1(pv_ops, cpu.load_idt, dtr); } @@ -234,7 +234,7 @@ static inline void load_TLS(struct thread_struct *t, unsigned cpu) PVOP_VCALL2(pv_ops, cpu.load_tls, t, cpu); } -static inline void load_gs_index(unsigned int gs) +static inline void notrace load_gs_index(unsigned int gs) { PVOP_VCALL1(pv_ops, cpu.load_gs_index, gs); } diff --git a/arch/x86/include/asm/segment.h b/arch/x86/include/asm/segment.h index dbd90fede5e7..01ed6f1f7952 100644 --- a/arch/x86/include/asm/segment.h +++ b/arch/x86/include/asm/segment.h @@ -303,7 +303,7 @@ extern const char xen_early_idt_handler_array[NUM_EXCEPTION_VECTORS][XEN_EARLY_I * FS and GS. */ #define LOAD_SEGMENT(seg) \ -static inline void __loadsegment_##seg(u16 value) \ +static inline void notrace __loadsegment_##seg(u16 value) \ { \ asm volatile("1: movl %k0,%%" #seg "\n" \ _ASM_EXTABLE_TYPE_REG(1b, 1b, EX_TYPE_ZERO_REG, %k0)\ @@ -325,7 +325,7 @@ LOAD_SEGMENT(gs) #else -static inline void __loadsegment_fs(u16 value) +static inline void notrace __loadsegment_fs(u16 value) { asm volatile("1: movw %0, %%fs\n" "2:\n" diff --git a/arch/x86/include/asm/special_insns.h b/arch/x86/include/asm/special_insns.h index f39891c94e7b..10c30ae70798 100644 --- a/arch/x86/include/asm/special_insns.h +++ b/arch/x86/include/asm/special_insns.h @@ -134,7 +134,7 @@ static inline unsigned long read_cr0(void) return native_read_cr0(); } -static inline void write_cr0(unsigned long x) +static inline void notrace write_cr0(unsigned long x) { native_write_cr0(x); } @@ -158,12 +158,12 @@ static inline unsigned long __read_cr3(void) return __native_read_cr3(); } -static inline void write_cr3(unsigned long x) +static inline void notrace write_cr3(unsigned long x) { native_write_cr3(x); } -static inline void __write_cr4(unsigned long x) +static inline void notrace __write_cr4(unsigned long x) { native_write_cr4(x); } -- 2.53.1-Meta _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv