From patchwork Tue Jun 18 11:54:53 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: 11001449 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 4821B14B6 for ; Tue, 18 Jun 2019 11:55:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 38A6326247 for ; Tue, 18 Jun 2019 11:55:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2CBFF288C7; Tue, 18 Jun 2019 11:55:15 +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 E145426247 for ; Tue, 18 Jun 2019 11:55:14 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1DDE86E15A; Tue, 18 Jun 2019 11:55:03 +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 1CA926E151; Tue, 18 Jun 2019 11:55:01 +0000 (UTC) Received: by mail-wr1-x441.google.com with SMTP id k11so13662998wrl.1; Tue, 18 Jun 2019 04:55:01 -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=NE3hfYG/T3rCWfqhG4/+dxzY7lcK7lm1RJTpIxXzxpBc7RFK/FZsKf5nKzRn4F+MFq Bb8tdl19LaILkGdBd9Ms4rK9Pjs71ucNQ3YIBfYIgSMCGXCD19wK4natBH6ux0N8iyFL FHoX+Otl3ZrO3CCVPM2zzH7KfDPKglQp60n4hVvmZwKDwyzBluUUgKIqoAuWcyzWN9du Ug4dDL20LFGmkyHeWcsYBMXaC+cJMDhRHtlbwGjWlC8okRQ31tKuHebdT9v4IcDkPzMW wrj1E37tk2Dh3/hhYAuB8YFPCWbSQ5ft/CNDw0Af6M7Pm7xR/r4NG1WiSf8aPFiySNs8 IGzg== X-Gm-Message-State: APjAAAVlDXn0sAfIXs1P20BKcOMkFP747npIZUb9ZCKhR2Hk3Ramun3x mqbGvgVwxb343d80BzEsXn3nUkih X-Google-Smtp-Source: APXvYqzVPZs0gtS1klFlUx1lO9fmsPXYGPYKeVAArQh3140lcV/t9+TNFldIDSwSJDDnWKegKhK4Mw== X-Received: by 2002:a5d:5302:: with SMTP id e2mr66313115wrv.347.1560858899141; Tue, 18 Jun 2019 04:54:59 -0700 (PDT) Received: from abel.fritz.box ([2a02:908:1252:fb60:88da:f390:6b90:ca6c]) by smtp.gmail.com with ESMTPSA id l19sm1441963wmj.33.2019.06.18.04.54.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 18 Jun 2019 04:54:58 -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: Tue, 18 Jun 2019 13:54:53 +0200 Message-Id: <20190618115455.1253-4-christian.koenig@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190618115455.1253-1-christian.koenig@amd.com> References: <20190618115455.1253-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=mKYkx+hr3qaD8QOs3J7HC1CaAyqX7BOFFg/B+7PzsURbjVagQLZZKb3Ddu1Z6/v9lN Gk1ItdF7rEWBzAire8DG0qsUl+SuW4weRfQ3z38pmtDK95GctD/9s/Ok1rGancQjVlZ1 KNxAmgmVukdRq3bRe0rknGmnY0b9bVNtL7BWvCrq5tNjWHYQL5z2JZU7Jq+CLUxKVdTp rlAZoKL8Gs/y1OpQlSvV0SPdsJtvHRfoEnOasceji6ITxyLmTuIC08b4m7wpzeR+5Q4i 7IbCTDlT4gihkig2Cf2IR73a9gZqCU/8llvXtml8Igel2jP0fvPts9uqIrwFmIG1qqnA BW4g== 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