Add rdma service for kernel boot support
PATCH 1/1 Add rdma service for kernel boot support
Currently upstream does not provide a rdma or openibd service. Only the RedHat package ships a rdma service and rdma modules configuration files. The ibacm and srp_daemon services depend on the openibd service.
Make RedHat's rdma service available to all distros by cherry-picking the basic files for the rdma service to run and trim them down to the minimum. Do not pick workarounds or other quirk that might not needed any more. Then replace the openibd service dependency by the rdma service.
---
CMakeLists.txt | 1 +
debian/rdma-core.install | 4 +
ibacm/CMakeLists.txt | 1 -
ibacm/ibacm.init.in | 4 +-
kernel-boot/CMakeLists.txt | 22 ++++
kernel-boot/rdma-init-kernel.in | 143 +++++++++++++++++++++
kernel-boot/rdma.conf | 23 ++++
redhat/rdma.service => kernel-boot/rdma.service.in | 6 +-
{redhat => kernel-boot}/rdma.udev-rules | 6 +-
redhat/rdma-core.spec | 2 -
redhat/rdma.conf | 25 ----
srp_daemon/CMakeLists.txt | 2 -
srp_daemon/srpd.in | 4 +-
13 files changed, 203 insertions(+), 40 deletions(-)
create mode 100644 kernel-boot/CMakeLists.txt
create mode 100644 kernel-boot/rdma-init-kernel.in
create mode 100644 kernel-boot/rdma.conf
rename redhat/rdma.service => kernel-boot/rdma.service.in (59%)
rename {redhat => kernel-boot}/rdma.udev-rules (100%)
delete mode 100644 redhat/rdma.confCMakeLists.txt +1 -0
@@ -398,6 +398,7 @@ configure_file("${BUILDLIB}/config.h.in" "${BUILD_INCLUDE}/config.h" ESCAPE_QUOT add_subdirectory(ccan) add_subdirectory(util) add_subdirectory(Documentation) +add_subdirectory(kernel-boot) # Libraries add_subdirectory(libibumad) add_subdirectory(libibumad/man)
debian/rdma-core.install +4 -0
@@ -1,5 +1,9 @@ +etc/rdma/rdma.conf lib/systemd/system/rdma-ndd.service +lib/systemd/system/rdma.service +lib/udev/rules.d/98-rdma.rules lib/udev/rules.d/rdma-ndd.rules +usr/lib/rdma-init-kernel usr/sbin/rdma-ndd usr/share/doc/rdma-core/MAINTAINERS usr/share/doc/rdma-core/README.md
ibacm/CMakeLists.txt +0 -1
@@ -58,7 +58,6 @@ rdma_man_pages( ) # FIXME: update the .init.in -set(rdmascript "openibd") set(prefix "${CMAKE_INSTALL_PREFIX}") rdma_subst_install(FILES "ibacm.init.in" DESTINATION "${CMAKE_INSTALL_INITDDIR}"
ibacm/ibacm.init.in +2 -2
@@ -10,8 +10,8 @@ # Provides: ibacm # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 -# Required-Start: @rdmascript@ $network $remote_fs -# Required-Stop: @rdmascript@ $network $remote_fs +# Required-Start: rdma $network $remote_fs +# Required-Stop: rdma $network $remote_fs # Should-Start: # Should-Stop: # Short-Description: Starts and stops the InfiniBand ACM service
kernel-boot/CMakeLists.txt new file +22 -0
@@ -0,0 +1,22 @@ +# Copyright (c) 2017 Benjamin Drung <[email protected]> +# Licensed under BSD (MIT variant) or GPLv2. See COPYING. + +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") + +install(FILES rdma.conf DESTINATION "${CMAKE_INSTALL_SYSCONFDIR}/rdma/" + PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ) + +rdma_subst_install(FILES "rdma-init-kernel.in" + DESTINATION "${CMAKE_INSTALL_FULL_LIBEXECDIR}" + RENAME "rdma-init-kernel" + PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ OWNER_EXECUTE GROUP_EXECUTE WORLD_EXECUTE) + +install(FILES "rdma.udev-rules" + DESTINATION "${CMAKE_INSTALL_UDEV_RULESDIR}" + RENAME "98-rdma.rules" + PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ) + +rdma_subst_install(FILES "rdma.service.in" + DESTINATION "${CMAKE_INSTALL_SYSTEMD_SERVICEDIR}" + RENAME "rdma.service" + PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ)
kernel-boot/rdma-init-kernel.in new file +143 -0
143 lines not on this page · raw message
kernel-boot/rdma.conf new file +23 -0
@@ -0,0 +1,23 @@ +# Load IP over InfiniBand (IPoIB) network driver module +IPOIB_LOAD=yes + +# Load SCSI Remote Protocol (SRP) initiator support module +SRP_LOAD=yes + +# Load SCSI Remote Protocol target (SRPT) support module +SRPT_LOAD=yes + +# Load iSCSI Extensions for RDMA (iSER) initiator support module +ISER_LOAD=yes + +# Load iSCSI Extensions for RDMA target (iSERT) support module +ISERT_LOAD=yes + +# Load Reliable Datagram Service (RDS) network protocol +RDS_LOAD=no + +# Load NFS over RDMA (NFSoRDMA) client transport module +XPRTRDMA_LOAD=yes + +# Load NFS over RDMA (NFSoRDMA) server transport module +SVCRDMA_LOAD=no
kernel-boot/rdma.service.in renamed from redhat/rdma.service +3 -3
@@ -1,15 +1,15 @@ [Unit] Description=Initialize the iWARP/InfiniBand/RDMA stack in the kernel -Documentation=file:/etc/rdma/rdma.conf +Documentation=file:@CMAKE_INSTALL_SYSCONFDIR@/rdma/rdma.conf RefuseManualStop=true DefaultDependencies=false Conflicts=emergency.target emergency.service -Before=network.target remote-fs-pre.target +Before=network-pre.target remote-fs-pre.target [Service] Type=oneshot RemainAfterExit=yes -ExecStart=/usr/libexec/rdma-init-kernel +ExecStart=@CMAKE_INSTALL_FULL_LIBEXECDIR@/rdma-init-kernel [Install] WantedBy=sysinit.target
kernel-boot/rdma.udev-rules renamed from redhat/rdma.udev-rules +3 -3
@@ -4,9 +4,9 @@ # enable the IB stack, so do so unilaterally) and on load of any of that # hardware, we trigger the rdma.service load in systemd +SUBSYSTEM=="module", KERNEL=="be2net", ACTION=="add", TAG+="systemd", ENV{SYSTEMD_WANTS}="rdma.service" SUBSYSTEM=="module", KERNEL=="cxgb*", ACTION=="add", TAG+="systemd", ENV{SYSTEMD_WANTS}="rdma.service" +SUBSYSTEM=="module", KERNEL=="enic", ACTION=="add", TAG+="systemd", ENV{SYSTEMD_WANTS}="rdma.service" SUBSYSTEM=="module", KERNEL=="ib_*", ACTION=="add", TAG+="systemd", ENV{SYSTEMD_WANTS}="rdma.service" -SUBSYSTEM=="module", KERNEL=="mlx*", ACTION=="add", TAG+="systemd", ENV{SYSTEMD_WANTS}="rdma.service" SUBSYSTEM=="module", KERNEL=="iw_*", ACTION=="add", TAG+="systemd", ENV{SYSTEMD_WANTS}="rdma.service" -SUBSYSTEM=="module", KERNEL=="be2net", ACTION=="add", TAG+="systemd", ENV{SYSTEMD_WANTS}="rdma.service" -SUBSYSTEM=="module", KERNEL=="enic", ACTION=="add", TAG+="systemd", ENV{SYSTEMD_WANTS}="rdma.service" +SUBSYSTEM=="module", KERNEL=="mlx*", ACTION=="add", TAG+="systemd", ENV{SYSTEMD_WANTS}="rdma.service"
redhat/rdma-core.spec +0 -2
@@ -250,7 +250,6 @@ mkdir -p %{buildroot}%{_libexecdir} mkdir -p %{buildroot}%{_udevrulesdir} mkdir -p %{buildroot}%{dracutlibdir}/modules.d/05rdma mkdir -p %{buildroot}%{sysmodprobedir} -install -D -m0644 redhat/rdma.conf %{buildroot}/%{_sysconfdir}/rdma/rdma.conf install -D -m0644 redhat/rdma.sriov-vfs %{buildroot}/%{_sysconfdir}/rdma/sriov-vfs install -D -m0644 redhat/rdma.mlx4.conf %{buildroot}/%{_sysconfdir}/rdma/mlx4.conf install -D -m0755 redhat/rdma.ifup-ib %{buildroot}/%{_sysconfdir}/sysconfig/network-scripts/ifup-ib
@@ -259,7 +258,6 @@ install -D -m0644 redhat/rdma.service %{buildroot}%{_unitdir}/rdma.service install -D -m0644 redhat/rdma.udev-ipoib-naming.rules %{buildroot}%{_sysconfdir}/udev/rules.d/70-persistent-ipoib.rules install -D -m0644 redhat/rdma.mlx4.user.modprobe %{buildroot}%{_sysconfdir}/modprobe.d/mlx4.conf install -D -m0755 redhat/rdma.modules-setup.sh %{buildroot}%{dracutlibdir}/modules.d/05rdma/module-setup.sh -install -D -m0644 redhat/rdma.udev-rules %{buildroot}%{_udevrulesdir}/98-rdma.rules install -D -m0644 redhat/rdma.mlx4.sys.modprobe %{buildroot}%{sysmodprobedir}/libmlx4.conf install -D -m0644 redhat/rdma.cxgb3.sys.modprobe %{buildroot}%{sysmodprobedir}/cxgb3.conf install -D -m0644 redhat/rdma.cxgb4.sys.modprobe %{buildroot}%{sysmodprobedir}/cxgb4.conf
redhat/rdma.conf deleted +0 -25
@@ -1,25 +0,0 @@ -# Load IPoIB -IPOIB_LOAD=yes -# Load SRP (SCSI Remote Protocol initiator support) module -SRP_LOAD=yes -# Load SRPT (SCSI Remote Protocol target support) module -SRPT_LOAD=yes -# Load iSER (iSCSI over RDMA initiator support) module -ISER_LOAD=yes -# Load iSERT (iSCSI over RDMA target support) module -ISERT_LOAD=yes -# Load RDS (Reliable Datagram Service) network protocol -RDS_LOAD=no -# Load NFSoRDMA client transport module -XPRTRDMA_LOAD=yes -# Load NFSoRDMA server transport module -SVCRDMA_LOAD=no -# Load Tech Preview device driver modules -TECH_PREVIEW_LOAD=no -# Should we modify the system mtrr registers? We may need to do this if you -# get messages from the ib_ipath driver saying that it couldn't enable -# write combining for the PIO buffs on the card. -# -# Note: recent kernels should do this for us, but in case they don't, we'll -# leave this option -FIXUP_MTRR_REGS=no
srp_daemon/CMakeLists.txt +0 -2
@@ -45,8 +45,6 @@ install(FILES srp_daemon.conf DESTINATION "${CMAKE_INSTALL_SYSCONFDIR}") install(FILES srp_daemon.rules DESTINATION "${CMAKE_INSTALL_UDEV_RULESDIR}") -# FIXME: The ib init.d file should really be included in rdma-core as well. -set(RDMA_SERVICE "openibd" CACHE STRING "init.d file service name to order srpd after") # NOTE: These defaults are for CentOS, packagers should override. set(SRP_DEFAULT_START "2 3 4 5" CACHE STRING "Default-Start service data for srpd") set(SRP_DEFAULT_STOP "0 1 6" CACHE STRING "Default-Stop service data for srpd")
srp_daemon/srpd.in +2 -2
@@ -9,8 +9,8 @@ # ### BEGIN INIT INFO # Provides: srpd -# Required-Start: $syslog @RDMA_SERVICE@ -# Required-Stop: $syslog @RDMA_SERVICE@ +# Required-Start: $syslog rdma +# Required-Stop: $syslog rdma # Default-Start: @SRP_DEFAULT_START@ # Default-Stop: @SRP_DEFAULT_STOP@ # Should-Start:
Signature · 6 lines
2.11.0 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 20170713172057.25411-1-benjamin.drung-EIkl63zCoXaH+58JC4qpiA@public.gmane.org
Quoted 9 lines · Benjamin Drung
Currently upstream does not provide a rdma or openibd service. Only the RedHat package ships a rdma service and rdma modules configuration files. The ibacm and
srp_daemonservices depend on the openibd service.Make RedHat's rdma service available to all distros by cherry-picking the basic files for the rdma service to run and trim them down to the minimum. Do not pick workarounds or other quirk that might not needed any more. Then replace the openibd service dependency by the rdma service.
Hello Benjamin,
Shouldn't the rdma / openibd service be split into multiple services - one for IPoIB, one for the SRP initiator driver, one for the SRP target driver, one for the iSER initiator driver, one for the iSER target driver, one for RDS and one for NFSoRDMA? I think that would allow us to get rid of the rdma.conf configuration file and also that this would allow systemd to load those services concurrently that do not depend on each other.
Bart.--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 11 lines · Bart Van Assche
Quoted 9 lines · Benjamin Drung
Currently upstream does not provide a rdma or openibd service. Only the RedHat package ships a rdma service and rdma modules configuration files. The ibacm and
srp_daemonservices depend on the openibd service.Make RedHat's rdma service available to all distros by cherry-picking the basic files for the rdma service to run and trim them down to the minimum. Do not pick workarounds or other quirk that might not needed any more. Then replace the openibd service dependency by the rdma service.
Quoted 8 lines
Hello Benjamin,
Shouldn't the rdma / openibd service be split into multiple services - one for IPoIB, one for the SRP initiator driver, one for the SRP target driver, one for the iSER initiator driver, one for the iSER target driver, one for RDS and one for NFSoRDMA? I think that would allow us to get rid of the rdma.conf configuration file and also that this would allow systemd to load those services concurrently that do not depend on each other.
I broadly agree.
For instance, Bart's work has already completely fixed srp to load properly and race free. The missing piece is to have it also autoload the required srp kernel module.
Benjamin, I have a different, simpler suggestion for some of the other bits, let me post an RFC
Here is an untested attempt to move module loading into srp_daemon - what do you think Bart?
Jason
Quoted 1 line
From
28c1e19719ed850bc8f328d187c536c97eef7fd7Mon Sep 17 00:00:00 2001
From: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
Date: Thu, 13 Jul 2017 12:10:07 -0600
Subject: [PATCH] srp: Autoload the SRP kernel module if required
Doing this before starting the daemon ensures the daemon will work. Since the daemon is using sysfs files there is no easy way to have the kernel auto load it.
--- srp_daemon/srp_daemon.service.in | 2 +- srp_daemon/[email protected] | 1 + srp_daemon/srp_kernel_module.service | 12 ++++++++++++ 3 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 srp_daemon/srp_kernel_module.service
srp_daemon/srp_daemon.service.in +1 -1
@@ -1,6 +1,6 @@ [Unit] Description=Daemon that discovers and logs in to SRP target systems -Documentation=man:srp_daemon file:/etc/rdma/rdma.conf file:/etc/srp_daemon.conf +Documentation=man:srp_daemon file:/etc/srp_daemon.conf DefaultDependencies=false Conflicts=emergency.target emergency.service Before=remote-fs-pre.target
srp_daemon/[email protected] +1 -0
@@ -3,6 +3,7 @@ Description=SRP daemon that monitors port %i Documentation=man:srp_daemon file:/etc/rdma/rdma.conf file:/etc/srp_daemon.conf DefaultDependencies=false Conflicts=emergency.target emergency.service +Requires=srp_kernel_module.service After=srp_daemon.service dev-infiniband-umad-%i.device network.target BindsTo=srp_daemon.service dev-infiniband-umad-%i.device Before=remote-fs-pre.target
srp_daemon/srp_kernel_module.service new file +12 -0
@@ -0,0 +1,12 @@ +[Unit] +Description=Load the SRP daemon kernel module +Documentation=man:srp_daemon +After=systemd-modules-load.service +ConditionCapability=CAP_SYS_MODULE +ConditionPathIsDirectory=!/sys/class/infiniband_srp/ + +[Service] +Type=oneshot +RemainAfterExit=yes +ExecPre=bash -c 'mkdir -p /run/modules-load.d && echo ib_srp > /run/modules-load.d/rdma_core_srp_modules.conf' +ExecStart=/lib/systemd/systemd-modules-load
Signature · 6 lines
2.7.4 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 20170713182018.GE11069-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org
Quoted 2 lines · Jason Gunthorpe
Here is an untested attempt to move module loading into
srp_daemon- what do you think Bart?
Hello Jason,
Thanks for the patch. To me this looks like a nice simplification compared to the current approach. Do you want me to test this patch?
Bart.--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 8 lines · Bart Van Assche
Quoted 2 lines · Jason Gunthorpe
Here is an untested attempt to move module loading into
srp_daemon- what do you think Bart?Hello Jason,
Thanks for the patch. To me this looks like a nice simplification compared to the current approach. Do you want me to test this patch?
I did some more steps..
Benjamin/Bart let me know what you think, I'll send the patches to the list if you like the idea.
https://github.com/jgunthorpe/rdma-plumbing/tree/systemd
This replaces Benjamins rdma.conf based approach.
The basic approach is to directly use systemd to load the modules and determine what modules to load by using udev and explicit Requires in the units.
Eg, the extra modules for mlx4 are loaded by triggering this udev rule:
SUBSYSTEM=="module", KERNEL=="mlx4_core", ACTION=="add", TAG+="systemd", ENV{SYSTEMD_WANTS}="rdma-load-modules@mlx4"
Which causes the module loader to load the contents of the modules list in /etc/rdma/modules/mlx4.conf
If the user does not want a specific to load then they can comment out the module line in the /etc/rdma/modules files or use the usual module black list scheme.
The interesting thing about this is how the boot ordering works, since [email protected] is a 'before' sysinit.target it will run before normal system startup tasks if the unit is scheduled to run early enough. I expect that boot time module loads triggered by udev will be early enough..
This makes it much closer to normal module loading, instead of being so strange and should eliminate much of the need for explicit rdma.service dependencies. The places that need something special, like srp, can directly depend on their specific module loader:
Requires=rdma-load-modules@srp_daemon
Again, if srp_daemon is scheduled to start during system boot this should result in the modules being loaded together with the rest of the modules before sysinit.target.
The one nit that I don't have an easy solution for is starting modules depending on the device technology, eg not starting srp or ipoib on !IB devices. The issue is that I can't think of an easy way to detect the device technology from the udev rule, at least not without a helper script or additional kernel sysfs..
I havne't been able to test this yet, help would be appreciated.
Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 20170713221520.GA10088-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org
Quoted 5 lines · Jason Gunthorpe
The one nit that I don't have an easy solution for is starting modules depending on the device technology, eg not starting srp or ipoib on !IB devices. The issue is that I can't think of an easy way to detect the device technology from the udev rule, at least not without a helper script or additional kernel sysfs..
Are users expected to modify the kernel-boot/modules/*.conf files? I expect that only a minority of the RDMA users will want to load the ib_srpt and ib_isert kernel modules.
Quoted 1 line
I havne't been able to test this yet, help would be appreciated.
I will try to free up some time to test the SRP-related changes.
Bart.--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 10 lines · Bart Van Assche
Quoted 5 lines · Jason Gunthorpe
The one nit that I don't have an easy solution for is starting modules depending on the device technology, eg not starting srp or ipoib on !IB devices. The issue is that I can't think of an easy way to detect the device technology from the udev rule, at least not without a helper script or additional kernel sysfs..
Are users expected to modify the kernel-boot/modules/*.conf files? I expect that only a minority of the RDMA users will want to load the
ib_srptandib_isertkernel modules.
I'd say in the same way they would be expected to modify the RedHat /etc/rdma/rdma.conf file. I copied the defaults from that file, which was to autoload target drivers.
I agree with you, they probably don't make sense to be defaulted on. Ideally their respective supporting packages or kernel would ensure the modules autoload if someone is working with RDMA... I know nothing about the target infrastructure - can you see a way to do that?
Thanks,
Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 20170713224137.GA24689-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org
Quoted 12 lines · Jason Gunthorpe
Quoted 10 lines · Bart Van Assche
Quoted 5 lines · Jason Gunthorpe
The one nit that I don't have an easy solution for is starting modules depending on the device technology, eg not starting srp or ipoib on !IB devices. The issue is that I can't think of an easy way to detect the device technology from the udev rule, at least not without a helper script or additional kernel sysfs..
Are users expected to modify the kernel-boot/modules/*.conf files? I expect that only a minority of the RDMA users will want to load the
ib_srptandib_isertkernel modules.
Quoted 8 lines
I'd say in the same way they would be expected to modify the RedHat
/etc/rdma/rdma.conffile. I copied the defaults from that file, which was to autoload target drivers.I agree with you, they probably don't make sense to be defaulted on. Ideally their respective supporting packages or kernel would ensure the modules autoload if someone is working with RDMA... I know nothing about the target infrastructure - can you see a way to do that?
Hello Jason,
Users who want to enable RDMA target functionality probably will know the names of the kernel modules that provide such functionality. On Debian systems the names of these kernel modules can e.g. be added to /etc/modules. However, I'm not sure all distro's have an equivalent of the /etc/modules file.
Bart.--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 5 lines · Bart Van Assche
Users who want to enable RDMA target functionality probably will know the names of the kernel modules that provide such functionality. On Debian systems the names of these kernel modules can e.g. be added to
/etc/modules. However, I'm not sure all distro's have an equivalent of the/etc/modulesfile.
systemd supports /etc/modules-load.d/ as a built in, some distros will symlink ../modules.conf to that directory, but these days dropping a file in /etc/modules-load.d/ is pretty safe.
Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Hi Jason,
Am Donnerstag, den 13.07.2017, 16:15 -0600 schrieb Jason Gunthorpe:
Quoted 18 lines · Bart Van Assche
Quoted 10 lines · Jason Gunthorpe
Quoted 3 lines
Here is an untested attempt to move module loading into
srp_daemon-
what do you think Bart?Hello Jason,
Thanks for the patch. To me this looks like a nice simplification compared
to the current approach. Do you want me to test this patch?I did some more steps..
Benjamin/Bart let me know what you think, I'll send the patches to the
list if you like the idea.
Quoted 7 lines
https://github.com/jgunthorpe/rdma-plumbing/tree/systemd
This replaces Benjamins rdma.conf based approach.
The basic approach is to directly use systemd to load the modules and determine what modules to load by using udev and explicit Requires in the units.
I like your approach very much. It's cleaner and simpler. So let's ditch my approach and use yours.
I tested your branch on a Debian 8 (jessie) system with a mlx4 card and found several points to fix/improve/discuss:
1. The rdma-load-modules@ service needs to set DefaultDependencies=no. Otherwise it will end up in a dependency loop:
Found ordering cycle on rdma-load-modules-A9MMwDI1uB1TDjBF/[email protected]/start Found dependency on basic.target/start
Found dependency on paths.target/start
Found dependency on acpid.path/start
Found dependency on sysinit.target/start
Found dependency on rdma-load-modules-A9MMwDI1uB1TDjBF/[email protected]/start Breaking ordering cycle by deleting job paths.target/start
Found ordering cycle on rdma-load-modules-A9MMwDI1uB1TDjBF/[email protected]/start Found dependency on paths.target/start
Found dependency on acpid.path/start
Found dependency on sysinit.target/start
Found dependency on rdma-load-modules-A9MMwDI1uB1TDjBF/[email protected]/start Starting Load RDMA modules from /etc/rdma/modules/mlx4.conf...
2. You can just specify "etc/rdma/modules" in debian/rdma-core.install instead of listing each .conf file individually.
3. Default conf files for opa.conf and roce.conf are missing.
4. Should rdma-load-modules@ *not* fail if the corresponding .conf is missing?
5. How to handle build-in modules correctly? Our kernel has the i40e
module built in (CONFIG_I40E=y) and rdma-load-modules-QqjR1VyAyFhTDjBF/[email protected] will be started, but the system does not have a i40e card and thus I don't
want to have the module started.
Signature · 19 lines
Benjamin Drung System Developer Debian & Ubuntu Developer ProfitBricks GmbH Greifswalder Str. 207 D - 10405 Berlin Email: [email protected] Web: https://www.profitbricks.com Sitz der Gesellschaft: Berlin. Registergericht: Amtsgericht Charlottenburg, HRB 125506B. Geschäftsführer: Achim Weiss. -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): [email protected]
Am Freitag, den 14.07.2017, 12:08 +0200 schrieb Benjamin Drung:
Quoted 62 lines
Hi Jason,
Am Donnerstag, den 13.07.2017, 16:15 -0600 schrieb Jason Gunthorpe:
Quoted 20 lines · Bart Van Assche
Quoted 10 lines · Jason Gunthorpe
Quoted 3 lines
Here is an untested attempt to move module loading into
srp_daemon-
what do you think Bart?Hello Jason,
Thanks for the patch. To me this looks like a nice simplification compared
to the current approach. Do you want me to test this patch?I did some more steps..
Benjamin/Bart let me know what you think, I'll send the patches to the
list if you like the idea.Quoted 7 lines
This replaces Benjamins rdma.conf based approach.
The basic approach is to directly use systemd to load the modules and
determine what modules to load by using udev and explicit Requires in
the units.I like your approach very much. It's cleaner and simpler. So let's ditch my approach and use yours.
I tested your branch on a Debian 8 (jessie) system with a mlx4 card and
found several points to fix/improve/discuss:1. The rdma-load-modules@ service needs to set
DefaultDependencies=no.
Otherwise it will end up in a dependency loop:Found ordering cycle on rdma-load-modules-A9MMwDI1uB1TDjBF/[email protected]/start Found dependency on basic.target/start
Found dependency on paths.target/start
Found dependency on acpid.path/start
Found dependency on sysinit.target/start
Found dependency on rdma-load-modules-A9MMwDI1uB1TDjBF/[email protected]/start Breaking ordering cycle by deleting job paths.target/start
Found ordering cycle on rdma-load-modules-A9MMwDI1uB1TDjBF/[email protected]/start Found dependency on paths.target/start
Found dependency on acpid.path/start
Found dependency on sysinit.target/start
Found dependency on rdma-load-modules-A9MMwDI1uB1TDjBF/[email protected]/start Starting Load RDMA modules from/etc/rdma/modules/mlx4.conf...2. You can just specify "etc/rdma/modules" in debian/rdma- core.install
instead of listing each .conf file individually.3. Default conf files for opa.conf and roce.conf are missing.
Quoted 8 lines
4. Should rdma-load-modules@ *not* fail if the corresponding .conf is missing?
5. How to handle build-in modules correctly? Our kernel has the i40e
module built in (CONFIG_I40E=y) and rdma-load-modules-QqjR1VyAyFhTDjBF/[email protected] will
be started, but the system does not have a i40e card and thus I don't
want to have the module started.
Forgot one point:
6. The ipoib module (loaded by rdma-load-modules@infiniband) needs to loaded before the networking.service is running. The networking.service brings up the network devices on Debian. It runs "ifup -a" which reads /etc/network/interfaces which we use to configure our ipoib devices. Here is the networking.service definition:
bdrung@server:~$ systemctl cat networking.service # /run/systemd/generator.late/networking.service # Automatically generated by systemd-sysv-generator
[Unit]
SourcePath=/etc/init.d/networking Description=LSB: Raise network interfaces. DefaultDependencies=no
Before=sysinit.target shutdown.target After=mountkernfs.service local-fs.target urandom.service Conflicts=shutdown.target
[Service]
Type=forking
Restart=no
TimeoutSec=0
IgnoreSIGPIPE=no
KillMode=process
GuessMainPID=no
RemainAfterExit=yes
SysVStartPriority=13
ExecStart=/etc/init.d/networking start
ExecStop=/etc/init.d/networking stop
ExecReload=/etc/init.d/networking reload
# /run/systemd/generator/networking.service.d/50-insserv.conf-$network.conf # Automatically generated by systemd-insserv-generator
[Unit]
Wants=network.target
Before=network.target
# /lib/systemd/system/networking.service.d/network-pre.conf [Unit] After=network-pre.target systemd-sysctl.service systemd-modules-load.service
Signature · 19 lines
Benjamin Drung System Developer Debian & Ubuntu Developer ProfitBricks GmbH Greifswalder Str. 207 D - 10405 Berlin Email: [email protected] Web: https://www.profitbricks.com Sitz der Gesellschaft: Berlin. Registergericht: Amtsgericht Charlottenburg, HRB 125506B. Geschäftsführer: Achim Weiss. -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 2 lines · Benjamin Drung
I tested your branch on a Debian 8 (jessie) system with a mlx4 card and found several points to fix/improve/discuss:
Thanks!
Quoted 2 lines
1. The rdma-load-modules@ service needs to set DefaultDependencies=no. Otherwise it will end up in a dependency loop:
Makes sense
Quoted 2 lines
2. You can just specify "etc/rdma/modules" in debian/rdma-core.install instead of listing each .conf file individually.
The srp_daemon.conf is in the srp package, so I don't think I can do that?
Quoted 1 line
3. Default conf files for opa.conf and roce.conf are missing.
Right.. Not sure if we should split them like this or not, depends if we can detect the card type at runtime.
Quoted 2 lines
4. Should rdma-load-modules@ *not* fail if the corresponding .conf is missing?
Does it fail now? Failing seems like the right thing to do for a missing conf file.
Quoted 4 lines
5. How to handle build-in modules correctly? Our kernel has the i40e
module built in (CONFIG_I40E=y) and rdma-load-modules-QqjR1VyAyFhTDjBF/[email protected] will be started, but the system does not have a i40e card and thus I don't
want to have the module started.
Fixing this would require more fancy udev wonkery - I copied RH's tested approach which triggers on driver presence, not on driver binding.
My udev is not great, but something like this:
DRIVER=="mlx4_core", ACTION=="add", TAG+="systemd", ENV{SYSTEMD_WANTS}="rdma-load-modules@mlx4"
Might work better? I think that triggers on driver bind? Could you try to switch your mlx and i40e drivers in that way?
Quoted 3 lines
6. The ipoib module (loaded by rdma-load-modules@infiniband) needs to loaded before the networking.service is running. The networking.service brings up the network devices on Debian. It runs "ifup -a" which reads
Hum. That LSB networking.service sure is an ugly hack, it doesn't support hotplug so it has this:
After=network-pre.target systemd-sysctl.service systemd-modules-load.service
To 'try' and run after some amount of hot plugging is done. IMHO this is done wrong, it should start after sysinit.target but before network-online.target or something...
The only solution to this kind of problem is to add more ordering, Debian should include a patch to rdma-load-modules@ to put it before their unique networking.service..
Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 20170714155544.GA25760-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org
Am Freitag, den 14.07.2017, 09:55 -0600 schrieb Jason Gunthorpe:
Quoted 6 lines
2. You can just specify "etc/rdma/modules" in debian/rdma-
Quoted 2 lines
core.install
instead of listing each .conf file individually.The srp_daemon.conf is in the srp package, so I don't think I can do that?
Yes. You are right. So it needs to be listed individually.
Quoted 6 lines
Quoted 3 lines
4. Should rdma-load-modules@ *not* fail if the corresponding .conf is
missing?Does it fail now? Failing seems like the right thing to do for a missing conf file.
Yes. Currently it fails in this situation.
Quoted 12 lines
Quoted 7 lines
5. How to handle build-in modules correctly? Our kernel has the
i40e
module built in (CONFIG_I40E=y) and rdma-load-modules-QqjR1VyAyFhTDjBF/[email protected] will
be started, but the system does not have a i40e card and thus I
don't
want to have the module started.Fixing this would require more fancy udev wonkery - I copied RH's tested approach which triggers on driver presence, not on driver binding.
Quoted 8 lines
My udev is not great, but something like this:
DRIVER=="mlx4_core", ACTION=="add", TAG+="systemd", ENV{SYSTEMD_WANTS}="rdma-load-modules@mlx4"
Might work better? I think that triggers on driver bind? Could you try
to switch your mlx and i40e drivers in that way?
I tried it. It works as expected. rdma-load-modules@mlx4 is loaded and rdma-load-modules-QqjR1VyAyFhTDjBF/[email protected] is not loaded. Not tested if the udev trigger will also work for used built-in modules.
Quoted 13 lines
Quoted 6 lines
6. The ipoib module (loaded by rdma-load-modules@infiniband) needs to
loaded before the networking.service is running. The networking.service
brings up the network devices on Debian. It runs "ifup -a" which readsHum. That LSB networking.service sure is an ugly hack, it doesn't support hotplug so it has this:
After=network-pre.target systemd-sysctl.service systemd-modules- load.service
Quoted 7 lines
To 'try' and run after some amount of hot plugging is done. IMHO this is done wrong, it should start after sysinit.target but before network-online.target or something...
The only solution to this kind of problem is to add more ordering, Debian should include a patch to rdma-load-modules@ to put it before their unique networking.service..
Or patch rdma-load-modules@ to put it before network-pre.target
Signature · 19 lines
Benjamin Drung System Developer Debian & Ubuntu Developer ProfitBricks GmbH Greifswalder Str. 207 D - 10405 Berlin Email: [email protected] Web: https://www.profitbricks.com Sitz der Gesellschaft: Berlin. Registergericht: Amtsgericht Charlottenburg, HRB 125506B. Geschäftsführer: Achim Weiss. -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 10 lines · Benjamin Drung
Quoted 6 lines
My udev is not great, but something like this:
DRIVER=="mlx4_core", ACTION=="add", TAG+="systemd", ENV{SYSTEMD_WANTS}="rdma-load-modules@mlx4"
Might work better? I think that triggers on driver bind? Could you try to switch your mlx and i40e drivers in that way?
I tried it. It works as expected. rdma-load-modules@mlx4 is loaded and rdma-load-modules-QqjR1VyAyFhTDjBF/[email protected] is not loaded. Not tested if the udev trigger will also work for used built-in modules.
Okay, I will change it to be like that and we can see what people think.
Quoted 5 lines
Quoted 3 lines
The only solution to this kind of problem is to add more ordering, Debian should include a patch to rdma-load-modules@ to put it before their unique networking.service..
Or patch rdma-load-modules@ to put it before network-pre.target
I think that would be OK.
Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 20170714164029.GA9942-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org
Am Freitag, den 14.07.2017, 10:40 -0600 schrieb Jason Gunthorpe:
Quoted 11 lines · Benjamin Drung
Quoted 10 lines
Quoted 9 lines
My udev is not great, but something like this:
DRIVER=="mlx4_core", ACTION=="add", TAG+="systemd", ENV{SYSTEMD_WANTS}="rdma-load-modules@mlx4"
Might work better? I think that triggers on driver bind? Could you
try to switch your mlx and i40e drivers in that way?
Quoted 8 lines
Quoted 5 lines
I tried it. It works as expected. rdma-load-modules@mlx4 is loaded
and
rdma-load-modules-QqjR1VyAyFhTDjBF/[email protected] is not loaded. Not tested if the udev
trigger will also work for used built-in modules.Okay, I will change it to be like that and we can see what people think.
Any updates?
Signature · 19 lines
Benjamin Drung System Developer Debian & Ubuntu Developer ProfitBricks GmbH Greifswalder Str. 207 D - 10405 Berlin Email: [email protected] Web: https://www.profitbricks.com Sitz der Gesellschaft: Berlin. Registergericht: Amtsgericht Charlottenburg, HRB 125506B. Geschäftsführer: Achim Weiss. -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 18 lines · Benjamin Drung
Am Freitag, den 14.07.2017, 10:40 -0600 schrieb Jason Gunthorpe:
Quoted 17 lines · Benjamin Drung
Quoted 15 lines
Quoted 9 lines
My udev is not great, but something like this:
DRIVER=="mlx4_core", ACTION=="add", TAG+="systemd", ENV{SYSTEMD_WANTS}="rdma-load-modules@mlx4"
Might work better? I think that triggers on driver bind? Could you
try to switch your mlx and i40e drivers in that way?I tried it. It works as expected.?rdma-load-modules@mlx4 is loaded
and?
rdma-load-modules-QqjR1VyAyFhTDjBF/[email protected] is not loaded. Not tested if the udev
trigger will also work for used built-in modules.
Quoted 4 lines
Quoted 2 lines
Okay, I will change it to be like that and we can see what people think.
Any updates?
I've been doing some more testing here and it does not work entirely properly yet.
The change to 'DRIVER==' causes things to fail, the kernel only generates uevents when kobjects are created, and binding a driver to a PCI device does not create a kobject. This means these lines:
DRIVER=="mlx4_core", ACTION=="add", TAG+="systemd", ENV{SYSTEMD_WANTS}="rdma-load-modules@mlx4"
Do not work reliably. Depending on the module like before would still seem to be the best option.
Also, the ordering before sysinit.target does not work reliably, udev loads modules asynchronously and systemd does not block on udev unless systemd-udevd-settle is depended on.
I'm not sure how Debian's legacy networking.service manages to work at all, perhaps it is broken and it is just unlikely to be hit because of how quickly most ethernet drivers get loaded by udev.
As far as I can tell, it needs to depend on systemd-udevd-settle to guarentee that all the cold-plug network drivers have been loaded by udev before starting..
.. all of these comments would seem to apply equally to the rdma.service approach, so I think this is still an improvement.
Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html