From patchwork Thu Aug 3 22:04:05 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Gunthorpe X-Patchwork-Id: 9879927 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 714FF603F4 for ; Thu, 3 Aug 2017 22:04:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5F8BD2896C for ; Thu, 3 Aug 2017 22:04:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 547A72896D; Thu, 3 Aug 2017 22:04:24 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EDFA928971 for ; Thu, 3 Aug 2017 22:04:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751918AbdHCWEV (ORCPT ); Thu, 3 Aug 2017 18:04:21 -0400 Received: from quartz.orcorp.ca ([184.70.90.242]:53042 "EHLO quartz.orcorp.ca" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751924AbdHCWET (ORCPT ); Thu, 3 Aug 2017 18:04:19 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=obsidianresearch.com; s=rsa1; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From; bh=3CxorKcOaS2M1Q9Ih2WcB70WWGAWiuCrTS6HCd9hMxk=; b=uRRLp7qSLMmLT1OrFpjgNN27cnrE/8pka4t9LNoJO65EnjTxM6LoRyNoD/yI49sGa174d1DD44ImlGeywniu3Pjh335TGQJX9qq7lAIsc7ud3p9BP8pMf1KB61MOY40SBWbCVrUb9Bg5KTMdmetDohaJ1H5Yd7AnJMIWPKPtvHE=; Received: from [10.0.0.156] (helo=jggl.edm.orcorp.ca) by quartz.orcorp.ca with esmtps (TLS1.2:ECDHE_RSA_AES_128_CBC_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1ddOE3-0004XK-7L; Thu, 03 Aug 2017 16:04:15 -0600 From: Jason Gunthorpe To: linux-rdma@vger.kernel.org Cc: Tatyana Nikolova , Steve Wise Subject: [PATCH rdma-core 3/4] iwpmd: Use sd_notify to synchronize bootup Date: Thu, 3 Aug 2017 16:04:05 -0600 Message-Id: <1501797846-8228-4-git-send-email-jgunthorpe@obsidianresearch.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1501797846-8228-1-git-send-email-jgunthorpe@obsidianresearch.com> References: <1501797846-8228-1-git-send-email-jgunthorpe@obsidianresearch.com> X-Broken-Reverse-DNS: no host name found for IP address 10.0.0.156 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Tell systemd that iwpmd is ready once it established all threads and netlink sockets. This perhaps should be pushed a little later, after the message sent by send_iwpm_mapinfo_request is responded to by the kernel? Signed-off-by: Jason Gunthorpe --- iwpmd/CMakeLists.txt | 1 + iwpmd/iwarp_pm_server.c | 5 +++++ iwpmd/iwpmd.service.in | 1 + 3 files changed, 7 insertions(+) diff --git a/iwpmd/CMakeLists.txt b/iwpmd/CMakeLists.txt index 6fd36e47bbbc54..bf538034ea5333 100644 --- a/iwpmd/CMakeLists.txt +++ b/iwpmd/CMakeLists.txt @@ -4,6 +4,7 @@ rdma_sbin_executable(iwpmd iwarp_pm_server.c ) target_link_libraries(iwpmd LINK_PRIVATE + ${SYSTEMD_LIBRARIES} ${NL_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ) diff --git a/iwpmd/iwarp_pm_server.c b/iwpmd/iwarp_pm_server.c index 637f2344d98402..ebed6f9d28ee59 100644 --- a/iwpmd/iwarp_pm_server.c +++ b/iwpmd/iwarp_pm_server.c @@ -32,6 +32,7 @@ */ #include "config.h" +#include #include #include "iwarp_pm.h" @@ -1447,6 +1448,10 @@ int main(int argc, char *argv[]) known_clients = init_iwpm_clients(&iwarp_clients[0]); send_iwpm_mapinfo_request(netlink_sock, &iwarp_clients[0], known_clients); + + if (systemd) + sd_notify(0, "READY=1"); + iwarp_port_mapper(); /* start iwarp port mapper process */ free_iwpm_mapped_ports(); diff --git a/iwpmd/iwpmd.service.in b/iwpmd/iwpmd.service.in index 4e4b49738fa29d..3451e7e50923af 100644 --- a/iwpmd/iwpmd.service.in +++ b/iwpmd/iwpmd.service.in @@ -5,6 +5,7 @@ Requires=rdma-load-modules@iwpmd.service After=network.target rdma-load-modules@iwpmd.service [Service] +Type=notify ExecStart=@CMAKE_INSTALL_FULL_SBINDIR@/iwpmd --systemd LimitNOFILE=102400