Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp480387pxk; Wed, 9 Sep 2020 10:14:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx9+rJEnzl/gytZYwYfUMgXJGEdNhIbGYZMVkHOzut+LNTRnwclToK7etS9szZ75EFdEHzT X-Received: by 2002:a17:906:8245:: with SMTP id f5mr4437380ejx.264.1599671642681; Wed, 09 Sep 2020 10:14:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599671642; cv=none; d=google.com; s=arc-20160816; b=XAvvKIXlJh6DXVbbJ8a0drqBAptuS0B93TgU6oGiOP2YmuQC9/PfpKXsy6F8bp63Uu jUBm2Y02KwNfikgnBCk5VowknNdLnPL1WkKaim0uALAMFqFQsi0n/AZxsxKXH3munWqZ lGZE4xj6h0LGdeZp8A3s8D+4suPpGLLZG15ukD635UyjWIm/NBButhoKcJAk2TPx4Xpd yLVHAjIBqE5Z5JOC4vAviqBqonwezBIbAvvwWWjyNj4PDa8xfWbHSXEutC2s6TpUkvgO eCxPpda9NiaZOxiwPgPK2t0skoupMaJimf2NZml3zeNaQTQVNHECwgTgLZx1aqJfdcOY B9Yg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=ckIFVGgJHCBY1cA5MmiDi5JHd3+uJkL9F5APYSbHoys=; b=KE9xrWxWb/s62uDu65xr/+oCvOtJ7KSgrR0nX7ghsZkfG94ZYSUgPCeEsIwFzutMw8 ohPw8bRnnADTrUXgY2XkzgI9mUmr9HkWWIkNyz4sty/khkpKOPyFxlY1Q1CuGQnHZn4+ tVg+SHHGBF3gZ/DS9Y8tWFudf3OMnARb4PMksCdgxx3GJIwPwj6a7TA4Fp6VU5VDdXDt RHUEzz+A203FqRC0RhBctsNSZrctP0xO+GlnpCTjryM2+9VK8J/IgpN9NLSO7Ea7f/bS wGUqkXLyKIMPxeh7OiY3zuVK9vMtKxHrqyCrH2QHWnPeKbUeuaGHmyo7wf+v7yRzprCk sJUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b=T9wd52lI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b19si1987560ejk.429.2020.09.09.10.13.39; Wed, 09 Sep 2020 10:14:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b=T9wd52lI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731131AbgIIRNI (ORCPT + 99 others); Wed, 9 Sep 2020 13:13:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47556 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730280AbgIIPcY (ORCPT ); Wed, 9 Sep 2020 11:32:24 -0400 Received: from mail-qv1-xf42.google.com (mail-qv1-xf42.google.com [IPv6:2607:f8b0:4864:20::f42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 07241C0619C0 for ; Wed, 9 Sep 2020 08:09:42 -0700 (PDT) Received: by mail-qv1-xf42.google.com with SMTP id h1so1660910qvo.9 for ; Wed, 09 Sep 2020 08:09:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=ckIFVGgJHCBY1cA5MmiDi5JHd3+uJkL9F5APYSbHoys=; b=T9wd52lIzwRMDofgJUuo+3ltiFsBzzqHT/6wDAtY+6fafz/u4H1lv3ixD52RgL+iOj wyH+C6VA1vtepU3Oy+Sbj0BaCUERjwT4ZX1AT/GfMWxny8Us3VtNSfvMpIxmLva4fOtJ E30s70diwiBDOYMLWHWotNO5rafTduvCHkA6Xc28TtVrnitKOVjDGEX2dFXLZGLazsRR EzGzWLb/GXWD6DKD8VJAapAU6qQB83epGB2sAf3pr548O8SpcBgVoaRBzfRaUMr2RXSQ TaJJGGi7Gnz/5Zi1cQquUYBl7ZuBcQ1tO9BOfN6fJFHYajPqQqiKnbZ36ygsyTDWvdLq 3A1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=ckIFVGgJHCBY1cA5MmiDi5JHd3+uJkL9F5APYSbHoys=; b=V1cEwuTaCRs29Z1zdkyvoxSNqPVrWgW5dRTWI8dl3T2NVKjPsgunn8P2+SHuN2qA63 KJu7t5MD2j8O2EX9+uGzeop7zmS6htf7RV3arMXvdILBSOnYfkSCGrz5DgZdMEJjTzw7 VV3sxk3ZbyXYWyQmtbOIUg+E9cvMRAzF5HEQBjtVRsrFKM7GRtecu1uFnR5+GzcSOJsB neY2476dxhTiXdnKrXQz48i87/WU+cKUqrE0G9hpwQRrbzsIVpLYUBL0A5Be+PQkSTot g8bicGwpnUc4QheRMFEO1pkpPr8RJ+jqmi0W4WAj/5d/X+1AWtmDNeChuwfL3miTZqlx ti0w== X-Gm-Message-State: AOAM531+u4Nu23togDvC5Yv6fogTP5L8DYCXWcSazQeuIXvn6E3K3ErR v9icYxu0Eq4fbrUs0cRPACXOoQ== X-Received: by 2002:a05:6214:180d:: with SMTP id o13mr4616379qvw.87.1599664181962; Wed, 09 Sep 2020 08:09:41 -0700 (PDT) Received: from ziepe.ca (hlfxns017vw-156-34-48-30.dhcp-dynamic.fibreop.ns.bellaliant.net. [156.34.48.30]) by smtp.gmail.com with ESMTPSA id r34sm3428714qtr.18.2020.09.09.08.09.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Sep 2020 08:09:41 -0700 (PDT) Received: from jgg by mlx with local (Exim 4.94) (envelope-from ) id 1kG1jA-003MI2-Ec; Wed, 09 Sep 2020 12:09:40 -0300 Date: Wed, 9 Sep 2020 12:09:40 -0300 From: Jason Gunthorpe To: Christoph Hellwig Cc: Ming Mao , linux-kernel@vger.kernel.org, kvm@vger.kernel.org, linux-mm@kvack.org, alex.williamson@redhat.com, akpm@linux-foundation.org, cohuck@redhat.com, jianjay.zhou@huawei.com, weidong.huang@huawei.com, peterx@redhat.com, aarcange@redhat.com, wangyunjian@huawei.com, willy@infradead.org, jhubbard@nvidia.com Subject: Re: [PATCH V4 1/2] vfio dma_map/unmap: optimized for hugetlbfs pages Message-ID: <20200909150940.GG87483@ziepe.ca> References: <20200908133204.1338-1-maoming.maoming@huawei.com> <20200908133204.1338-2-maoming.maoming@huawei.com> <20200909080114.GA8321@infradead.org> <20200909130518.GE87483@ziepe.ca> <20200909142941.GA23553@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200909142941.GA23553@infradead.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 09, 2020 at 03:29:41PM +0100, Christoph Hellwig wrote: > On Wed, Sep 09, 2020 at 10:05:18AM -0300, Jason Gunthorpe wrote: > > How to use? The VMAs can have mixed page sizes so the caller would > > have to somehow switch and call twice? Not sure this is faster. > > We can find out the page size based on the page. Right now it is > rather cumbersome, but one of willys pending series has a nicer helper > for that. So, returns a packed array of pinned head page pointers where each element's length is determined by page_size()? Some maths from VA figure out the initial page offset and final page length? Could this representation work effectively for general DMA mapping somehow? Put the array in chained pages like SGL so it can efficiently cover very large amounts of VA? Jason