Power Management In Windows Vista Pat Stemen Program Manager Windows Platform Architecture Group Microsoft Corporation



Yüklə 472 b.
tarix14.10.2017
ölçüsü472 b.
#4561


Power Management In Windows Vista

  • Pat Stemen Program Manager Windows Platform Architecture Group Microsoft Corporation


Agenda

  • Windows Vista Power Management Goals

  • Windows Vista Power Management Feature Overview

  • Power Policy Configuration Tasks

  • S3 Resume Performance

    • Resume Performance Measurements
    • Measuring with PwrTest


Windows Vista Power Management Goals

  • Simplify the user experience

  • Improve the reliability of sleep transitions

    • Ensure deterministic behavior
    • Improve visibility into power management actions
    • Provide extensive diagnostic tracing
  • Enable maximum energy savings by default

    • Help extend Mobile PC battery life
    • Reduce desktop power consumption
  • Enable easy deployment of power management configuration

    • Enterprise PC energy savings


Windows Vista Power Policy

  • Simplified for the user

    • 3 power plans by default
  • Group policy control of power settings

  • Extensible power policy settings model and data store

    • All power policy settings are GUID-based
    • All users manipulate the same set of power policy objects
    • Power setting access can be restricted
    • Highly integrated device and application power management
    • Development of custom power policy applications and tools is simplified


Power Policy Setting Scope

  • All power policy is stored on a per-machine basis

    • A single set of power schemes for the entire machine
    • All users have access to power schemes
      • Do not need to be an administrator
    • One active power scheme at any point in time
      • Last set active power scheme is used when no users are logged in, initial boot
    • Only the user at the console session can apply a new power scheme to the system


Power Policy Security

  • Windows Vista enables access control for individual power settings

    • E.g., Ability to change “Prompt for password on resume” power setting can be restricted to administrators only
    • By default, all authenticated users have access to change all power settings
    • Power policy access rights can be restricted
      • Apply a power scheme
      • Create/delete a power scheme
      • Restore power scheme defaults
    • Access control manipulated via powercfg.exe
      • Powercfg.exe – setsecuritydescriptor POWER_SETTING “[SDDL Security Descriptor String]”
      • SDDL string reference on MSDN


Group Policy

  • Windows Vista power policy can be enforced with group policy

    • Enables IT professionals to easily reduce PC energy consumption and associated cost
      • E.g., enforce monitor idle and system sleep timeouts
      • Potential cost savings and benefits
        • http://www.energystar.gov/powermanagement
    • All power settings included with Windows Vista can be enforced
    • Power Options in Control Panel indicates if group policy overrides are active


Reliable Sleep Transitions

  • Windows Vista promotes the use of sleep as the default off state

    • Requires reliable, fast and deterministic sleep transitions
  • Failed transitions were the primary sleep adoption blocker in previous versions of Windows

    • Lead to great user frustration and distrust of power management
    • Investigations indicate component vetoes are the primary cause
      • Application, service or driver willingly prevents the sleep transition


Reliable Sleep Transitions

  • Sleep transitions will succeed

    • Vista will not query user mode components when entering sleep
    • Drivers may not veto sleep transitions
    • User-mode notification (PBT_APMSUSPEND) will continue to be sent
      • Timeout to process event has been reduced from 20 seconds to 2 seconds
  • Applications, services, and drivers must be prepared for this change

    • Proper design and test is imperative


Integrating with Windows Power Management

  • Windows Vista enables all components to integrate with system-wide power policy

    • Including device drivers and software applications
    • Enables rich device power management
      • Beyond run time idle detection
    • Extends current policy preference to components
      • Provides mechanisms for definition and installation of custom power settings
    • Exposes a broad set of power event notifications


Integrating with Windows Power Management

  • Benefits of integrating with Windows Power Policy

    • Simplicity for users
      • Allows the entire platform to respond to the user’s current power policy
    • All power settings appear in Windows Power Options
      • No need to provide additional configuration UI
      • Including custom 3rd party power settings
    • Allows for true OEM power management innovation and value
      • Examples
        • Mobile graphics power management
          • Session CPA013 details an example by ATI
        • Chipset power management
        • Media playback applications


