Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp2411854rdb; Tue, 3 Oct 2023 23:26:42 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFGFIFv/qd8KKQWIdpfA04TW/qNiRujZbsS7yZqVbEzHAEesbOhCVTCOYR/Gq2UFeg0xves X-Received: by 2002:a17:902:7008:b0:1c5:cbfb:c16f with SMTP id y8-20020a170902700800b001c5cbfbc16fmr1347239plk.25.1696400802387; Tue, 03 Oct 2023 23:26:42 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1696400802; cv=pass; d=google.com; s=arc-20160816; b=SDEhYY6f63he7iPUKbYHvZWNpQFjyZeanLvxIlXMGhGLGYxHtNgNDoJQIJUhI5S3pS +JoloaYGceJ6pooL+z9NAt5JqNQrRFG6CuEAxmxe2sKnQ8viszHyMHVtkUhOt33hFdop sUMSaJbfz9qa1RLptueAXFaNoAJkGPmdNW5ortjSM5rtyoJqOf/g8DCNcRdUo6fKyvCt ecRKTV5sREfTnVezrvv2seUtT6uMtr4CSvuY+ynN+ML9CX0cQIIOiEi62XXRr4sBwhGz 9Rq7KObksHzvuOFIzUnLsi+LSCyI0J+qxdmWx0BC0SqryC/3kbscAdZL9l1TKzpadcgy CNEQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :in-reply-to:from:references:cc:to:content-language:subject :user-agent:date:message-id:dkim-signature; bh=oyNcEQFk9s11nRzIFaJp0XhsAi8cCRh08F+qa/fUztk=; fh=m1Gk4F5wsAP5TadUUuPScVi8uoWyPFaG8XR6TTLZ2ao=; b=RO7EU0WJLFXnpfhK6yaUNjVrJ0s2BcXj63eK4C+qzKZg49ayPwQYHehRBa0j/GVzUt g/awWNQI1iOAkWLnrhd26CSbV0l4agEGoEdEONVCutewf+kMlZ4eu/bv9tInMk+pZccd XQYQrMCc3vs23KrGs5xuNS1q1l3kVxGGC4MvuN6dZwMqUOFAwZchcXUHMO0Zb4QbGfo7 RXxsXrpyEOxwcAV706myGETlG5KCGPpiRkfHBtoSo8mvtTInwXWX4M5Sgn7aDQIwB5iz 7R3rMKAWOC44AFRP0g+jbcnqWHtwg0L1dIeAoeRYYcMbjawEDgrzvWdtpa4ngVppOYq2 vuWg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=D5VPpcaR; arc=pass (i=1 spf=pass spfdomain=amd.com dkim=pass dkdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Return-Path: Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id m12-20020a170902e40c00b001c589ba4a04si2886620ple.24.2023.10.03.23.26.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 23:26:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=D5VPpcaR; arc=pass (i=1 spf=pass spfdomain=amd.com dkim=pass dkdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 40EA08328AFC; Tue, 3 Oct 2023 23:26:41 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241385AbjJDG0i (ORCPT + 99 others); Wed, 4 Oct 2023 02:26:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52380 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241377AbjJDG0h (ORCPT ); Wed, 4 Oct 2023 02:26:37 -0400 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2072.outbound.protection.outlook.com [40.107.220.72]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0379CA6 for ; Tue, 3 Oct 2023 23:26:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=G9jqWu5lKZYUnxypNdB/BJINEkZGUjjWWHweVqnVUovQqEuYdlX/vVm/wE4iYUfOoT2TD9bzJIRVNPTvOpqIcdQgcO7xFa8okw/bgCzEnKaRtiFmTYg/vRF9KBsFki0YVEewsRgIhNOyNPyuJS0MJq1BdysgSUiHSsX7TpJl9ueimbvjfqSKstD/hduP3UzEmpWYxGwrh3vRb589k64zx8J7PR71TSMEyjk7VsLsBOrCuDwMQrnSi7dJUr7l84DY2cq17aTLZRxO6Ts1e6Qp4nV2AAzmxDyEGSaVgPFWcKZFB2Xr1JlzlF0lX4iuIg5/TJgpi0lQ9y+oxlwDFtj85g== 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=oyNcEQFk9s11nRzIFaJp0XhsAi8cCRh08F+qa/fUztk=; b=DFScXOjd/83iMQJhggu6LITMq8ILlaGT1XA4Fur7z/7p2ZUAtp0knYTN78OVhg+9rqWCy1TI+5Q69LoxMf+YCWoO61oO4Z6u0wciFSAWDVc2rO/rKgO6AXAP1I2lhqvg4HkmKv0blxl892prmJlc20lROkbwcNiKf5dXvOEdZFK1yRT9GLq74fUrBNr2NMmY2LcWQyQZYN3IFwOJZrXSjCoSbPy07Kp1ujGacnJGXuZ9RxMRnfZ66jbVgxq/QK1b1L+QG8cHOWg8+HGlAo/WX6R97CGKcT+/xGgdTlbJoHGyrNS/agTvVIPodQnktIkAWfjDuU6JdeaXLo/7BB73dQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=oyNcEQFk9s11nRzIFaJp0XhsAi8cCRh08F+qa/fUztk=; b=D5VPpcaRn6EgUpcUhgQ7+ohiDMFfPYXOd3WWXkuvuTmJrjK+DEiWxVmAp9hgiMnB6Zikc7Z4uWOdh4snb91/XcuLEWn7CnOa7j3I5ox6HLO2sHU6le7s4SXkVklNNeTLF6qH5XNNtKxrxxP93TsXXFlh9SmhoKgrMJjatcx2+UU= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; Received: from BN8PR12MB3587.namprd12.prod.outlook.com (2603:10b6:408:43::13) by IA1PR12MB6331.namprd12.prod.outlook.com (2603:10b6:208:3e3::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6813.20; Wed, 4 Oct 2023 06:26:30 +0000 Received: from BN8PR12MB3587.namprd12.prod.outlook.com ([fe80::a7fa:4411:67a3:131d]) by BN8PR12MB3587.namprd12.prod.outlook.com ([fe80::a7fa:4411:67a3:131d%4]) with mapi id 15.20.6838.027; Wed, 4 Oct 2023 06:26:30 +0000 Message-ID: Date: Wed, 4 Oct 2023 08:26:26 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.1 Subject: Re: dma_map_resource() has a bad performance in pcie peer to peer transactions when iommu enabled in Linux Content-Language: en-US To: Robin Murphy , Kelly Devilliv , "joro@8bytes.org" , "will@kernel.org" Cc: "iommu@lists.linux.dev" , "linux-kernel@vger.kernel.org" References: <13d73200-2d53-7f95-fb93-5b5f422251cd@arm.com> From: =?UTF-8?Q?Christian_K=c3=b6nig?= In-Reply-To: <13d73200-2d53-7f95-fb93-5b5f422251cd@arm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: FR0P281CA0005.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:15::10) To BN8PR12MB3587.namprd12.prod.outlook.com (2603:10b6:408:43::13) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8PR12MB3587:EE_|IA1PR12MB6331:EE_ X-MS-Office365-Filtering-Correlation-Id: ecc8777c-778b-4292-fef1-08dbc4a2d87a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: IfEwoz3Y5M8qB/aoWisH9/OdaenO1USrj10bsyEESBzpnB+uUHmF8b8bXT1P9lwwoRgP1tkPdbTYkRoA2gY7fhKQoGxxAGJTKYoYV7fT1x6crZNk0LwknZvO7ZigoeqQ1noX0xUBB42qDwugqL7kwwh0BE9365ufaazoFWXOOAcQ4zBZvtyrrusWd8UF2Tg2M/nLbcGnfIVC3MFqXMXIxowKPPFYDXVqZ0Lnh2Gz7OlVbgvqDqxcbdg8MpKGXIBd85jTFXW7eXlSem0O7SC1ZGI0df1kIDvV45deHLXzm5x6SGmQ5mckDOs+DriPSvVHKRT7BYOWXTphXbvYg3uDwbeHJsUFDGulKaFcUM09yBZAgq2tACuQ64mfIUHOgsf48HK0r37ukCd7ea5CrolRaIEaLC8I1sfk5hENR+dspZCmB+wROJAc84Va+L7l+SRdT+JVfAPmA852Fv9TJO83nBKrYu6BMLUWFc12n1+qZOm2LdGf6RrMaX8K0JY155vAASWosIh6jOHFK+yxoU2JS6L5OgEHNWDOU3I9ZmkCq/ySZEjHevMbOohOxFEazzTB8WQgMqNtzcHJQir9ccou5rdZYuz3lNJiJlKXsSmjLB3v4aPaTpQnsWpdG2X4EogdX06UBkfDyGaAEv7GVvvBDw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BN8PR12MB3587.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(346002)(366004)(136003)(396003)(376002)(39860400002)(230922051799003)(451199024)(186009)(1800799009)(64100799003)(36756003)(26005)(2616005)(5660300002)(83380400001)(6506007)(41300700001)(8676002)(38100700002)(4326008)(8936002)(6486002)(6666004)(53546011)(478600001)(31686004)(66946007)(110136005)(66556008)(54906003)(316002)(66476007)(86362001)(31696002)(6512007)(2906002)(43740500002)(45980500001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?MmcxUkQ1Y0pNNmtsWnM5V2pNck03SmtlUlYvbUVHY0RQeGRxODBNd1pEU2xq?= =?utf-8?B?Y24rRmZkenc5dmZGUGYzTDU2SHdRNjZEc2J3NXY3ODAzM1JDSWRINHZzcUxz?= =?utf-8?B?WS83Sll2UGxvbXpVV2I3eWYrWU9yTGV6NWdZR3VNdjRhdlJ0b2dQUXpHa0JY?= =?utf-8?B?ODU0YTFCaTZzTG1EUTh0ekRzSUs5V1BvWFgzT2ZyajIzcTdkOUdxUUttaURu?= =?utf-8?B?eFZHMUlLTHFkWVBEN0tHQWg0R0dERysxb3doWENTMmRzaWVLNXhkNWdLcVdK?= =?utf-8?B?bmpjeXRkZFJMUURGNWdjY3ZHb3drSWlPbndPOWl5RXVZTGI2UHpLdHpnV1Zw?= =?utf-8?B?cWhodGRNe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: ecc8777c-778b-4292-fef1-08dbc4a2d87a X-MS-Exchange-CrossTenant-AuthSource: BN8PR12MB3587.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Oct 2023 06:26:30.0922 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: VD673md6vsCpXpRcgwT24ZTGp7RU8hE7cQPzHb/dbgOSdak+fNa7Kb/CYBhmd/9k X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB6331 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, NICE_REPLY_A,RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS, SPF_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Tue, 03 Oct 2023 23:26:41 -0700 (PDT) Am 02.10.23 um 22:08 schrieb Robin Murphy: > On 2023-09-26 16:30, Kelly Devilliv wrote: >> [SNIP] >> Hi Robin, >> >> Is there any chance to extend the dma_map_resource() API as discussed >> above? > > As Christoph says, no. There are things one could do to make a > minimal-effort bodge in a downstream kernel, but upstream we already > have a dedicated PCI peer-to-peer API, so we have no reason and no > desire to also attempt to crowbar P2P support into a different API > which isn't designed for it. Sure there exist some drivers that went > ahead of the game and did their own thing before we realised that > dma_map_resource() just fundamentally wouldn't be a good fit for P2P > as initially suggested, but all that means is that if they're still > doing that today, they're now lagging behind and it's on them to > update to the newer solution if they want to benefit from all its > goodness. Note that this isn't just maintainer semantics or relatively > straightforward things like memory attributes; I believe the proper > API can also handle stuff like direct P2P when you do have an IOMMU > but don't have ACS upstream redirect, which dma_map_resource() could > never do. The problem is that the new API requires to have struct pages for PCIe resources which the graphics drivers absolutely don't want to do. Allocating struct pages for memory mapped I/O simply doesn't make to much sense when the underlying resource is not even memory. Regards, Christian. > > Thanks, > Robin.