Hi Liu Jiang,

This proposal looks great!

Here are some suggestions:

1) This proposal does not specify the context the callbacks will
execute in. Presumably idle callbacks will run in the idle-thread
context.   This proposal should state this.
Idle threads cannot block.  Idle threads also cannot spin when the
owner of the synchronization object expects to be able to wakeup
the CPU from idle.

2) Clients may only be interested in a sub-set of c-states.
cpu_idle_register_callback() could take another argument
that specified which c-state(s) the callback should be invoked.
I do not know if clients will want this option.

CPUs will likely only enter C1 idle when they do not expect to be
idle very long on C-State enabled kernels.

3) A "max idle time" argument could be added to cpu_idle_enter_cbfn().
As part of the C-State project CPUs now read their LAPIC Current
Count register to see when the next Local APIC Timer interrupt
will fire.  Would FIPE be interested in this max value?

4) Clients may not want their callback invoked if the CPU will not
be idle longer than a specified time due to the LAPIC Current Count
register.  Do you want cpu_idle_register_callback() to be able to
specify a minimum "max idle-time threshold" argument?  The callbeck
would not be called if the CPU knows it will not be idle that long.

5) Should any of the FIPE "system idleness" calculations be part
of the core kernel?  Other systems may be interested in this
information.

6) What does this sentence in 4.2.4 mean?
"If it returns non-zero value, CPU should cancel entering idle state"?
Does this mean "enter ACPI C1 instead of a deeper C-State"?
Does FIPE need this?

Can this functionality be removed?
CPUs have to at least enter C1 when idle.  There can be large
performance penalties if CPUs never halt in their idle loop....

7) How will rollback be handled when a callback cancels the idle
after other callbacks have already been called?

Will the cpu_idle_exit_cbfn() functions be called for all
callbacks that have already been invoked?

Will the CPU then just enter C1 idle without calling callbacks
again?  The lower priority callbacks will not get invoked in this
case.

The CPU needs to eventually at least enter the C1 idle state.

Best regards,
Bill


On 11/12/08 06:25, Liu, Jiang wrote:
> Hi all,
>       We're planning to develop a memory power management driver for some 
> platforms which need to add new interface to current OpenSolaris kernel. I 
> have written a PSARC onepager  for the new interfaces, please help to comment 
> on the interface design. The attachment is information about the memory power 
> management driver for your reference.
>       Thanks!
>
> Template Version: @(#)onepager.txt 1.35 07/11/07 SMI
>
> 1. Introduction
>     1.1. Project/Component Working Name:
>       CPU idle notification interface
>
>     1.2. Name of Document Author/Supplier:
>       Author: Gerry Liu <jiang.liu at intel.com>
>
>     1.3. Date of This Document:
>       October 21, 2008
>
> 4. Technical Description:
>     4.1. Problem
>       A CPU idle state change notification mechanism is needed to signal
>       other components which are interesting in the state change events
>       when CPU enters/leaves idle state. This mechanism could be used by
>       following components:
>       A) Memory power saving driver
>       B) Lazy TLB flush on x86 system
>       C) CPU power management framework
>
>     4.2. Proposal
>       We propose to add following data structures/interfaces to
>       OpenSolaris kernel.
>
>     4.2.1. CPU idle state change notification callback data structures
>       typedef int  (*cpu_idle_enter_cbfn)(void *arg, int flags,
>           int cstate);
>       Callback function prototype for entering idle state notification.
>
>       typedef void (*cpu_idle_exit_cbfn)(void *arg, int flags);
>       Callback function prototype for leaving idle state notification.
>
>       typedef struct cpu_idle_callback {
>               int                     version;
>               cpu_idle_enter_cbfn     idle_enter;
>               cpu_idle_exit_cbfn      idle_exit;
>       } cpu_idle_callback_t;
>       Data structure for CPU idle state change notification callback.
>
>     4.2.2. Register CPU idle state change notification callback
>       int cpu_idle_register_callback(uint_t priority,
>           cpu_idle_callback_t *callbackp, void *arg);
>       This interface registers a callback to be called when CPU idle state
>       changes. All registered callbacks will be called in priority order
>       from high to low when CPU enters idle state and will be called in
>       the reverse order when CPU leaves idle state.
>
>     4.2.3. Unregister CPU idle callback interface
>       int cpu_idle_unregister_callback(uint_t priority,
>           cpu_idle_callback_t *callbackp, void *arg);
>       This interface deregisters a registered callback.
>
>     4.2.4. Notify entering idle state
>       int cpu_idle_enter(int flags, int cstate, int64_t hints);
>       This interface signals that a specific CPU is entering idle state.
>       If it returns non-zero value, CPU should cancel entering idle state.
>
>     4.2.5. Signal exiting idle state interface
>       void cpu_idle_exit(int flags);
>       This interface signals that a specific CPU has left idle state.
>
>
> 6. Resources and Schedule:
>     6.4. Steering Committee requested information
>       6.4.1. Consolidation C-team Name:
>               ON
>     6.5. ARC review type: FastTrack
>     6.6. ARC Exposure: open
>
> Liu Jiang (Gerry)
> Senior Software Engineer 
> OpenSolaris, OTC
> Tel: (8610)82611515-1643
> iNet: 8758-1643
> ------------------------------------------------------------------------
>
> _______________________________________________
> tesla-dev mailing list
> tesla-dev at opensolaris.org
> http://mail.opensolaris.org/mailman/listinfo/tesla-dev


Reply via email to