@@ -8,7 +8,7 @@ use std::sync::atomic::AtomicUsize;
8
8
use std:: sync:: Arc ;
9
9
use std:: time:: Duration ;
10
10
11
- use logger:: { error, IncMetric , METRICS } ;
11
+ use logger:: { debug , error, IncMetric , METRICS } ;
12
12
use serde:: Serialize ;
13
13
use timerfd:: { ClockId , SetTimeFlags , TimerFd , TimerState } ;
14
14
use utils:: eventfd:: EventFd ;
@@ -158,6 +158,7 @@ impl Balloon {
158
158
stats_polling_interval_s : u16 ,
159
159
restored : bool ,
160
160
) -> Result < Balloon , BalloonError > {
161
+ debug ! ( "creating new balloon" ) ;
161
162
let mut avail_features = 1u64 << VIRTIO_F_VERSION_1 ;
162
163
163
164
if deflate_on_oom {
@@ -207,32 +208,45 @@ impl Balloon {
207
208
}
208
209
209
210
pub ( crate ) fn process_inflate_queue_event ( & mut self ) -> Result < ( ) , BalloonError > {
211
+ debug ! ( "balloon: inflate queue event" ) ;
210
212
self . queue_evts [ INFLATE_INDEX ]
211
213
. read ( )
212
214
. map_err ( BalloonError :: EventFd ) ?;
213
- self . process_inflate ( )
215
+ self . process_inflate ( ) ?;
216
+ debug ! ( "balloon: inflate queue event done" ) ;
217
+ Ok ( ( ) )
214
218
}
215
219
216
220
pub ( crate ) fn process_deflate_queue_event ( & mut self ) -> Result < ( ) , BalloonError > {
221
+ debug ! ( "balloon: deflate queue event" ) ;
217
222
self . queue_evts [ DEFLATE_INDEX ]
218
223
. read ( )
219
224
. map_err ( BalloonError :: EventFd ) ?;
220
- self . process_deflate_queue ( )
225
+ self . process_deflate_queue ( ) ?;
226
+ debug ! ( "balloon: deflate queue event done" ) ;
227
+ Ok ( ( ) )
221
228
}
222
229
223
230
pub ( crate ) fn process_stats_queue_event ( & mut self ) -> Result < ( ) , BalloonError > {
231
+ debug ! ( "balloon: process stats queue event" ) ;
224
232
self . queue_evts [ STATS_INDEX ]
225
233
. read ( )
226
234
. map_err ( BalloonError :: EventFd ) ?;
227
- self . process_stats_queue ( )
235
+ self . process_stats_queue ( ) ?;
236
+ debug ! ( "balloon: process stats queue event finished" ) ;
237
+ Ok ( ( ) )
228
238
}
229
239
230
240
pub ( crate ) fn process_stats_timer_event ( & mut self ) -> Result < ( ) , BalloonError > {
241
+ debug ! ( "balloon: process stats timer event" ) ;
231
242
self . stats_timer . read ( ) ;
232
- self . trigger_stats_update ( )
243
+ self . trigger_stats_update ( ) ?;
244
+ debug ! ( "balloon: process stats timer event done" ) ;
245
+ Ok ( ( ) )
233
246
}
234
247
235
248
pub ( crate ) fn process_inflate ( & mut self ) -> Result < ( ) , BalloonError > {
249
+ debug ! ( "balloon: process inflate queue" ) ;
236
250
// This is safe since we checked in the event handler that the device is activated.
237
251
let mem = self . device_state . mem ( ) . unwrap ( ) ;
238
252
METRICS . balloon . inflate_count . inc ( ) ;
@@ -316,14 +330,19 @@ impl Balloon {
316
330
}
317
331
}
318
332
333
+ debug ! ( "balloon: process inflate queue finished, interrupting..." ) ;
334
+
319
335
if needs_interrupt {
320
336
self . signal_used_queue ( ) ?;
321
337
}
322
338
339
+ debug ! ( "balloon: process inflate queue finally finished" ) ;
340
+
323
341
Ok ( ( ) )
324
342
}
325
343
326
344
pub ( crate ) fn process_deflate_queue ( & mut self ) -> Result < ( ) , BalloonError > {
345
+ debug ! ( "balloon: process deflate queue" ) ;
327
346
// This is safe since we checked in the event handler that the device is activated.
328
347
let mem = self . device_state . mem ( ) . unwrap ( ) ;
329
348
METRICS . balloon . deflate_count . inc ( ) ;
@@ -339,13 +358,17 @@ impl Balloon {
339
358
}
340
359
341
360
if needs_interrupt {
342
- self . signal_used_queue ( )
361
+ debug ! ( "balloon: process deflate queue finished, interrupting..." ) ;
362
+ self . signal_used_queue ( ) ?;
363
+ debug ! ( "balloon: process deflate queue finished" ) ;
364
+ Ok ( ( ) )
343
365
} else {
344
366
Ok ( ( ) )
345
367
}
346
368
}
347
369
348
370
pub ( crate ) fn process_stats_queue ( & mut self ) -> std:: result:: Result < ( ) , BalloonError > {
371
+ debug ! ( "balloon: process stats queue" ) ;
349
372
// This is safe since we checked in the event handler that the device is activated.
350
373
let mem = self . device_state . mem ( ) . unwrap ( ) ;
351
374
METRICS . balloon . stats_updates_count . inc ( ) ;
@@ -380,6 +403,8 @@ impl Balloon {
380
403
self . stats_desc_index = Some ( head. index ) ;
381
404
}
382
405
406
+ debug ! ( "balloon: process stats queue finished" ) ;
407
+
383
408
Ok ( ( ) )
384
409
}
385
410
0 commit comments