From patchwork Fri Jun 7 12:50: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: 10981629 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 4C17D15E6 for ; Fri, 7 Jun 2019 12:50:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3BD0F28BE5 for ; Fri, 7 Jun 2019 12:50:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 305F928BE8; Fri, 7 Jun 2019 12:50:52 +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 E864328BE5 for ; Fri, 7 Jun 2019 12:50:51 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 111DA89CDB; Fri, 7 Jun 2019 12:50:47 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-wm1-x344.google.com (mail-wm1-x344.google.com [IPv6:2a00:1450:4864:20::344]) by gabe.freedesktop.org (Postfix) with ESMTPS id 897C089D43; Fri, 7 Jun 2019 12:50:44 +0000 (UTC) Received: by mail-wm1-x344.google.com with SMTP id g135so1955124wme.4; Fri, 07 Jun 2019 05:50: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=p9wRG1vgieI5Tw7lzVfOuELR6Jdrkf3meS0vFGCuHyY=; b=ng9FO8ej4UIx6gN7TdiWKzNJYc6alH490EjvlyYcjUK6huStB9bUJcw0cMSDigHtMK qxjgXzXWqtzU6kKvb375W1U/+gl/ErlKzzZoQky97SyROX5B2nMECBFWqJm0S4rijM+E EXr5iuxeriUQLtclKeRw55+2imwYNdN+fSeDRXHbJUskJ62w2wbBdlPo9eGWAZvAHA3j n0CVomKbmMxdNnhnLEX2Ap6QuR/sTWfpR+v0nYWufsSMPDziIiD88TuAB2xBAFbnu6fk MsHMXO3fR0BTSdC8lXAJiGjR6EUdXQwdNnEn3VnSRS0BbZD64zT1QGDlo/6RFt6o5ZhB 6U6Q== X-Gm-Message-State: APjAAAVkM+QlxaVy1aU0tYVBe3xDJLNVpWvFj/cSS8ecxaEdsB+bQidW H5Ja7Bh+OXVdd7i+/AEtqQ+wQu5C X-Google-Smtp-Source: APXvYqw9hjAyrm3ZdAvHCvy35+Se2DsSZEPtM6lEDE5hdHZC1yA9gGiXS8dRbNeTrQVEgX6yGy1SoA== X-Received: by 2002:a7b:ce87:: with SMTP id q7mr3358312wmj.22.1559911843097; Fri, 07 Jun 2019 05:50:43 -0700 (PDT) Received: from abel.fritz.box ([2a02:908:1252:fb60:c5a0:21d3:d7e7:98b7]) by smtp.gmail.com with ESMTPSA id 32sm3923249wra.35.2019.06.07.05.50.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 07 Jun 2019 05:50: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, daniel.vetter@ffwll.ch Date: Fri, 7 Jun 2019 14:50:37 +0200 Message-Id: <20190607125039.2240-4-christian.koenig@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190607125039.2240-1-christian.koenig@amd.com> References: <20190607125039.2240-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=p9wRG1vgieI5Tw7lzVfOuELR6Jdrkf3meS0vFGCuHyY=; b=nKYevvOqxBT9jNvXXXgf6cw2ajXjc2TUEz3FTYb7dwd0ON0KReAtYoEtyiRg2PjWSY PO82Tx6JwrMhMUqA4ZMv+KzhhyXhCO2zT4xVugBBIykZ6WtoqPXbhmowd+PC7Sva9BGq ECi9oz0IkNWILuxiD2EBQGbUefVWiWEwUWu0Gi222n3/dqBZQ0ppfyVZjTqYUrakGpCI ijmVGva+zQWyV/otGwg0qh8/++h8ed7wxsQpw4PldlSJ0YzCtssPRGfiYYnIldFSNr9l H9mC2H0x7mguSfhowYWAAgnYeuvz0U7hL6M6qji6jllQ636KGaaXzT1fGKfy2T8AnEun 5Txg== 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 3e2da24cd17a..a59780654335 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c @@ -26,6 +26,7 @@ */ #include #include +#include #include #include #include @@ -412,7 +413,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