From owner-freebsd-hackers@FreeBSD.ORG Fri Jun 17 03:35:55 2011 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 886BB1065673 for ; Fri, 17 Jun 2011 03:35:55 +0000 (UTC) (envelope-from cattelan@thebarn.com) Received: from x.digitalelves.com (x.digitalelves.com [209.98.77.55]) by mx1.freebsd.org (Postfix) with ESMTP id 547958FC08 for ; Fri, 17 Jun 2011 03:35:55 +0000 (UTC) Received: from funky-wifi.x.thebarn.com (localhost [127.0.0.1]) (authenticated bits=0) by x.digitalelves.com (8.14.4/8.14.4) with ESMTP id p5H3ZrGQ047739; Thu, 16 Jun 2011 22:35:54 -0500 (CDT) (envelope-from cattelan@thebarn.com) Message-ID: <4DFACB99.1030707@thebarn.com> Date: Thu, 16 Jun 2011 22:35:53 -0500 From: Russell Cattelan User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.17) Gecko/20110414 Thunderbird/3.1.10 MIME-Version: 1.0 To: Gleb Kurtsou References: <4DFA4C47.8060503@digitalelves.com> <20110616200616.GA67011@tops> In-Reply-To: <20110616200616.GA67011@tops> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-hackers@freebsd.org Subject: Re: kexec or similar for FreeBSD X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Jun 2011 03:35:55 -0000 On 6/16/11 3:06 PM, Gleb Kurtsou wrote: > On (16/06/2011 13:32), Russell Cattelan wrote: >> I have been contacted about possibly implementing a fast reboot >> mechanism for FreeBSD similar to kexec on Linux. >> >> I have just started looking into how this accomplished so I figured >> a note to freebsd hackers would also be a good place to ask >> for comments. >> >> Has anybody looked at doing something like kexec? > I was working on similar project some time ago. First of all you have to > leave hardware in known good state for a new kernel. Reseting devices > can be generally accomplished by unloading corresponding kernel modules > (even if they are compiled in kernel). The biggest problem for me was > timers and programmable interrupt controller. I didn't make it work > properly, but my goals where much wider than replacing with another > FreeBSD kernel. Aim was to restore initial BIOS state as much as > possible. What were your goals beyond booting a new kernel? I think getting back to a known BIOS state is kinda required to get a kernel through the boot process. From what I can tell the main goal of kexec is to avoid the process of re-initializing the hardware via BIOS. >> Is it the right thing to do for FreeBSD. I'm concerned that the way >> FreeBSD handles early kernel modules (loaded via the boot loader) >> vs linux which does everything via initrd is going to be a problem. > I find loader code easy work with. You could write dummy filesystem > implementation for libstand. So that customized loader will load both > kernel and modules yet while running FreeBSD. Your "reboot" procedure > wouldn't even use any BIOS io interrupts. Linux boot is a real mess > imho. > So it is possible to get back to the loader once the kernel is booted? So the running kernel could load the new kernel / modules and then jump back to the loader to start the boot process. >> Thanks for any help on this. >> >> -Russell Cattelan