From patchwork Mon Feb 17 15:45:07 2020 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: 11389155 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B82DF138D for ; Tue, 18 Feb 2020 17:17:18 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 96B1F20801 for ; Tue, 18 Feb 2020 17:17:18 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Y22XVDoh" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 96B1F20801 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=intel-gfx-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id F41996EA48; Tue, 18 Feb 2020 17:17:16 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-wm1-x343.google.com (mail-wm1-x343.google.com [IPv6:2a00:1450:4864:20::343]) by gabe.freedesktop.org (Postfix) with ESMTPS id 37FFC6E97F; Mon, 17 Feb 2020 15:45:17 +0000 (UTC) Received: by mail-wm1-x343.google.com with SMTP id a9so18968999wmj.3; Mon, 17 Feb 2020 07:45:17 -0800 (PST) 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=0lgm553hPYQaEJTHB0pb7QyRdRPovA2HobQYck8682M=; b=Y22XVDohmOnl5FXMZcCupBmCBI122LiSYuXqxGmQeNvaUMRZpnGIB7yZKfO9/LzEXE P1HqSSGAXbCY5QHt91RFhrL6bihgjvlakYrIemt5iODVd9bT0TldOfcmQk4GijRSv443 ujQsvwuAzL1T2TRh8NWSgFwqbJKdiPj1yQZJf5CtU4frYO3w3IgNXzRtZSB9kdMGu3z1 /RbclQw1ARvC6+YC06Fq3PXPu5tUROT+6QewkZJ/4jc0c6lGsLEHHqeXqfHZbshef4VU smV+8wz3cJ3Crw6bPGBgA5gRRcIK1fKRlXY08bt35mPKkhlNvKMjtH4ymXfiVqFaf8K4 +vgg== 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=0lgm553hPYQaEJTHB0pb7QyRdRPovA2HobQYck8682M=; b=cyL/bM80fm0Xmeb7HZdzbl1dtsnb5WwnJuOFZ/w3Le2yjOYWUcan7eyyXPFbkzwR0P uchqH6qXt/RWhGr/qC2R0HDVvQlvdF1DfVFpV+Z0aEYre5fm0LcX7h9mN3vABUKs9K8T 1z9O8JiKolHGBzseQ55sisAKKm8W5zymJ/a5X6mgqGgcP1d3nBYEdXHwJPt3R2G6OMcC 7Qma5zXOTte76DjnM585h3G/+N8gvZKEthUeEkrfqbDa3u4/tKyrzUvvPjYYrkZxHjkX G5cK0B0NsL+ZKRYyZI6XTkbVfm8a7ECC47xnB2x7z67MQL3moPe2ibXOS6kUm7BxOdgx cDyA== X-Gm-Message-State: APjAAAWqQHyOyWQ1R4NqMJ4UYEBFG3HUYhtE9EEuwu3tinx44NXWZ0Qx Kbf1QXChRyx0AVeHy+8Ky1d7AQCq X-Google-Smtp-Source: APXvYqx4l6rbr7zg8+Q0aB2D7gM+bBaUt6brScjkVXjxlESt7DIT1gRqivO7ISJOtqu8ZVJTqwPZgA== X-Received: by 2002:a05:600c:251:: with SMTP id 17mr22586539wmj.59.1581954315652; Mon, 17 Feb 2020 07:45:15 -0800 (PST) Received: from abel.fritz.box ([2a02:908:1252:fb60:180d:d2d6:6ff9:a6cb]) by smtp.gmail.com with ESMTPSA id r6sm1372658wrq.92.2020.02.17.07.45.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Feb 2020 07:45:15 -0800 (PST) From: " =?utf-8?q?Christian_K=C3=B6nig?= " X-Google-Original-From: =?utf-8?q?Christian_K=C3=B6nig?= To: dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org, linux-media@vger.kernel.org, intel-gfx@lists.freedesktop.org, daniel@ffwll.ch Date: Mon, 17 Feb 2020 16:45:07 +0100 Message-Id: <20200217154509.2265-4-christian.koenig@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200217154509.2265-1-christian.koenig@amd.com> References: <20200217154509.2265-1-christian.koenig@amd.com> MIME-Version: 1.0 X-Mailman-Approved-At: Tue, 18 Feb 2020 17:16:57 +0000 Subject: [Intel-gfx] [PATCH 3/5] drm/amdgpu: use allowed_domains for exported DMA-bufs X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 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" 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 80ba6dfc54e2..d938d458e22d 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 @@ -417,7 +418,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->tbo.base.dma_buf || + list_empty(&bo->tbo.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