Received: by 2002:ab2:69cc:0:b0:1fd:c486:4f03 with SMTP id n12csp193962lqp; Tue, 11 Jun 2024 01:13:34 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXqiPGNuxCH8c8UOJMPx1PMH8RCVA1wsGL7f2KaCCiZe1GuaEHWmzq0Dzc7Ty4s5jW20DfqlLCKhyUG2v+Jk0tPTl5tM9Bl++Ub6IQTEg== X-Google-Smtp-Source: AGHT+IGTL2r7QpJTgTvdBK+CszeliXNDAk1rYmTQHI9m+pxHOp1uZGE/z/3eaEUBoSm7q7EomgX0 X-Received: by 2002:a17:90a:1289:b0:2c2:ee5c:35a4 with SMTP id 98e67ed59e1d1-2c2ee5c3602mr6908650a91.0.1718093614109; Tue, 11 Jun 2024 01:13:34 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718093614; cv=pass; d=google.com; s=arc-20160816; b=UMDncLvfkpBTQ7QriLoeA9wloFnc5bgbLosv295snX5AKL4M3GAtRpQczp0ZPkXPYo 6EQt5MmXLZSm0J9VxJpPuhLshlK92n79RFBSpSDA8xs5D8sHghMm9i6j+oItn2E+7eZH IwImzPPQqZauMrGrMdNpC3INl5fBfZicCYilX9HhG3PVZ6VIF/ILVPK/YPYPE8RQmFcv GQym7KnbjG9THoW/OoAsfCtGmiaPLJ3XGG6yQ9NPdFVzNkPqoq+xdVgfHHmcwhvatVUa qRRt18kOI8nP5jLnKKEVoWJlSeZfk/fRE4W5YHE8QBSL5OEMFpwetQ95OzsjWdrrZcA8 4NpQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=kecLidF3g75Y0M4dgmXIi2U7qv7nfX0gCWhXKA3lhlo=; fh=OUnvV/bzlsut4XaHPCBRk+QfAIIh3qe7N7Lo36xHFgc=; b=cBIRHNZsdw0kqxnPPivjISQcChqW5tT+Ktafhkwfjv5Qt9CTSPPZ4QjJH6+rap42Ab +GsmoiaiOS6HLgER0e7wZ/1eEbnvHWKCdycDtKKHL/pMJ1iykD63W/i+t0V5IxZx/l4e ADtlSVkaaqzrOm5l9cUqiBxXKgg2PL03PB0VVVuOnA7+5p+gxF63a7J2k9vHodxmvaaN 1y9em+kEmBKMgfo8oBb4cnrxcPqLZcwM5Qnpp3goz4LVuiRbtam6oqTKYJAWMPUkQwtI GvtPYBSdWyKPByRhGY+iiQAnAnNLf6+assBjfiNMcvngp90XK+G2qD9ZbDDEwBr42yuB PLxg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=kqNWeP+2; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-209412-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-209412-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id 98e67ed59e1d1-2c2ca488f26si5952556a91.86.2024.06.11.01.13.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Jun 2024 01:13:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-209412-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=kqNWeP+2; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-209412-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-209412-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 66053B2B520 for ; Tue, 11 Jun 2024 07:49:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0AE6417332F; Tue, 11 Jun 2024 07:49:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="kqNWeP+2" Received: from mail-ej1-f52.google.com (mail-ej1-f52.google.com [209.85.218.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 22B5C172BC1; Tue, 11 Jun 2024 07:49:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.52 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718092150; cv=none; b=ZTiLn66I+AUAb4OmWYB+Y1B6sxCkTfugnOpZfmzoaUrioyfA33IWSNtl4br9ksP1Kk7bAgNewxsy7Ag7QjV2hOET95iFbalCZlYAMOY+KsvnVyn2jj+zkcuOAxNxn+icDgi4L9ZQpks/G8fPiKlvddebkEsc9MWYMnz4+gsfnSQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718092150; c=relaxed/simple; bh=hiTi2Z2kFvgoVOSPubuhZsugltW45Q0GMSzZrbstP/c=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=gmnSZtXIgyx9CLmVyACQWNB5zRBRkr8rbw2JbXpLMFGe6j2Ah1fqT7jnszwVzr0OtndwodQ9Ey5rnc47nvGxFPrhmFYYg/7drJwrcQLX1gfKViMD1Sc+/jS46u0SPkId2yOD9PB+ZpFJjODmRlvrXnR2/2GyZnJLjBeTuWhbaao= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=kqNWeP+2; arc=none smtp.client-ip=209.85.218.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ej1-f52.google.com with SMTP id a640c23a62f3a-a68b41ef3f6so585001966b.1; Tue, 11 Jun 2024 00:49:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718092146; x=1718696946; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=kecLidF3g75Y0M4dgmXIi2U7qv7nfX0gCWhXKA3lhlo=; b=kqNWeP+25IMcqBz/PPTvHXgNcexBiD0qWmKen69qLb0yyE0NErMIiuDNtPNGjHfo6s OVVjfE2NzYTWjqFtZUc0rja2vWHLSLKCNUBfHUPJG+ZoTDgc9cp0DTXb1qq7+CFsIWDH 1EskANF9CgiWXHeQAZdT/+C4JKbfwYiPAsJiEK1AxRuzO6da3qEJS+pD6CJb+xIPy7CH jSzmwYRDyYGibhlMIUlgMqNOYV/nvX7PceMK8tI2dpDtxl3znFqt9LpoHU0RPfhjaUlL 9r6kwFIhPNBfGWJEbv4wXkelI0cpN7hR7B+NW6IWYsccIPrkB246Ba8BP2LjFyd7wM0z 5afg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718092146; x=1718696946; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=kecLidF3g75Y0M4dgmXIi2U7qv7nfX0gCWhXKA3lhlo=; b=pEdjEGt/8iFuAYBM1FR9QELYNHivsRnSpvckMU+R2itFa7kkcPcq8AJOYBSswPgczG gKqI6cgsAP/dq1ESS4VD81IfUXAs8lipY52Qr0BJUiK5zC7+DVbSc03DE2whpG/1/v6o GYjADjreGHYKOYQvHw1oMa4tUR7CrL8Do+ZJJXfkGkr4kjDuyikIwb1LzKp2k5T6vsh8 Q+sHPPSZjVf+l3ZF9yl3t4lB/N+gLP/pQpbapMiQyW1mNEWdPhJeIjfb7XgnaQ07CKpb 43vGc8Ex5gSPGgGCqA+VROAEju8zjxhaqPPkYCSJps5rwR4zu0JmBoycxPbPgqVsrfyA o5kg== X-Forwarded-Encrypted: i=1; AJvYcCWNGNFJj4EfjytCOvm7rju+YJzBlmOonL7ec0xLfAQssBh2hOB17EpcMuDAjSH+1HfGcuA+OO+a/5hnKoL22fRBcc5DU4at2bXBaVFHU0ton6cFjHHtMNwWchn/9RHbKoK0/G5mVIYebTxvCXAqjcJkZXOlLxZ6R0vFvkULjmWg4GOi9/njWo06SWCehsuxAPpZ6FntVRlB1JcxTlvslWgk+UdZuksOpyIvLA04Psih93sJa96U X-Gm-Message-State: AOJu0YwXgCgbmqwNr11Ijs1S3o9R14BymHtIiakaMydN7yTbAaeXSewh 9gp5GRHwNnv9qCrXVbFzm2GxFZFEMOi3+TCQfi6B0/iYWb1vZieX X-Received: by 2002:a17:906:6a0a:b0:a6f:1d19:c0b1 with SMTP id a640c23a62f3a-a6f1d19c496mr372629566b.18.1718092146075; Tue, 11 Jun 2024 00:49:06 -0700 (PDT) Received: from [10.16.124.60] ([212.227.34.98]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a6f2942b02fsm145877166b.167.2024.06.11.00.49.04 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 11 Jun 2024 00:49:05 -0700 (PDT) Message-ID: <900d1d56-28ea-4c6d-b8c7-749a952e5f4b@gmail.com> Date: Tue, 11 Jun 2024 09:49:03 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [RFC RESEND 00/16] Split IOMMU DMA mapping operation to two steps To: "Zeng, Oak" , Jason Gunthorpe Cc: Leon Romanovsky , Christoph Hellwig , Robin Murphy , Marek Szyprowski , Joerg Roedel , Will Deacon , Chaitanya Kulkarni , "Brost, Matthew" , "Hellstrom, Thomas" , Jonathan Corbet , Jens Axboe , Keith Busch , Sagi Grimberg , Yishai Hadas , Shameer Kolothum , "Tian, Kevin" , Alex Williamson , =?UTF-8?B?SsOpcsO0bWUgR2xpc3Nl?= , Andrew Morton , "linux-doc@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-block@vger.kernel.org" , "linux-rdma@vger.kernel.org" , "iommu@lists.linux.dev" , "linux-nvme@lists.infradead.org" , "kvm@vger.kernel.org" , "linux-mm@kvack.org" , Bart Van Assche , Damien Le Moal , Amir Goldstein , "josef@toxicpanda.com" , "Martin K. Petersen" , "daniel@iogearbox.net" , "Williams, Dan J" , "jack@suse.com" , "Bommu, Krishnaiah" , "Ghimiray, Himal Prasad" References: <20240503164239.GB901876@ziepe.ca> <20240610161826.GA4966@unreal> <20240610172501.GJ791043@ziepe.ca> Content-Language: en-US From: Zhu Yanjun In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 10.06.24 23:28, Zeng, Oak wrote: > Hi Jason, Leon, > > I was able to fix the issue from my side. Things work fine now. Can you enlarge the dma list, then make tests with fio? Not sure if the performance is better or not. Thanks, Zhu Yanjun > I got two questions though: > > 1) The value returned from dma_link_range function is not contiguous, see below print. The "linked pa" is the function return. > I think dma_map_sgtable API would return some contiguous dma address. Is the dma-map_sgtable api is more efficient regarding the iommu page table? i.e., try to use bigger page size, such as use 2M page size when it is possible. With your new API, does it also have such consideration? I vaguely remembered Jason mentioned such thing, but my print below doesn't look like so. Maybe I need to test bigger range (only 16 pages range in the test of below printing). Comment? > > [17584.665126] drm_svm_hmmptr_map_dma_pages iova.dma_addr = 0x0, linked pa = 18ef3f000 > [17584.665146] drm_svm_hmmptr_map_dma_pages iova.dma_addr = 0x0, linked pa = 190d00000 > [17584.665150] drm_svm_hmmptr_map_dma_pages iova.dma_addr = 0x0, linked pa = 190024000 > [17584.665153] drm_svm_hmmptr_map_dma_pages iova.dma_addr = 0x0, linked pa = 178e89000 > > 2) in the comment of dma_link_range function, it is said: " @dma_offset needs to be advanced by the caller with the size of previous page that was linked + DMA address returned for the previous page". > Is this description correct? I don't understand the part "+ DMA address returned for the previous page ". > In my codes, let's say I call this function to link 10 pages, the first dma_offset is 0, second is 4k, third 8k. This worked for me. I didn't add the previously returned dma address. > Maybe I need more test. But any comment? > > Thanks, > Oak > >> -----Original Message----- >> From: Jason Gunthorpe >> Sent: Monday, June 10, 2024 1:25 PM >> To: Zeng, Oak >> Cc: Leon Romanovsky ; Christoph Hellwig ; >> Robin Murphy ; Marek Szyprowski >> ; Joerg Roedel ; Will >> Deacon ; Chaitanya Kulkarni ; >> Brost, Matthew ; Hellstrom, Thomas >> ; Jonathan Corbet ; Jens >> Axboe ; Keith Busch ; Sagi >> Grimberg ; Yishai Hadas ; >> Shameer Kolothum ; Tian, Kevin >> ; Alex Williamson ; >> Jérôme Glisse ; Andrew Morton > foundation.org>; linux-doc@vger.kernel.org; linux-kernel@vger.kernel.org; >> linux-block@vger.kernel.org; linux-rdma@vger.kernel.org; >> iommu@lists.linux.dev; linux-nvme@lists.infradead.org; >> kvm@vger.kernel.org; linux-mm@kvack.org; Bart Van Assche >> ; Damien Le Moal >> ; Amir Goldstein >> ; josef@toxicpanda.com; Martin K. Petersen >> ; daniel@iogearbox.net; Williams, Dan J >> ; jack@suse.com; Zhu Yanjun >> ; Bommu, Krishnaiah >> ; Ghimiray, Himal Prasad >> >> Subject: Re: [RFC RESEND 00/16] Split IOMMU DMA mapping operation to >> two steps >> >> On Mon, Jun 10, 2024 at 04:40:19PM +0000, Zeng, Oak wrote: >>> Thanks Leon and Yanjun for the reply! >>> >>> Based on the reply, we will continue use the current version for >>> test (as it is tested for vfio and rdma). We will switch to v1 once >>> it is fully tested/reviewed. >> I'm glad you are finding it useful, one of my interests with this work >> is to improve all the HMM users. >> >> Jason -- Best