Received: by 10.223.185.116 with SMTP id b49csp830074wrg; Fri, 23 Feb 2018 07:28:03 -0800 (PST) X-Google-Smtp-Source: AH8x22690lHGpkgtATnuBkuZrneu2gersOQaF9gdvBXjsjivUHOeG6AwWbp1HqPjsKIaFpqEkRzm X-Received: by 2002:a17:902:ab94:: with SMTP id f20-v6mr1640074plr.395.1519399683441; Fri, 23 Feb 2018 07:28:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519399683; cv=none; d=google.com; s=arc-20160816; b=u4iVhigMRs8fMTu/2HtUNcDtMZLdpt4dvoy9AF+x64HAfj5Q5ScxRLkHvtJIFK+s74 r5a5yZg421f/kYqBFkDeeiy8cCPLqWViul8m311bNS11qA2917toSNGOeNBjydI4+BJ6 Njpb97RqYyZqfar26AdzX0wS5/Qvrsm01IrE91C52BQANp2qFa6Fu0EBvbY5B9d8wMXR rh4GJo3wfinOpO1LPAIdW1NJm96weQlrKpkHQ8ujIZaQgKiR47Zx3ZzBEJljEG0poepd KhBdmtVysZ6Q+wO0Dm1V1C08ivK5p1/RJmFLVpY93LQEMPamTIjvpc1HN0FkOB2PMBw6 TlYg== 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:cc:to:subject:dkim-signature :arc-authentication-results; bh=jNEhR0645QxuNB5IbNttk1VC7aj0e9Ypxs8SZu/klMA=; b=RXVSSgUN12m2qTTp/Wqqm1jwckZT9ebqZHi8JcSV19XGQqJ/bzKGIfUDEa9dHf7i5X GxRe8HwtI9j8LePLAiOqXVRMCUg+EFNQgRwDIijNYgiFyvP8jHFQP9btaD9dVs4Ksu1Y +cX89hybH82mtlkrWdVd3M5nA4FPGSUJEm1lv384MTjR/9eE8GD/dydudzf+4GzOL/JA GzBC7KtKzNIuoeBs4HNDAutxCiidgKW5Q9vx3fpORl8QMLM9lhfvAJza/pq5aWjK3DPZ UNiKv7duhu3IclCzoFmZ2XDO2qLKDa8AYwMv0Toh0SauX9hsvsT1VVpwNCeBsyntMyJg WOKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=ax5pworB; 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=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b6si1645075pgr.640.2018.02.23.07.27.48; Fri, 23 Feb 2018 07:28:03 -0800 (PST) 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=@oracle.com header.s=corp-2017-10-26 header.b=ax5pworB; 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=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751923AbeBWP0f (ORCPT + 99 others); Fri, 23 Feb 2018 10:26:35 -0500 Received: from userp2120.oracle.com ([156.151.31.85]:34378 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751494AbeBWP0d (ORCPT ); Fri, 23 Feb 2018 10:26:33 -0500 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w1NFOBs3064692; Fri, 23 Feb 2018 15:26:20 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : to : cc : references : from : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=corp-2017-10-26; bh=jNEhR0645QxuNB5IbNttk1VC7aj0e9Ypxs8SZu/klMA=; b=ax5pworBUqrwNi/yRxg/FzvHjc1kw/wazGzLFiGzvLITyzUiQgEYpr/axE5hj65KuGsC 9PQPgeYK8zVQxRg6QBIUEjUa81Y5xFpuXINJs9ShJCA+hRW4QIrXP59PxX4XMAwQLPfS /WADAZYfuuv9R1juWwzo9Us3Z1LbwhJqeJKdQfYxaDONGaggpKelEHnZUeF4c9ov4MrU A2sv5vJ+EzCc3CoTC27nRV+rdDVUYzeEvWZJCB2dEx6uOJzT3cZGbY9oGMONKOq2L8Tw Vga2rXYLtlk2U/hrNiA8fYb12Gcn32vCOLzDYRTWREpRkk7mtWRNb5XqStWd51eNVUxV JA== Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by userp2120.oracle.com with ESMTP id 2gamj2gdp9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 23 Feb 2018 15:26:20 +0000 Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w1NFQJMW023434 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 23 Feb 2018 15:26:19 GMT Received: from abhmp0005.oracle.com (abhmp0005.oracle.com [141.146.116.11]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w1NFQHZd022606; Fri, 23 Feb 2018 15:26:17 GMT Received: from dhcp-burlington7-2nd-B-east-10-152-55-162.usdhcp.oraclecorp.com (/10.152.32.65) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 23 Feb 2018 07:26:17 -0800 Subject: Re: [PATCH 8/9] drm/xen-front: Implement GEM operations 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, konrad.wilk@oracle.com Cc: Oleksandr Andrushchenko References: <1519200222-20623-1-git-send-email-andr2000@gmail.com> <1519200222-20623-9-git-send-email-andr2000@gmail.com> From: Boris Ostrovsky Message-ID: <2f2c6fea-c0cb-e244-41f3-269db07986fc@oracle.com> Date: Fri, 23 Feb 2018 10:26:56 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <1519200222-20623-9-git-send-email-andr2000@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Content-Language: en-US X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8812 signatures=668677 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=2 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=643 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1802230191 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 02/21/2018 03:03 AM, Oleksandr Andrushchenko wrote: > +static struct xen_gem_object *gem_create(struct drm_device *dev, size_t size) > +{ > + struct xen_drm_front_drm_info *drm_info = dev->dev_private; > + struct xen_gem_object *xen_obj; > + int ret; > + > + size = round_up(size, PAGE_SIZE); > + xen_obj = gem_create_obj(dev, size); > + if (IS_ERR_OR_NULL(xen_obj)) > + return xen_obj; > + > + if (drm_info->cfg->be_alloc) { > + /* > + * backend will allocate space for this buffer, so > + * only allocate array of pointers to pages > + */ > + xen_obj->be_alloc = true; If be_alloc is a flag (which I am not sure about) --- should it be set to true *after* you've successfully allocated your things? > + ret = gem_alloc_pages_array(xen_obj, size); > + if (ret < 0) { > + gem_free_pages_array(xen_obj); > + goto fail; > + } > + > + ret = alloc_xenballooned_pages(xen_obj->num_pages, > + xen_obj->pages); Why are you allocating balloon pages? -boris > + if (ret < 0) { > + DRM_ERROR("Cannot allocate %zu ballooned pages: %d\n", > + xen_obj->num_pages, ret); > + goto fail; > + } > + > + return xen_obj; > + } > + /* > + * need to allocate backing pages now, so we can share those > + * with the backend > + */ > + xen_obj->num_pages = DIV_ROUND_UP(size, PAGE_SIZE); > + xen_obj->pages = drm_gem_get_pages(&xen_obj->base); > + if (IS_ERR_OR_NULL(xen_obj->pages)) { > + ret = PTR_ERR(xen_obj->pages); > + xen_obj->pages = NULL; > + goto fail; > + } > + > + return xen_obj; > + > +fail: > + DRM_ERROR("Failed to allocate buffer with size %zu\n", size); > + return ERR_PTR(ret); > +} > + >