From owner-freebsd-hackers Fri Feb 6 07:21:07 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id HAA26399 for hackers-outgoing; Fri, 6 Feb 1998 07:21:07 -0800 (PST) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from callisto.fortean.com (callisto.fortean.com [209.42.194.97]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id HAA26322 for ; Fri, 6 Feb 1998 07:20:57 -0800 (PST) (envelope-from walter@fortean.com) Received: from localhost (walter@localhost) by callisto.fortean.com (8.8.8/8.8.5) with SMTP id KAA22553; Fri, 6 Feb 1998 10:20:28 -0500 (EST) X-Authentication-Warning: callisto.fortean.com: walter owned process doing -bs Date: Fri, 6 Feb 1998 10:20:27 -0500 (EST) From: "Bruce M. Walter" To: John Fieber cc: hackers@FreeBSD.ORG Subject: Re: Powering off the system/UPS In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG X-To-Unsubscribe: mail to majordomo@FreeBSD.org "unsubscribe hackers" > > It's necessary to have kernel support because the powerdown procedure > > should only be run after all disk syncing/buffer flushing etc... The UPS > > support code doesn't specifically need to be included, but another > > at_shutdown queue which gets called after SHUTDOWN_POSTSYNC or the > > implementation of ordered/prioritized shutdown queues would allow for a > > callout function to do the 'Right Thing.' > > And halt(8) or shutdown(8) are incapable of doing the Right > Thing? I'm still failing to see the point. Yes, shutdown(8) actually calls halt(8). halt(8) kills init (killing system processes) and eventually calls the reboot syscall. reboot(2) calls the at_shutdown SHUTDOWN_PRESYNC list of callout methods, syncs the disks and then calls the SHUTDOWN_POSTSYNC list of callout methods. Then if reboot was called with the RB_POWEROFF flag set, it calls cpu_power_off() which is an empty routine unless you've compiled in APM support in which case it calls apm_power_off(). The closest thing to a kernel callout which could call a UPS inverter poweroff routine is at_shutdown/SHUTDOWN_POSTSYNC but some drivers (the DPT driver for sure and maybe others) use this queue to flush unwritten data from their cache to disk *AFTER* the final FS sync. Since that callout list is not ordered, there's no way to insure the power wouldn't be cut after that flush has been performed. I've been hashing this out with Mike Smith, and he feels that a) the at_shutdown queues should be ordered to insure their being called in the right order -and- b) another callout queue should be established, like 'SHUTDOWN_POSTPOSTSYNCREALLYIAMSHUTTINGDOWNNOW' ;) which would be called after SHUTDOWN_POSTSYNC. APM and whatever else that needs a powerdown would be responsible for putting callouts on that list. My only trepidation with this scenario is that the priorities are compiled into the kernel and are not guaranteed to be correct because they are specified by the people writing the drivers. - Bruce ======================================================================== || Bruce M. Walter || 107 Timber Hollow Court #335 || || Senior Network Consultant || Chapel Hill, NC 27514 || || Fortean Technologies, Inc. || Tel: 919-967-4766 || || Information Technology Consultants || Fax: 919-967-4395 || ======================================================================== || BSD Unix -- It's not just a job, it's a way of life! || ========================================================================