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.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED 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 9B619C63793 for ; Thu, 22 Jul 2021 13:08:51 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6AD47610CC for ; Thu, 22 Jul 2021 13:08:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6AD47610CC Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=intel-gfx-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 21AB66E9AE; Thu, 22 Jul 2021 13:08:51 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by gabe.freedesktop.org (Postfix) with ESMTPS id EE8286E9AE; Thu, 22 Jul 2021 13:08:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=+mjAA153JG0Ln8wFYY041kj2Rsi0lJ7YGWt7SwKJF/8=; b=PCpF0eOlIHL6HnaeLDPKGuJyur Pj7KAq8ENbbzU+SxmHu185G55Dox0US5sMQr1fkTbdb/zTJoE2dUMURZfqMgPvnY8Hw0Llq333J0/ oYE1BbgMLmoWGIzHtyuYyyCjalyd5tJdIFcFM4VCDTmiZoYCPAA7QYxkWdeGOKGZNvkzZQGuGbuAu Jk2CxbLLWhfMRsoZbr62BVyBGiSsCcw0KdRDbcOTDQaShIX0iKY0n7puoBCH+YYkpr1ODbfZcIDZr VPW+l2FIH+WqntMDhWe4muRuevFo7ZNkAA3hAJHgAoXtN3DhasPfQxNY3uEhb/YUUsj/C4mQgg8Tr QgC9QV6w==; Received: from hch by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1m6YQZ-00AHI5-Mg; Thu, 22 Jul 2021 13:07:53 +0000 Date: Thu, 22 Jul 2021 14:07:51 +0100 From: Christoph Hellwig To: Jason Gunthorpe Message-ID: References: <36d655a0ff45f4c86762358c7b6a7b58939313fb.1626605893.git.leonro@nvidia.com> <20210722130040.GH1117491@nvidia.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210722130040.GH1117491@nvidia.com> X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html Subject: Re: [Intel-gfx] [PATCH rdma-next v2 1/2] lib/scatterlist: Fix wrong update of orig_nents X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Airlie , Mike Marciniszyn , dri-devel@lists.freedesktop.org, Zhu Yanjun , Leon Romanovsky , Dennis Dalessandro , linux-rdma@vger.kernel.org, Christoph Hellwig , Doug Ledford , VMware Graphics , intel-gfx@lists.freedesktop.org, Roland Scheidegger , Maxime Ripard , Yishai Hadas , linux-kernel@vger.kernel.org, Thomas Zimmermann , Maor Gottlieb , Zack Rusin Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" On Thu, Jul 22, 2021 at 10:00:40AM -0300, Jason Gunthorpe wrote: > this is better: > > struct sg_append_table state; > > sg_append_init(&state, sgt, gfp_mask); > > while (..) > ret = sg_append_pages(&state, pages, n_pages, ..) > if (ret) > sg_append_abort(&state); // Frees the sgt and puts it to NULL > sg_append_complete(&state) > > Which allows sg_alloc_table_from_pages() to be written as > > struct sg_append_table state; > sg_append_init(&state, sgt, gfp_mask); > ret = sg_append_pages(&state,pages, n_pages, offset, size, UINT_MAX) > if (ret) { > sg_append_abort(&state); > return ret; > } > sg_append_complete(&state); > return 0; > > And then the API can manage all of this in some sane and > understandable way. That would be a lot easier to use for sure. Not sure how invasive the changes would be, though. _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx