huang...@chinatelecom.cn writes:

> From: Hyman Huang(黄勇) <huang...@chinatelecom.cn>
>
> Implement dirtyrate calculation periodically basing on
> dirty-ring and throttle virtual CPU until it reachs the quota
> dirty page rate given by user.
>
> Introduce qmp commands "set-vcpu-dirty-limit",
> "cancel-vcpu-dirty-limit", "query-vcpu-dirty-limit"
> to enable, disable, query dirty page limit for virtual CPU.
>
> Meanwhile, introduce corresponding hmp commands
> "set_vcpu_dirty_limit", "cancel_vcpu_dirty_limit",
> "info vcpu_dirty_limit" so the feature can be more usable.
>
> Signed-off-by: Hyman Huang(黄勇) <huang...@chinatelecom.cn>

[...]

> diff --git a/include/monitor/hmp.h b/include/monitor/hmp.h
> index 96d0148..478820e 100644
> --- a/include/monitor/hmp.h
> +++ b/include/monitor/hmp.h
> @@ -131,6 +131,9 @@ void hmp_replay_delete_break(Monitor *mon, const QDict 
> *qdict);
>  void hmp_replay_seek(Monitor *mon, const QDict *qdict);
>  void hmp_info_dirty_rate(Monitor *mon, const QDict *qdict);
>  void hmp_calc_dirty_rate(Monitor *mon, const QDict *qdict);
> +void hmp_set_vcpu_dirty_limit(Monitor *mon, const QDict *qdict);
> +void hmp_cancel_vcpu_dirty_limit(Monitor *mon, const QDict *qdict);
> +void hmp_info_vcpu_dirty_limit(Monitor *mon, const QDict *qdict);
>  void hmp_human_readable_text_helper(Monitor *mon,
>                                      HumanReadableText *(*qmp_handler)(Error 
> **));
>  
> diff --git a/qapi/migration.json b/qapi/migration.json
> index bbfd48c..3855d6d 100644
> --- a/qapi/migration.json
> +++ b/qapi/migration.json
> @@ -1850,6 +1850,86 @@
>  { 'command': 'query-dirty-rate', 'returns': 'DirtyRateInfo' }
>  
>  ##
> +# @DirtyLimitInfo:
> +#
> +# Dirty page rate limit information of virtual CPU.

"of a virtual CPU"

> +#
> +# @cpu-index: index of virtual CPU.
> +#
> +# @limit-rate: upper limit of dirty page rate in units of MB/s for virtual
> +#              CPU, 0 means unlimited.

Could abridge "in units of MB/s" to "(MB/s)".  Same below.

> +#
> +# @current-rate: current dirty page rate in units of MB/s for virtual CPU.
> +#
> +# Since: 7.0
> +#
> +##
> +{ 'struct': 'DirtyLimitInfo',
> +  'data': { 'cpu-index': 'int',
> +            'limit-rate': 'uint64',
> +            'current-rate': 'uint64' } }
> +
> +##
> +# @set-vcpu-dirty-limit:
> +#
> +# Set the upper limit of dirty page rate for virtual CPUs.
> +#
> +# Requires KVM with accelerator property "dirty-ring-size" set.
> +# A virtual CPU's dirty page rate is a measure of its memory load.
> +# To observe dirty page rates, use @calc-dirty-rate.
> +#
> +# @cpu-index: index of virtual CPU, default is all.
> +#
> +# @dirty-rate: upper limit of dirty page rate in units of MB/s for virtual 
> CPU.

Long line, please wrap.

> +#
> +# Since: 7.0
> +#
> +# Example:
> +#   {"execute": "set-vcpu-dirty-limit"}
> +#    "arguments": { "dirty-rate": 200,
> +#                   "cpu-index": 1 } }
> +#
> +##
> +{ 'command': 'set-vcpu-dirty-limit',
> +  'data': { '*cpu-index': 'uint64',

Use 'int' for consistency with cpu-index arguments elsewhere.

> +            'dirty-rate': 'uint64' } }
> +
> +##
> +# @cancel-vcpu-dirty-limit:
> +#
> +# Cancel the upper limit of dirty page rate for virtual CPUs.
> +#
> +# Cancel the dirty page limit for the vCPU which has been set with
> +# set-vcpu-dirty-limit command. Note that this command requires
> +# support from dirty ring, same as the "set-vcpu-dirty-limit".
> +#
> +# @cpu-index: index of virtual CPU, default is all.
> +#
> +# Since: 7.0
> +#
> +# Example:
> +#   {"execute": "cancel-vcpu-dirty-limit"}
> +#    "arguments": { "cpu-index": 1 } }
> +#
> +##
> +{ 'command': 'cancel-vcpu-dirty-limit',
> +  'data': { '*cpu-index': 'uint64'} }

Likewise.

> +
> +##
> +# @query-vcpu-dirty-limit:
> +#
> +# Returns information about virtual CPU dirty page rate limits, if any.
> +#
> +# Since: 7.0
> +#
> +# Example:
> +#   {"execute": "query-vcpu-dirty-limit"}
> +#
> +##
> +{ 'command': 'query-vcpu-dirty-limit',
> +  'returns': [ 'DirtyLimitInfo' ] }
> +
> +##
>  # @snapshot-save:
>  #
>  # Save a VM snapshot

[...]


Reply via email to