Received: by 10.223.185.116 with SMTP id b49csp772300wrg; Fri, 23 Feb 2018 06:36:49 -0800 (PST) X-Google-Smtp-Source: AH8x227K5t/USfi67vRFVgNaye0xT5mln4JHu9TTbqWQS3xCM0OfCMwniA46CIbM1ju5jml4wKPL X-Received: by 10.98.0.67 with SMTP id 64mr1963316pfa.63.1519396609801; Fri, 23 Feb 2018 06:36:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519396609; cv=none; d=google.com; s=arc-20160816; b=ihFOXcsx2SkZLNE81oJ0TwOq9jF1hxCwkfLUPsPk6k1jlzgG91zWjOyiRNDEtStV8t 3IXxW9BNJqdaZNxdmObS66KnTLCSo1Z9gt7/8e++kS6UHJemCA9HM8cli+QvmTWpa/lm MMvU5JROGxIo4e65ckAXQ0GFfDNtyDAayw9Eu8oAzIC8i2ySWzMMSKDbYyPg2a6DnIzG /UHWZV6fbUjk8YpOQvqxNVLZfYYBalWesDOJqwmVvo1QxLzGc/IaH0vSwbk/vb0WM+I6 EPP/QKCh6j30W3txaN3c3u2ZF3Xhs4ziTtZp9Gj7ekeEyu+Vz17ig1K19TdU6bm/Uxx2 OogA== 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=EqEiaECaaJGEBLKf2AFY0LbuFIkpWaUjf0ET7URZhng=; b=fPaqWgKoYBEQji/OBpIemW+1kT9bOw+zQ372AA2OiwQsVReTfN1ugX03ZzUPqcqUEu aV3zF8Iv1ZMeLMSGpGzdhjAsf+CQfJhsnpwicdC9niegNdPjciS4qrkfA81XORm1OGXR UTjFfSua4SmwiA2IMvBjW+/p17xSai8v3FWgL0HIyEtVCHiZb4+Mxx11orgdLYEJKHFI 3SqnyDHHydHAGMYKla1lrMgjY60uMjpVH8o/hMO9AxAXgvlXW+h4Onurw915zJnIb1XV emWJVW0YWSteWx0zYDrexrDLZeOHjjW1EE9AK/TsMdke2vMViXWyMQR5JH2sXktq8HYd qdtA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=nKa+p5Ym; 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 w21-v6si1842702plq.486.2018.02.23.06.36.34; Fri, 23 Feb 2018 06:36:49 -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=nKa+p5Ym; 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 S1751425AbeBWOfz (ORCPT + 99 others); Fri, 23 Feb 2018 09:35:55 -0500 Received: from userp2130.oracle.com ([156.151.31.86]:57448 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751314AbeBWOfy (ORCPT ); Fri, 23 Feb 2018 09:35:54 -0500 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w1NEVirA153885; Fri, 23 Feb 2018 14:35:40 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=EqEiaECaaJGEBLKf2AFY0LbuFIkpWaUjf0ET7URZhng=; b=nKa+p5YmUoYD2LHySQ0t1qh88+dwsQF28LAr/xMwVlDjONTYjhgFKcBM5lLwlOP0lAGO aK7FDtbRPEaX5Thcuc+DsmBYACFgizg7fGG833zsWUUwNjg8Ar51xv6ary48TuGU9+U3 spg/k06PwfpXOhGdCnd5MsqV8CEKXeHnCwKPWI8trLls2ge2plDFGDmeIYBUvxFYkVxa tTgmlM/ZRbXYS6guLFHLlBJTlVogaV2VXxyHIsl+SyAMEW6ZdzAWe5zr1BQ4MBhv1WXh q67dlUq3H66IR/RlmlASvBvSdJosFCq/ALjPe9DQaRFUJrMiMQSYdf2KfLbe7OJOSdnz PA== Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by userp2130.oracle.com with ESMTP id 2gams7g0vd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 23 Feb 2018 14:35:40 +0000 Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w1NEZdw3016634 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 23 Feb 2018 14:35:39 GMT Received: from abhmp0013.oracle.com (abhmp0013.oracle.com [141.146.116.19]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w1NEZbxZ017562; Fri, 23 Feb 2018 14:35:37 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 06:35:37 -0800 Subject: Re: [PATCH 5/9] drm/xen-front: Implement handling of shared display buffers 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-6-git-send-email-andr2000@gmail.com> <11ce6c96-1739-435c-4b6f-c9f5d02a2905@oracle.com> From: Boris Ostrovsky Message-ID: <36003bb4-6fc9-f8f9-2817-103bf0f543e9@oracle.com> Date: Fri, 23 Feb 2018 09:36:16 -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: 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=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=710 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1802230182 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 02/23/2018 02:53 AM, Oleksandr Andrushchenko wrote: > On 02/23/2018 02:25 AM, Boris Ostrovsky wrote: >> On 02/21/2018 03:03 AM, Oleksandr Andrushchenko wrote: >>> static int __init xen_drv_init(void) >>> { >>> + /* At the moment we only support case with XEN_PAGE_SIZE == >>> PAGE_SIZE */ >>> + BUILD_BUG_ON(XEN_PAGE_SIZE != PAGE_SIZE); >> >> Why BUILD_BUG_ON? This should simply not load if page sizes are >> different. >> >> > This is a compile time check, so if kernel/Xen is configured > to use page size combination which is not supported by the > driver it will fail during compilation. This seems correct to me, > because you shouldn't even try to load the driver which > cannot handle different page sizes to not make any harm. This will prevent whole kernel from building. So, for example, randconfig builds will fail. >> >> >> >>> + ret = gnttab_map_refs(map_ops, NULL, buf->pages, buf->num_pages); >>> + BUG_ON(ret); >> >> We should try not to BUG*(). There are a few in this patch (and possibly >> others) that I think can be avoided. >> > I will rework BUG_* for map/unmap code to handle errors, > but will still leave > /* either pages or sgt, not both */ > BUG_ON(cfg->pages && cfg->sgt); > which is a real driver bug and must not happen Why not return an error? In fact, AFAICS you only call it in patch 9 where both of these can be tested, in which case something like -EINVAL would look reasonable. -boris