From patchwork Wed Jun 14 23:18:43 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 9787731 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id DF686602CB for ; Thu, 15 Jun 2017 00:57:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D46C0284DC for ; Thu, 15 Jun 2017 00:57:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C9507284ED; Thu, 15 Jun 2017 00:57:51 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6D46F284DC for ; Thu, 15 Jun 2017 00:57:51 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8EDC86E658; Thu, 15 Jun 2017 00:57:22 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lf0-x243.google.com (mail-lf0-x243.google.com [IPv6:2a00:1450:4010:c07::243]) by gabe.freedesktop.org (Postfix) with ESMTPS id 925666E642 for ; Wed, 14 Jun 2017 23:19:18 +0000 (UTC) Received: by mail-lf0-x243.google.com with SMTP id o28so1618682lfk.1 for ; Wed, 14 Jun 2017 16:19:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=Gfh7lrWECqmh1Oy40i68Y1h7Lm6qgkETH4IH/yRSEKU=; b=tjyjnRNP22BpnvwSavwk+V7pL1DKo/QvOWWHgDrS9+vU/rbI0bCVuhwK9/GIwCktLn r8S7+CSnWZlW3+QveqXaucv9v/00xzaCQR6+1v04WDNQ+kLyzqeUUfN5DPWiBA30tY/+ 0xifpDmY3F0Rz6S5coIIPhhr8hi5grhE3IlNbrmSTxhuyCUnSFio5D/sfCkuUE2yQ8kj TkY8huL+D74Xs7HLu/hTRQZfTgcly4chgWyKYNCbcqoUf8FhDwPoKeNPq4384U5pIrlL hS8RYw7izluRw9f4Jrf2MtKdSebFRqC2qmgANXMDJZDDV0FBWgpH6EryUKfdvtG1N7dm CT1g== 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:in-reply-to:references; bh=Gfh7lrWECqmh1Oy40i68Y1h7Lm6qgkETH4IH/yRSEKU=; b=Oe6WPPo36K8yLkxgfFidP0Bc4mTk7W9SdA99kNMCtXBBRLhBiVzjMqZDUcqA3wg3+V qVxtNOynGU6V7nNAZ2wITaD9/N2NkJKCdWohk2KkULNqnu6/YWOHF/H6Vrd3RRhk9Lap PPpbeSXWkOyh59MoKZx7tzrngKkOcRCvIkp/vOqtEmkq/oM9qJmYobwEV9XNCJOmNu0a UvLNLAdBvzClR57YdQ37pEtyNbn8k6xHlcesDqKLl0aU03WGzWaXrKXxQM4JgLmSNy+0 K3AFuEGYxqwRBT7e5zBP9ZGqbbU5xcSU64UHh37SOoURgQIPZ/OMirg5LMhy923YASUY BmcQ== X-Gm-Message-State: AKS2vOxlwJ/7MGfLp7yfMwX4KetaizTxuqIGffOdAcPULyPhsRAG0f44 h01IwXIp1OUa6w== X-Received: by 10.46.77.200 with SMTP id c69mr698565ljd.71.1497482357060; Wed, 14 Jun 2017 16:19:17 -0700 (PDT) Received: from localhost.localdomain (ppp109-252-91-7.pppoe.spdop.ru. [109.252.91.7]) by smtp.gmail.com with ESMTPSA id i24sm290165ljb.63.2017.06.14.16.19.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 14 Jun 2017 16:19:16 -0700 (PDT) From: Dmitry Osipenko To: Thierry Reding , Mikko Perttunen , Erik Faye-Lund Subject: [PATCH v3 20/20] gpu: host1x: At first try a non-blocking allocation for the gather copy Date: Thu, 15 Jun 2017 02:18:43 +0300 Message-Id: <55b832cf3e71fde6c28c05c58c001cf06c1bac8a.1497480758.git.digetx@gmail.com> X-Mailer: git-send-email 2.13.0 In-Reply-To: References: In-Reply-To: References: X-Mailman-Approved-At: Thu, 15 Jun 2017 00:57:20 +0000 Cc: linux-tegra@vger.kernel.org, DRI Development X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP The blocking gather copy allocation is a major performance downside of the Host1x firewall, it may take hundreds milliseconds which is unacceptable for the real-time graphics operations. Let's try a non-blocking allocation first as a least invasive solution, it makes opentegra (Xorg driver) performance indistinguishable with/without the firewall. Signed-off-by: Dmitry Osipenko Reviewed-by: Erik Faye-Lund --- drivers/gpu/host1x/job.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/host1x/job.c b/drivers/gpu/host1x/job.c index f32ae69a68c7..bee504406cfc 100644 --- a/drivers/gpu/host1x/job.c +++ b/drivers/gpu/host1x/job.c @@ -574,12 +574,20 @@ static inline int copy_gathers(struct host1x_job *job, struct device *dev) size += g->words * sizeof(u32); } + /* + * Try a non-blocking allocation from a higher priority pools first, + * as awaiting for the allocation here is a major performance hit. + */ job->gather_copy_mapped = dma_alloc_wc(dev, size, &job->gather_copy, - GFP_KERNEL); - if (!job->gather_copy_mapped) { - job->gather_copy_mapped = NULL; + GFP_NOWAIT); + + /* the higher priority allocation failed, try the generic-blocking */ + if (!job->gather_copy_mapped) + job->gather_copy_mapped = dma_alloc_wc(dev, size, + &job->gather_copy, + GFP_KERNEL); + if (!job->gather_copy_mapped) return -ENOMEM; - } job->gather_copy_size = size;