Received: by 10.213.65.68 with SMTP id h4csp513727imn; Fri, 6 Apr 2018 04:27:16 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/BN1/cay3wPUw340OeYHZ9plTRXtAEruvTzihK3Xy7NLRW6QL40jzKhxO8/xaquACXCCvf X-Received: by 10.98.21.209 with SMTP id 200mr19881896pfv.232.1523014036694; Fri, 06 Apr 2018 04:27:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523014036; cv=none; d=google.com; s=arc-20160816; b=pxSniNOd69becjcyh1hq/JUzXNdu9S2Q/Pwyu5EAIg4FyEGwEFLmi53k3Zuxwg52XN ogl4ATMB327VxBss6/3RvOcQxQ2f2qqYV71861nUx+D2eT2xaJh7ArtvkJv9d87CXW9+ Si/a+n7kYV+MPdJxsQ2GYrnDudMxV4wVhuKgerkFmkroddJgtfMNQUFIz/r7Gk6xJTGH i1lI5kLNj8i/VCAn2M+Y7A2Yh5sDAuDF6vbAUibUrVzaAmtsWJol8C+uJoReH23MZdtv F7MxSLlsKaMZAQ6JJI7g32029pxnaxPORK1NIHdWSGxD8bnRx/ntKNg+8LquVprOKtxh Qcgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:to:subject:dkim-signature :arc-authentication-results; bh=vZ99V2wS2yl6X3av+ktuKbnNlC5B5kwXm9vq7Kfi324=; b=xfSUSVdo1axprsZSRC8zawqp8tkz8x+XmIXoZ74q+F9iQDGMEZnmX74k+pAcgnGofh kxCitKLhVK25JwYOL/VZiYM7wzy7R/JREIXDlXqkpRsnlpyzPU5TxmjXTl4S0tnrDTGc HJ9s5xLFWxjm89jomc6s/rb0lslM7uzZYchqUrzDFmMSPA7MAeZ2I3tsH+MkBAfyHOuE ps8kbyjLmWkQMl0e2waTTTXGkcD/DkPLoJ9oZ4eDFHOkcEvFxX3898GnUUv3TeFupCk+ 4KriI4ThJ6rJ7FuOmpaoR2jrwDqgrUZyRY3opS56vxelKmeQNgBlbnrjmWgDuIX/D37z DVkQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Fy8vZOlB; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u3si2768557pfl.151.2018.04.06.04.27.03; Fri, 06 Apr 2018 04:27:16 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Fy8vZOlB; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752501AbeDFLZn (ORCPT + 99 others); Fri, 6 Apr 2018 07:25:43 -0400 Received: from mail-lf0-f68.google.com ([209.85.215.68]:34375 "EHLO mail-lf0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752307AbeDFLZL (ORCPT ); Fri, 6 Apr 2018 07:25:11 -0400 Received: by mail-lf0-f68.google.com with SMTP id c78-v6so51168lfh.1 for ; Fri, 06 Apr 2018 04:25:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding:content-language; bh=vZ99V2wS2yl6X3av+ktuKbnNlC5B5kwXm9vq7Kfi324=; b=Fy8vZOlBvwotid7hr6wfDB1wzN162TXy6gp/N/VLBCLoGQRxpDfmo4h5WaeekM3pHY 0P/llFfTUAslPjLoCJ6PpUxD+d9vE01TzIggOrd/eLHDdGWIAZZeZjXv16Ic9VmIBRo2 w2ulQRqA1DFLTxf+I2Aw04Azz/enFLcmGzI4DQ169Lb6oqvAVf5smzVyWSMzbezNGvC/ rtVUi2ro+yL6I7SEj7HcJu9dxJvEfwAk7rdhi9UL3S10thSWKjpn5YLaLOmqxIyz2LHs A3GMqpr37PTr2YXrLc6f1oI9+2lrp2mbNC1SgZmW2yRktG2hJTiobBTle184nKIoIErW hNkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=vZ99V2wS2yl6X3av+ktuKbnNlC5B5kwXm9vq7Kfi324=; b=Nw3CUOpsiYFvbMCJ4De2dSgZ4z1QpcofTkqfAHou/y9b5CkGZytOLJ/X9x/+ukBf1Y Hi7/IwchvoiRbTYRG8L3MNbfdtayNK7nE6/xK37LfWPI77bmulCawmdSdNBEu4VJm3SY pYvONtZRjn2wxvTWtYQ3dtpaUsAOIWn3BCNuu5OblecYmhL8BIjEIK9odPWIqE4sroju QS4SDlho9JLIGN6MhL/KS41MIiwOZNJpVVqgPcV69pzyv0fZgyHx8nt7uUmZu8UeQNPq vPJcAJt/GY1s5JRZEHCGS+xY5JD9Fzid8Ecs/vK/uZusuzaixZ2/BF5Hu+bUJuKo2DhP 0S5w== X-Gm-Message-State: ALQs6tC3tqDLlKALGqh84D+HIIAWBi9j2x6cviQVOWIHWRQnHrmqgTQ4 XBeetnvqDE9CLyHvbB40fbo= X-Received: by 2002:a19:9384:: with SMTP id w4-v6mr5287816lfk.30.1523013910267; Fri, 06 Apr 2018 04:25:10 -0700 (PDT) Received: from [10.17.182.9] (ll-53.209.223.85.sovam.net.ua. [85.223.209.53]) by smtp.gmail.com with ESMTPSA id u77-v6sm2051012lfi.0.2018.04.06.04.25.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 06 Apr 2018 04:25:09 -0700 (PDT) Subject: Re: [PATCH 1/1] drm/xen-zcopy: Add Xen zero-copy helper DRM driver To: xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, airlied@linux.ie, daniel.vetter@intel.com, seanpaul@chromium.org, gustavo@padovan.org, jgross@suse.com, boris.ostrovsky@oracle.com, konrad.wilk@oracle.com, Oleksandr Andrushchenko References: <20180329131931.29957-1-andr2000@gmail.com> <20180329131931.29957-2-andr2000@gmail.com> <20180403094734.GT3881@phenom.ffwll.local> From: Oleksandr Andrushchenko Message-ID: <1ef9290a-7564-007d-81c6-cf7db74252f3@gmail.com> Date: Fri, 6 Apr 2018 14:25:08 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <20180403094734.GT3881@phenom.ffwll.local> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 04/03/2018 12:47 PM, Daniel Vetter wrote: > On Thu, Mar 29, 2018 at 04:19:31PM +0300, Oleksandr Andrushchenko wrote: >> From: Oleksandr Andrushchenko >> +static int to_refs_grant_foreign_access(struct xen_gem_object *xen_obj) >> +{ >> + grant_ref_t priv_gref_head; >> + int ret, j, cur_ref, num_pages; >> + struct sg_page_iter sg_iter; >> + >> + ret = gnttab_alloc_grant_references(xen_obj->num_pages, >> + &priv_gref_head); >> + if (ret < 0) { >> + DRM_ERROR("Cannot allocate grant references\n"); >> + return ret; >> + } >> + >> + j = 0; >> + num_pages = xen_obj->num_pages; >> + for_each_sg_page(xen_obj->sgt->sgl, &sg_iter, xen_obj->sgt->nents, 0) { >> + struct page *page; >> + >> + page = sg_page_iter_page(&sg_iter); > Quick drive-by: You can't assume that an sgt is struct page backed. Do you mean that someone could give me sgt which never seen sg_assign_page for its entries? What are the other use-cases for that to happen? > And you probably want to check this at import/attach time. The check you mean is to make sure that when I call page = sg_page_iter_page(&sg_iter); I have to make sure that I get a valid page? > -Daniel Thank you, Oleksandr