From nobody Mon Feb 9 14:19:46 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=akamai.com ARC-Seal: i=1; a=rsa-sha256; t=1769632829; cv=none; d=zohomail.com; s=zohoarc; b=a6DfTk4q2huOnXDH9JxHncofQQFkEOXb7vRbJ2fkH6QgUMlgx7ikxZPFLICJXhdjLLJZlc5enrqR8AQiKCsNF0Yh4GVgiAyCsN94MSuqLg2YnHw27ht671u8a+pVZVk0quGVOwdV5S1iqqj6AtR8x2s9peUaDi0BoqkRqK+l9Gw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769632829; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=69oowmfGBBkxto45rQliLKa5kUPav6LIeURmLosLpL4=; b=dfSobSvWXNRK68xEXIUFweuX3OvwEuGw4tEp+Qre2Czj3pzQm7OrEgZpVDWK+p4Laesblsa6YTa0CZJwFnytP0wee6vqQVao5aUlYhOaT4uw6/EBdBKSK7YizmnCr9ndSmPDL4V6QIaQOeCa24+hFSUqAF6KygvqPSp9Nrawx5E= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1769632829262931.549225112819; Wed, 28 Jan 2026 12:40:29 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vlCKh-0007zL-Ac; Wed, 28 Jan 2026 15:40:11 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vlCKK-0007at-C9 for qemu-devel@nongnu.org; Wed, 28 Jan 2026 15:39:50 -0500 Received: from mx0b-00190b01.pphosted.com ([2620:100:9005:57f::1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vlCKG-00084f-UX for qemu-devel@nongnu.org; Wed, 28 Jan 2026 15:39:48 -0500 Received: from pps.filterd (m0050096.ppops.net [127.0.0.1]) by m0050096.ppops.net-00190b01. (8.18.1.11/8.18.1.11) with ESMTP id 60SIs2g12689064; Wed, 28 Jan 2026 20:39:41 GMT Received: from prod-mail-ppoint6 (prod-mail-ppoint6.akamai.com [184.51.33.61]) by m0050096.ppops.net-00190b01. (PPS) with ESMTPS id 4bypguk8pt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 28 Jan 2026 20:39:41 +0000 (GMT) Received: from pps.filterd (prod-mail-ppoint6.akamai.com [127.0.0.1]) by prod-mail-ppoint6.akamai.com (8.18.1.2/8.18.1.2) with ESMTP id 60SIYCkX028880; Wed, 28 Jan 2026 15:39:40 -0500 Received: from prod-mail-relay02.akamai.com ([172.27.118.35]) by prod-mail-ppoint6.akamai.com (PPS) with ESMTP id 4bvta3g7y4-1; Wed, 28 Jan 2026 15:39:40 -0500 Received: from bos-lhvkhf.bos01.corp.akamai.com (bos-lhvkhf.bos01.corp.akamai.com [172.28.220.254]) by prod-mail-relay02.akamai.com (Postfix) with ESMTP id 19F3FB3; Wed, 28 Jan 2026 20:39:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=akamai.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=jan2016.eng; bh=69oowmfGBBkxto45rQliLKa5kUPav6LIeURmLosLpL4=; b=lrC6kS2ZHR9t rkpmePePKzSm95WAVJgOm9/rbJncemzoHU+c+AsGVhw+bBP4CNVQyjo7ZQ3+A9hY 7TWisVvmf6H5gITjcxLjRA6yjCQfettnvmbUOy095+/jgz2eK290Ku3GAA+jdknl kdNK3dDripK2spMPtYO7RFV+Yq9pd7MAanz5kKk2rYvDehz4COVJO+XMxlHS5XxB xvmTfrEYwTWH6JoBcDUeb7oQbSWtHSMcoXLSeSCjE9+fDHIF3j2RjVennyZTfvyL TDusvwTwTe0gVm8ffb86DUvlK2oVi6/Yp7PXYg1yfMH61/Qz98oJ9B5QjjDD58CL OV44EzRbcg== From: Ben Chaney Date: Wed, 28 Jan 2026 15:39:35 -0500 Subject: [PATCH v4 7/8] tap: postload fix for cpr MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260128-cpr-tap-v4-7-48e334d4216b@akamai.com> References: <20260128-cpr-tap-v4-0-48e334d4216b@akamai.com> In-Reply-To: <20260128-cpr-tap-v4-0-48e334d4216b@akamai.com> To: qemu-devel@nongnu.org Cc: Peter Xu , Fabiano Rosas , "Michael S. Tsirkin" , Stefano Garzarella , Jason Wang , Alex Williamson , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Eric Blake , Markus Armbruster , Stefan Weil , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Paolo Bonzini , Hamza Khan , Mark Kanda , Joshua Hunt , Max Tottenham , Ben Chaney , Steve Sistare X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1769632778; l=3307; i=bchaney@akamai.com; s=20251203; h=from:subject:message-id; bh=y3Xxt4dRCKG5jHG1T2Jwbz9e9N+8cAe17JOL6mau9ac=; b=xs2C1EDZtANvhWWwZN0TkQtY/feQ6x80qIQlJgXcpAo/ckR8Va0Y1ePgL3bLUmrzV03cZwDsO megkj0AbKksBmeR/FMcAgy9SJbpXWOiJCaUOEDdy+R2CNzAfdh2ZVFR X-Developer-Key: i=bchaney@akamai.com; a=ed25519; pk=6+w9cse5QEeVdy3tjqFxs/4rAaRdQ2/fkTxVFq+lWy4= X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-01-28_06,2026-01-28_03,2025-10-01_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 phishscore=0 spamscore=0 mlxlogscore=999 bulkscore=0 malwarescore=0 mlxscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2601150000 definitions=main-2601280169 X-Proofpoint-GUID: hpNE29YmUXVp6nHI3lXGrEFtCqkL-oZJ X-Authority-Analysis: v=2.4 cv=bfVmkePB c=1 sm=1 tr=0 ts=697a740d cx=c_pps a=WPLAOKU3JHlOa4eSsQmUFQ==:117 a=WPLAOKU3JHlOa4eSsQmUFQ==:17 a=IkcTkHD0fZMA:10 a=vUbySO9Y5rIA:10 a=VkNPw1HP01LnGYTKEx00:22 a=yPCof4ZbAAAA:8 a=X7Ea-ya5AAAA:8 a=h1OFwVCXqnWUJWdIchYA:9 a=QEXdDO2ut3YA:10 X-Proofpoint-ORIG-GUID: hpNE29YmUXVp6nHI3lXGrEFtCqkL-oZJ X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMTI4MDE3MCBTYWx0ZWRfXyLbgko4ZpUKp lHm38TGmI/oYYtTLhGFykhPhsgkUujtkb6yT1nX9nuG4hxW73iJ4nC6FrgwGIBjlVZ3Vk8XHsA5 NU9amzMvavnc9oTrcW9ER4J60Ha0SpC37EjCfQ64P6RXeOa/BIx5/ZB08+bB4corRHybTUb0fA2 IvmzXzjfTrhn3nc6lWq6Qxxy/jXQzC+mFAHq98Wp7i2WnoUXSTtFUVMJC3ZqYO8xQbXj5sWAIiN IVg16Y3i17m8PtwA3ou9G2+r5wKBLl84Z68D5FrmNna2yUd2Yfk3XwY3bVPYXO1QsnRCvLtlKBd V597FCm5j/pWB8D0fLdzaGzHjxcrALpSjXE9xZ4FwXho0A/O58oRB/EraT3dQXiiPD4EQQyqCHh v5X9zHS5cjnpkfZjK/I2lL/OVcRvq0oqJlQt7STr8zDvcTNY09J/ZC237uCXtC4bNbYnWrQaFY8 +e+B2r+99k3YA209rXw== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-01-28_06,2026-01-28_03,2025-10-01_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 clxscore=1015 priorityscore=1501 impostorscore=0 lowpriorityscore=0 suspectscore=0 spamscore=0 malwarescore=0 bulkscore=0 phishscore=0 adultscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2601150000 definitions=main-2601280170 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2620:100:9005:57f::1; envelope-from=bchaney@akamai.com; helo=mx0b-00190b01.pphosted.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @akamai.com) X-ZM-MESSAGEID: 1769632832919154100 From: Steve Sistare After cpr of a multi-queue NIC, if any queues are unused, then the corresponding tap is marked enabled in userland, but it is disabled in the kernel for the fd that was preserved. One cannot call tap_disable() during postload, because that eventually calls IFF_DETACH_QUEUE, which fails because the queue is already detached. Define tap_disable_postload to avoid IFF_DETACH_QUEUE. Signed-off-by: Steve Sistare Signed-off-by: Ben Chaney --- hw/net/virtio-net.c | 20 ++++++++++++++++++++ include/net/tap.h | 1 + net/tap-win32.c | 5 +++++ net/tap.c | 17 +++++++++++++++++ 4 files changed, 43 insertions(+) diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c index 317f1ad23b..bb7c8d9b78 100644 --- a/hw/net/virtio-net.c +++ b/hw/net/virtio-net.c @@ -765,6 +765,25 @@ static int peer_detach(VirtIONet *n, int index) return tap_disable(nc->peer); } =20 +/* + * Set the disabled flag on unused queue pairs after vmstate load, without + * calling IFF_DETACH_QUEUE, which fails because the queue is already deta= ched. + */ +static void virtio_net_postload_queue_pairs(VirtIONet *n) +{ + int i; + MigMode mode =3D migrate_mode(); + + if (mode =3D=3D MIG_MODE_CPR_TRANSFER) { + for (i =3D n->curr_queue_pairs; i < n->max_queue_pairs; i++) { + NetClientState *nc =3D qemu_get_subqueue(n->nic, i); + if (nc->peer && nc->peer->info->type =3D=3D NET_CLIENT_DRIVER_= TAP) { + tap_disable_postload(nc->peer); + } + } + } +} + static void virtio_net_set_queue_pairs(VirtIONet *n) { int i; @@ -3210,6 +3229,7 @@ static int virtio_net_post_load_device(void *opaque, = int version_id) */ n->saved_guest_offloads =3D n->curr_guest_offloads; =20 + virtio_net_postload_queue_pairs(n); virtio_net_set_queue_pairs(n); =20 /* Find the first multicast entry in the saved MAC filter */ diff --git a/include/net/tap.h b/include/net/tap.h index 6f34f13eae..934131f551 100644 --- a/include/net/tap.h +++ b/include/net/tap.h @@ -30,6 +30,7 @@ =20 int tap_enable(NetClientState *nc); int tap_disable(NetClientState *nc); +void tap_disable_postload(NetClientState *nc); =20 int tap_get_fd(NetClientState *nc); =20 diff --git a/net/tap-win32.c b/net/tap-win32.c index 38baf90e0b..efe81c54ee 100644 --- a/net/tap-win32.c +++ b/net/tap-win32.c @@ -766,3 +766,8 @@ int tap_disable(NetClientState *nc) { abort(); } + +void tap_disable_postload(NetClientState *nc) +{ + abort(); +} diff --git a/net/tap.c b/net/tap.c index 8875498434..2961607cda 100644 --- a/net/tap.c +++ b/net/tap.c @@ -1121,3 +1121,20 @@ int tap_disable(NetClientState *nc) return ret; } } + +/* + * On cpr restart, the tap is marked enabled in userland, but it might be + * disabled in the kernel, and IFF_DETACH_QUEUE will fail because it is + * already detached. This function disables without calling IFF_DETACH_QU= EUE. + */ +void tap_disable_postload(NetClientState *nc) +{ + TAPState *s =3D DO_UPCAST(TAPState, nc, nc); + + if (!s->cpr || s->enabled =3D=3D 0) { + return; + } else { + s->enabled =3D false; + tap_update_fd_handler(s); + } +} --=20 2.34.1