From patchwork Fri Jan 29 03:05:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 373274 Delivered-To: patches@linaro.org Received: by 2002:a02:a60d:0:0:0:0:0 with SMTP id c13csp1807935jam; Thu, 28 Jan 2021 19:05:19 -0800 (PST) X-Received: by 2002:a17:902:6a83:b029:dc:2a2c:6b91 with SMTP id n3-20020a1709026a83b02900dc2a2c6b91mr2461963plk.8.1611889519269; Thu, 28 Jan 2021 19:05:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611889519; cv=none; d=google.com; s=arc-20160816; b=NBCuQXa+OV+QS7HpchLeao6E7W60otWwze1ynfXdva0IDJlJo7uueawUl/FBLmA6rf Ilau8H/obz4jw145dQEE6OsrszSAoURUYPhdvomZX7zbcsRdbj6rQh7VI7U2gY1Mb5tE 1di7PcU5NpFtkjxhIqQJS2x0q2G57BLpo0uHXApGGv6oSu2K/XcZTPTkFkQGbBwQekmO iJ0niePK7NI42CfIPi6JCVtda3Jv2n8Eu2eQnattEtO2v9UCBd8wfyOuq7tbrZ6ZhUBO nUhFDkQnN+FbLkvScvVMyaA8fYcDceItAn395KgMCLgOYVo+XkmstF+kQaISgV9rd4jq 5zEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=++jZtzOYyQ1+vtEeMaOUIstaO3RLvVGMYd5LElrs3tk=; b=vxdlNqOwf9bNcjfeZWcb+lFfrfyYYmM/0d4yqJJnb9S41lw95SbIL73Qjlh5Vl1UiL nJmYjvlhlEVA3zblTlCurq/CF9u8GibEgNWHCxdtc2LxLhsIrnJ6rdRGyGjk2BjwEmfi v0ahozm9lghHPN/VoeTyIOO1oSMdySf8/3s0g+wklRxFG8CUcyVTX0EasqzQEJbeFF+T sasYgIwtkNWCKtwFcgi7nhbiZbyrALimd9FXWcbioUYVaYVNPRbIXy9AaBHga8yFR+KX d0COa4bRoj4BUyNegJZ6zBTAclqhsB6yLl2B76xxbZUBGm5cqQ0ZG3VkHrDeLCYTerD+ bGrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=uhyod5IV; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.41 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id 3sor4266397plb.67.2021.01.28.19.05.19 for (Google Transport Security); Thu, 28 Jan 2021 19:05:19 -0800 (PST) Received-SPF: pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=uhyod5IV; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.41 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=++jZtzOYyQ1+vtEeMaOUIstaO3RLvVGMYd5LElrs3tk=; b=uhyod5IVvkWiHsST5/O68YcC4Axe3RKRQzvKBXYml1+ezIoSduIUXyT3McvxxfQb6X MdGdB6a0QGYeKJPc6EOPv4LDPZzHfkLWnQhCaEjmTW+3EDXkZRQFpri3M7TDZpXFwknB nzDT/YpZaeczzI5+TCeNblHK1riCKukRLYsO4ZNEgO2aC4WhQT2Ut1dctUoeYX4W6t9T ZW828X9T4wU/86xrUnE1rqIASwioP5MyUUMrrPaQuKKUYlALfUnddC1lV5fGS3MkmN8L pujzNObUmAqlaJN71GQQzc71PDhg+rwgYMgYwG4kvOBSZEYKrvspyB0LF4dA10Zcxcfq DqSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=++jZtzOYyQ1+vtEeMaOUIstaO3RLvVGMYd5LElrs3tk=; b=n6jYukLBqoVgKDkoZ1wfwmaoEXtDo41g/3hMz/NmtaNqR4QruU2bgXFIEOC2Tqj7z4 FNrgn6q4SP0ymdMAGYVdfNIRldRU1pssgBP16JXAJoth0YYLDp4bS2DocNrM1QyPoE6K 1Wjoj4ymNFWtJ0KjM8Cuho/dz9HnDmKuqskHI3xSKHeb0QNdmywfjXexx8Za6iU8felG /wc+F4UhW9CqRcnmvKoL1TYI8EZbciMIhhVEt4+tLoroqjaIq+/orbYfMLgvuPqatFZ9 cZ6mReILCsaCuyvA+WxzL8tMUnXxq+B6kdgx0MPVV6TbNfA6pudVtq0REgiD9slm6w9H yR+A== X-Gm-Message-State: AOAM533k91gb2IN7gIeJ9TIJyqUpm/hOmAvtV5BXI8Wamiv4aGTrPzg+ 2i5uzI8A8wIGoX2N7kr6w5Aa+lG1 X-Google-Smtp-Source: ABdhPJyGn3wdGoYadza5iNZE6bj/nXq6MrRCQBVxL3lyhFqvG5bHcjloTEwy1RXyVtmPLRFrsk59eQ== X-Received: by 2002:a17:902:a710:b029:dc:3817:e7c2 with SMTP id w16-20020a170902a710b02900dc3817e7c2mr2361020plq.0.1611889518950; Thu, 28 Jan 2021 19:05:18 -0800 (PST) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id y75sm6854496pfg.119.2021.01.28.19.05.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Jan 2021 19:05:18 -0800 (PST) From: John Stultz To: lkml Cc: John Stultz , Shuah Khan , Brian Starkey , Sumit Semwal , Laura Abbott , Hridya Valsaraju , Suren Baghdasaryan , Sandeep Patil , Daniel Mentz , linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-kselftest@vger.kernel.org Subject: [PATCH 2/5] kselftests: dmabuf-heaps: Add clearer checks on DMABUF_BEGIN/END_SYNC Date: Fri, 29 Jan 2021 03:05:11 +0000 Message-Id: <20210129030514.1231773-2-john.stultz@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210129030514.1231773-1-john.stultz@linaro.org> References: <20210129030514.1231773-1-john.stultz@linaro.org> MIME-Version: 1.0 Add logic to check the dmabuf sync calls succeed. Cc: Shuah Khan Cc: Brian Starkey Cc: Sumit Semwal Cc: Laura Abbott Cc: Hridya Valsaraju Cc: Suren Baghdasaryan Cc: Sandeep Patil Cc: Daniel Mentz Cc: linux-media@vger.kernel.org Cc: dri-devel@lists.freedesktop.org Cc: linux-kselftest@vger.kernel.org Signed-off-by: John Stultz --- .../selftests/dmabuf-heaps/dmabuf-heap.c | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) -- 2.25.1 diff --git a/tools/testing/selftests/dmabuf-heaps/dmabuf-heap.c b/tools/testing/selftests/dmabuf-heaps/dmabuf-heap.c index 909da9cdda97..46f6759a8acc 100644 --- a/tools/testing/selftests/dmabuf-heaps/dmabuf-heap.c +++ b/tools/testing/selftests/dmabuf-heaps/dmabuf-heap.c @@ -130,16 +130,13 @@ static int dmabuf_heap_alloc(int fd, size_t len, unsigned int flags, dmabuf_fd); } -static void dmabuf_sync(int fd, int start_stop) +static int dmabuf_sync(int fd, int start_stop) { struct dma_buf_sync sync = { .flags = start_stop | DMA_BUF_SYNC_RW, }; - int ret; - ret = ioctl(fd, DMA_BUF_IOCTL_SYNC, &sync); - if (ret) - printf("sync failed %d\n", errno); + return ioctl(fd, DMA_BUF_IOCTL_SYNC, &sync); } #define ONE_MEG (1024 * 1024) @@ -197,9 +194,18 @@ static int test_alloc_and_import(char *heap_name) } printf("import passed\n"); - dmabuf_sync(dmabuf_fd, DMA_BUF_SYNC_START); + ret = dmabuf_sync(dmabuf_fd, DMA_BUF_SYNC_START); + if (ret < 0) { + printf("Sync start failed!\n"); + goto out; + } + memset(p, 0xff, ONE_MEG); - dmabuf_sync(dmabuf_fd, DMA_BUF_SYNC_END); + ret = dmabuf_sync(dmabuf_fd, DMA_BUF_SYNC_END); + if (ret < 0) { + printf("Sync end failed!\n"); + goto out; + } printf("syncs passed\n"); close_handle(importer_fd, handle);