diff mbox series

sched: exporting linux-rt migrate_disable for ZFS

Message ID 20201208212841.694b3022@orivej.orivej.org
State New
Headers show
Series sched: exporting linux-rt migrate_disable for ZFS | expand

Commit Message

Orivej Desh Dec. 8, 2020, 11:58 p.m. UTC
Greetings!

(If you are receiving this again, that's because I'm sending from
another domain since my message from @gmx.fr was not forwarded to the
lists.)

With sched-Add-migrate_disable.patch first released in v5.9-rc8-rt14 [1]
linux-rt defines functions migrate_disable and migrate_enable.
They are used in linux headers in various macros and static inline
functions, and in particular in kmap_atomic and kunmap_atomic.
The latter are needed by ZFS which currently fails to build against
5.9-rt [2] because these functions are exported with EXPORT_SYMBOL_GPL.
Could you export them with EXPORT_SYMBOL instead?

I have checked that ZFS 2.0.0 builds and works with 5.9.1-rt20 (with
an additional fix [3]) with this patch:


[1] https://git.kernel.org/pub/scm/linux/kernel/git/rt/linux-rt-devel.git/diff/patches/0009-sched-Add-migrate_disable.patch?h=v5.9-rc8-rt14-patches&id=9a89bfdb3bc77aecdd0ff8cc69b595541c7b50c4
[2] https://github.com/openzfs/zfs/issues/11097#issuecomment-740682245
[3] https://github.com/openzfs/zfs/pull/11309

Comments

Sebastian Andrzej Siewior Dec. 14, 2020, 12:33 p.m. UTC | #1
On 2020-12-08 23:58:27 [+0000], Orivej Desh wrote:
> Greetings!

Hi,

> With sched-Add-migrate_disable.patch first released in v5.9-rc8-rt14 [1]

> linux-rt defines functions migrate_disable and migrate_enable.

> They are used in linux headers in various macros and static inline

> functions, and in particular in kmap_atomic and kunmap_atomic.

> The latter are needed by ZFS which currently fails to build against

> 5.9-rt [2] because these functions are exported with EXPORT_SYMBOL_GPL.

> Could you export them with EXPORT_SYMBOL instead?


This is out of my jurisdiction, so just a few notes:
- v5.9 is out of maintenance. Be careful.
- We don't export symbols for out-of-tree modules.

Sebastian
Orivej Desh Dec. 14, 2020, 11:31 p.m. UTC | #2
* Sebastian Andrzej Siewior <bigeasy@linutronix.de> [2020-12-14]
> On 2020-12-08 23:58:27 [+0000], Orivej Desh wrote:

> > With sched-Add-migrate_disable.patch first released in v5.9-rc8-rt14 [1]

> > linux-rt defines functions migrate_disable and migrate_enable.

> > They are used in linux headers in various macros and static inline

> > functions, and in particular in kmap_atomic and kunmap_atomic.

> > The latter are needed by ZFS which currently fails to build against

> > 5.9-rt [2] because these functions are exported with EXPORT_SYMBOL_GPL.

> > Could you export them with EXPORT_SYMBOL instead?  

> 

> This is out of my jurisdiction, so just a few notes:

> - v5.9 is out of maintenance. Be careful.


Thanks! I have noticed a bug with usb-storage (using smp_processor_id
in preemptible code) in 5.9.1-rt20 thas has been fixed in 5.10-rt17.

> - We don't export symbols for out-of-tree modules.


The issue is that in the vanilla kernel these two functions are
available as macros that expand into EXPORT_SYMBOL function calls
(kunmap_atomic_high, etc.). If I am not mistaken the kernel is
generally supposed to keep the API made available to non-GPL modules
still available, for example here https://lwn.net/Articles/171838/ :
"When GPL-only exports were first added to the kernel, they went in
with the understanding that only new symbols would be tagged
GPL-only. The current module interface - while always subject to
change - was not to have symbols withdrawn arbitrarily." The current
rt patch has this effect: it makes non-GPL API of the vanilla kernel
GPL-only.
Mike Galbraith Dec. 15, 2020, 3:19 a.m. UTC | #3
On Mon, 2020-12-14 at 13:33 +0100, Sebastian Andrzej Siewior wrote:
> On 2020-12-08 23:58:27 [+0000], Orivej Desh wrote:

> > Greetings!

> Hi,

>

> > With sched-Add-migrate_disable.patch first released in v5.9-rc8-rt14 [1]

> > linux-rt defines functions migrate_disable and migrate_enable.

> > They are used in linux headers in various macros and static inline

> > functions, and in particular in kmap_atomic and kunmap_atomic.

> > The latter are needed by ZFS which currently fails to build against

> > 5.9-rt [2] because these functions are exported with EXPORT_SYMBOL_GPL.

> > Could you export them with EXPORT_SYMBOL instead?

>

> This is out of my jurisdiction, so just a few notes:

> - v5.9 is out of maintenance. Be careful.

> - We don't export symbols for out-of-tree modules.


Hm, dejavu all over again.  I recall this issue long ago having been
resolved in favor of exporting via plain EXPORT_SYMBOL.

https://lore.kernel.org/linux-rt-users/1321359802.4181.1.camel@frodo/

From 859a31c5ec958326dd046f4e41f6fa0db0ce98c3 Mon Sep 17 00:00:00 2001
From: Steven Rostedt <srostedt@redhat.com>

Date: Mon, 16 Apr 2012 21:51:54 -0400
Subject: rt: Make migrate_disable/enable() and __rt_mutex_init non-GPL only

Modules that load on the normal vanilla kernel should also load on
an -rt kernel as well. This does not mean we condone non-GPL modules,
we are only being consistent.

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>

---
 kernel/rtmutex.c | 2 +-
 kernel/sched.c   | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/kernel/rtmutex.c b/kernel/rtmutex.c
index a02fbd9f9583..d58db993f5cd 100644
--- a/kernel/rtmutex.c
+++ b/kernel/rtmutex.c
@@ -1282,7 +1282,7 @@ void __rt_mutex_init(struct rt_mutex *lock, const char *name)

 	debug_rt_mutex_init(lock, name);
 }
-EXPORT_SYMBOL_GPL(__rt_mutex_init);
+EXPORT_SYMBOL(__rt_mutex_init);

 /**
  * rt_mutex_init_proxy_locked - initialize and lock a rt_mutex on behalf of a
diff --git a/kernel/sched.c b/kernel/sched.c
index df3048139d1b..ed3433573641 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -4255,7 +4255,7 @@ void migrate_disable(void)
 	p->migrate_disable = 1;
 	preempt_enable();
 }
-EXPORT_SYMBOL_GPL(migrate_disable);
+EXPORT_SYMBOL(migrate_disable);

 void migrate_enable(void)
 {
@@ -4307,7 +4307,7 @@ void migrate_enable(void)
 	unpin_current_cpu();
 	preempt_enable();
 }
-EXPORT_SYMBOL_GPL(migrate_enable);
+EXPORT_SYMBOL(migrate_enable);
 #else
 static inline void update_migrate_disable(struct task_struct *p) { }
 #define migrate_disabled_updated(p)		0
--
2.29.2
Steven Rostedt Dec. 15, 2020, 2:05 p.m. UTC | #4
On Tue, 15 Dec 2020 04:19:23 +0100
Mike Galbraith <efault@gmx.de> wrote:

> From 859a31c5ec958326dd046f4e41f6fa0db0ce98c3 Mon Sep 17 00:00:00 2001

> From: Steven Rostedt <srostedt@redhat.com>

> Date: Mon, 16 Apr 2012 21:51:54 -0400

> Subject: rt: Make migrate_disable/enable() and __rt_mutex_init non-GPL only

> 

> Modules that load on the normal vanilla kernel should also load on

> an -rt kernel as well. This does not mean we condone non-GPL modules,

> we are only being consistent.

> 

> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>


Yep,

Back in the day (like in 2005), we said that -rt should strive to work
wherever vanilla Linux works. Thus, if we add a symbol that replaces a non
GPL symbol, we need to keep that symbol non GPL.

-- Steve
diff mbox series

Patch

--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -1812 +1812 @@  void migrate_disable(void)
-EXPORT_SYMBOL_GPL(migrate_disable);
+EXPORT_SYMBOL(migrate_disable);
@@ -1843 +1843 @@  void migrate_enable(void)
-EXPORT_SYMBOL_GPL(migrate_enable);
+EXPORT_SYMBOL(migrate_enable);