Brightness Controls

  • Windows Vista integrates display brightness into power policy

    • Enables simple control of brightness for users
      • Each power scheme has an associated brightness level preference
      • Brightness controls are also exposed in Mobility Center
    • Requires ACPI brightness object support
      • See session CPA002 “ACPI in Windows Vista” for implementation details


Away Mode

  • Away Mode addresses media sharing scenarios

    • PC is required to be running (S0), but look and sound off
  • Away Mode is not a new power state

    • System remains in S0
    • Power consumption is the same as S0
      • Processor performance, fan speed may dynamically adjust based on workload, power policy
  • When entering Away Mode…

    • Display is turned off, audio is muted
    • Keyboard and mouse input are ignored
  • Away Mode does not replace other availability solutions, such as Wake-on-LAN (WoL)

    • Away Mode is not recommended for enterprise deployments


Away Mode Support

  • Away Mode does not expose a user interface

    • Away mode is enabled dynamically by applications or in the registry
      • Key: HKLM\System\CCS\Control\Power
      • Value: AwayModeEnabled (0x1: Enabled, 0x0: Disabled)
      • SetThreadExecutionState(ES_AWAYMODE_REQUIRED | ES_CONTINUOUS)
    • When enabled, any user-initiated sleep trigger will enter Away Mode
      • Sleep button, media remote, Start Menu power button, etc.
    • Any hardware button event will exit Away Mode
      • Includes sleep button on media remote
    • The system may idle into sleep (S3) based on current power policy
  • Away Mode is available in all Windows Vista SKUs

    • No hardware or BIOS dependencies


Hybrid Sleep

  • Saves Hibernate file, then enters Standby

    • Normally, resume is from memory image
    • If power is lost, system resumes from hibernate image on disk
  • Allows for a simple shutdown metaphor

    • Users do not need to understand or choose between Standby and Hibernate; just “Off”
    • Default off mode for Windows Vista desktops
  • Provides increased reliability

    • Data and system state are always backed by non-volatile storage


Hybrid Sleep

  • Core implementation

    • System device drivers are told the platform is entering the S4 state
      • IRP_MN_SET_POWER Parameters.Power.State == PowerSystemHibernate
      • Enables a hibernation context (system state on disk) to be generated
      • Device drivers should save enough context to resume from the S4 state
    • Platform firmware is placed in the S3 state


Hybrid Sleep

  • Wake-capable devices should support wake from all sleep states

    • S1, S3, S4
    • Users do not want their system to sleep into S1 state
      • Consumes unnecessary power when compared to S3
      • May be noisy with case and processor fans running
    • Note: Hybrid Sleep transitions will not lighten to S1 state if a driver fails IRP_MN_QUERY_POWER for S3 or S4
  • You may need to special case Hybrid Sleep transitions in your driver for wake-capable devices

    • Only necessary if your device supports wake from S3, but not S4
    • Devices that are wake-capable from S3 should be wake-capable from Hybrid Sleep
      • Hybrid Sleep transitions will appear to be S4 transitions unless your driver is modified


Common Power Policy Configuration Tasks

  • Powercfg command-line tool can be used to configure power policy

    • Included with Windows Vista
    • Suitable for most factory floor configuration tasks
      • Import/export new power schemes
      • Updating power policy defaults
      • Adjusting individual power settings
        • E.g., changing processor performance state min, max


Common Power Policy Configuration Tasks

  • Powercfg tool supports textual aliases for common power policy GUIDs

    • Every Windows Vista power scheme and setting is identified by a GUID
    • Use aliases in place of GUID parameters to powercfg
    • “powercfg /aliases” displays the entire list
    • Example: S3 idle timeout
      • Power setting GUID
        • “{29f6c1db-86da-48c5-9fdb-f2b67b1f44da}”
      • Powercfg alias
        • “STANDBYIDLE”


Common Power Policy Configuration Tasks

  • Configure power settings within a specific power scheme

    • Set AC, DC values for individual power settings


Common Power Policy Configuration Tasks

  • Rename a power scheme

    • Update power scheme friendly name, description
    • Strings can be localized
      • Use “@dllpath,-resourceID” syntax
      • E.g., “@%SystemRoot%\system32\powrprof.dll,-14”


Common Power Policy Configuration Tasks

  • Export a power scheme

    • Stores the contents of a power scheme on disk
    • Power scheme can be imported on other systems
      • Use to distribute custom power schemes across enterprise deployment


