[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2] libxl: wait for QEMU exit before restarting a domain


  • To: Jiaqing Zhao <Zhao.Jiaqing@xxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>
  • From: Jason Andryuk <jason.andryuk@xxxxxxx>
  • Date: Fri, 13 Nov 2026 19:14:03 -0500
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=suse.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=BG7dYyh7k5/6UKGeVFZ/x74uuALxATgZ1fp5uUSE8CE=; b=UEdAKFeiOZvW3BECLGCdTp1SA9po+y+qSYdA3H0EUown9Nv26eSfT3P8VAN7HTb6Kd9siFFeYmBa4obrdMRBqEvgZOn0oCSF+rkx9CXcWaJlnH/b9UZ4PmobRY3ZPU9xlmGQdHJITgkfd84K/Ze7WpGWoO7Yw+RkCgJKCk54SDMqXpnJeoKYqjDWirgizUe6CNIGVvNd6GGzWzfRYtr+dg6DujfwL4vHQBnk//WS0/S//6SvLZK9EQJGoK3smA1iID2nA3CwOpnnuD9DSW4uodem0a50yiQ9YHAxY54s4tYc18KsQeEmhPF7gnBz+k7H+H8cbro3pxyLzI+3e+ufKg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=p9eL4Ehz12ronxEiogjVYLQhAgG8hSFFU2Q5YWaDInrwGHc4yJu4Dh2SvqBhMqHfLKHEjsauQAJaj+vFisxEwU9SGNHlHrjA0IwAQQowIw001Jd6lw+RwvCP0xVbyiEOATc1AFOkwQIusskGINYZatf/rnqKR4emQMFaUI+5T0NqV6PUnxSmKMFwjQfxV0xL50hIbn844W+SsHZDWXWskJYsHwISdTYYq/jHUFFMfiTXA61CucPwxiB8YhywriFXrPLOMMSRYQe2vflh/KavJw59rpjSU5USGg1OBqKUE9gKw7hddVWSe3zanykDuo7oPGIUCqVgV2L/GJrmIi/FLQ==
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=amd.com header.i="@amd.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck"
  • Cc: Anthony PERARD <anthony.perard@xxxxxxxxxx>, Juergen Gross <jgross@xxxxxxxx>, Roger Pau Monné <roger@xxxxxxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Penny Zheng <penny.zheng@xxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Sat, 14 Nov 2026 00:14:39 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 2026-11-11 00:51, Jiaqing Zhao wrote:


On 2026-11-10 18:22, Jan Beulich wrote:
On 10.11.2026 11:02, Jiaqing Zhao wrote:
The PID-based device model destruction path returns immediately after
sending SIGHUP, before QEMU has necessarily exited. When an HVM guest
reboots with VNC enabled, the new QEMU process may fail to bind the VNC
port because the old process still holds it.

Wait for QEMU to exit in a child process after signaling it for at most
10 seconds. If waiting fails or times out, log the error and retain the
existing domain destruction behaviour.

Signed-off-by: Jiaqing Zhao <Zhao.Jiaqing@xxxxxxx>
---
v2:
* Share the fork, error handling and child exit handling between UID and
   PID-based destruction paths.
* Reduce the device-model stop timeout from 60 to 10 seconds.

As per my v1 comments I continue to question this.

I looked further into QEMU's shutdown path. After receiving SIGHUP,
QEMU calls bdrv_drain_all() to wait for outstanding block I/O requests
and bdrv_flush_all() to flush its block devices. These could take
longer than 10 seconds on slow storage.

While this does not identify the timeout you observed with SR-IOV,
my earlier measurements are insufficient to prove that 10s is enough.
I'll restore the 60s timeout in v3.

I'm okay with a longer (60s) timeout if we think that might help in some cases. It's an upper bound, and normal shutdown will proceed when QEMU exits.

Reviewed-by: Jason Andryuk <jason.andryuk@xxxxxxx>

Thanks,
Jason



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.