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.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,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 D3958C433FE for ; Thu, 10 Dec 2020 04:04:06 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 6FDD223142 for ; Thu, 10 Dec 2020 04:04:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6FDD223142 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id E2B726B0036; Wed, 9 Dec 2020 23:04:05 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id DDBD76B005D; Wed, 9 Dec 2020 23:04:05 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C7B9E6B0068; Wed, 9 Dec 2020 23:04:05 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0025.hostedemail.com [216.40.44.25]) by kanga.kvack.org (Postfix) with ESMTP id AE0256B0036 for ; Wed, 9 Dec 2020 23:04:05 -0500 (EST) Received: from smtpin08.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 78EAB362A for ; Thu, 10 Dec 2020 04:04:05 +0000 (UTC) X-FDA: 77576029650.08.coat63_1b00146273f5 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin08.hostedemail.com (Postfix) with ESMTP id 5B2F81819E793 for ; Thu, 10 Dec 2020 04:04:05 +0000 (UTC) X-HE-Tag: coat63_1b00146273f5 X-Filterd-Recvd-Size: 4860 Received: from mail-ej1-f68.google.com (mail-ej1-f68.google.com [209.85.218.68]) by imf13.hostedemail.com (Postfix) with ESMTP for ; Thu, 10 Dec 2020 04:04:03 +0000 (UTC) Received: by mail-ej1-f68.google.com with SMTP id x16so5372249ejj.7 for ; Wed, 09 Dec 2020 20:04:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=aiXzNIBEdezK7LvwdToUmyEveX4RTWL1Q1rKEHzG6GY=; b=V12HS7Wn+bctaIkufygbNwtKV1pkBbE9hHZV8Lf9tSE5VPt6nBit0Nb1HWPIB+8XdO UwbjHDBYoCvlSOrafC5rCuQbCx1D+/3PDyFehNe398RSQzHQ1rPu9pgXYXyg3wMVKY7l FuBEUYEFzcobG0z1knWel86vWiyTyuA3aX6iyNBGyPUSEugrsJ77EmD5w3Zhr4gllpgD NDD0P3wO1Rjasg3bPJKXdNNtxJFUZzyODiRBozAcezwWwmKvGT1tnVg88ssqoLYPKQyE vxZa8+AdNxohhjfYmcfYxPAKri7o/zxhpGNApPEe/Ugj0ylq5uh8h/HdVnA0K5L3ljWV 0UiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=aiXzNIBEdezK7LvwdToUmyEveX4RTWL1Q1rKEHzG6GY=; b=HbJEZRPwubPQAvYLXGnjOfDPCCMS9tJaLhc/JkmZFeh3P2KCU8l8YjTS1peL+i/IP+ d48imujkiq9q8hASQ5960v6yEgbU36yCLLs9EgAgfTwYt/urzSOSXPA7hI/H193zGGBF IPCpOnrfXJjhsbnhvhXOtMUXKcmUJrfzv0UXuD4tcnb+BCr0eFcu3s+uIWB4dDEIRlkz yyvqtxctJFpmWUn8uEIiSNTWgjwiDLkI7cVCdJfsCb9C/xy9H2jyhLu1CuIMGgS7UORM NitmW8uGvbwKKXsBSVF67bywu30yXLgDvlD3FZ4DMfAJz8KxHmh4UhoZyN3siaWvdpQE N2Jw== X-Gm-Message-State: AOAM532Sy9O4zdYxnCSbi+CqdMIwWKBeuLFQhLbYF+B755PvITymcXw3 TnSYqhh9OcYG4EOPQWxnVaZIg/Ej0cUFgWvnB/osbw== X-Google-Smtp-Source: ABdhPJz4kqsM2zajOVSAKgswV7LD/u9Of8EB4mcOSELuzl9N3rbE8Zn+Vb136NhMCEF83xMViBOj9nm8pJkMBp6g77Y= X-Received: by 2002:a17:906:518a:: with SMTP id y10mr4811157ejk.323.1607573042542; Wed, 09 Dec 2020 20:04:02 -0800 (PST) MIME-Version: 1.0 References: <20201106170036.18713-1-logang@deltatee.com> <20201106170036.18713-5-logang@deltatee.com> <20201109091258.GB28918@lst.de> <4e336c7e-207b-31fa-806e-c4e8028524a5@deltatee.com> In-Reply-To: From: Dan Williams Date: Wed, 9 Dec 2020 20:04:00 -0800 Message-ID: Subject: Re: [RFC PATCH 04/15] lib/scatterlist: Add flag for indicating P2PDMA segments in an SGL To: Logan Gunthorpe Cc: Christoph Hellwig , Linux Kernel Mailing List , linux-nvme@lists.infradead.org, linux-block@vger.kernel.org, Linux PCI , Linux MM , "open list:DMA MAPPING HELPERS" , Stephen Bates , Jason Gunthorpe , =?UTF-8?Q?Christian_K=C3=B6nig?= , Ira Weiny , John Hubbard , Don Dutile , Matthew Wilcox , Daniel Vetter Content-Type: text/plain; charset="UTF-8" X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Wed, Dec 9, 2020 at 6:07 PM Logan Gunthorpe wrote: > > > > On 2020-12-09 6:22 p.m., Dan Williams wrote: > > On Mon, Nov 9, 2020 at 8:47 AM Logan Gunthorpe wrote: > >> > >> > >> > >> On 2020-11-09 2:12 a.m., Christoph Hellwig wrote: > >>> On Fri, Nov 06, 2020 at 10:00:25AM -0700, Logan Gunthorpe wrote: > >>>> We make use of the top bit of the dma_length to indicate a P2PDMA > >>>> segment. > >>> > >>> I don't think "we" can. There is nothing limiting the size of a SGL > >>> segment. > >> > >> Yes, I expected this would be the unacceptable part. Any alternative ideas? > > > > Why is the SG_P2PDMA_FLAG needed as compared to checking the SGL > > segment-pages for is_pci_p2pdma_page()? > > Because the DMA and page segments in the SGL aren't necessarily aligned... > > The IOMMU implementations can coalesce multiple pages into fewer DMA > address ranges, so the page pointed to by sg->page_link may not be the > one that corresponds to the address in sg->dma_address for a given segment. > > If that makes sense -- it's not the easiest thing to explain. It does... Did someone already grab, or did you already consider the 3rd available bit in page_link? AFAICS only SG_CHAIN and SG_END are reserved. However, if you have a CONFIG_64BIT dependency for user-directed p2pdma that would seem to allow SG_P2PDMA_FLAG to be (0x4) in page_link.