infiniband-diags: add rdma-ndd daemon
Subsystems (2)
PATCH v2 1/1 infiniband-diags: add rdma-ndd daemon
From: Ira Weiny <[email protected]>
rdma-ndd is a system daemon which watches the procfs hostname file for updates.
Upon detecting an update it will update the Node Descriptions of the RDMA devices in the system.
This deamon is intended to work with kernels which support polling of the procfs hostname file. If your kernel does not support this feature the daemon will set the Node Descriptions to the hostname at start up and then sleep forever.
---
Changes in V2
fix Valgrind errors and comments from Bart
Makefile.am | 10 +- configure.ac | 21 ++++ etc/rdma-ndd.init.in | 144 ++++++++++++++++++++++++ infiniband-diags.spec.in | 36 +++++- man/rdma-ndd.8.in | 41 +++++++ src/rdma-ndd.c | 285 +++++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 534 insertions(+), 3 deletions(-) create mode 100644 etc/rdma-ndd.init.in create mode 100644 man/rdma-ndd.8.in create mode 100644 src/rdma-ndd.c
Makefile.am +8 -2
@@ -16,7 +16,8 @@ sbin_PROGRAMS = src/ibaddr src/ibnetdiscover src/ibping src/ibportstate \ src/saquery src/vendstat src/iblinkinfo \ src/ibqueryerrors src/ibcacheedit src/ibccquery \ src/ibccconfig \ - src/dump_fts + src/dump_fts \ + src/rdma-ndd if ENABLE_TEST_UTILS sbin_PROGRAMS += src/ibsendtrap src/mcm_rereg_test
@@ -71,7 +72,8 @@ man_MANS = doc/man/ibaddr.8 \ doc/man/vendstat.8 \ doc/man/infiniband-diags.8 \ man/dump_lfts.8 \ - man/dump_mfts.8 + man/dump_mfts.8 \ + man/rdma-ndd.8 # define this for the dist target compat_man_pages = man/ibdiscover.8 man/ibcheckerrors.8 man/ibcheckerrs.8 \
@@ -158,3 +160,7 @@ install-data-hook: $(top_srcdir)/config/install-sh -c -m 444 $(top_srcdir)/scripts/IBswcountlimits.pm $(DESTDIR)/$(PERL_INSTALLDIR)/IBswcountlimits.pm $(top_srcdir)/config/install-sh -c -m 444 $(top_srcdir)/etc/error_thresholds $(DESTDIR)/$(sysconfdir)/infiniband-diags $(top_srcdir)/config/install-sh -c -m 400 $(top_srcdir)/etc/ibdiag.conf $(DESTDIR)/$(sysconfdir)/infiniband-diags + +install-exec-hook: + $(top_srcdir)/config/install-sh -m 755 -d $(DESTDIR)/$(sysconfdir)/init.d + $(top_srcdir)/config/install-sh -m 755 $(top_srcdir)/etc/rdma-ndd.init $(DESTDIR)/$(sysconfdir)/init.d/rdma-ndd
configure.ac +21 -0
@@ -180,6 +180,25 @@ fi AC_SUBST(ibnetdisc_api_version) dnl End libibnetdisc stuff +dnl configures for rdma-ndd startup script +default_rdma_service=openibd +AC_ARG_WITH([rdma_service], + AC_HELP_STRING([--with-rdma-service=name], + [name of the RDMA service: "rdma" when using /etc/init.d/rdma to start RDMA services; "openibd" when using /etc/init.d/openibd to start RDMA services [default=${default_rdma_service}]])) +AC_SUBST(RDMA_SERVICE, ${with_rdma_service:-${default_rdma_service}}) + +if { rpm -q sles-release || rpm -q openSUSE-release; } >/dev/null 2>&1; then + default_stop="0 1 4 6" +else + default_stop="0 1 6" +fi + +default_start="null" + +AC_SUBST(DEFAULT_START, $default_start) +AC_SUBST(DEFAULT_STOP, $default_stop) +dnl End rdma-ndd + dnl Generate doc/man/*.in files if possible DOC_DATE="`date +%Y-%m-%d`" AC_SUBST(BUILD_DATE)
@@ -253,6 +272,8 @@ AC_CONFIG_FILES([\ doc/man/smpquery.8 \ doc/man/vendstat.8 \ doc/man/infiniband-diags.8 \ + man/rdma-ndd.8 \ + etc/rdma-ndd.init \ libibnetdisc/Makefile \ ]) AC_OUTPUT
etc/rdma-ndd.init.in new file +144 -0
144 lines not on this page · raw message
infiniband-diags.spec.in +35 -1
@@ -129,6 +129,8 @@ rm -rf $RPM_BUILD_ROOT %{_mandir}/man8/ibccconfig.8.gz %{_sbindir}/dump_fts %{_mandir}/man8/dump_fts.8.gz +%{_sbindir}/rdma-ndd +%{_mandir}/man8/rdma-ndd.8.gz # scripts here %{_sbindir}/ibhosts
@@ -164,9 +166,41 @@ rm -rf $RPM_BUILD_ROOT %{_includedir}/infiniband/*.h %define _perldir %(perl -e 'use Config; $T=$Config{installvendorlib}; print $T;') %{_perldir}/* -%{_sysconfdir}/* +%{_sysconfdir}/infiniband-diags/* +%{_sysconfdir}/init.d/rdma-ndd %doc README COPYING ChangeLog + +%post +if [ $1 = 1 ]; then + if [ -e /sbin/chkconfig ]; then + /sbin/chkconfig --add rdma-ndd + /sbin/chkconfig rdma-ndd on + elif [ -e /usr/sbin/update-rc.d ]; then + /usr/sbin/update-rc.d rdma-ndd defaults + else + /usr/lib/lsb/install_initd /etc/init.d/rdma-ndd + fi + if type systemctl >/dev/null 2>&1; then + systemctl --system daemon-reload + fi +else + /etc/init.d/rdma-ndd condrestart +fi + +%preun +if [ $1 = 0 ]; then + /etc/init.d/rdma-ndd stop + if [ -e /sbin/chkconfig ]; then + /sbin/chkconfig --del rdma-ndd + elif [ -e /usr/sbin/update-rc.d ]; then + /usr/sbin/update-rc.d -f rdma-ndd remove + else + /usr/lib/lsb/remove_initd /etc/init.d/rdma-ndd + fi +fi + + %changelog * Mon Mar 03 2008 Albert Chu <[email protected]> - 1.3.5 - Add check_lft_balance script.
man/rdma-ndd.8.in new file +41 -0
41 lines not on this page · raw message
src/rdma-ndd.c new file +285 -0
285 lines not on this page · raw message
Signature · 6 lines
1.8.2 -- 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): 1414780065-15267-1-git-send-email-ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org
Bart Van Assche
Reviewed-bysrc/rdma-ndd.c line 109
Quoted 7 lines · On 10/31/14 19:27, [email protected] wrote:
src/rdma-ndd.c new file +7
-0+ format_specifier =0 ; +for (tmp = node_desc; tmp[0 ] !='\0' ; tmp++) { +if (tmp[0 ] =='%' && tmp[1 ] =='h' ) { + format_specifier =1 ; +break ; + } + }
Hello Ira,
Sorry that I hadn't noticed this before but I think the above code can be simplified into "format_specifier = !!strstr(node_desc, "%h")". With or without that change, if you want you can add:
--
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 6 lines · On 10/31/2014 2:27 PM, [email protected] wrote:
From: Ira Weiny <[email protected]>
rdma-ndd is a system daemon which watches the procfs hostname file for updates.
Upon detecting an update it will update the Node Descriptions of the RDMA devices in the system.
What is the effect of this on RoCE and IWARP adapters ? While they populate node_desc in sysfs, I don't think they support IB_DEVICE_MODIFY_NODE_DESC for ib_modify_device.
Shouldn't such devices be "skipped" in terms of setting NodeDescription ?
-- Hal
Quoted 6 lines
This deamon is intended to work with kernels which support polling of the procfs hostname file. If your kernel does not support this feature the daemon will set the Node Descriptions to the hostname at start up and then sleep forever.
Signed-off-by Ira Weiny <[email protected]>
<snip...>
--
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): 545CB84F.1070808-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org
Quoted 10 lines
Quoted 2 lines
rdma-ndd is a system daemon which watches the procfs hostname file for
updates.
Quoted 3 lines
Upon detecting an update it will update the Node Descriptions of the RDMA devices in the system.
What is the effect of this on RoCE and IWARP adapters ? While they populate
node_descin sysfs, I don't think they supportIB_DEVICE_MODIFY_NODE_DESCforib_modify_device.
No they don't support it.
Quoted 2 lines
Shouldn't such devices be "skipped" in terms of setting NodeDescription ?
AFAIK all of the current user space software which write to the node_desc sysfs simply ignore any errors. Those devices which do not support ib_modify_device return EIO from sysfs. This is the same mechanism I used and should be safe.
If we want to go down this path[*] I think the core sysfs code should be changed such that the node_desc is either A) not available on those devices or B) not writable if ib_modify_device is not supported.
-- Ira
[*] Changing this sysfs behavior was not the intent of this patch series and I think should be dealt with separately.
--
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