From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <010701a111e5026e-305911cb-8468-4ed1-9d98-db51a716522a-000000@eu-central-1.amazonses.com> Received: from DUZPR83CU001.outbound.protection.outlook.com (mail-northeuropeazon11022123.outbound.protection.outlook.com [52.101.66.123]) by lore.virtuozzo.com (Postfix) with ESMTPS id 658CD802A5 for ; Tue, 6 Oct 2026 15:46:27 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=JgEC7o92L7kIo4hz0FliZQ7fhFYN9QiIZkzd5fkTc8QUWdjnIuXpKvUVanB6C9W4+QWSWcRecf8Pqz+DasveLmpMmfntE3WIViZjHy41mMEhDeKrJrcAtEsYi9mPBVEgTVPYKCz/hSO1qgS0UblM5yQx5jdVxyMDoCdxmqCxaGZ5+iwGtA7xstJJ8x7yZGS/UFDhTgJrNaytEFJbXP4U4kskVZ2ASBf9szdJfeVcY0UvUIoo6gjX9Bw5rNAAhHIyYd+/5da4x+vx4zOM4fq0favJ1jhHa3czqEm65/nAm0H2z1pC7tRK/sGyGGLL/LtyWnRf1AldEinAREwT04smfA== 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=MhI2q1kpXCRzIxMuUKmdOx83in88U025IqY+r+2kUQM=; b=r+Et0sqY7xNdG6NgAGB09//M2qlppbz/AkDIE5XZ+BvEtHdMaI9rZpgiG8M7+anMzpBR+PLgBWeuJHLxFrsp8kEw2PZ+0OSD2Flt9nrur1wMvnyxFyQ44JzPh4i8RUAcLqBTMszpoycwu9zdHdoOir2r3q6bRsyqRV7otzX8pdVLaWlUgluO3is3cuBZQ6o6x44eGRyqIEx4HD3Gp4w76UoF4IFfFN7W88Nxb8LKeZ10a6JmMd82/xpLP5QBDOjPKWMRRrEbS0DBisDMeC+oeWT2pqVutC9X2fqfy+VkYMcqIyCmuZX4MkEr0V5XsFXY/PAq/eHacz+Fq7BR9i5K4w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 69.169.224.1) 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=MhI2q1kpXCRzIxMuUKmdOx83in88U025IqY+r+2kUQM=; b=XBKc76vwNuMheCrnrfUGfR7w5MfGP0BfJZL2exvAVaXUbfSe2ZfbE7dlBiCLhBZWRnBzZvafHKxZTnw6UfiPeEhEuBP3mtCalg4WLOzMnawO5RkJ2fL+vyVZpc5NWAHCsZ91+WTzq363ip/wnmsYqE/aY5Efb8Btfv41myCn4lc= Received: from AS8PR04CA0048.eurprd04.prod.outlook.com (2603:10a6:20b:312::23) by DB4PR08MB9264.eurprd08.prod.outlook.com (2603:10a6:10:3f7::12) 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 15:46:24 +0000 Received: from AMS1EPF0000008E.eurprd05.prod.outlook.com (2603:10a6:20b:312:cafe::63) by AS8PR04CA0048.outlook.office365.com (2603:10a6:20b:312::23) 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:46:24 +0000 Authentication-Results: mx.microsoft.com 1; spf=pass (sender IP is 69.169.224.1) 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.1 as permitted sender) receiver=protection.outlook.com; client-ip=69.169.224.1; helo=b224-1.smtp-out.eu-central-1.amazonses.com; pr=C Received: from b224-1.smtp-out.eu-central-1.amazonses.com (69.169.224.1) by AMS1EPF0000008E.mail.protection.outlook.com (10.167.242.85) 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:46:23 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=23yjbh4k34hwzfubhuiim7m4inbd3ick; d=sashiko.virtuozzo.com; t=1791301583; h=From:Subject:To:Cc:In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date:Message-ID; bh=gcqhYb3rU6PYs6qzyXgJO90OI4mrb72hQ113X0LFEhA=; b=Xpu71cMMGgr4GRWTfgmKcf5v36JfJxi98dGCiuf5FxN4lFUak8Fld8SssHXeO5Ft M05Asr6zte2km354TuFzKQEwIaSIdZ2T3rNAoGKiUTmm1fKSKDZnt1Yv0OX1PIVd8oq MMyTKapzy+tcIH4uuIw+ww5w8ZlZn7eAwNGU9ONq/luyivFssMc3JbBOUA6/0DDy5Vz uzirbJqBt/I3aMyhGIDBMOWVfaIb5Uanc6ZrH8yJfdPD5EID+gqF3huLLRAInzvqBym v3mrDPiQX6tjlg27ZhUc7/yzki/k6Y1mL/vgcMVH07yrZiVTDtU1gIwBUY93/6anTs2 cDuLw8VmHQ== DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=sokbgaaqhfgd6qjht2wmdajpuuanpimv; d=amazonses.com; t=1791301583; h=From:Subject:To:Cc:In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date:Message-ID:Feedback-ID; bh=gcqhYb3rU6PYs6qzyXgJO90OI4mrb72hQ113X0LFEhA=; b=XJQUoBfai06FeWXpfyj1Nzhyfxs72hNHZ0Uhsd+UO6DKfr5k/HIIbNF1W76+fWfr 40ldikv8M3awI6iBDEHQ1LUYnIXvSqyB129a9912zp4f7ulQ9796NZKWaWFJzBDikY+ i06CPR7a0wNgR6MVQfg8wlvKgoMZ0kKiidtpCIOo= From: no-reply@sashiko.virtuozzo.com Subject: Re: [PATCH QEMU HCI-8.0 v7 07/14] usb-host: re-issue drained URBs if CPR is aborted #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-7-044f668789a1@virtuozzo.com> References: <20261006-usb-host_v3-v7-0-044f668789a1@virtuozzo.com> <20261006-usb-host_v3-v7-7-044f668789a1@virtuozzo.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Tue, 6 Oct 2026 15:46:23 +0000 Message-ID: <010701a111e5026e-305911cb-8468-4ed1-9d98-db51a716522a-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.1 X-EOPAttributedMessage: 0 X-EOPTenantAttributedMessage: 0bc7f26d-0264-416e-a6fc-8352af79c58f:0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AMS1EPF0000008E:EE_|DB4PR08MB9264:EE_ MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: c68b041b-5f7c-4e10-f180-08df23c0f9aa 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|32142699015|48200799018|61400799027|9140799003|18002099003|55112099003|22082099003|16102099003|13003099007|4143699003|5023799004|6133799003|10067099003|5063699009|56012099006|5113699003|4113699003; X-Microsoft-Antispam-Message-Info: sOgOvkN0d2U00r0BU2QnOSCC7PuR45cPifXmp37IGM23xJU+G72n8QQNbGDWDiFaJCcOY1VENFP18xGQMR3YUZ3LqL74XCwwGpGcFqaDrlIDpR1MNNE8LWDzw+g7F9womvgCuVRHF5XoWFlocjcwELsxEMHem8Us9mhuormTlTebHLbyabkvv/YBz/8TfooWlc8ELNJnfCYT71q0ANgIiCCCNpPDuLGewN81sS7YAME71h6+RcBIGncKAldnO8Xedk+gQBZOgVBxatH6JCM754ZqlP8sd4kkBLaLRoB5S3VvPw4wB/5P7bjNZ5ENHF2HYFc4b0iWf4GAdeJ1KcW6qaq6DCnIKDaCT593QMPw35DqiyDR5CpZEAXrHopQcvl1JVw0foLhk372IzElMLNdvHaagWOheecxL5MWQseZHac5iCs+FjQDiqvWQK0fN9M3ORa0GcI/GaJUHLxw5RbEqIWOtfKkzMlpeXJZSePhue/OdF1QCvuO8Ekre4BoKIwTc2akpIfn4uNYkUpDxEDGTJt3zuMClH8ZZ7TBmLL5bp8o2Semvh99acIe6HGBHHoc4g6Jwag/Om8jnwIh4E5bDF8aDtp1qajS43dRbHa3tByOiHDjev9xb5BqkQRL3HDT7GUv6JWrNnAxR6/Lu8KCrZU81yHPMEavmeNLXS0fXXnd003PoeH+hqqSH2cHMTHpZvZW7CAj5q7kqULMT0XzZIGEdEB0sqmNp0qjIRNFPefUB8/IEzVmS+LFjsZHu62ye+DI/MRUu9ekdRFYm1B+aS1YIh+qro6fAXzJu0FrIVE3BcYNisXdEGv4VmlmwMgm X-Forefront-Antispam-Report: CIP:69.169.224.1;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:b224-1.smtp-out.eu-central-1.amazonses.com;PTR:b224-1.smtp-out.eu-central-1.amazonses.com;CAT:NONE;SFS:(13230040)(704161411799003)(376014)(32142699015)(48200799018)(61400799027)(9140799003)(18002099003)(55112099003)(22082099003)(16102099003)(13003099007)(4143699003)(5023799004)(6133799003)(10067099003)(5063699009)(56012099006)(5113699003)(4113699003);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: mDNRAZFJQcxp9u5T4XJhWS1dTzIeSYSV/AS/1Owu/TDv/wDKiKPOuik1ZOHrsC8QDtW5qCABrw6+7NZf5ARgFfLK5g6JJbEArGggSwtkOdmKHrjEBQkWiwn917GzvS2QxCYj4SY66jVxjqZzMWrYZWmz8UAdkw3rdhYCLFgm3DpIvDuTA1G/uPz/ydO/PfkcoXuKN/7XROM+nUD1nRdGuWytj31SxwjDJkUNkG5NEG5XqIKoxELjNMEaIy62e0xlckN0Sf7GoX0JTuHc8Nnwc1TDRwSzLB1TtFaTwC6mgeeHozI406KCQFV0FGfsL9jdrk0zHEk9/s8h3yrKD+90l7ZrxF2NZP7mBMr5OQRO/oGRWJHNkxLwWasHM2jU/7t+sXhK4cVGrI1epppMt67UDMb9wz3cf/b6NLZYcO2qUG6RZtyo3AIYwCbFBux2Htrc X-ExternalRecipientOutboundConnectors: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Oct 2026 15:46:23.8709 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c68b041b-5f7c-4e10-f180-08df23c0f9aa X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-AuthSource: AMS1EPF0000008E.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: Internet X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB4PR08MB9264 Thank you for your contribution! Sashiko AI review found 1 potential issue(= s) to consider: - [Medium] usb-host: replay_all queues completed URBs, so aborted CPR re-se= nds or drops data -- commit 2947a35eaf543430e9227a58d6c2b6610a15e890 Author: Andrey Drobyshev usb-host: re-issue drained URBs if CPR is aborted #VSTOR-137800 This patch records the packets suppressed during the CPR drain on a cpr_inflight list. If CPR is aborted, the vm-state handler's resume branch re-issues them on the preserved fd. Control transfers are completed with an error instead of being re-issued. > diff --git a/hw/usb/host-libusb.c b/hw/usb/host-libusb.c > --- a/hw/usb/host-libusb.c > +++ b/hw/usb/host-libusb.c [ ... ] > @@ -450,6 +453,9 @@ static bool usb_host_req_cpr_replay(USBHostRequest *r, > return false; > } > } > + if (r->p->state =3D=3D USB_PACKET_ASYNC) { > + r->host->cpr_inflight =3D g_slist_append(r->host->cpr_inflight, = r->p); > + } > return true; > } [Severity: Medium] When cpr_replay_all is set by the paused-VM usb_host_pre_save() fallback, the status and actual_length checks above are skipped. Does usb_host_req_cpr_replay() then queue every reaped URB on cpr_inflight, including URBs that completed successfully? The request is then freed without its data being copied into the packet. [ ... ] > + for (it =3D s->cpr_inflight; it; it =3D it->next) { > + p =3D it->data; > + /* > + * Replay from the start of the TD. A transfer that already mov= ed some > + * data is re-run in full, so an OUT fragment the device consume= d may be > + * sent twice. Only the paused-VM pre_save fallback queues such= partial > + * transfers here; the normal drain delivers them as short trans= fers. > + */ > + p->actual_length =3D 0; > + if (p->ep->nr =3D=3D 0) { > + /* control endpoint: can't be reconstructed, so error it out= */ > + p->status =3D USB_RET_IOERROR; > + usb_generic_async_ctrl_complete(udev, p); > + } else { > + usb_host_handle_data(udev, p); If CPR aborts after that fallback, usb_host_cpr_reissue() re-submits these fully completed transfers from the start: - A completed OUT transfer can be sent to the physical device a second time. - A completed IN transfer has its data discarded, and a new read is issued. - A completed control transfer is failed with USB_RET_IOERROR, even though the device already executed it. The commit message and the comment above only mention a partial OUT fragment being sent twice. Could they, or the queueing in usb_host_req_cpr_replay(), be changed to cover fully completed transfers too? This could matter for non-idempotent streams such as mass storage, serial or printer traffic. --=20 Sashiko AI review =C2=B7 https://sashiko.vzint.dev/#/patchset/20261006-usb-= host_v3-v7-0-044f668789a1@virtuozzo.com?part=3D7