From owner-freebsd-arch@freebsd.org Tue Oct 24 18:03:26 2017 Return-Path: Delivered-To: freebsd-arch@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1BC61E54991 for ; Tue, 24 Oct 2017 18:03:26 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mailman.ysv.freebsd.org (mailman.ysv.freebsd.org [IPv6:2001:1900:2254:206a::50:5]) by mx1.freebsd.org (Postfix) with ESMTP id E70F86A9C7 for ; Tue, 24 Oct 2017 18:03:25 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mailman.ysv.freebsd.org (Postfix) id E65D5E5498D; Tue, 24 Oct 2017 18:03:25 +0000 (UTC) Delivered-To: arch@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E5FF5E5498C for ; Tue, 24 Oct 2017 18:03:25 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-it0-x22c.google.com (mail-it0-x22c.google.com [IPv6:2607:f8b0:4001:c0b::22c]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id AB5586A9C4 for ; Tue, 24 Oct 2017 18:03:25 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-it0-x22c.google.com with SMTP id y15so11042813ita.4 for ; Tue, 24 Oct 2017 11:03:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:from:date:message-id:subject:to; bh=z+e82HopCEWdkrGXmeQmIkvFE2DzP3BYVtKkRynoS0Q=; b=BGVTnyChMoryAWiw51UWC4WQQHaU5SCx2alIWjUDDjvQUwqhasM6yKnpgLpkjCQIGX TvDpVE5fWjrZzlnGH6lP73NUOZXLSLE8sCh4AS8MqCaycWDImW+BtDLybDfKtMf1qmDZ qJ/OqhNj5mBic4ngvt2mxoZ9UqxmD6Vj64z5xba6v+rovaySHHtDgWF88u+EFzSzVYpV OYU5vcA9pf+PeysSC0Ms3S5vVF5qJBl+lW+fquiPaEbrOHf6gRxzVu0qqgfj8G7SzMbt x/j2lMERtJEyfb7ORnSWA0/xkfqdRx86RGGWzXs4AUb117Kpt1eYm/pY1I6Eo1mJaTB4 sIDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:from:date:message-id:subject :to; bh=z+e82HopCEWdkrGXmeQmIkvFE2DzP3BYVtKkRynoS0Q=; b=Kmmh29UuoxF4YFNzJCxQsBzT1UMZZpvhpw99gUngbputOvQlTthxWoTCTcr6Yo25/4 RvKMIBod2gY7X42ldysM0IswOzGnQFVNIdzj2uXNPcwyP9qvuWnpT4pXX+SOgj91AFj+ RJCplLkEyaIPwtA5ilVdIMYFMBRToL4d/bg+hj9g64qPFGtiU950B3oNAdIPmGPs4OeL wssMYsgZkKKbYHqMowCv/Y5J3qukWbIqcwgzlI88x9b4ViJwV3tWw0WPSUfCxncOU7CF B50V7bUpZ5/5KQxAZoKNv2puh4DClVpLHRKvD+eetC2ndjWEZnu8+GMWyanD3PnLAWcH 57bA== X-Gm-Message-State: AMCzsaUm865B4KQy0zw9F6AOT+LigOG4kx9Zf/kvwYAbb9u51HmoDlGh UfHr4GzpA87nNv9/QTDbJthuSo3OtuTMXcnxyJpTKc1q X-Google-Smtp-Source: ABhQp+Rl9Gtwg73lKOkAmAIOrgNolcxZhyKc/iGBoXDQF612WsOdyHniuatW6lb6/cCR6TbNavlIrtIoEYytYSFUMBs= X-Received: by 10.36.64.145 with SMTP id n139mr15345412ita.115.1508868204661; Tue, 24 Oct 2017 11:03:24 -0700 (PDT) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.57.22 with HTTP; Tue, 24 Oct 2017 11:03:24 -0700 (PDT) X-Originating-IP: [2603:300b:6:5100:e136:19f5:a7c3:fff2] From: Warner Losh Date: Tue, 24 Oct 2017 12:03:24 -0600 X-Google-Sender-Auth: U5-xZKDiA1dsnmt-2nLMFVPKOqE Message-ID: Subject: New reboot flag: -c for 'power cycle' To: "freebsd-arch@freebsd.org" Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Oct 2017 18:03:26 -0000 I've worked up a prototype for a new type of reboot. Currently we can halt the system, reboot (reset) the system, and power off the system. However, there's no reliable[*] way, however, to power cycle a system from the command line. For a variety of reasons, we have the need to power cycle a system on reboot. That is, to remove power and reapply it a short time later. This obviously requires special hardware to accomplish, but the number of BMC equipped servers is interesting. The reasons boil down to 'we did something to some bit of hardware that requires us to power cycle to restore it to operational state or for new settings to take effect.' I've uploaded https://reviews.freebsd.org/D12777 with all the changes. Briefly, it introduces a new howto flag RB_POWERCYCLE. This flag instructs capable hardware to cause the system to power cycle at the end of shutdown_full. A new signal has been added to init (SIGWINCH) which initiates this. Since init has no controlling terminal, SIGWINCH is useless to it anyway... It add -c to the shutdown,reboot,halt, etc family of commands. It tweaks the processing of reboot in a couple of places to treat RB_POWERCYCLE the same way as we treat RB_POWEROFF as appropriate. Finally, it registers a shutdown_final handler in IPMI and will power off systems when howto has the RB_POWERCYCLE bit set and the BMC supports the chassis device. Failure to implement RB_POWERCYCLE is handled the same way that we handle RB_POWEROFF: in the event of failure, we either reboot or halt the machine as instructed. Code comments should go to the review. Design comments should come here. Warner [*] To be fair, one can arrange it so that one halts the system after arming the watchdog and configuring it to power cycle when it fires, but that relies on systems finishing their halt sequence before the watchdog fires, and experience suggests that even with that there's a small (~1%) failure rate for this method that requires manual intervention.