From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <010701a111e98c02-0b632499-9eaf-4229-a423-aa8a3dadc88b-000000@eu-central-1.amazonses.com> Received: from DUZPR83CU001.outbound.protection.outlook.com (mail-northeuropeazon11022087.outbound.protection.outlook.com [52.101.66.87]) by lore.virtuozzo.com (Postfix) with ESMTPS id 47D7B802A5 for ; Tue, 6 Oct 2026 15:51:28 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=aKUOv7/ci6GR4CRB+dzs9FGvI0byrlz6zwwS9eleFyDl9w+4r6o3GxZHcu7leYhgKAfxV3sl1QCkKISA5/EykcOTQ+/GiukcOh2I2bHdTPMbsLqV+C0ybtrmT2+Ou/o6UumCtf5OWfTX8Kk46nyJvahIc5UncvcYZITiyz/4LTkESpQG78cO+Yz2X4ooryZ/E5qZ1+fAcDxz8dFZ1h/aQimBTrKM/T9husk7j3rqTCCtpmHzvKwNTzV/k29vblVKdX3JRjBYlUsP553vcnUKi3f2aeA+XvRUEk0M6ggvFc6CppmkR8imUYOJwaV3IEPTYKkpxndKQj0/wyT1QyUfUg== 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=GL5Ey3MUvpaGk+VZNtHaTWi269P7KNzXjhzm7mLE2Tg=; b=bkovaw7oB4X/lPwZRm1MRFmMnybvi/FSut0AsHldYU5wyTsafFgCvhFZWbrFjO44RO0pTkuqXb3h1S4aHiab7y+VtRWRZoe8GUp9wwnzG/49RjcCxAwxq2o38rCyxd/tGGws7Q4rCISFKO7UjMjYAfjUop3+gNTbcFm+x5huhpdw6HKGVMS/2yk+Bfz0Bijn5bJMzPhlDH3Te3aW+aasRlju4txDOr/QgSkXwiBlJ3gyDmI+ejaLUEtHPE2yKz9LEuy6UBZHz9CcnEaaRuBR0kepkmaOsY2pn+Q6EO5P2svrGNCVPb7YeV8brElpyq2rFHpPtAHtfLlp8HEpn997GQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 69.169.224.6) 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=GL5Ey3MUvpaGk+VZNtHaTWi269P7KNzXjhzm7mLE2Tg=; b=mgkhwIelX8dYEe5nWgKMklNtXFy5scjgxvhlkpVAF86Nix1Y8A1nWkvp/l0Se/W3c1LUYhwZvQrQKT+jIPt7cSMQFDxX/noAvzIOgDWTpBKO81q5vkoyM78VgJTbYmd3pgXLaDpa8BrOGrqqwAqTQDSLS3vZGot7XwGpjfN6Lb8= Received: from DU2PR04CA0167.eurprd04.prod.outlook.com (2603:10a6:10:2b0::22) by AS2PR08MB8806.eurprd08.prod.outlook.com (2603:10a6:20b:5f2::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.472.14; Tue, 6 Oct 2026 15:51:21 +0000 Received: from DU6PEPF0000A7DD.eurprd02.prod.outlook.com (2603:10a6:10:2b0:cafe::7e) by DU2PR04CA0167.outlook.office365.com (2603:10a6:10:2b0::22) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.472.20 via Frontend Transport; Tue, 6 Oct 2026 15:51:21 +0000 Authentication-Results: mx.microsoft.com 1; spf=pass (sender IP is 69.169.224.6) 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.6 as permitted sender) receiver=protection.outlook.com; client-ip=69.169.224.6; helo=b224-6.smtp-out.eu-central-1.amazonses.com; pr=C Received: from b224-6.smtp-out.eu-central-1.amazonses.com (69.169.224.6) by DU6PEPF0000A7DD.mail.protection.outlook.com (10.167.8.37) 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 15:51:21 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=23yjbh4k34hwzfubhuiim7m4inbd3ick; d=sashiko.virtuozzo.com; t=1791301881; h=From:Subject:To:Cc:In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date:Message-ID; bh=0WyyMYPK1zqp1RFl6jSDB9/B3hhEsRdRMU86JeIDxrA=; b=UPnVFVXOfg8NAUWI5/vSJ2JyMeaiHC6C8daXcL60Qf8WxGsvBdxts6itTedCHHim yR1tsw4SohLhI0iMSPl4+z3vlwpDHmyni/O+3U/Vj3iC1rUUCXQJ6WR+iRrBDAAhUv0 aSQjeWbaCOVo926ky32C2/MFTKWfHhyYZkNHvRHpTPPauEeltP6c8SuYVU7u52IWMR6 GxpcopCNg93h8F9dCaBMwcvhjKCX3iU6Cr7nzkHTWlojriPtNYN9TCITeJ1mxUhb1Qe azAKWgtwn3b/ti+hzcg7VhDsRd9f6P/bOBKgJtOayqbIIOP2BVZKe59h5weN5vpYP5c o9jKIiUVTQ== DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=sokbgaaqhfgd6qjht2wmdajpuuanpimv; d=amazonses.com; t=1791301881; h=From:Subject:To:Cc:In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date:Message-ID:Feedback-ID; bh=0WyyMYPK1zqp1RFl6jSDB9/B3hhEsRdRMU86JeIDxrA=; b=kpE+pSmcMADZA3ervNOvhFmY9ZEVt2R0dgj+TQpP5bUBw4dG+/wXiZY3SehUXU1/ WQbRKg2MjZlJU4JdfuRiyEZwI6a8sBkZ2Shi9mo6IVkx9m2UqOCVgQyX+j7prwznvPf 9lr4rggVH+FPqwgoTphePDLX4V3bRpAinuF7YPaw= From: no-reply@sashiko.virtuozzo.com Subject: Re: [PATCH QEMU HCI-8.0 v7 11/14] 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-v7-11-044f668789a1@virtuozzo.com> References: <20261006-usb-host_v3-v7-0-044f668789a1@virtuozzo.com> <20261006-usb-host_v3-v7-11-044f668789a1@virtuozzo.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Tue, 6 Oct 2026 15:51:20 +0000 Message-ID: <010701a111e98c02-0b632499-9eaf-4229-a423-aa8a3dadc88b-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.6 X-EOPAttributedMessage: 0 X-EOPTenantAttributedMessage: 0bc7f26d-0264-416e-a6fc-8352af79c58f:0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU6PEPF0000A7DD:EE_|AS2PR08MB8806:EE_ MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: e856df34-f10a-4ea2-158c-08df23c1aafe 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|376014|61400799027|48200799018|32142699015|9140799003|13003099007|55112099003|16102099003|18002099003|22082099003|5113699003|4113699003|6133799003|5023799004|5063699009|10067099003|56012099006|4143699003; X-Microsoft-Antispam-Message-Info: Fp0fC6lyIQ/Wlq0Pd5uszHs4T/qxFMC2Ga3cOY94cuXi8ioM13wRJRdNhla6MQNpXMulWgZwKNzHBXyIkdzkwNZhQe2irCCzdmWmWVscCKfzo+DEGeTJIecHXlNgCaG643/8KYZ3Q1GEEzJU1Ug9Uu/NKaNniSeh1BpzM5DzrBWd5ItTGKlaBm9VvnwrKa1UAGvtuXk6swT2QY408y3j6aS2II3DfcZGcwPv8Sbk1h96OXoydTQNJuR88xHsPjSBdGcOOiYKS7KFJraLyT344i5vEQaZbDmex/ciyTMJZOAAHPDiTZ+hPxQp+PGn0Vim9RIKKLYhIZEkgBjOiq8609TYKMW6on56Y0OgpgT+BGi5uLTbIlxk9ZTiFsE/FvI7FSArKIRnSUYYmb+NhJfJNV44wr9YzevrXdj2WnypHBX7zsFVqfII7XQD5lx2jibTncM8c1aIW9iecM0TZNCR6bADmAV3ORrMIDoSh+iKd0pLj6Yf1pg5GmoNTr73aWRW113FgXoU761wHaymMk2suc87cBoCTCP3OUJH13csicF7aSkA5GucltrflhOWHI13eDw1OoUAxdKdIrQKZ3uJg96MXDPEEhN31pGSAXB4Fna7JR2CKZ1CT79fzdfqLamSctHyS0MoUgRPkneZHV2ufP9a3fGehxNCLYJPNHVBrAX/c+1LaWz4AcS4BT3syMBdCe2Kwiv1FVL4SXRtiCfwQV7O32vVH+0lCkJnAXSqGELtS/FIdiYLt/qPQvkK948le2Fpi9vSLOxoSL4/3yFIExFcn2INkpiQZ6Jq8kCNUfygYCzEP7x2YB9G1zk05bLReNZf2ND7JXmZXI5PeKoLvv21AzIrFH5BNcV6ifus4Bo= X-Forefront-Antispam-Report: CIP:69.169.224.6;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:b224-6.smtp-out.eu-central-1.amazonses.com;PTR:b224-6.smtp-out.eu-central-1.amazonses.com;CAT:NONE;SFS:(13230040)(704161411799003)(376014)(61400799027)(48200799018)(32142699015)(9140799003)(13003099007)(55112099003)(16102099003)(18002099003)(22082099003)(5113699003)(4113699003)(6133799003)(5023799004)(5063699009)(10067099003)(56012099006)(4143699003);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: IrO7XlzEvGk8cCjJOcgG7uyb1HTuypvCWQiQ1VwgHJvLu/VUJQy7mdxJfqfP2/VirCEjy3rLArWisfPDlFpuIeAZ8JzXSw07niLYN2xyv1EA3xP416CstT0p4VsVWPXgO36tsjZkT+0Kl64y1b8DukWpcCmV1N1fdTQB8g2wVU1Jl43b2tywp/wlRF49OOTUycqIAZauqEeRkEuhny+MuPaECFltPU7VqZkGDDOJzNxYaAMyO0DUz9rHTUV76BR943JfS58aXM7dCTR5i6yLqBkQBEtgaFIV709ZjgXHmr23YA4D3Fk7TAfBv2o3O8HLuqMpBBNwBu6vnsySJn8411ROwXZcUEYS7MO1CT19w7MLLwiJsHjnj9A/aBk2WYnBEog7iIBHUCg4Ec5ltL7LqT6LlrKy+yNkYTFzWN6JvCJB4MXPa6KbrmbNX4Bfr7rz X-ExternalRecipientOutboundConnectors: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Oct 2026 15:51:21.3451 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e856df34-f10a-4ea2-158c-08df23c1aafe X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-AuthSource: DU6PEPF0000A7DD.eurprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: Internet X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS2PR08MB8806 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 c0dc143b080568d7b0883600b0776ce496b368ca Author: Andrey Drobyshev usb: migrate the interface altsetting #VSTOR-137800 This patch adds a vmstate subsection to the shared USBDevice vmstate that carries the altsetting[] array. The subsection is emitted only in the CPR migration modes and only when some altsetting[] entry is non-zero. > 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; > +} [Severity: Low] Is this gate too broad? usb_altsetting_needed() checks only cpr_incoming_needed() and whether any dev->altsetting[i] is non-zero. It does not check the device type, but the stated reason (the CPR target rebuilds its endpoints) seems to hold only for usb-host. [ ... ] > + .subsections =3D (const VMStateDescription * const []) { > + &vmstate_usb_device_altsetting, > + NULL > } The subsection is attached to the shared vmstate_usb_device, so it is emitted and loaded for every USB device type, including emulated devices. For an emulated device, usb_desc_set_interface() in hw/usb/desc.c updates the three together: old =3D dev->altsetting[index]; dev->altsetting[index] =3D value; dev->ifaces[index] =3D iface; usb_desc_ep_init(dev); After a CPR load, only altsetting[] is restored. ifaces[] and the endpoint table stay at altsetting 0. Can GET_INTERFACE then report the guest's non-zero altsetting while the device model behaves as if altsetting 0 were active? Before this patch the state was wrong but self-consistent. It is still wrong after the patch, so emulated devices gain nothing from it. The consumer in this series is only in usb_host_post_load() in hw/usb/host-libusb.c, which calls usb_host_cpr_reclaim_interfaces() and usb_host_ep_update(). Nothing re-applies ifaces[] or calls usb_desc_ep_init() for emulated devices. I did not verify which emulated devices have multiple altsettings or can be CPR-migrated, so this may be of limited reach. Would it make sense to limit the subsection to usb-host, or to restore ifaces[] and the endpoints in a generic post_load? Separately, the commit message says "The active altsetting of each interface is host controller state". Is that accurate? altsetting[] is a field of USBDevice, not of the host controller. --=20 Sashiko AI review =C2=B7 https://sashiko.vzint.dev/#/patchset/20261006-usb-= host_v3-v7-0-044f668789a1@virtuozzo.com?part=3D11