From patchwork Wed Jan 18 18:00:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Gunthorpe X-Patchwork-Id: 13106882 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9CE06C38159 for ; Wed, 18 Jan 2023 18:10:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=oPvnfJWzI9g1c39Rtoj7GPiV4sFY+8+AVgvmZDKKbxo=; b=JXTnN8uxOZsT0m BCdyPzQhvhtZo6g02ufgR6zBn6Ly2qkTmQ7acz824LDKdb08Nmvt/FH7JqpmBWxm+vhFozVKEj24a dU1NVz2GqMU4tF/Xe5OFEsZQDB5393WIdfLA5mYRvoHWLE1/HisYmEQGqbs4mlc7x5iyh+w7VMwkD FUQ9k8+PWNhjBWy4s48uFxkcMcLDl0WzUPR/37hq1UBY9925Vp7kU2TvCOLhIlzXu+skLQAEkGr/4 AK10kLyXbR8RB31UWrPCiQJKclxwciOsPm2WCB5aZ+DWS9bthB0dvGaOHBQkr9b6mZk+tirnoVPUX XjWFglrM+TTnXvKj4gSg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pICro-002CjR-0W; Wed, 18 Jan 2023 18:08:57 +0000 Received: from mail-dm6nam12on2063.outbound.protection.outlook.com ([40.107.243.63] helo=NAM12-DM6-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pICkC-00299s-UJ; Wed, 18 Jan 2023 18:01:08 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=b83gBiPSSsb14AVKvi1HBOtjheXFjagdsSRJfqakIFLmNfwUcBIp3FQaX+Q26xTDjyEAOgJTKf/+MNMRd4Ci+0wejL3ENaK2ZNIPK3NrnC47SQ0P4/PwsEZ7+78/eCg4CeXAwnuBcDYYDPNEcfRGDy001MUq80wIg3QJjO2YaKhrboO3juF1MmFFHTNmaqy4H6LqvHt6rzRzukhgyMX8BcswN2laocFzfbzm/tP/uin99Yt/D6gh8dsAgy87cfus4GNB6zy0ZyKWpQbu1MSWTlZSmCQFUs4FV+bxqoCk8VdWLAB/uCceRGCmzspX3Wq/LVz3J8rnLp+QAU+QPn+12A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=i28832YwpvUJbHlTSOfIPaYAPWwxtMVLBQ1NJ2uFvIs=; b=KJfNJ0Uc473qv0uSwI0jLzEs5yZujhCUZfIlS43l8p0sgD6cmWERbeGserqsFiENhX0p1mrpY8k5gq8kdcfSebO1VwFbLH0ZA418HVWbJHMQh8FJwXYtXuJp3AAeHz7j+ihdY6w90JB7jFMuWeVUkGNXFXCqz/dO2euh1NELN2qfcL4g5OG6XS67dY67c6waNSMzXouFCLzWyOeeiZReWdndsc7oCih4B5SwNv3lxf7YftQ5Fc/Tig/FCbHE9TzYhSdmyTFEvvZUuYfLidiIENZtnHZSEJYAQS+HV/CGbphcmaCa8Myh3kuZtyjqjq8yUH1y7CefsneAe0lA8J/2fA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=i28832YwpvUJbHlTSOfIPaYAPWwxtMVLBQ1NJ2uFvIs=; b=fHM+LdaFx5q7OjQ+Qb0rCCL7c8X8lPPC8rg9Cua2nMoIcWqLLL++dN7EY//pYEJvx5JFNmgst4FCBcxz4SKRZj+99Ghe6DUewGOa7HSBJoZsbNLq5L8hab2AyomYs0p52pbkrtPYEA9jDc8uPo4oq55qZkFGBeFmojHHtlc2qZuosoaYSAwalQupZ4EHNXKLKkLM9KPvBJSjO8TYflME/Y7jZxvtOiciEzfzH8WBT5pkZuOCv+8tZ/OG6mtL17kcsFRWVP3IQU/bW2EaCfJXLDbqF+VKvBaoGF479XgqEv7RA0z6HZATeuzHELd1rDwqQwBVV76ZCvHggj0edd8K5w== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from LV2PR12MB5869.namprd12.prod.outlook.com (2603:10b6:408:176::16) by DM4PR12MB5818.namprd12.prod.outlook.com (2603:10b6:8:62::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.23; Wed, 18 Jan 2023 18:00:51 +0000 Received: from LV2PR12MB5869.namprd12.prod.outlook.com ([fe80::f8b0:df13:5f8d:12a]) by LV2PR12MB5869.namprd12.prod.outlook.com ([fe80::f8b0:df13:5f8d:12a%9]) with mapi id 15.20.6002.013; Wed, 18 Jan 2023 18:00:51 +0000 From: Jason Gunthorpe To: Lu Baolu , Joerg Roedel , Kevin Tian , Matthew Rosato , Robin Murphy Cc: Alex Williamson , ath10k@lists.infradead.org, ath11k@lists.infradead.org, Christian Borntraeger , dri-devel@lists.freedesktop.org, iommu@lists.linux.dev, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-media@vger.kernel.org, linux-rdma@vger.kernel.org, linux-remoteproc@vger.kernel.org, linux-s390@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-tegra@vger.kernel.org, linux-wireless@vger.kernel.org, netdev@vger.kernel.org, nouveau@lists.freedesktop.org, Niklas Schnelle , virtualization@lists.linux-foundation.org Subject: [PATCH v2 04/10] iommu/dma: Use the gfp parameter in __iommu_dma_alloc_noncontiguous() Date: Wed, 18 Jan 2023 14:00:38 -0400 Message-Id: <4-v2-ce66f632bd0d+484-iommu_map_gfp_jgg@nvidia.com> In-Reply-To: <0-v2-ce66f632bd0d+484-iommu_map_gfp_jgg@nvidia.com> References: X-ClientProxiedBy: BL0PR02CA0142.namprd02.prod.outlook.com (2603:10b6:208:35::47) To LV2PR12MB5869.namprd12.prod.outlook.com (2603:10b6:408:176::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: LV2PR12MB5869:EE_|DM4PR12MB5818:EE_ X-MS-Office365-Filtering-Correlation-Id: 3a42fed2-83fa-4c5b-cefd-08daf97decd0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: bTRKsduCS9s79AzQ2MPbrMF5hpDqAKyzymEHViYRnb1C1srzo58F3QjMCR4Hw6VIDvEXjcHw8aU7hoN6luCW0VnMQynULsRy1mmXvTrspYlF6GLwX7q49f/CXp5LN3U1tsLu2lOjasz3QV3QZD+ahgW/YVsW3KfdllkSrLk8YBi0rb5qUuye355+Z1l05faxOwwrjE1H5H2Ew5x93+eavvKDn7ywOn2C/Vd6Gvf6oK3QVcZ8y6MQfGb/Wfv167/4NY4O6xpbvlLmmEE31SyGculxQWiRkMrOdw7Fs0Tb/2hED5tUJBOxQCP3shI+sdRZzZqtdeHpUuCO8jxt0uZR/5B9R4Cn5+UZky9Rw83DIB0lVEjQuangj7zbzoMyD7kD//xU2Q2fqzmIpMH17KYGRHqScFprt3fjsTbs0zFcNwAbLk4ayIRsZrKdBO6PFiAjT0piW130GV+OXXIC7m9c0Xy/Sr14qQPZsXURab7B609fEaErIWbMqCFV3xT/xNVHXiCku4nChXZubUJQelPoIUOnxqW+J3VXu10GiRyeXDlzGQ0hdgCXNvNbdltr83urYejgTIindmlknZ+bKBqj/kA+ZZYE0SeJt5cy4OqjAVduTc4zTwLBN7fXLS6BLJnhMCknduphZ4UZosDPKWTF1pZQKGC/zJvzciSrm1gObSMKeifNu70bHJpcVUnR2Aol X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:LV2PR12MB5869.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(136003)(39860400002)(376002)(396003)(346002)(366004)(451199015)(8676002)(36756003)(83380400001)(41300700001)(8936002)(2906002)(66476007)(2616005)(110136005)(54906003)(4326008)(316002)(5660300002)(38100700002)(86362001)(66556008)(7416002)(4744005)(186003)(6486002)(6512007)(478600001)(26005)(66946007)(6666004)(6506007)(4216001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 2f0Uut1aescwxLLm2nudPyU7lR6i3Jh6wJTsepXy+lAJ3Yrq567SDzNCsuxOn7miKfQDY2iNpOCM0oXGyjx7IP/msuTEWpM9zwBvY4XHYwUcoGKFk8rIOzUH2gAEYWSAnHJzOKncKycY4axodL28uBXKM0t9vCXSr5/shLIl7xeqb1gB1KVWDYLtjZL3sWa+4vWwCZgA8fpatbmj3WOyIj+VFQd3evRCQMTrJozUSTQ9Ok6hBsewM+03m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sjvqAlyD0GBGZC60bv+S6cSRKi+qjIKGwbsrirt41SwG4LxNh3T3KbTTu2C14OaCNtxJFaZprakT0lNhYalLQ5CuTRDGxouYpZm7Pf9D+5YlgWFpIsdVbJxRsb27IAJ1bIzVXiz3cx+GqC5I2W+8TsUnA3HSb0hriInCtJL4jCBbbZrHYEZi5PrbhrASDoR02hMQZR3a8/x9e24xd9iZM4bRAd6fXAcNMhOKRq5hWo5a96jnjAuMZCUuwE9ngtT3S/kE9NACeLv X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3a42fed2-83fa-4c5b-cefd-08daf97decd0 X-MS-Exchange-CrossTenant-AuthSource: LV2PR12MB5869.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Jan 2023 18:00:46.8806 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: mzD/OnsX4Ro4ty43+yJ9jWAKT/OVO/tqlP+BiA2m7qlXlZRx8unJtenyDPa2RjUd X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB5818 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230118_100105_044684_E81058CE X-CRM114-Status: GOOD ( 11.60 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Change the sg_alloc_table_from_pages() allocation that was hardwired to GFP_KERNEL to use the gfp parameter like the other allocations in this function. Auditing says this is never called from an atomic context, so it is safe as is, but reads wrong. Signed-off-by: Jason Gunthorpe Reviewed-by: Kevin Tian --- drivers/iommu/dma-iommu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iommu/dma-iommu.c b/drivers/iommu/dma-iommu.c index 8c2788633c1766..e4bf1bb159f7c7 100644 --- a/drivers/iommu/dma-iommu.c +++ b/drivers/iommu/dma-iommu.c @@ -822,7 +822,7 @@ static struct page **__iommu_dma_alloc_noncontiguous(struct device *dev, if (!iova) goto out_free_pages; - if (sg_alloc_table_from_pages(sgt, pages, count, 0, size, GFP_KERNEL)) + if (sg_alloc_table_from_pages(sgt, pages, count, 0, size, gfp)) goto out_free_iova; if (!(ioprot & IOMMU_CACHE)) {