From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [IPv6:2a0f:8001:1:32::40]) by lore.proxmox.com (Postfix) with ESMTPS id BBF801FF0B7 for ; Fri, 30 Oct 2026 15:07:08 +0100 (CET) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id DABC921699; Fri, 30 Oct 2026 15:06:49 +0100 (CET) Message-ID: <7a96844b-edb3-4386-abc5-7e50d56840b4@proxmox.com> Date: Fri, 30 Oct 2026 15:06:43 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Beta Subject: Re: [PATCH qemu-server v3 1/3] qemuserver: add pvpanic device To: Kaiyang Wu , pve-devel@lists.proxmox.com References: <20261009065813.109006-1-wukaiyang@loongfans.cn> <20261009065813.109006-2-wukaiyang@loongfans.cn> Content-Language: en-US From: Dominik Csapak In-Reply-To: <20261009065813.109006-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: 1793369203675 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.340 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: 6XXGCFPGWIVZD7ACIGCZ5SIHRA2C5BTI X-Message-ID-Hash: 6XXGCFPGWIVZD7ACIGCZ5SIHRA2C5BTI 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: one comment inline, rest LGTM On 10/9/26 8:59 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 | 42 +++++++++++++++++++++++++++++++++++++++ > src/PVE/QemuServer/PCI.pm | 1 + > 3 files changed, 44 insertions(+) > > diff --git a/src/PVE/API2/Qemu.pm b/src/PVE/API2/Qemu.pm > index 922c6599..fb5c2f05 100644 > --- a/src/PVE/API2/Qemu.pm > +++ b/src/PVE/API2/Qemu.pm > @@ -818,6 +818,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 f199371d..8698fb11 100644 > --- a/src/PVE/QemuServer.pm > +++ b/src/PVE/QemuServer.pm > @@ -141,6 +141,23 @@ 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.", > + optional => 1, since this is optional, it should define its default for the docs. > + }, > +}; > +PVE::JSONSchema::register_format('pve-qm-pvpanic', $pvpanic_fmt); > + > my $watchdog_fmt = { > model => { > default_key => 1, > @@ -739,6 +756,12 @@ EODESCR > optional => 1, > default => 1, > }, > + pvpanic => { > + optional => 1, > + type => 'string', > + format => 'pve-qm-pvpanic', > + description => "Create a panic monitor device.", > + }, > }; > > my $cicustom_fmt = { > @@ -1674,6 +1697,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) = @_; > > @@ -3556,6 +3589,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 },