Common Power Policy Configuration Tasks

  • Import a power scheme

    • Restores a power scheme from a file containing an exported power scheme
    • Allows IT, OEM to install custom power scheme on multiple systems
      • Specify a well-known GUID when importing the new scheme to enable group policy enforcement


Common Power Policy Configuration Tasks

  • Update default power schemes

    • Copies the current power schemes to the default user registry hive
      • Enables OEM, IT to have custom schemes, values restored when user restores defaults


Optimizing S3 Resume Performance

  • Fast resume performance is critical to the PC user experience

    • Users want instant PC availability, appliance-like behavior
    • Sleep states are preferred to boot, shutdown
      • Boot and shutdown have longer on, off latencies
      • Sleep states (S3, S4) on desktops have almost the same power consumption as shutdown (S5)
  • Sleep states are the default off mode in Windows Vista



Optimizing S3 Resume Performance

  • Windows Vista core technologies enable PCs to have almost instantaneous S3 resume performance

    • Improvements to the kernel power manager IRP dispatch mechanism
    • Intelligent memory management to reduce hard disk faults on the resume path
      • SuperFetch™
    • Updated USB hub driver removes serialization delays
    • Automatic performance tracing of every suspend, resume transition
      • Built on Event Tracing for Windows (ETW)
    • New tools to enable partners to test, profile and analyze systems for S3 resume performance


S3 Resume Process Phases

  • Power On

    • Time to prepare the hardware for resume
      • No processor instructions are executed
    • Begins with wake event
      • E.g., RTC, HW button, wake-capable device
    • Ends when processor begins executing instructions
    • The performance of the Power On phase can not be measured by software


S3 Resume Process Phases

  • BIOS Initialization

    • Time required to initialize hardware
      • CPU, memory controller, cache, chipset
    • Only BIOS code is executing
      • Starts with power-on reset vector
    • Phase ends when the processor jumps to the OS waking vector
    • Phase duration is measured using the processor time-stamp counter (TSC)
      • TSC is assumed to be reset (value of 0) during the Power On phase
      • Windows records the value of the TSC immediately after OS begins executing instructions
      • Windows records the frequency of the TSC during the suspend process


Resume Process Phases

  • Device Initialization

    • Time required to notify devices that the system has resumed
      • Power manger sends IRP_MN_SET_POWER (S0) IRPs to all drivers
    • Phase begins immediately after OS regains control from the BIOS
    • Phase ends after all drivers have completed their system power (IRP_MN_SET_POWER, S0) IRPs
    • Phase duration logged
      • IRP start, completion times also recorded


Resume Process Phases

  • USER Initialization

    • USER applications and services are notified that the system has resumed
      • WM_POWERBROADCAST message, PBT_APMRESUME event
    • Begins immediately after devices have been initialized
    • Ends after the power manager has asked the USER subsystem to notify applications
      • USER notifications occur asynchronously from the power manager’s point of view
      • USER notifications continue to occur after the power manager has considered resume to be complete
    • Phase progress logged


Measuring Resume Performance

  • Microsoft measures total S3 resume time as

    • BIOS Initialization + Device Initialization phase durations
  • Starts when the CPU begins execution

  • Ends after all driver IRP_MN_SET_POWER (S0) IRPs have been completed

  • This is the benchmark used for the Windows Hardware Logo Requirement

    • Logo program requires S3 resume in less than 2000 milliseconds


Resume Performance Best Practices

  • It is expected that not all device-specific re-initialization will be complete within the total resume time

    • Devices should initialize their hardware when handling their device power (IRP_MN_SET_POWER, D0) IRPs
      • Depending on parallelism, this may occur after Device Initialization phase has completed


Resume Performance Best Practices

  • Drivers for devices without children devices will help decrease total DriverInit time by completing their S-IRP immediately

    • Request a D0 set-power IRP immediately after receiving an S0 set-power IRP
    • Complete the S0 set-power IRP immediately
      • Do not wait for the D0 IRP completion before completing the S0 IRP
      • Continue to queue I/O until the D0 IRP is completed
    • Complete any device initialization required when the D0 set-power IRP is received
    • Complete the D0 set-power IRP
    • Begin handling any queued I/O requests
      • I/O should be queued when the Dx set-power IRP is received on the suspend path
  • Completing the S-IRP immediately enables the power manager to power up additional devices



Resume Performance Best Practices

  • Drivers must not block forward progress of the system on the S3 resume path

    • Prevents the power manager from powering up other devices
  • Guidelines

    • Do not execute a single DPC for more than 100us
    • Do not call KeStallExecutionProcessor() for more than 100us total in a single DPC
    • If you need additional time to power up your device, use a dedicated thread or a kernel-mode worker thread
      • Then, use KeDelayExecutionThread() to wait on hardware
    • These are the same guidelines for supporting glitch-free multimedia on Windows Vista
      • http://www.microsoft.com/whdc/driver/perform/mmdrv.mspx


Resume Performance Tools

  • Resume performance can be measured using PwrTest

    • Command-line tool, supports multiple power management scenarios
    • Included in the Windows Driver Kit (WDK)
    • System can be repetitively cycled through sleep states
    • Resume performance information logged to XML file
    • Used to profile the system for the Windows Hardware Logo Requirement
  • WDK also includes a sample resume performance script

    • Cycles through four S3 transitions, ignores the first
  • Resume Performance can be observed in the Windows Event Log

    • See backup slide for details


Measuring S3 Resume Performance with PwrTest



Summary

  • Windows Vista power management goal is simplicity for users

  • Windows Vista enables integration of custom power management features with power policy

  • Powercfg command-line tool can be used to customize power policy for factory floor scenarios

  • Systems with Windows Vista will offer users near-instantaneous S3 resume performance

  • S3 resume performance can be measured using PwrTest WDK tool or Windows Event Log



Call To Action

  • Test your application, service or driver with Windows Vista power management

  • Support Hybrid Sleep in your driver for a wake-capable device

  • Use powercfg command-line tool to configure power policy

  • Measure S3 resume performance with PwrTest or the Windows Event Log

  • Optimize device drivers for S3 resume performance



Additional Resources

  • Power Management and ACPI on Windows Hardware and Driver Central

    • http://www.microsoft.com/whdc/system/pnppwr/powermgmt/ default.mspx
  • White papers

    • Measuring Resume Performance on Windows Vista
      • http://go.microsoft.com/fwlink/?LinkId=61994
    • Direct Application Launch for System Startup on Windows Vista
      • http://www.microsoft.com/whdc/system/vista/DirAppLaunch.mspx
  • Other WinHEC Sessions

    • CPA013: “Case Study: ATI Device Power Management in Windows Vista”
    • CPA002: “ACPI in Windows Vista”


Backup Slides Resume Performance Event

  • Windows Vista exposes resume performance information in the event log

    • Automatically, every sleep/resume transition
  • Event details

    • Source
      • Microsoft-Windows-Power-Troubleshooter
    • Event ID
      • 1
    • Description
      • “The system has resumed from sleep”
      • Sleep Time: [date-time]
      • Wake Time: [date-time]
      • Wake source: [wake source description]
    • Resume performance, sleep state, Hibernate metrics included in event data


Backup Slides Hybrid Sleep

  • Drivers for wake-capable devices may need to do extra work on a Hybrid Sleep transition

    • Only necessary if your device supports wake from S3, but not wake from S4
    • If your device supports wake from S3, it should also support wake from Hybrid Sleep
      • However, IRP_MN_SET_POWER Parameters.Power.State == PowerSystemHibernate (S4) for Hybrid Sleep
    • Use the SystemContext field of the IRP_MN_SET_POWER IRP to determine if the system is transitioning to Hybrid Sleep
      • Arm for wake if your device supports wake from S3
      • Use SYSTEM_POWER_STATE_CONTEXT
        • TargetState == PowerSystemSleeping3
        • EffectiveState == PowerSystemHibernate


Backup Slides Hybrid Sleep

  • Arm device for wake on Hybrid Sleep transition

    • TargetSystemState == PowerSystemSleeping3
    • EffectiveSystemState == PowerSystemHibernate






Yüklə 472 b.

Dostları ilə paylaş:




Verilənlər bazası müəlliflik hüququ ilə müdafiə olunur ©www.genderi.org 2024
rəhbərliyinə müraciət

    Ana səhifə