Received: by 10.213.65.68 with SMTP id h4csp3319443imn; Tue, 3 Apr 2018 02:49:20 -0700 (PDT) X-Google-Smtp-Source: AIpwx49k1DiVUYVPjAJr9cg4Jy9QyrBcFNssXcL3aoQd7aAx6Lt5jizbQN/z1KIz3BsRMHrmw/af X-Received: by 10.98.156.7 with SMTP id f7mr10135176pfe.104.1522748959961; Tue, 03 Apr 2018 02:49:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522748959; cv=none; d=google.com; s=arc-20160816; b=q0DUZInbArk6gs+1umPSlYqExkymTCwzvn9uvfywpM6MZSpD++GJk0ogfgjcTAQFmq WaJ9zHr/egimwNGgGbC3YCbAr4OhJlfo52xUZavOOuD5sxcWJ/l/z9J22MO475vUeerv rxUP4MKRm1ZV9BVxrKDL156nCmhWqq8hBgftBNB35QTsfCaJPFKITqn085hfyeGZ5Xp9 CUW0Qg6MkfmGB+Gduk2co27MoHctAb+z9TX7vqhzVHmtoMwsmFl299cTMKFeTX6L5QqL bHxIXNi+U7sZmHHF/2tUvp/ERfHX0446EVBDqV0A45bQeILjB5bCYA5f7Fpep2Pk4hr6 eeXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:mail-followup-to :message-id:subject:cc:to:from:date:dkim-signature :arc-authentication-results; bh=sfkdvAiLNEtlkCsyLHV27jwZg/+832WSX3yu3syz6a8=; b=EI6IgJOT0/fgakOWLZfdqgz8QOCXVpnvu2BrW8DWYx9yWUpXQw+nh31z28ag0O9+OX pUbiAZ42X17zcq3hVvjp3G5lfQzW2WiDBEIZqqsbO9+SwWuN53oOAt8Q7Naa9KYaRif7 XLRkCG/OAWQipjHuiOkdXVTTsjRbL/X+v97+2hPN7XVD0AbBrE3HLrOC0sa12Hq6phNG 6IMr1aIK7TfN9ZJj5Rgb//AVuV1nq0aC4eGDVFNxlez+jMpD2qvEapSnONR98WhHSkDI HFlq/YALK8N1ixyYszJqHR5LdguH6NK3t2xs2WDNoDeYzBzDjnVJtRitSGAxiszhVGzu niwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@ffwll.ch header.s=google header.b=Sl3oAWeg; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x24si1649071pgv.394.2018.04.03.02.49.05; Tue, 03 Apr 2018 02:49:19 -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=fail header.i=@ffwll.ch header.s=google header.b=Sl3oAWeg; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754908AbeDCJrj (ORCPT + 99 others); Tue, 3 Apr 2018 05:47:39 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:37286 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754579AbeDCJri (ORCPT ); Tue, 3 Apr 2018 05:47:38 -0400 Received: by mail-wm0-f67.google.com with SMTP id r131so33717192wmb.2 for ; Tue, 03 Apr 2018 02:47:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=sender:date:from:to:cc:subject:message-id:mail-followup-to :references:mime-version:content-disposition:in-reply-to:user-agent; bh=sfkdvAiLNEtlkCsyLHV27jwZg/+832WSX3yu3syz6a8=; b=Sl3oAWegq8JDVSh5O8FPH15IAW/CuMm0++Hf3ZFiWdy8hJLRo2u0iB0ft6IV5vWCei rwjqwvLtho8A351INP5DiOKfJaRU7HXmP0eMjWXwhlYP9uFDa/3URn/uCc0c8hpIcmuk jVHteeqWN7B6J+HoVu17PgPisbseRDOLOtl8c= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :in-reply-to:user-agent; bh=sfkdvAiLNEtlkCsyLHV27jwZg/+832WSX3yu3syz6a8=; b=bTr1pdww2W3BFAV//uycLN/zt0DfhdEwR27nGNTw3o0QsYGm85JCzCiCz5VJLRMvjZ YYH65zsqPKoXvIr8O/3KQoxDMnRvGwHY6IQxL/cdf+gMndvK8ri8hahSp8f+unh8iCj1 xac+6zwuSYI+TfwRom7tRu8M4uj3y/KUokdhy3UjfVB9dSue0vh6DLmv4HiioaH7dTnI mICytGRypZPX3bntjFePdCu2YKzGODxNI8ouehpkRGu0wctjd8J1/tElB/enrBLLTJxc TvHEj071ivaPnHX0vAdP6hBtRbbOIxOzdD6Oh7iyh73B6RbWha3HNBFETYqLAWl1/652 ReDw== X-Gm-Message-State: AElRT7FTafOMHMiT1zfCUAN45dUfzVvv9tRvDXrg8xkWBAQAKpiFfBmb eGkqPU4sbvShmlrI+V8ukbZKYQ== X-Received: by 10.80.216.131 with SMTP id p3mr15882078edj.86.1522748856923; Tue, 03 Apr 2018 02:47:36 -0700 (PDT) Received: from phenom.ffwll.local (212-51-149-109.fiber7.init7.net. [212.51.149.109]) by smtp.gmail.com with ESMTPSA id w10sm1552635eda.66.2018.04.03.02.47.35 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 03 Apr 2018 02:47:36 -0700 (PDT) Date: Tue, 3 Apr 2018 11:47:34 +0200 From: Daniel Vetter To: Oleksandr Andrushchenko Cc: 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 Subject: Re: [PATCH 1/1] drm/xen-zcopy: Add Xen zero-copy helper DRM driver Message-ID: <20180403094734.GT3881@phenom.ffwll.local> Mail-Followup-To: Oleksandr Andrushchenko , 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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180329131931.29957-2-andr2000@gmail.com> X-Operating-System: Linux phenom 4.15.0-1-amd64 User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. And you probably want to check this at import/attach time. -Daniel -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch