public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Dominik Csapak <d.csapak@proxmox.com>
To: Kaiyang Wu <wukaiyang2003@gmail.com>, pve-devel@lists.proxmox.com
Cc: Kaiyang Wu <wukaiyang@loongfans.cn>
Subject: Re: [PATCH qemu-server v4 1/3] qemuserver: add pvpanic device
Date: Mon, 16 Nov 2026 17:10:19 +0100	[thread overview]
Message-ID: <2bb9c12f-ca04-4bdb-b4f9-44809cfd4760@proxmox.com> (raw)
In-Reply-To: <20261102095525.1635251-2-wukaiyang@loongfans.cn>

this looks good to me now, but it touches the same places
as my recent pci handling patches [0]

0: 
https://lore.proxmox.com/pve-devel/20261113143939.3012964-1-d.csapak@proxmox.com/

so either my or your series needs some action depending on
which is applied first (no need to do anything for now though)

other than that:

Reviewed-by: Dominik Csapak <d.csapak@proxmox.com>
Tested-by: Dominik Csapak <d.csapak@proxmox.com>

On 11/2/26 10:55 AM, Kaiyang Wu wrote:
> Add pvpanic PCI device to monitor guest system panics. Allow to specify
> the action to perform when the guest system panics.
> 
> Suggested-by: Dominik Csapak <d.csapak@proxmox.com>
> Signed-off-by: Kaiyang Wu <wukaiyang@loongfans.cn>
> ---
>   src/PVE/API2/Qemu.pm      |  1 +
>   src/PVE/QemuServer.pm     | 43 +++++++++++++++++++++++++++++++++++++++
>   src/PVE/QemuServer/PCI.pm |  1 +
>   3 files changed, 45 insertions(+)
> 
> diff --git a/src/PVE/API2/Qemu.pm b/src/PVE/API2/Qemu.pm
> index 7830d09b..8a65d586 100644
> --- a/src/PVE/API2/Qemu.pm
> +++ b/src/PVE/API2/Qemu.pm
> @@ -840,6 +840,7 @@ my $hwtypeoptions = {
>       'watchdog' => 1,
>       'audio0' => 1,
>       'rng0' => 1,
> +    'pvpanic' => 1,
>   };
>   
>   my $generaloptions = {
> diff --git a/src/PVE/QemuServer.pm b/src/PVE/QemuServer.pm
> index b4a1a38d..2a13a1fb 100644
> --- a/src/PVE/QemuServer.pm
> +++ b/src/PVE/QemuServer.pm
> @@ -143,6 +143,24 @@ sub nodename {
>       return $nodename_cache;
>   }
>   
> +my $pvpanic_fmt = {
> +    enabled => {
> +        default_key => 1,
> +        type => 'boolean',
> +        description => "Create a pvpanic device to monitor guest panics.",
> +        default => 0,
> +    },
> +    action => {
> +        type => 'string',
> +        enum => [qw(none pause shutdown exit-failure)],
> +        description =>
> +            "The action to perform if the guest panics.",
> +        default => 'shutdown',
> +        optional => 1,
> +    },
> +};
> +PVE::JSONSchema::register_format('pve-qm-pvpanic', $pvpanic_fmt);
> +
>   my $watchdog_fmt = {
>       model => {
>           default_key => 1,
> @@ -741,6 +759,12 @@ EODESCR
>           optional => 1,
>           default => 1,
>       },
> +    pvpanic => {
> +        optional => 1,
> +        type => 'string',
> +        format => 'pve-qm-pvpanic',
> +        description => "Create a panic monitor device.",
> +    },
>   };
>   
>   my $cicustom_fmt = {
> @@ -1643,6 +1667,16 @@ sub print_smbios1 {
>   
>   PVE::JSONSchema::register_format('pve-qm-smbios1', $smbios1_fmt);
>   
> +sub parse_pvpanic {
> +    my ($value) = @_;
> +
> +    return if !$value;
> +
> +    my $res = eval { parse_property_string($pvpanic_fmt, $value) };
> +    warn $@ if $@;
> +    return $res;
> +}
> +
>   sub parse_watchdog {
>       my ($value) = @_;
>   
> @@ -3538,6 +3572,15 @@ sub config_to_command {
>           push @$devices, '-device', $ballooncmd;
>       }
>   
> +    if ($conf->{pvpanic}) {
> +        my $pvpanicopts = parse_pvpanic($conf->{pvpanic});
> +        if ($pvpanicopts->{enabled}) {
> +            my $pvpanicpciaddr = print_pci_addr("pvpanic", $arch);
> +            push @$devices, '-device', "pvpanic-pci,id=pvpanic$pvpanicpciaddr";
> +        }
> +        push @$devices, '-action', "panic=$pvpanicopts->{action}" if $pvpanicopts->{action};
> +    }
> +
>       if ($conf->{watchdog}) {
>           my $wdopts = parse_watchdog($conf->{watchdog});
>           my $pciaddr = print_pci_addr("watchdog", $arch);
> diff --git a/src/PVE/QemuServer/PCI.pm b/src/PVE/QemuServer/PCI.pm
> index d7dc6121..5b0603a0 100644
> --- a/src/PVE/QemuServer/PCI.pm
> +++ b/src/PVE/QemuServer/PCI.pm
> @@ -220,6 +220,7 @@ sub get_pci_addr_map {
>           'pci.4' => { bus => 1, addr => 28 },
>           'rng0' => { bus => 1, addr => 29 },
>           'pci.2-igd' => { bus => 1, addr => 30 }, # replaces pci.2 in case a legacy IGD device is passed through
> +        'pvpanic' => { bus => 1, addr => 31 },
>           'virtio6' => { bus => 2, addr => 1 },
>           'virtio7' => { bus => 2, addr => 2 },
>           'virtio8' => { bus => 2, addr => 3 },





  reply	other threads:[~2026-11-16 16:10 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-02  9:55 [PATCH qemu-server v4 0/3] add pvpanic device support Kaiyang Wu
2026-11-02  9:55 ` [PATCH qemu-server v4 1/3] qemuserver: add pvpanic device Kaiyang Wu
2026-11-16 16:10   ` Dominik Csapak [this message]
2026-11-02  9:55 ` [PATCH docs v4 2/3] qm: add document section for the " Kaiyang Wu
2026-11-16 16:10   ` Dominik Csapak
2026-11-02  9:55 ` [PATCH manager v4 3/3] ui: qemu: add pvpanic device support Kaiyang Wu
2026-11-16 16:10   ` Dominik Csapak
2026-11-12  9:41 ` [PATCH qemu-server v4 0/3] " Kaiyang Wu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2bb9c12f-ca04-4bdb-b4f9-44809cfd4760@proxmox.com \
    --to=d.csapak@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    --cc=wukaiyang2003@gmail.com \
    --cc=wukaiyang@loongfans.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal