From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <010701a110d78faf-e112153a-25aa-4829-9d2f-d0ab691f6fd3-000000@eu-central-1.amazonses.com> Received: from PA4PR04CU001.outbound.protection.outlook.com (mail-francecentralazon11023092.outbound.protection.outlook.com [40.107.162.92]) by lore.virtuozzo.com (Postfix) with ESMTPS id 18B338017D for ; Tue, 6 Oct 2026 10:52:09 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=g0intmHW/YTdJCVk198nuPqbSlzlJcnC6D2x7Y4fYN2VJFMnN8R2C/u3wXy9xiU2i5cq04WWpRIjmOeQ+XGBRuH5Uf85zvOdKV+gEYq7+ePH9ZECI4g0rO4kTONr5va6j9LXvf1hWXdXmgIxfwkJqAW2PC1xhHDufnao3jVY3/UUL1tlPxCZHy+M0xAeqZXGHLvI+GzLWJN+TDUqG8Wo/jKSJP1xMFa1VQs78hItOXvgIQATaKani56xmnVpZ1cdfNtgNa+lSla1/Zw/+/4a8LNTApLJofuwYRetbo5/8SNRDSS2Ms292qIZIUJ3XMSiC+f3xMCX5/GxXZDNNiEflA== 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=/uh1WHIfnYS1CIFKkmudGjWdMAzRogIQO8e8Qds+G10=; b=Skj0qPYWxuhtXXnEPtIoGv8RhvqOEbStFg/kV24MdTtIBBxyDXgxmez8eHiuf/ATEG1gmqeV1aTGFgRRcJrqafBX/g3P/lyWGQCfABL4liUNzEpw1WIq0B31DxD4wBpiy8IA+rxN3EHQEYzX+OfaSHGxpzS4aK3xHcD8pr0R1HlCnyyi19Zc5TXbWfkmUX2NqNsG0BIML6kYU2w+Zj/Vi9bnRXnpKAIerqpLtUqd8VBYjrhNC+6OTDHot5pOwowprkAr0WqN9TmPS/GMR11EFJoXvGq5MLfxjgC8+OfTrhnwrPfstpUGmv8wYcVIT0ec6GQUFsyQe7q/lpsTNcgAMQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 69.169.224.5) smtp.rcpttodomain=virtuozzo.com smtp.mailfrom=eu-central-1.amazonses.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=sashiko.virtuozzo.com; dkim=pass (signature was verified) header.d=sashiko.virtuozzo.com; dkim=pass (signature was verified) header.d=amazonses.com; arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.onmicrosoft.com; s=selector2-virtuozzo-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=/uh1WHIfnYS1CIFKkmudGjWdMAzRogIQO8e8Qds+G10=; b=Zn0Zm+E+4BsLKs0W6FHSxdZibTzx/TR+tY+eUUEbwo9OqTYk4kl62qkPKIE5ptpgKDgLN7XG7g3UTQ2zXKuORE5U1iy+8J04iV1zPHVi8TATbhIEuAEzGDBIB1iUaIqeZOFZ7NDqM3I7fFQM+ywzbm7krhGU6vsKywVFGXS4MVY= Received: from DU2PR04CA0283.eurprd04.prod.outlook.com (2603:10a6:10:28c::18) by AMBPR08MB544735.eurprd08.prod.outlook.com (2603:10a6:20b:7af::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.496.15; Tue, 6 Oct 2026 10:52:06 +0000 Received: from MAD0EPF000008B4.eurprd04.prod.outlook.com (2603:10a6:10:28c:cafe::4) by DU2PR04CA0283.outlook.office365.com (2603:10a6:10:28c::18) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.472.21 via Frontend Transport; Tue, 6 Oct 2026 10:52:05 +0000 Authentication-Results: mx.microsoft.com 1; spf=pass (sender IP is 69.169.224.5) smtp.mailfrom=eu-central-1.amazonses.com; dkim=pass (signature was verified) header.d=sashiko.virtuozzo.com;dkim=pass (signature was verified) header.d=amazonses.com;dmarc=pass action=none header.from=sashiko.virtuozzo.com; Received-SPF: Pass (protection.outlook.com: domain of eu-central-1.amazonses.com designates 69.169.224.5 as permitted sender) receiver=protection.outlook.com; client-ip=69.169.224.5; helo=b224-5.smtp-out.eu-central-1.amazonses.com; pr=C Received: from b224-5.smtp-out.eu-central-1.amazonses.com (69.169.224.5) by MAD0EPF000008B4.mail.protection.outlook.com (10.167.241.136) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.496.14 via Frontend Transport; Tue, 6 Oct 2026 10:52:05 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=23yjbh4k34hwzfubhuiim7m4inbd3ick; d=sashiko.virtuozzo.com; t=1791283925; h=From:Subject:To:Cc:In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date:Message-ID; bh=lnTI/kn/x3ALFyfOmp2f6ES/nYvwckwW5DcGwFGmpuE=; b=OCE902Ag/c0afpz8w4dW2M0tmB5SOXufP4plzR3DnJVg0CKCcGXser86l3+oTa+r updw67t0aKnm/YaYNXCNtrftGLkxb16fPRFtF3zqIF1Yn9AuqLIS9r+FD9IfSdHTxfk K4GfmPObRXGsIL7CDCufHSzZIZafmjYyU1VQpMdHO9qBoPLfkWvmcJX1iWBcTs7Wnan ly5P3CZr4W43itptltlN/u2PoAGzDgyeGJlelecz2pJr1GJOVSrRjmqvabeE7CKdcpr i5L54xLXWtMQkskxi4Sa+f6+GOtX44uCxQy5LvkUaKuPB3JkIR82eF4sdl9qc4SVPT4 qU2eg6Lsew== DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=sokbgaaqhfgd6qjht2wmdajpuuanpimv; d=amazonses.com; t=1791283925; h=From:Subject:To:Cc:In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date:Message-ID:Feedback-ID; bh=lnTI/kn/x3ALFyfOmp2f6ES/nYvwckwW5DcGwFGmpuE=; b=A9o8Lk7hXXz163YONaKXADd6m5ZFspH4QLabMq3RFHusgyFM++qetCUQjdL2ELzb vP/SYJ8E4l1pxadM06q+qUdFIsvoTd4dy1rCQGuKfnbeDDaKGP4pMelXWpOcjl7G0cy lS+JtnZKBWUbEip5cCg6esogr8f4kq6gV6A35LZs= From: no-reply@sashiko.virtuozzo.com Subject: Re: [PATCH QEMU HCI-8.0 v6 09/12] usb: migrate the interface altsetting #VSTOR-137800 To: Andrey Drobyshev , svt-core@virtuozzo.com Cc: den@openvz.org, andrey.drobyshev@virtuozzo.com In-Reply-To: <20261006-usb-host_v3-v6-9-8688ec9576d1@virtuozzo.com> References: <20261006-usb-host_v3-v6-0-8688ec9576d1@virtuozzo.com> <20261006-usb-host_v3-v6-9-8688ec9576d1@virtuozzo.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Tue, 6 Oct 2026 10:52:04 +0000 Message-ID: <010701a110d78faf-e112153a-25aa-4829-9d2f-d0ab691f6fd3-000000@eu-central-1.amazonses.com> Feedback-ID: ::1.eu-central-1.2wRQJBpg9g1fGRYexx3dUuYGS25Bux+2TEOx72/m6U4=:AmazonSES X-SES-Outgoing: 2026.10.06-69.169.224.5 X-EOPAttributedMessage: 0 X-EOPTenantAttributedMessage: 0bc7f26d-0264-416e-a6fc-8352af79c58f:0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MAD0EPF000008B4:EE_|AMBPR08MB544735:EE_ MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: 3810eda7-3fe3-4114-0494-08df2397dc7b X-LD-Processed: 0bc7f26d-0264-416e-a6fc-8352af79c58f,ExtAddr X-MS-Exchange-AtpMessageProperties: SA List-Id: svt-core@virtuozzo.com X-MS-Exchange-Transport-Rules-Loop: 1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|704161411799003|32142699015|9140799003|48200799018|376014|61400799027|16102099003|55112099003|18002099003|22082099003|13003099007|5023799004|10067099003|4143699003|56012099006|5063699009|5113699003|4113699003|6133799003; X-Microsoft-Antispam-Message-Info: 4rwt/RZHoJev1Ks94r+e9eDuDcdKT2u8qI+Vk/OZ5Pod1KMKrwq4aFwHxZIILeAYaUwUH9pIdMaBRQTOZPw0kTWIT4yX2Z/dH0qcKndc8lGmWQcdGPc/PqPWejl8gxYt6YQwFQ4g4i6thzbFjd7nEwyvIoWLOaFBzK/6NoCacoKJnBKQOsRNpw2uG+uecoeVdXyVai83ZaPIBVRNbC8T+0MIEFbar+ePjpxLc8aERh1qpWEcPaBK2MOOSS5tB0wH0GLup5/2qBwJnnIwQVyVbqJmneL5ZqHEILrDlh4UMyRgff7nilTDNYO7c3FHwHhrUnqMohXYLiMrNk6FqOsr889qAhP+ZUhcW+5Sfq7K9VDKcWZY26SkUefMuNqaq515DCBS5191U7ETYAyi8nS1ARTHJLhtyyzhz3kU3PYkOzTUpGbQ1PJ25bsq07IdDpk0dikh579Ti/7FX8lerWXQ0tJ02GYSrvJMQiPpYhv+1ngr4Z4CyTFiUXImIkFziFhXR7jAw9vC4AxYY80t9VDs6Gi7YdnzHVd+oXlBVZeaXmznA6Hgxhb95iH85I1qfu5dHuvGjVBrOF/BtVDem2aGGaay+CbDnJjrrljPHZMwO/ftpwXtwyagI5lDXiLZZLn45fiLEfwsUfkJJDfaDUNs9arnHI2rpwRu5Qbf9i34QJWE3T/SK3OR3BcP++m0SKWR0yS8MK/g6uL/QNoQ2vkjnY/kDDZkscmQtEnoJ3EQpQkfyb1Hy0wqhnK/OYwxYrHnR7ePf3RNf9yBSIVSvxE28KCA7PpmgbekCqUKccQ5EY8U7rDfLNBBxUT9fxGHfk4Qwa/N7Z80d7R85AQ1fZcMC2uNF6tyj/5Pa7jAFyDrOXe9Mc7z/OThnWCT+fJxNimJ8Wl7XEXy0lRbUSRyl6W1LwJL4PDgEC7x9d2BpdLz36XrZLu3nR4MfahJjRGQXA3A X-Forefront-Antispam-Report: CIP:69.169.224.5;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:b224-5.smtp-out.eu-central-1.amazonses.com;PTR:b224-5.smtp-out.eu-central-1.amazonses.com;CAT:NONE;SFS:(13230040)(704161411799003)(32142699015)(9140799003)(48200799018)(376014)(61400799027)(16102099003)(55112099003)(18002099003)(22082099003)(13003099007)(5023799004)(10067099003)(4143699003)(56012099006)(5063699009)(5113699003)(4113699003)(6133799003);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: BGTzq+w2y/VDQY5uVNyuzH2FHWNd40cJXYdoz9AXZORD3qqQcfySqliHHZUN4VvZY5DHp8odLWv4pZPc1T4Lf0n5ImymRN0pII/nFddauL+odEV+hztbNgd26LENEwCaNAbQU1zWFIQaRLqYKEa7efGYY98e9nJcXueF+8Cq62/tnTVaTXYAPm/vq7uIVW82pKYf7AO9BboynuGZ6r4ml58MVbTuwxoK00bS/K7L0fD9NuB5lUFtlZgShCl7yMd8W56vp+AppZSW4qq9OOhm5LtlRcDRgXmet/aIROHraGRowd1750QJmZcN2LGoi1cN2KI1hITqWOo2UuD5LbunX3BXSx9et8n1KhTL3q300cut3Q3/CK+UaigqKbSNVsPjy0GJxeFJd+ApCfL5DkY9Y74yWOlxcychYnHAu34QClvXz/HAwoqAHxsC4R8Sbolf X-ExternalRecipientOutboundConnectors: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Oct 2026 10:52:05.4901 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3810eda7-3fe3-4114-0494-08df2397dc7b X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-AuthSource: MAD0EPF000008B4.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: Internet X-MS-Exchange-Transport-CrossTenantHeadersStamped: AMBPR08MB544735 Thank you for your contribution! Sashiko AI review found 1 potential issue(= s) to consider: - [Low] usb: altsetting subsection in generic vmstate_usb_device has no con= sumer for emulated devices -- commit 6d71f98dc9c0687ea03b267e596a32a451816b68 Author: Andrey Drobyshev usb: migrate the interface altsetting #VSTOR-137800 This commit adds a vmstate subsection to the generic vmstate_usb_device that migrates the USBDevice altsetting[] array. The subsection is emitted only in the CPR migration modes and only when some interface is on a non-zero altsetting. > diff --git a/hw/usb/bus.c b/hw/usb/bus.c > --- a/hw/usb/bus.c > +++ b/hw/usb/bus.c [ ... ] > +static bool usb_altsetting_needed(void *opaque) > +{ > + USBDevice *dev =3D opaque; > + int i; > + > + /* > + * Only the CPR target consumes this, to rebuild its endpoints; other > + * migrations reopen the device and reconstruct the altsetting. > + */ > + if (!cpr_incoming_needed(NULL)) { > + return false; > + } > + for (i =3D 0; i < USB_MAX_INTERFACES; i++) { > + if (dev->altsetting[i]) { > + return true; > + } > + } > + return false; > +} > + > +static const VMStateDescription vmstate_usb_device_altsetting =3D { > + .name =3D "USBDevice/altsetting", [Severity: Low] Is this gate specific enough to the devices that consume the state? usb_altsetting_needed() checks only cpr_incoming_needed() and whether some dev->altsetting[i] is non-zero. It does not check whether the device is a usb-host device. The subsection lives in the generic vmstate_usb_device, so an emulated USB device that supports SET_INTERFACE and sits on a non-zero altsetting (an audio-style device, for example) will also emit and load altsetting[] in CPR modes. The generic usb_device_post_load() only recomputes dev->attached: if (dev->state =3D=3D USB_STATE_NOTATTACHED) { dev->attached =3D false; } else { dev->attached =3D true; } Nothing there rebuilds dev->ifaces[] or calls usb_desc_ep_init() from the loaded altsetting[]. On the CPR target such a device could report the restored altsetting via GET_INTERFACE while its endpoints still follow altsetting 0. No emulated device that triggers this today has been identified, so this is speculative. The later patch in the series, "usb-host: reconfigure endpoints on CPR incoming", adds usb_host_cpr_reclaim_interfaces(), which range-checks the migrated altsetting. It also adds a usb_host_ep_update() call in usb_host_post_load() and changes the assert in usb_host_ep_update() to check alt >=3D 0. That covers the usb-host consumer and the unvalidated index concern. The series adds no consumer for non-usb-host devices. Should the subsection be restricted to usb-host devices, or should the generic post_load rebuild the interface and endpoint state from altsetting[]? > + .version_id =3D 1, > + .minimum_version_id =3D 1, > + .needed =3D usb_altsetting_needed, > + .fields =3D (const VMStateField[]) { > + VMSTATE_INT32_ARRAY(altsetting, USBDevice, USB_MAX_INTERFACES), > + VMSTATE_END_OF_LIST(), > + } > +}; [ ... ] > + .subsections =3D (const VMStateDescription * const []) { > + &vmstate_usb_device_altsetting, > + NULL > } > }; --=20 Sashiko AI review =C2=B7 https://sashiko.vzint.dev/#/patchset/20261006-usb-= host_v3-v6-0-8688ec9576d1@virtuozzo.com?part=3D9