From patchwork Mon Jun 24 13:58:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Christian_K=C3=B6nig?= X-Patchwork-Id: 11013229 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 430E376 for ; Mon, 24 Jun 2019 13:58:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 33CCC2870F for ; Mon, 24 Jun 2019 13:58:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 281AE28856; Mon, 24 Jun 2019 13:58:59 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED 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 E0C5E2870F for ; Mon, 24 Jun 2019 13:58:58 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 248D689B9A; Mon, 24 Jun 2019 13:58:48 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-wr1-x441.google.com (mail-wr1-x441.google.com [IPv6:2a00:1450:4864:20::441]) by gabe.freedesktop.org (Postfix) with ESMTPS id A3F9089B65; Mon, 24 Jun 2019 13:58:44 +0000 (UTC) Received: by mail-wr1-x441.google.com with SMTP id d18so14051336wrs.5; Mon, 24 Jun 2019 06:58:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=X/Ddz4BsAQiAV9qvChmuYB8diI88JLFrEunb+dejOTU=; b=Y9m5JZX9Yw2f/omnRIKFk+Yh/sO+lSRSRCZ6TfnW2Rt7sS5pexMX11rPnlaqhCg7l4 1mkw/cW/yf3IiLtbynwUglWxFRuWOxxVDmxg8ng9lOaRNa49I9IK+bbPes33EORVmjax KOFQlexKlWph7j/DNDmoX/4xc+HT49sxdBk7zro1DB3IJr8jKbwGiLDXy8GnYcujnsJ9 QiIOQ8WF/H2mYL9J3U5H64tJGbFygJwE2MXv3Lt48HH3vuci/Om8UddloQd1M0TWOhET 8QC6ZCsRtmXo/hC4esquzZu1euYoawxawQPBb5RY+TsX2w9tvhXBELE2xACTKTWBwPmU gqCA== X-Gm-Message-State: APjAAAWUFxxH4lSGEvknKtW2znVLSoBvOufQjrJJNzh9M/LzfmF/Plh1 R7F0hFEGj0HSZErc2XIqUaOK8Czh X-Google-Smtp-Source: APXvYqyJi9tfvosMzdBDUogvcocFeD5pXvHPe+o5pkdG2MI5egKjL15nolaJilpWJm8a46IbJr57RQ== X-Received: by 2002:adf:f1d1:: with SMTP id z17mr2701067wro.190.1561384723196; Mon, 24 Jun 2019 06:58:43 -0700 (PDT) Received: from abel.fritz.box ([2a02:908:1252:fb60:c026:1db1:e413:81a2]) by smtp.gmail.com with ESMTPSA id y19sm14848623wmc.21.2019.06.24.06.58.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 24 Jun 2019 06:58:42 -0700 (PDT) From: " =?utf-8?q?Christian_K=C3=B6nig?= " X-Google-Original-From: =?utf-8?q?Christian_K=C3=B6nig?= To: intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org Date: Mon, 24 Jun 2019 15:58:37 +0200 Message-Id: <20190624135839.1661-4-christian.koenig@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190624135839.1661-1-christian.koenig@amd.com> References: <20190624135839.1661-1-christian.koenig@amd.com> MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=X/Ddz4BsAQiAV9qvChmuYB8diI88JLFrEunb+dejOTU=; b=gpocmnG3kKF1dAJbZ64EhgNbLaXeIggJc/rAmG1mM2ONkEj6rHgL7jPZefqV7jYCoG ELPYGk0/aW4oUEqFvl28ARPg/nqsEX001vAi/pjsoPsO+mcLGHpn/0XQZZ5TEkAzNmOT NfngVdJd52sD7PdDftckxM1WU8RetXe9IPeBSZm8MsgkXV818zAOtApipDVHiK6STZlk cB1/fuD/trtWzlwCbcX5AejLww1p9/sf80ExPt94re5YJVLyXPMw7gp6d5rVSDW3sgyL +UJeeoWiQJ5U3gpAyxsCOb09HNoIKA+P+uHwgBfZEYvyF7sY86DTcSNN9z2dbe0rsJcZ FBcA== Subject: [Intel-gfx] [PATCH 4/6] drm/amdgpu: use allowed_domains for exported DMA-bufs X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP Avoid that we ping/pong the buffers when we stop to pin DMA-buf exports by using the allowed domains for exported buffers. Signed-off-by: Christian König --- drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c index dc63707e426f..0da512341194 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c @@ -28,6 +28,7 @@ #include #include #include +#include #include #include @@ -414,7 +415,9 @@ static int amdgpu_cs_bo_validate(struct amdgpu_cs_parser *p, /* Don't move this buffer if we have depleted our allowance * to move it. Don't move anything if the threshold is zero. */ - if (p->bytes_moved < p->bytes_moved_threshold) { + if (p->bytes_moved < p->bytes_moved_threshold && + (!bo->gem_base.dma_buf || + list_empty(&bo->gem_base.dma_buf->attachments))) { if (!amdgpu_gmc_vram_full_visible(&adev->gmc) && (bo->flags & AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED)) { /* And don't move a CPU_ACCESS_REQUIRED BO to limited