Skip to content

Commit 37b6799

Browse files
authored
vmm_tests: Adds a regression test to verify that duplicate aer requests are not sent after servicing with keepalive. (#2135)
Add a regression test to verify that the driver does not issue additional AERs after restore if something is already pending. Also some minor restructuring of tests.
1 parent 55eb36d commit 37b6799

File tree

1 file changed

+44
-22
lines changed

1 file changed

+44
-22
lines changed

vmm_tests/vmm_tests/tests/tests/multiarch/openhcl_servicing.rs

Lines changed: 44 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ use petri::PetriVmBuilder;
2424
use petri::PetriVmmBackend;
2525
use petri::ResolvedArtifact;
2626
use petri::openvmm::OpenVmmPetriBackend;
27-
use petri::pipette::PipetteClient;
2827
use petri::pipette::cmd;
2928
use petri::vtl2_settings::ControllerType;
3029
use petri::vtl2_settings::Vtl2LunBuilder;
@@ -40,6 +39,7 @@ use petri_artifacts_vmm_test::artifacts::openhcl_igvm::LATEST_STANDARD_X64;
4039
use petri_artifacts_vmm_test::artifacts::openhcl_igvm::RELEASE_25_05_LINUX_DIRECT_X64;
4140
#[allow(unused_imports)]
4241
use petri_artifacts_vmm_test::artifacts::openhcl_igvm::RELEASE_25_05_STANDARD_AARCH64;
42+
use pipette_client::PipetteClient;
4343
use scsidisk_resources::SimpleScsiDiskHandle;
4444
use storvsp_resources::ScsiControllerHandle;
4545
use storvsp_resources::ScsiDeviceAndPath;
@@ -281,29 +281,38 @@ async fn servicing_keepalive_with_nvme_fault(
281281
),
282282
);
283283

284-
let (mut vm, agent) = create_keepalive_test_config(config, fault_configuration).await?;
284+
apply_fault_with_keepalive(
285+
config,
286+
fault_configuration,
287+
fault_start_updater,
288+
(igvm_file,),
289+
)
290+
.await
291+
}
285292

286-
agent.ping().await?;
287-
let sh = agent.unix_shell();
293+
/// Verifies that the driver awaits an existing AER instead of issuing a new one after servicing.
294+
#[openvmm_test(openhcl_linux_direct_x64 [LATEST_LINUX_DIRECT_TEST_X64])]
295+
async fn servicing_keepalive_verify_no_duplicate_aers(
296+
config: PetriVmBuilder<OpenVmmPetriBackend>,
297+
(igvm_file,): (ResolvedArtifact<impl petri_artifacts_common::tags::IsOpenhclIgvm>,),
298+
) -> Result<(), anyhow::Error> {
299+
let mut fault_start_updater = CellUpdater::new(false);
288300

289-
// Make sure the disk showed up.
290-
cmd!(sh, "ls /dev/sda").run().await?;
301+
let fault_configuration = FaultConfiguration::new(fault_start_updater.cell())
302+
.with_admin_queue_fault(
303+
AdminQueueFaultConfig::new().with_submission_queue_fault(
304+
CommandMatchBuilder::new().match_cdw0_opcode(nvme_spec::AdminOpcode::ASYNCHRONOUS_EVENT_REQUEST.0).build(),
305+
QueueFaultBehavior::Panic("Received a duplicate ASYNCHRONOUS_EVENT_REQUEST command during servicing with keepalive enabled. THERE IS A BUG SOMEWHERE.".to_string()),
306+
),
307+
);
291308

292-
// CREATE_IO_COMPLETION_QUEUE is blocked. This will panic out without keepalive enabled.
293-
fault_start_updater.set(true).await;
294-
vm.restart_openhcl(
295-
igvm_file.clone(),
296-
OpenHclServicingFlags {
297-
enable_nvme_keepalive: true,
298-
..Default::default()
299-
},
309+
apply_fault_with_keepalive(
310+
config,
311+
fault_configuration,
312+
fault_start_updater,
313+
(igvm_file,),
300314
)
301-
.await?;
302-
303-
fault_start_updater.set(false).await;
304-
agent.ping().await?;
305-
306-
Ok(())
315+
.await
307316
}
308317

309318
/// Test servicing an OpenHCL VM from the current version to itself with NVMe keepalive support
@@ -321,7 +330,6 @@ async fn servicing_keepalive_with_nvme_identify_fault(
321330
// Reduce the reported size of the namespace to 256 blocks instead of the original 512.
322331
let mut buf: u64 = 256;
323332
let buf = buf.as_mut_bytes();
324-
325333
let fault_configuration = FaultConfiguration::new(fault_start_updater.cell())
326334
.with_admin_queue_fault(
327335
AdminQueueFaultConfig::new().with_completion_queue_fault(
@@ -338,6 +346,21 @@ async fn servicing_keepalive_with_nvme_identify_fault(
338346
),
339347
);
340348

349+
apply_fault_with_keepalive(
350+
config,
351+
fault_configuration,
352+
fault_start_updater,
353+
(igvm_file,),
354+
)
355+
.await
356+
}
357+
358+
async fn apply_fault_with_keepalive(
359+
config: PetriVmBuilder<OpenVmmPetriBackend>,
360+
fault_configuration: FaultConfiguration,
361+
mut fault_start_updater: CellUpdater<bool>,
362+
(igvm_file,): (ResolvedArtifact<impl petri_artifacts_common::tags::IsOpenhclIgvm>,),
363+
) -> Result<(), anyhow::Error> {
341364
let (mut vm, agent) = create_keepalive_test_config(config, fault_configuration).await?;
342365

343366
agent.ping().await?;
@@ -346,7 +369,6 @@ async fn servicing_keepalive_with_nvme_identify_fault(
346369
// Make sure the disk showed up.
347370
cmd!(sh, "ls /dev/sda").run().await?;
348371

349-
// IDENTIFY:NAMESPACE is faulty. It will report a changed namespace size. The driver is still expected to make progress.
350372
fault_start_updater.set(true).await;
351373
vm.restart_openhcl(
352374
igvm_file.clone(),

0 commit comments

Comments
 (0)