Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

devices: Add pvpanic support #5526

Merged
merged 5 commits into from
Jul 6, 2023
Merged

Conversation

up2wing
Copy link
Contributor

@up2wing up2wing commented Jun 20, 2023

When crash occurs in guest, we can use pvpanic device to notify through the event-monitor. This is useful to monitor the guest's running state and respond to the event.

The pvpanic device can be implemented as an ISA device or PCI device, we implemented the pvpanic-pci device for now.

@up2wing up2wing requested a review from a team as a code owner June 20, 2023 08:24
@up2wing up2wing force-pushed the pvpanic branch 2 times, most recently from d4d35e7 to 1b7e1de Compare June 20, 2023 14:22
@up2wing
Copy link
Contributor Author

up2wing commented Jun 22, 2023

Hi Rob,
Could you please review this patch again? I update it as you suggested :)

@rbradford

parser.add_valueless("pci");
parser.parse(device_type).map_err(Error::ParsePvPanic)?;

if parser.is_set("pci") {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we will ever support anything other than a PCI device so you don't need this.

@up2wing up2wing force-pushed the pvpanic branch 4 times, most recently from bacc9cf to 7394466 Compare June 28, 2023 04:03
@rbradford
Copy link
Member

I think you need to update the integration tests.

@up2wing
Copy link
Contributor Author

up2wing commented Jun 28, 2023

I think you need to update the integration tests.

Yes, I am working on this.
Thanks a lot :)

@up2wing
Copy link
Contributor Author

up2wing commented Jun 29, 2023

I think you need to update the integration tests.

patches have been updated, Rob ;)
@rbradford

// Wait a while for guest
thread::sleep(std::time::Duration::new(5, 0));

// Ignore event check tempraly, as we need pvpanic-pci driver
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not add the panic driver to the kernel config file?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean resources/linux-config-x86_64?
Will the vmlinux used in CI workloads build from this config? Forgive me for not knowing this 😅

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the CI builds from that config file - there is an aarch64 equivalent too.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay. I will try to fix this.
Thx 😸

@up2wing up2wing force-pushed the pvpanic branch 2 times, most recently from a8c4b05 to d5fcc3c Compare July 3, 2023 07:14
Copy link
Member

@rbradford rbradford left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good - really close now!

/// Failed parsing pvpanic
ParsePvPanic(OptionParserError),
/// No device type given for pvpanic
ParsePvPanicDeviceTypeGiven,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leftover error

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yes, thanks to point out.

@@ -336,6 +340,13 @@ impl fmt::Display for Error {
ParseVdpaPathMissing => write!(f, "Error parsing --vdpa: path missing"),
ParseTpm(o) => write!(f, "Error parsing --tpm: {o}"),
ParseTpmPathMissing => write!(f, "Error parsing --tpm: path missing"),
ParsePvPanic(o) => write!(f, "Error parsing --pvpanic: {}", o),
ParsePvPanicDeviceTypeGiven => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can also be removed.

@@ -1402,7 +1402,9 @@ CONFIG_NVME_MULTIPATH=y
# CONFIG_MISC_RTSX_PCI is not set
# CONFIG_HABANA_AI is not set
# CONFIG_UACCE is not set
# CONFIG_PVPANIC is not set
CONFIG_PVPANIC=y
CONFIG_PVPANIC_MMIO=y
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you need this one? Does PCI depend on it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No :)
We need pvpanic-pci only now, I will fix that immediately.

@up2wing
Copy link
Contributor Author

up2wing commented Jul 5, 2023

Hi all,
There are still three build check fail which I am not sure where's the problem. I revert the source code to that before I push the pvpanic patch, the problems still exist :(

@likebreath
Copy link
Member

Hi all, There are still three build check fail which I am not sure where's the problem. I revert the source code to that before I push the pvpanic patch, the problems still exist :(

Please rebase. I believe the issues have been fixed in the upstream main branch with #5566 and #5567.

@up2wing
Copy link
Contributor Author

up2wing commented Jul 6, 2023

Hi all, There are still three build check fail which I am not sure where's the problem. I revert the source code to that before I push the pvpanic patch, the problems still exist :(

Please rebase. I believe the issues have been fixed in the upstream main branch with #5566 and #5567.

That works, thanks so much.
I will pay attention to this in the future.


self.device_tree.lock().unwrap().insert(id, node);

info!("add pvpanic device");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove this log.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done :)

Introduce emulation of pvpanic device to allow cloud hypervisor to get
the notify from guest's pvpanic driver when guest kernel crash.

Signed-off-by: Yi Wang <foxywang@tencent.com>
Implemetion of BusDevice and PciDevice trait for pvpanic device.

Pvpanic device can be implemented as an ISA device or as a
PCI device, we choose PCI device for now.

Signed-off-by: Yi Wang <foxywang@tencent.com>
Add PvPanicDeviceState to retore events of pvpanic from snapshot,
and also PciConfigurationState.

Signed-off-by: Yi Wang <foxywang@tencent.com>
Add method for DeviceManager to invoke.

Signed-off-by: Yi Wang <foxywang@tencent.com>
Signed-off-by: Rob Bradford <rbradford@rivosinc.com>
Add integration test for pvpanic, by two methods:
- the vendor id and device id of pci device in guest
- triggering a guest panic and check event-monitor.

Also, to support pvpanic-pci driver, add pvpanic config
in resources.

Signed-off-by: Yi Wang <foxywang@tencent.com>
Signed-off-by: Rob Bradford <rbradford@rivosinc.com>
@rbradford rbradford merged commit 9935385 into cloud-hypervisor:main Jul 6, 2023
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

None yet

3 participants