Message ID | 20250401-page-pool-track-dma-v6-0-8b83474870d4@redhat.com (mailing list archive) |
---|---|
Headers | show
Return-Path: <owner-linux-mm@kvack.org> X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id AAB6FC36014 for <linux-mm@archiver.kernel.org>; Tue, 1 Apr 2025 09:27:38 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 061B4280001; Tue, 1 Apr 2025 05:27:34 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id F0A35280004; Tue, 1 Apr 2025 05:27:33 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D323F280001; Tue, 1 Apr 2025 05:27:33 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 90B51280004 for <linux-mm@kvack.org>; Tue, 1 Apr 2025 05:27:33 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 13AC1BBFB5 for <linux-mm@kvack.org>; Tue, 1 Apr 2025 09:27:35 +0000 (UTC) X-FDA: 83284947270.20.A9166B1 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf21.hostedemail.com (Postfix) with ESMTP id C20381C0002 for <linux-mm@kvack.org>; Tue, 1 Apr 2025 09:27:32 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=eVL+6mIG; spf=pass (imf21.hostedemail.com: domain of toke@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=toke@redhat.com; dmarc=pass (policy=quarantine) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1743499652; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:in-reply-to: references:dkim-signature; bh=1ZiwmWlfT5msBPwsaS4TsFciafSUxtrnbKJoha2W67Q=; b=iKX4Ql+gErlRTgpj+EG62YdOWV0LMvZaUqY6O348ifb145DeZqXWNV0hoe+k1y5Pz79hB9 9VInvBlUzIy/Wlw2WD2qhSSiKCx+nFaCZZ/KhVvPBcQi7Rwieo8w0IVLZ19nOAcPPQKAns qUafl1jI6yx0uX775ZwokzYgFuhMjCA= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=eVL+6mIG; spf=pass (imf21.hostedemail.com: domain of toke@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=toke@redhat.com; dmarc=pass (policy=quarantine) header.from=redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1743499652; a=rsa-sha256; cv=none; b=QZdKZx3iIlR6YxudCyNlPzVR04hNZ4IXoZQ/ytJnuY/v38pnKz66AXy0EkoVF+pA71YmYx Ardq4csNh/tW1I6pxfgfFOIhdNoelk4ZPYoW0U52B84YFPO1cS0yALurtuLJcM3h1DqmHK YS7E5tBvXdydtRTaCChWfGEciHIx8q0= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1743499652; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=1ZiwmWlfT5msBPwsaS4TsFciafSUxtrnbKJoha2W67Q=; b=eVL+6mIGReCoPgzBn5hTHDZeYBH3jW4nPnKE9tqtQLVMEqhQcifEn7VbutSgBXVVVpW417 e9BvdZp0x1R9SKGm4wHrGrM3B6MF24CcfzBWcVc4vvf4rN2A/vMuhwcP5O1+7SbbNU5W46 CH+FgiIf7kzglfslwv5SSJ9cJShRA78= Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-322-FJa3OwNlPGmUIwHANneYmA-1; Tue, 01 Apr 2025 05:27:30 -0400 X-MC-Unique: FJa3OwNlPGmUIwHANneYmA-1 X-Mimecast-MFC-AGG-ID: FJa3OwNlPGmUIwHANneYmA_1743499650 Received: by mail-ej1-f70.google.com with SMTP id a640c23a62f3a-ac737973d06so286901666b.2 for <linux-mm@kvack.org>; Tue, 01 Apr 2025 02:27:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743499649; x=1744104449; h=cc:to:content-transfer-encoding:mime-version:message-id:date :subject:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=1ZiwmWlfT5msBPwsaS4TsFciafSUxtrnbKJoha2W67Q=; b=XwnL4uIW7DUhNOy5v/gZSEAl+uZ4qSlGZqvzoABObP7KDjG7WPm1Jhn91vVxuhihaX g01nw9xkXcTkNmbnsHB2n6d3Dah5jkVt9nbILcx9ao+Lg4kxaGNbEFfT2TRMwpJ0yx5G joi+y5phQ4wJSnGfbdUEVdrIzuJ4kMWjJYiNWzfoDKvDZ9swko9w77AU8HjgGzFJLtK8 xuhx9KN/aan6mPyEavKCcKinMI6qH+NROLADtQiMf4LXV64V19/foZ7skpHh0jMiY9Wk kbk8iX+vVyYr4RlJC7tyORraCTUpBfvxt1mGRqj2fP2lzOkaHj5ZOsRXITsZfXbAiC21 MfoQ== X-Forwarded-Encrypted: i=1; AJvYcCXwlSCJgFrxFuYH4y/zaRXBJl07zTs73A0MfXWvHXEK79PEgL8TQgZlV0FM5R6JN4vjhAIB4HP0TA==@kvack.org X-Gm-Message-State: AOJu0Yybun+r/7d/kBHsJVqeQ7MpmKlu+W2Q95EkrQNHgM538w9L9+Oh 2UhbJQsOWvj8HvtYGkOxKx0wxpcB2TNOEvE6sRKTj35TZTnjTvuU3IUJoM1wrEbDRpkAnBa3PiL ntrnrRvckyYt5jHdHgNFfsxaBWiXCQxsMm6GAYGKcZ5cQqMgv X-Gm-Gg: ASbGncu2/zmIE1SYnww/QmsMHBjlbq1LLlv99r8L3tIQSxt6epjHh6cVLvRmOseiVgw r7+8VYwj7YsQZDCQdwH52BVO9nQjoZneATteL/FoYORujgprKnlebUcoHZEtoXCpu9QFGKnNKrz DgqhfkV4I2WU3rA73Wv6WixVlArVpVV+S4qtMfhviIbwCVS1lWLjKuL78Vha1SQmSJZ7A4FfywQ BKvq0AA/GRMj3PnNvgalmRgUT/RMddeq7XfD6sfzyq7eI0iS7TeXggtrrUJEp52NeT5kRKeZBJH rk22yvHS6+Tj X-Received: by 2002:a05:6402:278f:b0:5e1:8604:9a2d with SMTP id 4fb4d7f45d1cf-5edfcc04fd5mr9820805a12.4.1743499649596; Tue, 01 Apr 2025 02:27:29 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHUGsT6plXzO/A1LVcdoXRQcUcCcBW0zBrJ/EkRGpYDjtXu+hVn+0Ib/LtdHGE/4da71LQe5w== X-Received: by 2002:a05:6402:278f:b0:5e1:8604:9a2d with SMTP id 4fb4d7f45d1cf-5edfcc04fd5mr9820775a12.4.1743499648927; Tue, 01 Apr 2025 02:27:28 -0700 (PDT) Received: from alrua-x1.borgediget.toke.dk ([2a0c:4d80:42:443::2]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5edc16aae2fsm6755282a12.4.2025.04.01.02.27.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Apr 2025 02:27:27 -0700 (PDT) Received: by alrua-x1.borgediget.toke.dk (Postfix, from userid 1000) id 81DF318FD267; Tue, 01 Apr 2025 11:27:26 +0200 (CEST) From: =?utf-8?q?Toke_H=C3=B8iland-J=C3=B8rgensen?= <toke@redhat.com> Subject: [PATCH net-next v6 0/2] Fix late DMA unmap crash for page pool Date: Tue, 01 Apr 2025 11:27:17 +0200 Message-Id: <20250401-page-pool-track-dma-v6-0-8b83474870d4@redhat.com> MIME-Version: 1.0 X-B4-Tracking: v=1; b=H4sIAHWx62cC/23NwU7EIBAG4FfZcBYzzACtnnwP44GFqSW6paGkW bPpu0saDzXl+M+f/5uHWDhHXsTr5SEyr3GJaarBPl2EH930yTKGmgUCGiAFcnb1Nqf0LUt2/ku Gm5NAhKTJaQss6nLOPMT7rr6LiYuc+F7ER23GuJSUf/Z3q9r7P1k35VVJkB4Vsulcpz2+ZQ6jK 88+3XZwxQOCpo1gRZQivnr1ou1AJ4SOiG0jVJGetdWgLIPzJ0Qfka6N6IpcqYfgbQc2wAkxR6R vI6YixgCgG2xPLvxDtm37BdksqQjVAQAA X-Change-ID: 20250310-page-pool-track-dma-0332343a460e To: "David S. Miller" <davem@davemloft.net>, Jakub Kicinski <kuba@kernel.org>, Jesper Dangaard Brouer <hawk@kernel.org>, Saeed Mahameed <saeedm@nvidia.com>, Leon Romanovsky <leon@kernel.org>, Tariq Toukan <tariqt@nvidia.com>, Andrew Lunn <andrew+netdev@lunn.ch>, Eric Dumazet <edumazet@google.com>, Paolo Abeni <pabeni@redhat.com>, Ilias Apalodimas <ilias.apalodimas@linaro.org>, Simon Horman <horms@kernel.org>, Andrew Morton <akpm@linux-foundation.org>, Mina Almasry <almasrymina@google.com>, Yonglong Liu <liuyonglong@huawei.com>, Yunsheng Lin <linyunsheng@huawei.com>, Pavel Begunkov <asml.silence@gmail.com>, Matthew Wilcox <willy@infradead.org> Cc: netdev@vger.kernel.org, bpf@vger.kernel.org, linux-rdma@vger.kernel.org, linux-mm@kvack.org, =?utf-8?q?Toke_H=C3=B8iland-J=C3=B8rgensen?= <toke@redhat.com>, Qiuling Ren <qren@redhat.com>, Yuying Ma <yuma@redhat.com> X-Mailer: b4 0.14.2 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: FfNRTeOdQiAjJlImn3DUF-EJPwIgy3aanqhnR5yvAAE_1743499650 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: C20381C0002 X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: 1x677483wa9gcrtseo4sqtd4hhqqepzs X-HE-Tag: 1743499652-989343 X-HE-Meta: U2FsdGVkX185oS3u71v1icRilQl8ftLN7QPH6H7VFwXKRlXH42pYcGgdEFzckIpxwGnM0Hlx0B08WgOzLwLwb0UC83oTx+kQRlXbEywc0Pvb1YD9BkcLBcK8StDe/F0dhbL6R5VUinLnl81Of49b3+cW1wVQo4NFwGOVIUrcsSz6lH5WFvXnYpeA7AKNmPLsQZDsnYCB5zdwvgRE0hN0cWSilkyRdpey58oJ9yTdtbrdgEf1HUIUJSwCL6ic8rIwo5yQgXgJ5oCH2yMlbXwoQ8zh16wbiyHSYnN4+LfWqcoY/PbYsjf7NrgDL55bva5epFQVriVRHdl9SOmBF5KGVMNTZHYAhI3DBv8NSND3xG6AmKBl9ypF8b+yh2exxUofr2XO5Aygmsqha6Nfu6W1WpxelM2CLIvD364Xii/lztUKasCx70o0oCvwrz3sKftAVBMkp/YTytaxL5icgEiT+xTNbHnA21m2a0CDmkZPNMi43sEpnH/dItshZ9RQSU6kZlRYt/0atHf6HCy5M71hVQnAOt+lpnMC6QrYRxeKt/Jhb8HdjVs7nqA9GXVm6CG2yAQF/SlGV0Xukr09aid8Fve0hmp9+ZTYmHEHyRQkzPd9EvfFIk+3xERMQp9c8dsNUN8+OKX3GA8xjMYW/2Vi6xczsFj00dLLqWBbqeXRnYQ8bVIHoIVZH6R+kU4Bheb7MUyojoylUehy2IikzxWs20fS6BtqG4JmBDggeK15ggFg4sk89fnSo8J2l5ah0+oYAP0UITsO89Gw8MJvT1JD5OjaEyiuZEM4UUeROHt6qniUOobDdbVFv8FZDMJw4do/OuDboT/N1U1lKRn8xKCt5ASVfWE1ne1qV723BjOIVeYwDcIZ+s2nvmzSW59MiEK1K6rXs+63lNh0cOSQ/TOBC5G/O/CYjeUJP8ZVoyUYwIwxQyZPKBsq83PRkh4kWnPWhQvlMoW69TJA76jtpsD B5G37xqN ShyuQk9cAA3TkNhz2C80t7vkuFeEtjCfPC64o5X9mea1o4596VZV0251nxd4V7db8TY1qshWse0O34IT7RvCDx4D683viXx5M3OSEnA/h4JjvkoyO2Sv5aPQjx2ZsI1VPEzCKqL+rM20apUsbrqI/1OtyCiKZnDRkpKI7pdwtjjBCttBfvpl83kMrAs193zPvk+aYaH9xjJiGjkpw13V57i5dP+FUljZf5ozw7S8bN4XmmQ/FkyuvuiX2yUwj6Dw3VGS9YWntvrJZg6cQVptIj33kdVx96hqG0KC+y6dTA6XIMg3SX56tffaSgxv6/zR/d3I2N3WuReDaYsl2uwMPh+78rtmM4aDnLpqeLrtmaO0W83ydi51NbP5P98sESTLjW/8S7YaAeg4ZjqK0XtJ0Mlk5YTomtZn+QMPWmsgK8rIyOaqLUaZFnOqdT1yuK8Y8q7SAnT7y1eQZyuJ4i29/2FcowJ/UFrAstituShLGlSWU9uZ6Z9r8dGST6HCViNHUmCYEXz8i+q8NrubwJciXhPmQxl6WRJXeKo3FJ4uSY4qZV+74IrSq7np6hIsxxrTsewkP+VaLS1mxRkgcoYb0utP3v1g7+ApRtF1S X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: <linux-mm.kvack.org> List-Subscribe: <mailto:majordomo@kvack.org> List-Unsubscribe: <mailto:majordomo@kvack.org> |
Series |
Fix late DMA unmap crash for page pool
|
expand
|
This series fixes the late dma_unmap crash for page pool first reported by Yonglong Liu in [0]. It is an alternative approach to the one submitted by Yunsheng Lin, most recently in [1]. The first commit just wraps some tests in a helper function, in preparation of the main change in patch 2. See the commit message of patch 2 for the details. -Toke [0] https://lore.kernel.org/lkml/8067f204-1380-4d37-8ffd-007fc6f26738@kernel.org/T/ [1] https://lore.kernel.org/r/20250307092356.638242-1-linyunsheng@huawei.com Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com> --- Changes in v6: - Add READ_ONCE() around both reads of pp->dma_sync - Link to v5: https://lore.kernel.org/r/20250328-page-pool-track-dma-v5-0-55002af683ad@redhat.com Changes in v5: - Dereferencing pp->p.dev if pp->pma_sync is unset could lead to a crash, so make sure we don't do that. - With the change above, patch 2 was just changing a single field, so squash it into patch 3 - Link to v4: https://lore.kernel.org/r/20250327-page-pool-track-dma-v4-0-b380dc6706d0@redhat.com Changes in v4: - Rebase on net-next - Collect tags - Link to v3: https://lore.kernel.org/r/20250326-page-pool-track-dma-v3-0-8e464016e0ac@redhat.com Changes in v3: - Use a full-width bool for pp->dma_sync instead of a full unsigned long (in patch 2), and leave pp->dma_sync_cpu alone. - Link to v2: https://lore.kernel.org/r/20250325-page-pool-track-dma-v2-0-113ebc1946f3@redhat.com Changes in v2: - Always leave two bits at the top of pp_magic as zero, instead of one - Add an rcu_read_lock() around __page_pool_dma_sync_for_device() - Add a comment in poison.h with a reference to the bitmask definition - Add a longer description of the logic of the bitmask definitions to the comment in types.h, and a summary of the security implications of using the pp_magic field to the commit message of patch 3 - Collect Mina's Reviewed-by and Yonglong's Tested-by tags - Link to v1: https://lore.kernel.org/r/20250314-page-pool-track-dma-v1-0-c212e57a74c2@redhat.com --- Toke Høiland-Jørgensen (2): page_pool: Move pp_magic check into helper functions page_pool: Track DMA-mapped pages and unmap them when destroying the pool drivers/net/ethernet/mellanox/mlx5/core/en/xdp.c | 4 +- include/linux/poison.h | 4 ++ include/net/page_pool/types.h | 63 +++++++++++++++++- mm/page_alloc.c | 9 +-- net/core/netmem_priv.h | 33 +++++++++- net/core/page_pool.c | 82 ++++++++++++++++++++---- net/core/skbuff.c | 16 +---- net/core/xdp.c | 4 +- 8 files changed, 176 insertions(+), 39 deletions(-) --- base-commit: 1a9239bb4253f9076b5b4b2a1a4e8d7defd77a95 change-id: 20250310-page-pool-track-dma-0332343a460e