From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.openvz.org (mail.openvz.org [69.168.225.77]) by lore.virtuozzo.com (Postfix) with ESMTPS id 6FE5C8017D for ; Tue, 10 Nov 2026 17:54:52 +0000 (UTC) Received: from mail.openvz.org (localhost [127.0.0.1]) by mail.openvz.org (8.14.4/8.14.4) with ESMTP id 6AAHra1A017743; Tue, 10 Nov 2026 20:53:36 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 6AAHra1A017743 Authentication-Results: mail.openvz.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=virtuozzo.com header.i=@virtuozzo.com header.b="nJECBt7c" Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by mail.openvz.org (8.14.4/8.14.4) with ESMTP id 6AAHrYcX017737 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=FAIL) for ; Tue, 10 Nov 2026 20:53:34 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 6AAHrYcX017737 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-4a027f2e364so17719565e9.3 for ; Tue, 10 Nov 2026 09:53:34 -0800 (PST) X-Forwarded-Encrypted: i=2; AL+hErH0eLHmf3JHFcx0LV5oXwnh9hqs56T/4h/8GGSqul3VXbRgO9rMvNV/M0aLAUUh/dhkrZt5SA==@openvz.org X-Gm-Message-State: APuU4Z+35eyD2NdyyigW0aTQ6Z7ZAuw1xaQUvXXoHOGn5zvyTIouEn9M /RVl7gUQCEPzygB3xtQyXyTcsbp4wHtliH+NsJjGBHHu3FAeGl/5EucRw/BWAeXDz10Kmz4fIJl ZCT1p+SgD7rinVm7uwN+Qjxrco862DGRaPL1+ITUTV+VmFTUUG8sorQ== X-Gm-Gg: AYBFou2pzo0JqJZLwaF+IqGCgZBVYVpIj3O+/3EDyohxkO06jFJEVTzkpd82Vdrg/A6 VDHa16pgWTjt2E7avcp5+qhFCzbgRVDEuDIaL5/QLQRW5ml6A3aw1yBVLi52PgOVguBR6p5PfaJ lvmiOsprjy1eZSST+BanbN0ZMQf59eYIzEYDuujxq8Ux4DAFNUE/0cdRz7x6a9ePMiiuyXcOxWl sIAuBPxmtMdnUu8F5gGJKD6UmolFueFtdZry9mOjghSbkZMQpSOTvEdb952fe8qWQqwGkl6054d j7oJ7lxRyQAZhUYfPwrpeE8OedRo0OlPlZeqvHRs+bMWwCIDmk6b6GJwhvDzEEHgPRKVnDoK3NX g9mnUiVtLWHNnXwt+Rw== X-Received: by 2002:a05:600c:5251:b0:4a1:efba:511 with SMTP id 5b1f17b1804b1-4ba0235ecfcmr60462435e9.35.1794333212902; Tue, 10 Nov 2026 09:53:32 -0800 (PST) X-Received: by 2002:a05:600c:5251:b0:4a1:efba:511 with SMTP id 5b1f17b1804b1-4ba0235ecfcmr60462155e9.35.1794333212436; Tue, 10 Nov 2026 09:53:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1794333212; cv=none; d=google.com; s=arc-20260327; b=edZP48qoPpHZJX+zrtW2oFSxeyuVo/QsCxHYa7ghmP3puHLCxo9sJiqSw/HHEkyTpf uUaSFvbaa09PLX2y0w2mwvr1Yj6JG3aSVL/IkHrJE/Po6N3j7MIBdYci4klYcgCmG8cw 5HEOx4wVRNhA3QE/1sI2U8chlYPJWYUnzCZ9YNMsHa+qYjSU5VYm10ZIVUvwL9TxOiuY 5X1XlFZw019rbazO7mEWDa+fePahwewAEt5dVQLq43nZcnuRfRjgVvM9600LNoAtW4HO zaYmywkNKlx/EHQUl/bzuWGh8q5dfEXiUxatXCGeA+a8VJBz9Iz8gYGP4JESl9z+q4u4 CVtQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=message-id:date:references:in-reply-to:cc:to:from:subject :content-transfer-encoding:mime-version:dkim-signature; bh=kCbugwY1UymAnF6HvOjpKvbOB9w5eBQfNjVXnDGbVI4=; fh=8+L1GLzK3OTQKnTfH5/my9NmwzU+1/k679YBeB1tMzs=; b=F+voHJHn8pGH2VkAvyG36lnUNwaof5wF83D2wv05CTsZoSSWu1AP1RXvOa/qCqMXRS /DIrjcA+tbSYXlKjz2wtl2l9PuQgcOzHMlQ3qMBaN2toUsFX88WoKOy40ZdbYoN4qAvK IN+u90GKHl45OEJKY7Wq89O3j7NXTpEtVchwS01zc6voZEAUFnNtif4v0KhKRqLlwFYy iFI8tiwNdtvgSLzGavCa3y/b2J5FkooaIDAg7L4Vz2r9E1VZ7khGDFaMBrHZvwKbkq5T 1JSYtow+fHD9Navj81575fZgjjxBVIIE/GZRgvf+SltnGAbwx8LLPjPXCAd2z+h3THmm 9S3w==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=relay header.b=nJECBt7c; spf=pass (google.com: domain of khorenko@virtuozzo.com designates 130.117.225.111 as permitted sender) smtp.mailfrom=khorenko@virtuozzo.com; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=virtuozzo.com Received: from relay.virtuozzo.com (relay.virtuozzo.com. [130.117.225.111]) by mx.google.com with ESMTPS id ffacd0b85a97d-4984a22b522si5719521f8f.162.2026.11.10.09.53.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Nov 2026 09:53:32 -0800 (PST) Received-SPF: pass (google.com: domain of khorenko@virtuozzo.com designates 130.117.225.111 as permitted sender) client-ip=130.117.225.111; Authentication-Results: mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=relay header.b=nJECBt7c; spf=pass (google.com: domain of khorenko@virtuozzo.com designates 130.117.225.111 as permitted sender) smtp.mailfrom=khorenko@virtuozzo.com; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=virtuozzo.com DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=virtuozzo.com; s=relay; h=Message-Id:Date:From:Subject:Content-Type: MIME-Version; bh=kCbugwY1UymAnF6HvOjpKvbOB9w5eBQfNjVXnDGbVI4=; b=nJECBt7cjWpV PavSjiBSc8GOlsP4B6AojeS1I/ZVM2Do9l34mi0+lM/svPv6IOcqwaR82xl35+l7qqYjsBdgKbAkp Zay/qtRIW9+c8z2Tp971YdBC7OZf96qXkN/kzdkouAwshZjTkC0ZFH+ZXkg4Oc99avISXDaexf2c9 xiin93nphSxsBS+ToKd4caXkEXNmQ8/Eo9aTm0AKgH9iJRrAETWMGp+6X+LoJtpqJToxxWqkzGkqG 3T9iurD+xlzHpJtqBxXE9K5jGUiQ3csYiQAvScAfkCwnFhR44q/I+pIDN0fa3wnkhQX+FOMqNTTbS 0qnoyYszqhaEs3nY+DdRrQ==; Received: from ch-demo-asa.virtuozzo.com ([130.117.225.8] helo=f0.sw.ru) by relay.virtuozzo.com with esmtp (Exim 4.96) (envelope-from ) id 1xQpy9-002XIa-1o; Tue, 10 Nov 2026 18:53:21 +0100 MIME-Version: 1.0 From: Konstantin Khorenko To: "Denis V. Lunev" In-Reply-To: <20261110164529.2794752-1-den@openvz.org> References: <20261110164529.2794752-1-den@openvz.org> Date: Tue, 10 Nov 2026 18:53:29 +0100 Message-Id: <179433320943.3571692.9638725304344595705.b4-review@b4> X-Mailer: b4 0.16.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1682; i=khorenko@virtuozzo.com; h=from:subject:message-id; bh=vOHfT2FsicC7Oq3p6sJundLnDb8B8xrY+dbd4aURbzc=; b=owEBbQKS/ZANAwAKAVGWCkf5YVwqAcsmYgBq81obNxp8P2yrvsuiJvI8p3SEGeYELtIuacfVN 6/vbAY7SKiJAjMEAAEKAB0WIQRWD23IPcXT0GO9CCxRlgpH+WFcKgUCavNaGwAKCRBRlgpH+WFc KuqrD/9o4BEAGz/E1jgLFEUMRXAQbmcNhYh1RGUbOMSy6jN/HTe6oa80Ym7PTpiPlHE5Hv6P8Xn GfU7EPTLsb1qn0TveY2sdyvyZDxmKTnmNCeWjaUezSCaKZr8ROs6rIanMp5wUsbRJGppNaUqRJK 1mSmXKCz7NDOSjb7w/Zmk0hqnQInqyrXFZJu/hwKuvaRGwD0JSlQuTwgbjnhbS1Miv5Tc8XDJCS fUvvm/eyouq35cHfwjVW6cRuyWONFAZrsjdmKPwz29ffx9CrbTHveok2QB+BGjoLcxojLlH/nxE 20tGqdeSM5QB5t65//dEUvyZqcDyMjxLPfMzUUYYA2/J8R/aFDmVJohplvJLICecHefNWRTj8c2 lnHF3yAH+NKFIz5zjVqfZWCX7rhpdmiJBg04ClClLGNfbOqXM9Y3ogVJlihVZbNmXRJX3tmQHDs VHw8sErJL2DkpVWgnUyMF+wa2G3tZtIk+H1S03p7+qTw8wbF0qbvzb32pKWBk0na3Mk7erHjw81 ZJlm9j49yuBr7J9Lo6XbQA2Dxa7Hmn0A+DWkRmXVVcPlLz79Ig1Yrh6MVj9Lp4HUZdVCwq2J+JW FYuT/PTX6wGt9jEObIXTqISLSJXnrnIjgQ+nuQElznzeLXEgKQIuM//LFMARkR1GVWuwe5MZHS1 sBf7ui2dY308IDg== X-Developer-Key: i=khorenko@virtuozzo.com; a=openpgp; fpr=560F6DC83DC5D3D063BD082C51960A47F9615C2A X-OZ-Fwd: true Cc: devel@openvz.org Subject: Re: [Devel] [PATCH hci-8.1] iommu/amd/pgtbl: fix DMA faults on IOVAs mapped while the table grows X-BeenThere: devel@openvz.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: OpenVZ development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: devel-bounces@openvz.org Errors-To: devel-bounces@openvz.org Applying with these fixes on my side: - "grows to 6" -> "grows up to 6" - the second paragraph split in two: when the table grows, and what a faulting read and write do, as a "- " list On Tue, 10 Nov 2026 17:45:29 +0100, Denis V. Lunev wrote: > The v1 table starts with 3 levels and grows to 6 on the first IOVA > dma-iommu takes from the top of the 64-bit space, once the 32-bit space > runs out. The table stops at amd_iommu_hpt_level. On parts whose EFR[HATS] allows only 4 or 5 levels it never reaches 6, and the race is the same there. > - write_seqcount_end(&pgtable->seqcount); > - > amd_iommu_update_and_flush_device_table(domain); > + write_seqcount_end(&pgtable->seqcount); - Please send a separate backport of upstream 1e75a8255f11c ("iommu/amd: Wait for completion instead of returning early in iommu_completion_wait()"). I created a task for that: https://virtuozzo.atlassian.net/browse/VSTOR-154424 This fix relies on domain_flush_complete() having waited for the DTE invalidation before write_seqcount_end(). In vz10 iommu_completion_wait() still tests need_sync without iommu->lock. If another CPU queues a completion wait on the same IOMMU right after our invalidation, it clears need_sync. Our wait then returns before the IOMMU has run the invalidation, and a mapper can hand out a 64-bit IOVA while the old DTE is still cached. The window is much smaller than the one this patch closes, but it opens under the same heavy DMA load. The stable trees have the fix, vz10 does not yet. It needs a small adaptation, cmd_sem_val is still an atomic64_t here. -- Konstantin Khorenko, Virtuozzo Linux Kernel Team _______________________________________________ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel