Skip to contentSkip to conversation

riscv: vector: Fixup modules compile error

PATCH In review [email protected] 4 participants 9 messages May 29, 2023 – May 30, 2023 RISC-V

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 riscv: vector: Fixup modules compile error

From: Guo Ren <[email protected]>

Some .ko also need the riscv_v_user_allowed symbol.

ERROR: modpost: "riscv_v_user_allowed" [arch/riscv/kvm/kvm.ko] undefined!
make[3]: *** [/home/guoren/source/kernel/linux/scripts/Makefile.modpost:136:
Module.symvers] Error 1

---
 arch/riscv/kernel/vector.c | 1 +
 1 file changed, 1 insertion(+)
arch/riscv/kernel/vector.c +1 -0
index 1c4ac821e008..3ae08816d608 100644
@@ -129,6 +129,7 @@ bool riscv_v_user_allowed(void)
 {
 	return riscv_v_get_cur_ctrl(current) == PR_RISCV_V_VSTATE_CTRL_ON;
 }
+EXPORT_SYMBOL(riscv_v_user_allowed);
 
 bool riscv_v_first_use_handler(struct pt_regs *regs)
 {
Signature · 1 line
2.36.1
#1 lore raw
Quoted 21 lines · On Mon, May 29, 2023 at 03:38:45AM -0400, [email protected] wrote:

From: Guo Ren <[email protected]>

Some .ko also need the riscv_v_user_allowed symbol.

ERROR: modpost: "riscv_v_user_allowed" [arch/riscv/kvm/kvm.ko] undefined!
make[3]: *** [/home/guoren/source/kernel/linux/scripts/Makefile.modpost:136:
Module.symvers] Error 1

---
 arch/riscv/kernel/vector.c | 1 +
 1 file changed, 1 insertion(+)
arch/riscv/kernel/vector.c +0 -0
index 1c4ac821e008..3ae08816d608 100644

arch/riscv/kernel/vector.c bool riscv_v_user_allowed(void) · line 132

Quoted 4 lines
arch/riscv/kernel/vector.c +1 -0
@@ -129,6 +129,7 @@ bool riscv_v_user_allowed(void)
 {
 	return riscv_v_get_cur_ctrl(current) == PR_RISCV_V_VSTATE_CTRL_ON;
 }
+EXPORT_SYMBOL(riscv_v_user_allowed);

Is there a reason that this should not be EXPORT_SYMBOL_GPL()?

I figure Andy will roll this into this next revision..

Cheers,
Conor.

author
#2 lore raw
Quoted 18 lines · Conor Dooley
Quoted 16 lines · On Mon, May 29, 2023 at 03:38:45AM -0400, [email protected] wrote:

From: Guo Ren <[email protected]>

Some .ko also need the riscv_v_user_allowed symbol.

ERROR: modpost: "riscv_v_user_allowed" [arch/riscv/kvm/kvm.ko] undefined!
make[3]: *** [/home/guoren/source/kernel/linux/scripts/Makefile.modpost:136:
Module.symvers] Error 1

---
 arch/riscv/kernel/vector.c | 1 +
 1 file changed, 1 insertion(+)
Quoted 11 lines

arch/riscv/kernel/vector.c bool riscv_v_user_allowed(void) · line 132

Quoted 9 lines
arch/riscv/kernel/vector.c +1 -0
index 1c4ac821e008..3ae08816d608 100644
@@ -129,6 +129,7 @@ bool riscv_v_user_allowed(void)
 {
      return riscv_v_get_cur_ctrl(current) == PR_RISCV_V_VSTATE_CTRL_ON;
 }
+EXPORT_SYMBOL(riscv_v_user_allowed);

Is there a reason that this should not be EXPORT_SYMBOL_GPL()?

Good question, but I just follow our arch/riscv habbit, maybe we should change all of that in another patch.

➜ linux-s64ilp32 git:(s64ilp32) ✗ grep EXPORT_SYMBOL arch/riscv -r | wc -l 66
➜ linux-s64ilp32 git:(s64ilp32) ✗ grep EXPORT_SYMBOL_GPL arch/riscv -r | wc -l 15

Quoted 5 lines

I figure Andy will roll this into this next revision.

Cheers,
Conor.

Signature · 2 lines
Best Regards
 Guo Ren
author
#3 lore raw
Quoted 31 lines · Guo Ren
Quoted 18 lines · Conor Dooley
Quoted 16 lines · On Mon, May 29, 2023 at 03:38:45AM -0400, [email protected] wrote:

From: Guo Ren <[email protected]>

Some .ko also need the riscv_v_user_allowed symbol.

ERROR: modpost: "riscv_v_user_allowed" [arch/riscv/kvm/kvm.ko] undefined!
make[3]: *** [/home/guoren/source/kernel/linux/scripts/Makefile.modpost:136:
Module.symvers] Error 1

---
 arch/riscv/kernel/vector.c | 1 +
 1 file changed, 1 insertion(+)
Quoted 11 lines

arch/riscv/kernel/vector.c bool riscv_v_user_allowed(void) · line 132

Quoted 9 lines
arch/riscv/kernel/vector.c +1 -0
index 1c4ac821e008..3ae08816d608 100644
@@ -129,6 +129,7 @@ bool riscv_v_user_allowed(void)
 {
      return riscv_v_get_cur_ctrl(current) == PR_RISCV_V_VSTATE_CTRL_ON;
 }
+EXPORT_SYMBOL(riscv_v_user_allowed);

Is there a reason that this should not be EXPORT_SYMBOL_GPL()?

Quoted 7 lines

Good question, but I just follow our arch/riscv habbit, maybe we should change all of that in another patch.

➜ linux-s64ilp32 git:(s64ilp32) ✗ grep EXPORT_SYMBOL arch/riscv -r | wc -l 66
➜ linux-s64ilp32 git:(s64ilp32) ✗ grep EXPORT_SYMBOL_GPL arch/riscv -r | wc -l 15

Why !MODULE_LICENSE(GPL) modules couldn't use riscv_v_user_allowed? Seems EXPORT_SYMBOL_GPL has more limitations.

:c:func:EXPORT_SYMBOL_GPL()
-----------------------------

Defined in ``include/linux/export.h``

Similar to :c:func:EXPORT_SYMBOL() except that the symbols exported by :c:func:EXPORT_SYMBOL_GPL() can only be seen by modules with a :c:func:MODULE_LICENSE() that specifies a GPL compatible license. It implies that the function is considered an internal implementation issue, and not really an interface. Some maintainers and developers may however require EXPORT_SYMBOL_GPL() when adding any new APIs or functionality.

For kvm is okay:

MODULE_AUTHOR("Qumranet");
MODULE_LICENSE("GPL");

So, I would leave the decition to Andy. If he didn't want it used with other non-gpl modules, choose the EXPORT_SYMBOL_GPL.

Quoted 12 lines
Quoted 6 lines

I figure Andy will roll this into this next revision.

Cheers,
Conor.

--
Best Regards
Guo Ren

Signature · 7 lines
Best Regards
 Guo Ren

_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv
#4 lore raw
Quoted 57 lines · Guo Ren
Quoted 31 lines · Guo Ren
Quoted 18 lines · Conor Dooley
Quoted 16 lines · On Mon, May 29, 2023 at 03:38:45AM -0400, [email protected] wrote:

From: Guo Ren <[email protected]>

Some .ko also need the riscv_v_user_allowed symbol.

ERROR: modpost: "riscv_v_user_allowed" [arch/riscv/kvm/kvm.ko] undefined!
make[3]: *** [/home/guoren/source/kernel/linux/scripts/Makefile.modpost:136:
Module.symvers] Error 1

---
 arch/riscv/kernel/vector.c | 1 +
 1 file changed, 1 insertion(+)
Quoted 11 lines

arch/riscv/kernel/vector.c bool riscv_v_user_allowed(void) · line 132

Quoted 9 lines
arch/riscv/kernel/vector.c +1 -0
index 1c4ac821e008..3ae08816d608 100644
@@ -129,6 +129,7 @@ bool riscv_v_user_allowed(void)
 {
      return riscv_v_get_cur_ctrl(current) == PR_RISCV_V_VSTATE_CTRL_ON;
 }
+EXPORT_SYMBOL(riscv_v_user_allowed);

Is there a reason that this should not be EXPORT_SYMBOL_GPL()?

Quoted 7 lines

Good question, but I just follow our arch/riscv habbit, maybe we should change all of that in another patch.

➜ linux-s64ilp32 git:(s64ilp32) ✗ grep EXPORT_SYMBOL arch/riscv -r | wc -l 66
➜ linux-s64ilp32 git:(s64ilp32) ✗ grep EXPORT_SYMBOL_GPL arch/riscv -r | wc -l 15

Why !MODULE_LICENSE(GPL) modules couldn't use riscv_v_user_allowed? Seems EXPORT_SYMBOL_GPL has more limitations.

:c:func:EXPORT_SYMBOL_GPL()
-----------------------------

Defined in ``include/linux/export.h``

Similar to :c:func:EXPORT_SYMBOL() except that the symbols exported by :c:func:EXPORT_SYMBOL_GPL() can only be seen by modules with a :c:func:MODULE_LICENSE() that specifies a GPL compatible license. It implies that the function is considered an internal implementation issue, and not really an interface. Some maintainers and developers may however require EXPORT_SYMBOL_GPL() when adding any new APIs or functionality.

Quoted 7 lines

For kvm is okay:

MODULE_AUTHOR("Qumranet");
MODULE_LICENSE("GPL");

So, I would leave the decition to Andy. If he didn't want it used with other non-gpl modules, choose the EXPORT_SYMBOL_GPL.

Do you have any use case for exporting this function to non-GPL licensed modules? I exported the function with EXPORT_SYMBOL_GPL() in v20[1] because I thought most maintainers would accept GPL rather than non-GPL one. And it seems most drivers would never call this function anyway.

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

I figure Andy will roll this into this next revision.

The fix for this has been included in v20[1]. However, I also changed the function name s/riscv_v_user_allowed/riscv_v_vstate_ctrl_user_allowed/.

Quoted 12 lines
Quoted 9 lines
Quoted 3 lines

Cheers,
Conor.

--
Best Regards
Guo Ren

Quoted 3 lines

--
Best Regards
Guo Ren

[1]: https://lore.kernel.org/all/[email protected]/

Cheers,
Andy

author
#5 lore raw
Quoted 64 lines · Andy Chiu
Quoted 62 lines · Guo Ren
Quoted 31 lines · Guo Ren
Quoted 18 lines · Conor Dooley
Quoted 16 lines · On Mon, May 29, 2023 at 03:38:45AM -0400, [email protected] wrote:

From: Guo Ren <[email protected]>

Some .ko also need the riscv_v_user_allowed symbol.

ERROR: modpost: "riscv_v_user_allowed" [arch/riscv/kvm/kvm.ko] undefined!
make[3]: *** [/home/guoren/source/kernel/linux/scripts/Makefile.modpost:136:
Module.symvers] Error 1

---
 arch/riscv/kernel/vector.c | 1 +
 1 file changed, 1 insertion(+)
Quoted 11 lines

arch/riscv/kernel/vector.c bool riscv_v_user_allowed(void) · line 132

Quoted 9 lines
arch/riscv/kernel/vector.c +1 -0
index 1c4ac821e008..3ae08816d608 100644
@@ -129,6 +129,7 @@ bool riscv_v_user_allowed(void)
 {
      return riscv_v_get_cur_ctrl(current) == PR_RISCV_V_VSTATE_CTRL_ON;
 }
+EXPORT_SYMBOL(riscv_v_user_allowed);

Is there a reason that this should not be EXPORT_SYMBOL_GPL()?

Quoted 7 lines

Good question, but I just follow our arch/riscv habbit, maybe we should change all of that in another patch.

➜ linux-s64ilp32 git:(s64ilp32) ✗ grep EXPORT_SYMBOL arch/riscv -r | wc -l 66
➜ linux-s64ilp32 git:(s64ilp32) ✗ grep EXPORT_SYMBOL_GPL arch/riscv -r | wc -l 15

Why !MODULE_LICENSE(GPL) modules couldn't use riscv_v_user_allowed? Seems EXPORT_SYMBOL_GPL has more limitations.

:c:func:EXPORT_SYMBOL_GPL()
-----------------------------

Defined in ``include/linux/export.h``

Similar to :c:func:EXPORT_SYMBOL() except that the symbols exported by :c:func:EXPORT_SYMBOL_GPL() can only be seen by modules with a :c:func:MODULE_LICENSE() that specifies a GPL compatible license. It implies that the function is considered an internal implementation issue, and not really an interface. Some maintainers and developers may however require EXPORT_SYMBOL_GPL() when adding any new APIs or functionality.

For kvm is okay:

MODULE_AUTHOR("Qumranet");
MODULE_LICENSE("GPL");

Quoted 8 lines
Quoted 2 lines

So, I would leave the decition to Andy. If he didn't want it used with other non-gpl modules, choose the EXPORT_SYMBOL_GPL.

Do you have any use case for exporting this function to non-GPL licensed modules? I exported the function with EXPORT_SYMBOL_GPL() in v20[1] because I thought most maintainers would accept GPL rather than non-GPL one. And it seems most drivers would never call this function anyway.

I just found Linux-next build is broken, so I sent the patch. It seems you've solved that. That's okay.

Quoted 30 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

I figure Andy will roll this into this next revision.

The fix for this has been included in v20[1]. However, I also changed the function name s/riscv_v_user_allowed/riscv_v_vstate_ctrl_user_allowed/.

Quoted 12 lines
Quoted 9 lines
Quoted 3 lines

Cheers,
Conor.

--
Best Regards
Guo Ren

Quoted 3 lines

--
Best Regards
Guo Ren

[1]: https://lore.kernel.org/all/[email protected]/

Cheers,
Andy

Signature · 2 lines
Best Regards
 Guo Ren
author
#7 lore raw
Quoted 7 lines · Conor Dooley
Quoted 2 lines · Guo Ren

I just found Linux-next build is broken, so I sent the patch. It seems you've solved that. That's okay.

Are you sure that linux-next is broken because of this? This series should not be in linux-next...

I mean:

https://git.kernel.org/pub/scm/linux/kernel/git/palmer/linux.git/log/?h=for-next

Signature · 7 lines
Best Regards
 Guo Ren

_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv
author
#8 lore raw
Quoted 4 lines · Guo Ren
Quoted 2 lines · Conor Dooley

On Tue, May 30, 2023 at 11:37:38PM +0800, Guo Ren wrote:

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

I just found Linux-next build is broken, so I sent the patch. It seems you've solved that. That's okay.

Are you sure that linux-next is broken because of this? This series should not be in linux-next...

I mean:

https://git.kernel.org/pub/scm/linux/kernel/git/palmer/linux.git/log/?h=for-next

I would change it to

+risc-v git git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux.git#for-next

next.

Quoted 6 lines

--
Best Regards
Guo Ren

Signature · 7 lines
Best Regards
 Guo Ren

_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv