From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [45.144.208.40]) by lore.proxmox.com (Postfix) with ESMTPS id F16C51FF0BC for ; Mon, 16 Nov 2026 17:10:43 +0100 (CET) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id EEF5521669; Mon, 16 Nov 2026 17:10:27 +0100 (CET) Message-ID: <2bb9c12f-ca04-4bdb-b4f9-44809cfd4760@proxmox.com> Date: Mon, 16 Nov 2026 17:10:19 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Beta Subject: Re: [PATCH qemu-server v4 1/3] qemuserver: add pvpanic device To: Kaiyang Wu , pve-devel@lists.proxmox.com References: <20261102095525.1635251-1-wukaiyang@loongfans.cn> <20261102095525.1635251-2-wukaiyang@loongfans.cn> Content-Language: en-US From: Dominik Csapak In-Reply-To: <20261102095525.1635251-2-wukaiyang@loongfans.cn> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1794845420218 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.304 Adjusted score from AWL reputation of From: address DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: WWJKGRVUTSEQGP5JIZNUQJNYRLZ4WTCB X-Message-ID-Hash: WWJKGRVUTSEQGP5JIZNUQJNYRLZ4WTCB X-MailFrom: d.csapak@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Kaiyang Wu X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: 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 Tested-by: Dominik Csapak 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 > Signed-off-by: Kaiyang Wu > --- > 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 },