On Tue, Feb 18, 2025 at 10:39:55AM +0800, yong.hu...@smartx.com wrote: > From: Hyman Huang <yong.hu...@smartx.com> > > When the developer is examining the time distribution of > the migration, it is useful to record the migration throttle > timestamp. Consequently, include the migration throttle event.
Would trace_cpu_throttle_set() work too? That can provide a timestamp and also the new percentage of throttle. I don't feel strongly that we must not introduce qmp events for debugging, but allowing that to happen means we can get tons of events at last.. as people can start requesting many more events, and we'll need one way to justify them at last. One way to justify events can be that it could be consumed by mgmt. On that, this one I'm not yet sure.. so ideally tracepoints could work already. > > Signed-off-by: Hyman Huang <yong.hu...@smartx.com> > --- > migration/ram.c | 1 + > qapi/migration.json | 15 +++++++++++++++ > 2 files changed, 16 insertions(+) > > diff --git a/migration/ram.c b/migration/ram.c > index 589b6505eb..725e029927 100644 > --- a/migration/ram.c > +++ b/migration/ram.c > @@ -524,6 +524,7 @@ static void mig_throttle_guest_down(uint64_t > bytes_dirty_period, > > /* We have not started throttling yet. Let's start it. */ > if (!cpu_throttle_active()) { > + qapi_event_send_migration_throttle(); > cpu_throttle_set(pct_initial); > } else { > /* Throttling already on, just increase the rate */ > diff --git a/qapi/migration.json b/qapi/migration.json > index 8b9c53595c..0495065b5d 100644 > --- a/qapi/migration.json > +++ b/qapi/migration.json > @@ -1393,6 +1393,21 @@ > { 'event': 'MIGRATION_PASS', > 'data': { 'pass': 'int' } } > > +## > +# @MIGRATION_THROTTLE: > +# > +# Emitted from the source side of a migration at the start of vCPU throttle > +# > +# Since: 10.0 > +# > +# Example: > +# > +# <- { "event": "MIGRATION_THROTTLE", > +# "timestamp": { "seconds": 1267041730, "microseconds": 281295 } } > +# > +## > +{ 'event': 'MIGRATION_THROTTLE' } > + > ## > # @COLOMessage: > # > -- > 2.27.0 > -- Peter Xu