Skip to contentSkip to conversation

sched: exporting linux-rt migrate_disable for ZFS

PATCH Orivej Desh 4 participants 5 messages Dec 8, 2020 – Dec 15, 2020 Scheduler

lore
Share & tools
lore
#0 lore raw

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:

kernel/sched/core.c +2 -2
@@ -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);

[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

#1 lore raw
Quoted 1 line · Orivej Desh

Greetings!

Hi,

Quoted 7 lines

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

#2 lore raw

* Sebastian Andrzej Siewior <[email protected]> [2020-12-14]

Quoted 11 lines · Orivej Desh
Quoted 7 lines

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.

Quoted 1 line

- 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.

#3 lore raw
In reply to Sebastian Andrzej Siewior
Quoted 12 lines · Sebastian Andrzej Siewior
Quoted 1 line · Orivej Desh

Greetings!

Hi,

Quoted 7 lines

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?

Quoted 3 lines

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 <[email protected]>
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.

---
 kernel/rtmutex.c | 2 +-
 kernel/sched.c   | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
kernel/rtmutex.c +1 -1
index a02fbd9f9583..d58db993f5cd 100644
@@ -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
kernel/sched.c +2 -2
index df3048139d1b..ed3433573641 100644
@@ -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

#4 lore raw
Quoted 10 lines · On Tue, 15 Dec 2020 04:19:23 +0100 Mike Galbraith <[email protected]> wrote:

From 859a31c5ec958326dd046f4e41f6fa0db0ce98c3 Mon Sep 17 00:00:00 2001
From: Steven Rostedt <[email protected]>
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.

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