From: maobibo <maobibo@loongson.cn>
To: Tiezhu Yang <yangtiezhu@loongson.cn>,
Huacai Chen <chenhuacai@kernel.org>
Cc: Arnd Bergmann <arnd@arndb.de>,
loongarch@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1 2/2] LoongArch: Add ifdefs to fix LSX and LASX related issues
Date: Wed, 21 Aug 2024 09:12:34 +0800 [thread overview]
Message-ID: <1d23bbfe-dd36-b2ff-c4b3-cf69396ea53f@loongson.cn> (raw)
In-Reply-To: <20240820123731.31568-3-yangtiezhu@loongson.cn>
On 2024/8/20 下午8:37, Tiezhu Yang wrote:
> There exist some issues when building kernel if CONFIG_CPU_HAS_LBT is set
> but CONFIG_CPU_HAS_LSX and CONFIG_CPU_HAS_LASX are not set. In this case,
> there are no definitions of _restore_lsx and _restore_lasx and there are
> also no definitions of kvm_restore_lsx and kvm_restore_lasx in fpu.S and
> switch.S respectively, just add some ifdefs to fix the issues.
>
> AS arch/loongarch/kernel/fpu.o
> arch/loongarch/kernel/fpu.o: warning: objtool: unexpected relocation symbol type in .rela.discard.func_stack_frame_non_standard: 0
> arch/loongarch/kernel/fpu.o: warning: objtool: unexpected relocation symbol type in .rela.discard.func_stack_frame_non_standard: 0
>
> AS [M] arch/loongarch/kvm/switch.o
> arch/loongarch/kvm/switch.o: warning: objtool: unexpected relocation symbol type in .rela.discard.func_stack_frame_non_standard: 0
> arch/loongarch/kvm/switch.o: warning: objtool: unexpected relocation symbol type in .rela.discard.func_stack_frame_non_standard: 0
>
> MODPOST Module.symvers
> ERROR: modpost: "kvm_restore_lsx" [arch/loongarch/kvm/kvm.ko] undefined!
> ERROR: modpost: "kvm_restore_lasx" [arch/loongarch/kvm/kvm.ko] undefined!
>
> Cc: stable@vger.kernel.org # 6.9+
> Fixes: cb8a2ef0848c ("LoongArch: Add ORC stack unwinder support")
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202408120955.qls5oNQY-lkp@intel.com/
> Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
> ---
> arch/loongarch/kernel/fpu.S | 4 ++++
> arch/loongarch/kvm/switch.S | 4 ++++
> 2 files changed, 8 insertions(+)
>
> diff --git a/arch/loongarch/kernel/fpu.S b/arch/loongarch/kernel/fpu.S
> index 69a85f2479fb..6ab640101457 100644
> --- a/arch/loongarch/kernel/fpu.S
> +++ b/arch/loongarch/kernel/fpu.S
> @@ -530,6 +530,10 @@ SYM_FUNC_END(_restore_lasx_context)
>
> #ifdef CONFIG_CPU_HAS_LBT
> STACK_FRAME_NON_STANDARD _restore_fp
> +#ifdef CONFIG_CPU_HAS_LSX
> STACK_FRAME_NON_STANDARD _restore_lsx
> +#endif
> +#ifdef CONFIG_CPU_HAS_LASX
> STACK_FRAME_NON_STANDARD _restore_lasx
> #endif
> +#endif
> diff --git a/arch/loongarch/kvm/switch.S b/arch/loongarch/kvm/switch.S
> index 80e988985a6a..0c292f818492 100644
> --- a/arch/loongarch/kvm/switch.S
> +++ b/arch/loongarch/kvm/switch.S
> @@ -277,6 +277,10 @@ SYM_DATA(kvm_enter_guest_size, .quad kvm_enter_guest_end - kvm_enter_guest)
>
> #ifdef CONFIG_CPU_HAS_LBT
> STACK_FRAME_NON_STANDARD kvm_restore_fpu
> +#ifdef CONFIG_CPU_HAS_LSX
> STACK_FRAME_NON_STANDARD kvm_restore_lsx
> +#endif
> +#ifdef CONFIG_CPU_HAS_LASX
> STACK_FRAME_NON_STANDARD kvm_restore_lasx
> #endif
> +#endif
>
It is hard to understand to put CONFIG_CPU_HAS_LASX inside
CONFIG_CPU_HAS_LBT, in general option CONFIG_CPU_HAS_LBT has nothing
with CONFIG_CPU_HAS_LASX.
Would you like to add parameter func in macro fpu_restore_csr like this?
--- a/arch/loongarch/include/asm/asmmacro.h
+++ b/arch/loongarch/include/asm/asmmacro.h
@@ -55,10 +55,11 @@
#endif
.endm
- .macro fpu_restore_csr thread tmp0 tmp1
+ .macro fpu_restore_csr thread tmp0 tmp1 func
ldptr.w \tmp0, \thread, THREAD_FCSR
movgr2fcsr fcsr0, \tmp0
#ifdef CONFIG_CPU_HAS_LBT
+ STACK_FRAME_NON_STANDARD \func
/* TM bit is always 0 if LBT not supported */
andi \tmp0, \tmp0, FPU_CSR_TM
beqz \tmp0, 2f
@@ -282,10 +283,10 @@
lsx_save_data \thread, \tmp0
.endm
Regards
Bibo Mao
next prev parent reply other threads:[~2024-08-21 1:12 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-20 12:37 [PATCH v1 0/2] LoongArch: Fix some build issues with randconfig Tiezhu Yang
2024-08-20 12:37 ` [PATCH v1 1/2] LoongArch: Define barrier_before_unreachable() as empty Tiezhu Yang
2024-08-21 7:37 ` Huacai Chen
2024-08-21 7:52 ` Xi Ruoyao
2024-08-21 10:02 ` Jinyang He
2024-08-20 12:37 ` [PATCH v1 2/2] LoongArch: Add ifdefs to fix LSX and LASX related issues Tiezhu Yang
2024-08-21 1:12 ` maobibo [this message]
2024-08-21 10:07 ` Tiezhu Yang
2024-08-22 1:09 ` maobibo
2024-08-22 2:51 ` Tiezhu Yang
2024-08-22 2:57 ` maobibo
2024-08-26 14:22 ` Huacai Chen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1d23bbfe-dd36-b2ff-c4b3-cf69396ea53f@loongson.cn \
--to=maobibo@loongson.cn \
--cc=arnd@arndb.de \
--cc=chenhuacai@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=loongarch@lists.linux.dev \
--cc=yangtiezhu@loongson.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®