From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.9 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BA2E2C433E2 for ; Wed, 9 Sep 2020 15:09:49 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 4611022269 for ; Wed, 9 Sep 2020 15:09:48 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=ziepe.ca header.i=@ziepe.ca header.b="T9wd52lI" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4611022269 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ziepe.ca Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 326196B0073; Wed, 9 Sep 2020 11:09:48 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2B08B6B0074; Wed, 9 Sep 2020 11:09:48 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 178526B007D; Wed, 9 Sep 2020 11:09:48 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id F27E16B0073 for ; Wed, 9 Sep 2020 11:09:47 -0400 (EDT) Received: from smtpin03.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 955811DE8 for ; Wed, 9 Sep 2020 15:09:47 +0000 (UTC) X-FDA: 77243857614.03.sock55_4115d8c270de Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin03.hostedemail.com (Postfix) with ESMTP id 5ABD228A4ED for ; Wed, 9 Sep 2020 15:09:43 +0000 (UTC) X-HE-Tag: sock55_4115d8c270de X-Filterd-Recvd-Size: 4329 Received: from mail-qv1-f65.google.com (mail-qv1-f65.google.com [209.85.219.65]) by imf44.hostedemail.com (Postfix) with ESMTP for ; Wed, 9 Sep 2020 15:09:42 +0000 (UTC) Received: by mail-qv1-f65.google.com with SMTP id f11so1682315qvw.3 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=fkXTLOGv9OC7ThTibMPuTdcfG2Fenw2fDpzEiJMyUX3YdcsT6aw3dM4XxQAoDcBYH5 ZtDK+RlvZD1yj8v9Y64H6ebEl2Orhwpm7kbiwmsoZqkyw2PHJTF3SjlhY5X6d1uPufN+ NRYwRgcRacF3ZTFwZT8+GoKAgpF9Z6Ns8iPqA+grZRz6awDAwtzvrUrb4V4YoZpvDyN8 5YTzZDnwcMJbLeFnn4bFte9EHHR4UJI/kbrx2wLoRbKeLxZogNSoubY9YGZttDTRj3OS O2MwH90dSpcBiUblM8n5LXquYYSrPFrABDdEvgn5iJSdASFsRSR15eLo/UhCj1eo1sjK qG2g== X-Gm-Message-State: AOAM531gXMr8CjG7XL4anb7RPDklcfasXpb3L/DkjVAWO3Kmh+9wCt7/ xtUuv202OHxOQx3WPu/TwLQVmw== X-Google-Smtp-Source: ABdhPJy90a1Sij3B0JFqI0M18Ne3sL4AB2hocicAm5yltS1FCpUYMt5qGJjgohzozkPrsosLEtpZIg== 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> X-Rspamd-Queue-Id: 5ABD228A4ED X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam05 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000001, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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