From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-vk1-f175.google.com (mail-vk1-f175.google.com [209.85.221.175]) (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 DC972289340 for ; Wed, 23 Apr 2025 17:15:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.175 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745428542; cv=none; b=UgHRS8lJOYpHoYWVbT0UGTO0Wd4xEIUA7F6wpNGmQqTSAbVlT/m92QLO1bXRkSK3JS3exlm0G1oUIPMe8Cc/14z3NUMsC1GocLi+FdlL+qz+ivF+fk2/WEaA1ok+gbpHpLLuqFmk4HprFz9hUnLNEQ+i9ZDBdq5EpJObY81fzxY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745428542; c=relaxed/simple; bh=ZSWmIXnoHeqHpg22is4DCb+FQUxyjWQhdchI0xl2uAo=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=SSyAqLlXouc5qSL7NvSNGwqjv02EeZKhY+rOhFQSk5v2+IoSfqATYdHw8BpTEbGbZ+G1oDqDf7YpGW/30f/e8Y8aaePSdPRBS7/10xloLFAeeWCBIkhhVndZYlI6eeqDpZKLE9TYpQDRaQyJq7Zb5exmL5MZOTU0pOfDOXI8M5w= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ziepe.ca; spf=pass smtp.mailfrom=ziepe.ca; dkim=pass (2048-bit key) header.d=ziepe.ca header.i=@ziepe.ca header.b=f3RJOF+9; arc=none smtp.client-ip=209.85.221.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ziepe.ca Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ziepe.ca Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ziepe.ca header.i=@ziepe.ca header.b="f3RJOF+9" Received: by mail-vk1-f175.google.com with SMTP id 71dfb90a1353d-523de5611a3so46966e0c.1 for ; Wed, 23 Apr 2025 10:15:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; t=1745428539; x=1746033339; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=sAA3ahIS+2Nb+9ARKVTXCSjk2uwR/TOFzjA5DEQnqxg=; b=f3RJOF+9I5aUeLfKwhY41cyNNsV/7gzE8mnt0B7y7vbeRVxS8lsyPkRNroBYBI3tAJ LoOcUnWESA/cjHCPlWjRHA3M+53oDTrejya0NpMfeL6ljH+lfqQ/w5WsXx5ptqIdwRDv nsp4EdSeE1qB0xl7OhzzYJKM36aE0m+MI2XLpfk6xpvXrCfNBJoewKHE7+njIVYSVVE9 uh237S2zCPLxHmND8hCSoBynFpTclSrt0aPYz/VfLhJATgS9agmNsggyOtAJAI5FOQCt Odf2Xxn7vp+XAbxZin8Yl6xswoHmQ5A7Db9GS23ti5naaSYjMpciujFTq8n0nXWju1+8 8EaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1745428539; x=1746033339; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=sAA3ahIS+2Nb+9ARKVTXCSjk2uwR/TOFzjA5DEQnqxg=; b=VZb6HGkyuYBN7jH19gKpkXeKdiolQAUjOYeqDH8MawyZoaBHCb5YslOwZhFad8kJq3 yQeoHOEeetFRZFx8vs7EJB0GiJ+HuT5WxDMSslWCtaMRb3M85iIne69Rkt4WchaI/6dY eN4CPKnnu1K5/uOGr+8DL2Qd3L3ciS2NVfi5zFy0jVFldAlN/h8pm3DEdQXamF3+8btX Vn2Eu+23rWUitvInGnaqg4PDcmQxUMKXQsFmZLiws5m5znXK5/2B/p3tAkDHwR7+YH+p xP+FHDarg7KcNhG/YobT/in2+9TrgDKyKNHl55ncEelzGtPYZMt70Odsk6qUrfVVBnWn YCDQ== X-Forwarded-Encrypted: i=1; AJvYcCWOJH6Hd7HP76cBw2jxYRhVpo5pCyvtop9YJ75EVXYCIcc2XCUpku65NWCWb/2B+AZu+hUCpIe+tcU=@vger.kernel.org X-Gm-Message-State: AOJu0Yx8Fg2DEBFyTK3xzPooOfbSX7JJ5Lt4i3kewsBNW+GG0dZIdK/b oLKCYgEMuL+hOD+COgG9v5QcsE/Mdq0HXJO8oA4Owi6WA3j9FO/L4WvOoh7BE98= X-Gm-Gg: ASbGncth4k7+fAXRtDfMa+FWY7rgbgETjMJDju4DWAesD8Saz6QsQXqzJQoVp+cBFVg 7QWslQop+ffPnAg37hoNQZg2HvQVm0KbV25StxdfnrOmCAm2QvfbBphDN8UQVhqUleZ9qy8/86O q2PqtOAvaGOY13vlWSahOO73DUDcjPWTTor30zPV8CF446HFwzBYlhPw0DnB+24krg9qls+eFiu K07f3QfES9YvYAcVNNxaNp0QhRRK0KuFyzz6sHpKW5eCszPhaahMjRW4X+SGVVq3/zw/huFaGFm hG91ztMCV9eq5xjqac1mJ4M6ya36+R1qSMP3JqF9FgKMvwbvsZWMEzjjACNscprPGmVfP9T25xL 8pV0okSzStBA9Phv1Tlg46HblXs0g7w== X-Google-Smtp-Source: AGHT+IG91ka296h4XrJ4QPDo73jdYlZoOj1Zkc9PInMILwbVuqXEZMd5w4C/WgEttaatAxBubBvu3Q== X-Received: by 2002:a05:6122:3c54:b0:529:24f8:dbdd with SMTP id 71dfb90a1353d-529253da601mr17813854e0c.4.1745428538734; Wed, 23 Apr 2025 10:15:38 -0700 (PDT) Received: from ziepe.ca (hlfxns017vw-142-167-219-86.dhcp-dynamic.fibreop.ns.bellaliant.net. [142.167.219.86]) by smtp.gmail.com with ESMTPSA id 71dfb90a1353d-52a74d3a2d0sm79186e0c.40.2025.04.23.10.15.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Apr 2025 10:15:38 -0700 (PDT) Received: from jgg by wakko with local (Exim 4.97) (envelope-from ) id 1u7dhB-00000007LQW-2UhV; Wed, 23 Apr 2025 14:15:37 -0300 Date: Wed, 23 Apr 2025 14:15:37 -0300 From: Jason Gunthorpe To: Leon Romanovsky Cc: Marek Szyprowski , Jens Axboe , Christoph Hellwig , Keith Busch , Jake Edge , Jonathan Corbet , Zhu Yanjun , Robin Murphy , Joerg Roedel , Will Deacon , Sagi Grimberg , Bjorn Helgaas , Logan Gunthorpe , Yishai Hadas , Shameer Kolothum , Kevin Tian , Alex Williamson , =?utf-8?B?SsOpcsO0bWU=?= Glisse , 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, linux-pci@vger.kernel.org, kvm@vger.kernel.org, linux-mm@kvack.org, Niklas Schnelle , Chuck Lever , Luis Chamberlain , Matthew Wilcox , Dan Williams , Kanchan Joshi , Chaitanya Kulkarni , Leon Romanovsky Subject: Re: [PATCH v9 03/24] iommu: generalize the batched sync after map interface Message-ID: <20250423171537.GJ1213339@ziepe.ca> References: <2ce6a74ddf5e13a7fdb731984aa781a15f17749d.1745394536.git.leon@kernel.org> Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2ce6a74ddf5e13a7fdb731984aa781a15f17749d.1745394536.git.leon@kernel.org> On Wed, Apr 23, 2025 at 11:12:54AM +0300, Leon Romanovsky wrote: > From: Christoph Hellwig > > For the upcoming IOVA-based DMA API we want to use the interface batch the > sync after mapping multiple entries from dma-iommu without having a > scatterlist. Grammer: For the upcoming IOVA-based DMA API we want to batch the ops->iotlb_sync_map() call after mapping multiple IOVAs from dma-iommu without having a scatterlist. Improve the API. Add a wrapper for the map_sync as iommu_sync_map() so that callers don't need to poke into the methods directly. Formalize __iommu_map() into iommu_map_nosync() which requires the caller to call iommu_sync_map() after all maps are completed. Refactor the existing sanity checks from all the different layers into iommu_map_nosync(). > drivers/iommu/iommu.c | 65 +++++++++++++++++++------------------------ > include/linux/iommu.h | 4 +++ > 2 files changed, 33 insertions(+), 36 deletions(-) Reviewed-by: Jason Gunthorpe > + /* Discourage passing strange GFP flags */ > + if (WARN_ON_ONCE(gfp & (__GFP_COMP | __GFP_DMA | __GFP_DMA32 | > + __GFP_HIGHMEM))) > + return -EINVAL; There is some kind of overlap with the new iommu_alloc_pages_node() here that does a similar check, nothing that can be addressed in this series but maybe a TBD for later.. Jason