@@ -500,9 +500,7 @@ impl Queue {
500
500
}
501
501
502
502
/// Pop the first available descriptor chain from the avail ring.
503
- pub fn pop < M : GuestMemory > ( & mut self , mem : & M ) -> Option < DescriptorChain > {
504
- debug_assert ! ( self . is_valid( mem) ) ;
505
-
503
+ pub fn pop ( & mut self ) -> Option < DescriptorChain > {
506
504
let len = self . len ( ) ;
507
505
// The number of descriptor chain heads to process should always
508
506
// be smaller or equal to the queue size, as the driver should
@@ -531,10 +529,10 @@ impl Queue {
531
529
/// If no descriptor is available, enable notifications.
532
530
pub fn pop_or_enable_notification < M : GuestMemory > (
533
531
& mut self ,
534
- mem : & M ,
532
+ _mem : & M ,
535
533
) -> Option < DescriptorChain > {
536
534
if !self . uses_notif_suppression {
537
- return self . pop ( mem ) ;
535
+ return self . pop ( ) ;
538
536
}
539
537
540
538
if self . try_enable_notification ( ) {
@@ -1087,7 +1085,7 @@ mod verification {
1087
1085
#[ kani:: unwind( 0 ) ]
1088
1086
#[ kani:: solver( cadical) ]
1089
1087
fn verify_pop ( ) {
1090
- let ProofContext ( mut queue, mem ) = ProofContext :: bounded_queue ( ) ;
1088
+ let ProofContext ( mut queue, _ ) = ProofContext :: bounded_queue ( ) ;
1091
1089
1092
1090
// This is an assertion in pop which we use to abort firecracker in a ddos scenario
1093
1091
// This condition being false means that the guest is asking us to process every element
@@ -1099,7 +1097,7 @@ mod verification {
1099
1097
1100
1098
let next_avail = queue. next_avail ;
1101
1099
1102
- if let Some ( _) = queue. pop ( & mem ) {
1100
+ if let Some ( _) = queue. pop ( ) {
1103
1101
// Can't get anything out of an empty queue, assert queue_len != 0
1104
1102
assert_ne ! ( queue_len, 0 ) ;
1105
1103
assert_eq ! ( queue. next_avail, next_avail + Wrapping ( 1 ) ) ;
@@ -1110,13 +1108,13 @@ mod verification {
1110
1108
#[ kani:: unwind( 0 ) ]
1111
1109
#[ kani:: solver( cadical) ]
1112
1110
fn verify_undo_pop ( ) {
1113
- let ProofContext ( mut queue, mem ) = ProofContext :: bounded_queue ( ) ;
1111
+ let ProofContext ( mut queue, _ ) = ProofContext :: bounded_queue ( ) ;
1114
1112
1115
1113
// See verify_pop for explanation
1116
1114
kani:: assume ( queue. len ( ) <= queue. actual_size ( ) ) ;
1117
1115
1118
1116
let queue_clone = queue. clone ( ) ;
1119
- if let Some ( _) = queue. pop ( & mem ) {
1117
+ if let Some ( _) = queue. pop ( ) {
1120
1118
queue. undo_pop ( ) ;
1121
1119
assert_eq ! ( queue, queue_clone) ;
1122
1120
@@ -1322,7 +1320,7 @@ mod tests {
1322
1320
assert_eq ! ( q. len( ) , 2 ) ;
1323
1321
1324
1322
// The first chain should hold exactly two descriptors.
1325
- let d = q. pop ( m ) . unwrap ( ) . next_descriptor ( ) . unwrap ( ) ;
1323
+ let d = q. pop ( ) . unwrap ( ) . next_descriptor ( ) . unwrap ( ) ;
1326
1324
assert ! ( !d. has_next( ) ) ;
1327
1325
assert ! ( d. next_descriptor( ) . is_none( ) ) ;
1328
1326
@@ -1331,7 +1329,7 @@ mod tests {
1331
1329
1332
1330
// The next chain holds three descriptors.
1333
1331
let d = q
1334
- . pop ( m )
1332
+ . pop ( )
1335
1333
. unwrap ( )
1336
1334
. next_descriptor ( )
1337
1335
. unwrap ( )
@@ -1342,15 +1340,15 @@ mod tests {
1342
1340
1343
1341
// We've popped both chains, so the queue should be empty.
1344
1342
assert ! ( q. is_empty( ) ) ;
1345
- assert ! ( q. pop( m ) . is_none( ) ) ;
1343
+ assert ! ( q. pop( ) . is_none( ) ) ;
1346
1344
1347
1345
// Undoing the last pop should let us walk the last chain again.
1348
1346
q. undo_pop ( ) ;
1349
1347
assert_eq ! ( q. len( ) , 1 ) ;
1350
1348
1351
1349
// Walk the last chain again (three descriptors).
1352
1350
let d = q
1353
- . pop ( m )
1351
+ . pop ( )
1354
1352
. unwrap ( )
1355
1353
. next_descriptor ( )
1356
1354
. unwrap ( )
@@ -1418,7 +1416,7 @@ mod tests {
1418
1416
assert_eq ! ( q. len( ) , 2 ) ;
1419
1417
1420
1418
// We process the first descriptor.
1421
- let d = q. pop ( m ) . unwrap ( ) . next_descriptor ( ) ;
1419
+ let d = q. pop ( ) . unwrap ( ) . next_descriptor ( ) ;
1422
1420
assert ! ( matches!( d, Some ( x) if !x. has_next( ) ) ) ;
1423
1421
// We confuse the device and set the available index as being 6.
1424
1422
vq. avail . idx . set ( 6 ) ;
@@ -1429,7 +1427,7 @@ mod tests {
1429
1427
// However, since the apparent length set by the driver is more than the queue size,
1430
1428
// we would be running the risk of going through some descriptors more than once.
1431
1429
// As such, we expect to panic.
1432
- q. pop ( m ) ;
1430
+ q. pop ( ) ;
1433
1431
}
1434
1432
1435
1433
#[ test]
@@ -1592,7 +1590,7 @@ mod tests {
1592
1590
assert_eq ! ( q. avail_event( m) , 0 ) ;
1593
1591
1594
1592
// Consume the descriptor. avail_event should be modified
1595
- assert ! ( q. pop( m ) . is_some( ) ) ;
1593
+ assert ! ( q. pop( ) . is_some( ) ) ;
1596
1594
assert ! ( q. try_enable_notification( ) ) ;
1597
1595
assert_eq ! ( q. avail_event( m) , 1 ) ;
1598
1596
}
0 commit comments