DragonFly submit List (threaded) for 2009-09
DragonFly BSD
DragonFly submit List (threaded) for 2009-09
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Re: ahci power management


From: Matthew Dillon <dillon@xxxxxxxxxxxxxxxxxxxx>
Date: Fri, 11 Sep 2009 09:46:27 -0700 (PDT)

:Here is a first patch to add support for AHCI HBA initiated power
:management to ahci(4):
:http://leaf.dragonflybsd.org/~hofmann/ahci_pwrmgmt.patch
:
:To enable it you need to set
:	hint.ahci/powermanagement=1
:for medium or
:	hint.ahci/powermanagement=2
:for aggressive power management in /boot/loader.conf.
:Setting it to 2 reduces performance quite a bit!
:On the positive side I see the 1W reduction in power consumption as it is 
:reported for Linux.
:
:Obviously this should be tunable at runtime, but I have some
:questions:
:
:In which context are sysctl callbacks run? How would I avoid races
:when modifying flags or accessing registers (to disable the PRCE intr
:for example)? 
:Maybe setting flags with with atomic operations and do the real work
:in the per port thread?
:
:Cheers,
:Johannes

    If you set up a SYSCTL_PROC (you can probably find examples
    in various places in the kernel) then whenever the sysctl is
    read or written the procedure callback is made.

    In order to safely modify the feature while AHCI is operational
    you probably just need to get the AHCI port lock.  There are
    numerous examples in the ahci code of calls to e.g. 
    ahci_os_lock_port(ap).  So you'd get the lock, modify the
    feature, and then release the lock.

    The patch looks pretty good, but needs one or two more passes
    before comitting.  There are capability bits for AHCI features
    and the power management feature must be conditionalized on the
    capability existing.  I think the one that applies is
    AHCI_REG_CAP_SALP.  See other AHCI_REG_CAP_* uses in the ahci
    code for examples.

					-Matt
					Matthew Dillon 
					<dillon@backplane.com>



[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]