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 "vcpu-dirty-limit", "query-vcpu-dirty-limit" > to enable, disable, query dirty page limit for virtual CPU. > > Meanwhile, introduce corresponding hmp commands "vcpu_dirty_limit", > "info vcpu_dirty_limit" so developers can play with them easier. > > Signed-off-by: Hyman Huang(黄勇) <huang...@chinatelecom.cn>
[...] > diff --git a/include/monitor/hmp.h b/include/monitor/hmp.h > index 96d0148..04879a2 100644 > --- a/include/monitor/hmp.h > +++ b/include/monitor/hmp.h > @@ -131,6 +131,8 @@ 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_info_vcpu_dirty_limit(Monitor *mon, const QDict *qdict); > +void hmp_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 ac5fa56..7d8da4f 100644 > --- a/qapi/migration.json > +++ b/qapi/migration.json > @@ -1869,6 +1869,50 @@ > 'current-rate': 'int64' } } > > ## > +# @vcpu-dirty-limit: > +# > +# Set or cancel the upper limit of dirty page rate for a virtual CPU. > +# > +# 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. > +# > +# @enable: true to enable, false to disable. > +# > +# @cpu-index: index of virtual CPU, default is all. Suggest # @cpu-index: The vCPU to act upon (all by default). (I'm stealing this from trace.json) > +# > +# @dirty-rate: upper limit of dirty page rate for virtual CPU, to > +# cancel dirty limit, this field will be ignored. > +# > +# Since: 7.0 > +# > +# Example: > +# {"execute": "vcpu-dirty-limit"} > +# "arguments": { "enable": true, > +# "cpu-index": 1, > +# "dirty-rate": 200 } } > +# > +## > +{ 'command': 'vcpu-dirty-limit', > + 'data': { 'enable': 'bool', > + '*cpu-index': 'uint64', > + '*dirty-rate': 'uint64'} } Drop @enable, please. If @dirty-rate is present, set the limit to its value. If it's absent, cancel the limit. > + > +## > +# @query-vcpu-dirty-limit: > +# > +# Returns information about all virtual CPU dirty limit if enabled. > +# > +# Since: 7.0 > +# > +# Example: > +# {"execute": "query-vcpu-dirty-limit"} > +# > +## > +{ 'command': 'query-vcpu-dirty-limit', > + 'returns': [ 'DirtyLimitInfo' ] } > + > +## > # @snapshot-save: > # > # Save a VM snapshot