Received: by 10.223.185.116 with SMTP id b49csp782870wrg; Fri, 23 Feb 2018 06:46:52 -0800 (PST) X-Google-Smtp-Source: AH8x227UMMQGMDzQk30m1s7aVCFc/QuSwO4af9T2+LqNkSPharQWgPZraCdMjeRhhCfJeh8BMZeI X-Received: by 2002:a17:902:ab8a:: with SMTP id f10-v6mr1980819plr.318.1519397212463; Fri, 23 Feb 2018 06:46:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519397212; cv=none; d=google.com; s=arc-20160816; b=PxtuvA2FaxMCyGbB6ZtDBYhYkUeO0w11YkgDbXrS0H5ICZMxTJHT4OjiI9C+T2LXe4 79bVS7nQqJQI+mJ739SpiTJ4rJVkbQ85ancJqYTpaDQBmw3EH0nbSGe8AVQgKv+LUUPt qkrsUBwxS7hjQhvz5NpGykIdfefk6Pv0xCyW4pO2xOR/Mal0d/7xn/CY5WKP/N7edHLO Gm9MbJ/vAcHJiZ/E3pY9DbjK5bcOfRueZq1URvnoWCLuU9j0WQjBpYNRYeW9X6clI7vJ +zDWF/M/b3IAZUSGemuilOvzf93XyA0NxyAC2MfAtkyKVMG0adYoXTB08GhxEQdCzItV wBfw== 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=leAhOzy7Gi1B5Zf/NUMNmLNIXfgvbjAnXXxOU85Xm3w=; b=nVcsQxL2yfoDQWsDKeTvwOc1rCzjleCvq0kMw3CHzKZR0sVkr5OQIwTP47Zxb5XHjb zDXeGCGf35v0LShClIq5LgGbxsf+/QSW7AL4Qcg7CW91GdpUs76NAqES195/8UiL1Jfv L/AHGcCop957P0BdnZn/bEKKWq+Bg+L1V6Gg5qqTgXLElUUgd1Iqz5Sq0CtFTs5uLahb 8G3Zx8iqh097GUZTbNPM4iCO/+lkA63VzyNW0eJ7FX0Afyw3JomPUGCGaZj/iUDcgxRM e4d0kh6x3sQGE2zz/cPv3VR0Pcz0uOQk8zzcxOnohMlG5Pe5CwxVi1koBD51TMnOLr19 Yk1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=WEjwiy1a; 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 l1-v6si1888964pld.81.2018.02.23.06.46.37; Fri, 23 Feb 2018 06:46:52 -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=@gmail.com header.s=20161025 header.b=WEjwiy1a; 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 S1751503AbeBWOp2 (ORCPT + 99 others); Fri, 23 Feb 2018 09:45:28 -0500 Received: from mail-lf0-f65.google.com ([209.85.215.65]:41245 "EHLO mail-lf0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751317AbeBWOp1 (ORCPT ); Fri, 23 Feb 2018 09:45:27 -0500 Received: by mail-lf0-f65.google.com with SMTP id m69so12683866lfe.8 for ; Fri, 23 Feb 2018 06:45:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=leAhOzy7Gi1B5Zf/NUMNmLNIXfgvbjAnXXxOU85Xm3w=; b=WEjwiy1aY20sQMwMW8QTmXKD0V3bGUp3SjiMT9GtwIzlzGDKt/698n4fmYJoThHI6A 0wGQjz3R49hJao0hjkdN+5CBhoIieG/xUVIynkCMKCX9SQrUuQsQmdTBD6O/s8M+wmod HHE36uCKjVhahd7/D7SO04janozwtNqIAlU9JYOYHELiuq5BE5HsUwQFy+puOwxKvFSR f5P5u1MouFT4zcmGAuPvoVh+5yQxwsr/+76F6aSohOh+c6U38N5Hgj2sFn5OrIoTv7Y7 5sQzLzr526ras7QhwRtS3AN6SX+L/qN6nLLgnKTST+EDgM9SUAdl3rWFCRigrQC4JO4C odyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=leAhOzy7Gi1B5Zf/NUMNmLNIXfgvbjAnXXxOU85Xm3w=; b=UzUvJcHUP4M4UXIZfCyL0Q/V603yNXBPt1dYr4fGxAx691/ZpTq3KNJhgVGIBGGrUP ipst8NmDKUeaJTwlgZpigwX3Ja5cZvicgwKIwi0Bbp1XFEEQwYUKdv19N1k2/G+sXdJe tbHRZDVJ55VkCMeuV9YmJPWVADLHQGzd4cmnv+9b7tXgGntmSFZYS+aRnMN7gV0tYc2o F8ZRl0uyVpnTcYYa24qtYXw2ZE7rA1dgSTc5nyHM6SwZK877Pe64uNhIY66+sgI6Q5Da t8fDUmnWi/v8dF5b9GnpBshc2AKU7ASjuwRUHrjkraLRJtHFcCrQvY3wAopcJRyM2y+E 5HoA== X-Gm-Message-State: APf1xPB+fs3fFsCDpZTsBghJilRZQR/iyN9+eq7MRh+TvUL8xEgVKg/D 6RS3YIoxn31eA1I8jogS8dg= X-Received: by 10.25.147.219 with SMTP id w88mr1580699lfk.58.1519397126063; Fri, 23 Feb 2018 06:45:26 -0800 (PST) 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 q133sm499677lfe.60.2018.02.23.06.45.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Feb 2018 06:45:25 -0800 (PST) Subject: Re: [PATCH 5/9] drm/xen-front: Implement handling of shared display buffers To: Boris Ostrovsky , 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> <36003bb4-6fc9-f8f9-2817-103bf0f543e9@oracle.com> From: Oleksandr Andrushchenko Message-ID: Date: Fri, 23 Feb 2018 16:45:23 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <36003bb4-6fc9-f8f9-2817-103bf0f543e9@oracle.com> 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 02/23/2018 04:36 PM, Boris Ostrovsky wrote: > 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. > makes a lot of sense, thank you will rework so I reject to load if the requirement is not met >>> >>> >>>> + 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. ok, will remove BUG_ON as well > -boris