Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp738864imm; Fri, 8 Jun 2018 04:35:22 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIQBYKBIosisAiN6h6h9u/tlqFlDOeGhdMktdzduuR6XpCplBJ8VqLSdiT1LCzEdLCZaGyZ X-Received: by 2002:a17:902:2805:: with SMTP id e5-v6mr6272559plb.55.1528457722006; Fri, 08 Jun 2018 04:35:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528457721; cv=none; d=google.com; s=arc-20160816; b=jQEEk5nZ+JT0CRVaWG4vdGtHpBnjnhzUllfQkjJjR4n5MGkE4Zz2e6PIC683cS/y5G xePN8l90Q9/M9Goygwr0FxOdEIRtm+3WveKY3Lj0Xk07tMWevbv11woS/CEZXDSg42G1 5lCM5ZFdIsdSjTePFAoQmJ/pCVQ0+n1+uAtNpXG7M5YW3zhrnFudaYls+SHZFCU1lBbD Lglv9ik8QBlQ/m9nMa4GtqGRF/+ISWKxZjyyX3xtVx6cc/XCmDqKx7/twcStGNUsohye WhEWPBECR12tj/vioMd2osB435hyJhgyXFDLEfkSk5CF7TEbYayI6oSpKT75/k2463Nv ODyw== 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=9sA7oRCH1r5JNp+7y2Zmxqp3kX7+dtEdhA8/B7jnz48=; b=odKJOACF3Aw+WE63BuQVKQmY0pA8eFNw4icD7k8Xhu0PB851LQVmQnicUPv4n6rq/V MGJRUB/kGg67u+h7NUuXp+YMlt3d/dZhCZHLKlRWyFF7Cm8Al8SGnVcWhB7/NAl/OBT+ ytQNNrfigtdSt/7drnpckfN9ncOkpi3dFMwrVbcKoS77RpzRkyQCB8zdmfTYqlAPqYwu nbfIOrF9U7yeNkPuCTwgDtdLvtx7QdphAclPfxzot4vEGVn+YagaiI4m5DTt1TSh19EC v2Kax2KJ55pJ+77/PYEhqmlnfneaJUML+0G9WCihv1x/48Tst+GfP0yNMKbyGBxlulgC fwKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Zrblun/i; 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 t87-v6si16093734pfk.228.2018.06.08.04.35.07; Fri, 08 Jun 2018 04:35:21 -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=Zrblun/i; 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 S1752875AbeFHLeo (ORCPT + 99 others); Fri, 8 Jun 2018 07:34:44 -0400 Received: from mail-lf0-f65.google.com ([209.85.215.65]:44799 "EHLO mail-lf0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752650AbeFHLem (ORCPT ); Fri, 8 Jun 2018 07:34:42 -0400 Received: by mail-lf0-f65.google.com with SMTP id 36-v6so19538480lfr.11; Fri, 08 Jun 2018 04:34:42 -0700 (PDT) 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=9sA7oRCH1r5JNp+7y2Zmxqp3kX7+dtEdhA8/B7jnz48=; b=Zrblun/i1qmWE3Ez/n4WFoRk/PquieOgftJDYbTsQnsUeNEBod71Fgyxzcq9qQjs+1 wTA6CwRpjX7aEnUtROWJ9aVSRLvnvvX1uHuoVTeHLWYEypxlVFyQ/PC0Sp8wnVPczMSd tNTWo5xL7ybIcDXknC9WiMWsfBdMiAINpMqGzpTaoxrPOFk0XKS21dzyEZX6ArkoQgv7 e7gLZ5yXc2KKOyu8dY1kzQrD1bPOOYHpLvO6QixrR3iQ85wF3VA6CTJQlKMRytdRFmbd FKf/WAxmzBaDccLZl/is43KGZ+poa2ZyJlp/NqPojPnfclHpfIeTAFRomT4ewZTKzVZn hOKw== 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=9sA7oRCH1r5JNp+7y2Zmxqp3kX7+dtEdhA8/B7jnz48=; b=K6CzpEtjgnzihPwV06XM+B68fuhQdBQieDP/ScesU+Fa4Smg8lX1pKs3vCUsZ40WLL bjxmt+OO8bM6Zc76hsmBBsZM18FWcDaKFivPr2z24QWtmaVK81q6hotdLUY40zqbJ3NJ mBwzkCeryirGApe8T0DTMFraY4RbGJIkpi/saSIFHsIPLblKLu9cBTnXWHw+H1hRVND/ LyT2GL+HQk6oUBtYYwwokrjp0QkB08ZMlzMyqH16InEURI2+PwPhLzglP4eMOFeGEBUx C+Ku4v/Wn8vnnjRelAU1NuTb1NAzdEnXFH57KVrcD/bMr8QquRN7GoNw9Ap08/7REl2y fTlg== X-Gm-Message-State: APt69E0491baaq5DDZr6sJF3g1aQQATt2TP1PqtLB8Hywkua1lBmrOd4 kCaH+MNJPU0Ivd10Ypq0Dfs= X-Received: by 2002:a19:d1d4:: with SMTP id i203-v6mr3636202lfg.93.1528457681224; Fri, 08 Jun 2018 04:34:41 -0700 (PDT) Received: from [10.17.182.9] (ll-74.141.223.85.sovam.net.ua. [85.223.141.74]) by smtp.gmail.com with ESMTPSA id p18-v6sm12180747lfd.91.2018.06.08.04.34.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 08 Jun 2018 04:34:40 -0700 (PDT) Subject: Re: [PATCH v2 7/9] xen/gntdev: Implement dma-buf export functionality To: Boris Ostrovsky , xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-media@vger.kernel.org, jgross@suse.com, konrad.wilk@oracle.com Cc: daniel.vetter@intel.com, dongwon.kim@intel.com, matthew.d.roper@intel.com, Oleksandr Andrushchenko References: <20180601114132.22596-1-andr2000@gmail.com> <20180601114132.22596-8-andr2000@gmail.com> <96dd30f5-6ac6-498f-06e7-352e46994576@oracle.com> <117e05b3-69f6-b879-50d9-0cddd8e4c313@gmail.com> <4b37bbe1-6c5c-1941-bac0-2c7ba88af3e3@oracle.com> From: Oleksandr Andrushchenko Message-ID: <0c820b7d-d9e5-8a60-b9fc-86eb3ca81df8@gmail.com> Date: Fri, 8 Jun 2018 14:34:39 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 06/08/2018 01:30 AM, Boris Ostrovsky wrote: > On 06/07/2018 04:44 AM, Oleksandr Andrushchenko wrote: >> On 06/07/2018 12:48 AM, Boris Ostrovsky wrote: >>> On 06/06/2018 08:10 AM, Oleksandr Andrushchenko wrote: >>>> On 06/05/2018 01:07 AM, Boris Ostrovsky wrote: >>>>> On 06/01/2018 07:41 AM, Oleksandr Andrushchenko wrote: >>>>> + >>>>> +static struct sg_table * >>>>> +dmabuf_exp_ops_map_dma_buf(struct dma_buf_attachment *attach, >>>>> +               enum dma_data_direction dir) >>>>> +{ >>>>> +    struct gntdev_dmabuf_attachment *gntdev_dmabuf_attach = >>>>> attach->priv; >>>>> +    struct gntdev_dmabuf *gntdev_dmabuf = attach->dmabuf->priv; >>>>> +    struct sg_table *sgt; >>>>> + >>>>> +    pr_debug("Mapping %d pages for dev %p\n", >>>>> gntdev_dmabuf->nr_pages, >>>>> +         attach->dev); >>>>> + >>>>> +    if (WARN_ON(dir == DMA_NONE || !gntdev_dmabuf_attach)) >>>>> >>>>> WARN_ON_ONCE. Here and elsewhere. >>>> Why? The UAPI may be used by different applications, thus we might >>>> lose warnings for some of them. Having WARN_ON will show problems >>>> for multiple users, not for the first one. >>>> Does this make sense to still use WARN_ON? >>> Just as with pr_err call somewhere else the concern here is that >>> userland (which I think is where this is eventually called from?) may >>> intentionally trigger the error, flooding the log. >>> >>> And even this is not directly called from userland there is still a >>> possibility of triggering this error multiple times. >> Ok, will use WARN_ON_ONCE > > In fact, is there a reason to use WARN at all? Does this condition > indicate some sort of internal inconsistency/error? Well, the corresponding errors are anyways handled, so I will remove WARN > -boris > > >