From owner-freebsd-arch@FreeBSD.ORG Mon Mar 5 19:31:34 2012 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 94A0B106564A for ; Mon, 5 Mar 2012 19:31:34 +0000 (UTC) (envelope-from ray@ddteam.net) Received: from mail-ww0-f42.google.com (mail-ww0-f42.google.com [74.125.82.42]) by mx1.freebsd.org (Postfix) with ESMTP id 24E918FC14 for ; Mon, 5 Mar 2012 19:31:33 +0000 (UTC) Received: by wgbds11 with SMTP id ds11so1581086wgb.1 for ; Mon, 05 Mar 2012 11:31:33 -0800 (PST) Received: by 10.180.84.170 with SMTP id a10mr13930825wiz.9.1330975892950; Mon, 05 Mar 2012 11:31:32 -0800 (PST) Received: from rnote.ddteam.net (123-8-133-95.pool.ukrtel.net. [95.133.8.123]) by mx.google.com with ESMTPS id ep17sm21688666wid.2.2012.03.05.11.31.30 (version=SSLv3 cipher=OTHER); Mon, 05 Mar 2012 11:31:31 -0800 (PST) Date: Mon, 5 Mar 2012 21:30:48 +0200 From: Aleksandr Rybalko To: Warner Losh , Adrian Chadd Message-Id: <20120305213048.4999b5a1.ray@ddteam.net> In-Reply-To: <4996D1CF-25E5-4422-996C-DF23B5C10732@bsdimp.com> References: <20120131213857.86c81626.ray@ddteam.net> <20120210110243.GA2012@lor.one-eyed-alien.net> <4996D1CF-25E5-4422-996C-DF23B5C10732@bsdimp.com> X-Mailer: Sylpheed 3.1.2 (GTK+ 2.24.5; amd64-portbld-freebsd9.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Gm-Message-State: ALoCoQmSOsag1N406ZRGXxzrnsGJnEU799FHVP8ar/QjNae6kLsl9U0mzLX7/a+Uqnd7x/Wphi5f Cc: Brooks Davis , freebsd-arch@FreeBSD.org Subject: suspend/resume + Re: dynamic attach of hinted devices X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Mar 2012 19:31:34 -0000 Changing subject because now it will affect suspend/resume thread. On Fri, 10 Feb 2012 09:45:48 -0700 Warner Losh wrote: > > On Feb 10, 2012, at 4:02 AM, Brooks Davis wrote: > > > On Tue, Jan 31, 2012 at 09:38:57PM +0200, Aleksandr Rybalko wrote: > >> Hi FreeBSD hackers, > >> > >> at first I want to say this: :) > >> WARNING: FOLLOWING DEVCTL PATCH MAY EASILY PANIC YOUR SYSTEM, > >> PLEASE DO NOT TRY IT ON PRODUCTION SERVERS AND TRY IT WITH > >> FILESYSTEMS MOUNTED AS READONLY :))))) > >> > >> So I introduce two patches first one [1] used to migrate from > >> static_hints or hints in the static_kenv to dynamic hints. > >> > >> sysctl kern.hintmode=2 will copy hints from static hints or from > >> static kenv and put it into dynamic kenv. Those will allow to > >> manipulate hints values and attach hinted devices with devctl tool. > >> > >> Second [2] allow attach/detach devices with userland tool devctl. > >> > >> devctl tool allow add and initialize new devices which is not able > >> to be autoenumerating, such a hinted devices. > >> > >> Both designed to have ability update EEPROM items in runtime, since > >> some device can't work in mode when it accessible like a EEPROM > >> chip. > >> > >> Example: > >> # sysctl kern.hintmode=2 > >> # kenv hint.mx25l.0.at="spibus0" > >> # kenv hint.mx25l.0.cs=0 > >> # kenv hint.mx25l.0.chipname="at25128" > >> # devctl hinted spibus 0 mx25l 0 > >> mx25l0: at cs 0 mode 0 on spibus0 > >> mx25l0: at25128, sector 64 bytes, 256 sectors > >> GEOM: new disk flash/spi0 > >> > >> Someone may found it also useful for testing device attach/detach > >> code (memory leaks, resource allocation, etc). > >> > >> So, say me please your opinion. > > > > I skimmed over the patch and the concept looks good to me. I'm > > probably not the right person to review this proposal in detail, > > but perhaps John Baldwin (cc'd) could do it or suggest someone. > > I've looked at it and it looks OK, but I had lots of feedback I > didn't have time to write up. I like the concept, but have lots of > suggestions for improvement since I'd like to see this more > generically done. > > Warner Think this version will cover another few items from your suggestion list, Warner. :) Now devctl able to do also DEVICE_SHUTDOWN, DEVICE_SUSPEND and DEVICE_RESUME, so folks who want to test suspend/resume ability can do it easy, but of course without real device power-off. Link: http://my.ddteam.net/files/2012-03-05_devctl2.patch Another one thing to dial is a name of device. now it is /dev/devctl2, just because /dev/devctl used by devd (which not control, but just listen for device events). So we can use: 1. synonym like /dev/devmng, or 2. teach devd to do ioctl over /dev/devctl Second have another list of problems. devd is a single tool wrote in C++ used for embedded firmwares, so I replace it with simplified analogue (cdevd) to not hold c++ libs. and then, of course, much more works and bigger complexity. Hope many hackers say me own opinion :) P.S. patch is not subject to commit, but only for peoples who want to test it. When I will prepare it to commit, I will do it in 3 parts: 1. kern/subr_hints 2. kern/subr_bus + sys/bus.h + conf/options 3. sbin/devctl WBW -- Aleksandr Rybalko