From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 04057C47084 for ; Tue, 25 May 2021 15:23:56 +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 A9170613AD for ; Tue, 25 May 2021 15:23:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A9170613AD Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ffwll.ch Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id AE1326EA5A; Tue, 25 May 2021 15:23:51 +0000 (UTC) Received: from mail-oi1-x22e.google.com (mail-oi1-x22e.google.com [IPv6:2607:f8b0:4864:20::22e]) by gabe.freedesktop.org (Postfix) with ESMTPS id EB78F6E154 for ; Tue, 25 May 2021 15:23:49 +0000 (UTC) Received: by mail-oi1-x22e.google.com with SMTP id c3so30620915oic.8 for ; Tue, 25 May 2021 08:23:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=kTDVYERloXMatCyeiZprMdw+ZqqAF8U3vkXxwNviuhE=; b=hFRX90RiXmVdz6wOJEn4loBpHqSWMrMbjZynm/DxKGZsKMl+hkatktMc3cP5Dg0KJr +5P0ufkS0x1utRnP5TriCW9U7L1/m5IQfZM+WxrdUkGENWSrDCVDoYM5kqnhnHvtMqgA 9OcrvouZwFc/e0+kT4i55+Ne4FK56XH6+uhfo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=kTDVYERloXMatCyeiZprMdw+ZqqAF8U3vkXxwNviuhE=; b=lCihCsl4Q3o2KPXPDCMAr8uD/pucmHGFPJ4w+VhedP3DWffy1sfpPKPROJaSboKWAf hos/OEe96N8D613lSJzxelbKG9ceog8R1iFYdgBD20v0AOnWxMkRZy+AezME3SM/cucc 5Uz0yz2kptGIqd4uhhYrGbvnp7v/4fHxxM5Cr60mi0PSP/ifPMciQdSwhHFZT4LiSnrq HwcNjHYvX3pHb/2KRJQJw2MjnPBpdRNVTi6MabKc3iVwQ4vIevv5IZRP0z4lNTOO1iQL y1K/tXn55w4K+SZ8ADAjWds4UmWHkDxhCsKc40bEd1+NuP/OQ+kA22tL8PaDGWphT/z5 0sxA== X-Gm-Message-State: AOAM530zZec0OURvt/CJQp77v0X+9GqbqEtuzB6NuGKO+EmRgL5+tlJz lwOUjMtMakNbCLz2pW/cCKaAszFmv4KigwLptmExQw== X-Google-Smtp-Source: ABdhPJxBtqznOER5ji1pe4q7zkzmZLFcts0wZUaXWwdx183bu9IvqBts79PXhAkKTw3Mm2nfiB5S2ymvDCJqaInJxj0= X-Received: by 2002:a54:4809:: with SMTP id j9mr3145800oij.14.1621956228923; Tue, 25 May 2021 08:23:48 -0700 (PDT) MIME-Version: 1.0 References: <20210521090959.1663703-1-daniel.vetter@ffwll.ch> <31467363-e936-879b-8b0d-5a2a92644221@gmail.com> <312b183f-8eb2-d9e2-24ad-b429b74c886c@gmail.com> In-Reply-To: <312b183f-8eb2-d9e2-24ad-b429b74c886c@gmail.com> From: Daniel Vetter Date: Tue, 25 May 2021 17:23:37 +0200 Message-ID: Subject: Re: [Mesa-dev] [PATCH 01/11] drm/amdgpu: Comply with implicit fencing rules To: =?UTF-8?Q?Christian_K=C3=B6nig?= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Rob Clark , Daniel Stone , =?UTF-8?Q?Michel_D=C3=A4nzer?= , Intel Graphics Development , Kevin Wang , DRI Development , "moderated list:DMA BUFFER SHARING FRAMEWORK" , Luben Tuikov , "Kristian H . Kristensen" , Chen Li , Alex Deucher , Daniel Vetter , mesa-dev , =?UTF-8?Q?Christian_K=C3=B6nig?= , Dennis Li , Deepak R Varma Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On Tue, May 25, 2021 at 5:05 PM Christian K=C3=B6nig wrote: > > Hi Daniel, > > Am 25.05.21 um 15:05 schrieb Daniel Vetter: > > Hi Christian, > > > > On Sat, May 22, 2021 at 10:30:19AM +0200, Christian K=C3=B6nig wrote: > >> Am 21.05.21 um 20:31 schrieb Daniel Vetter: > >> This works by adding the fence of the last eviction DMA operation to B= Os > >> when their backing store is newly allocated. That's what the > >> ttm_bo_add_move_fence() function you stumbled over is good for: https:= //elixir.bootlin.com/linux/v5.13-rc2/source/drivers/gpu/drm/ttm/ttm_bo.c#L6= 92 > >> > >> Now the problem is it is possible that the application is terminated b= efore > >> it can complete it's command submission. But since resource management= only > >> waits for the shared fences when there are some there is a chance that= we > >> free up memory while it is still in use. > > Hm where is this code? Would help in my audit that I wanted to do this > > week? If you look at most other places like > > drm_gem_fence_array_add_implicit() I mentioned earlier, then we don't > > treat the shared fences special and always also include the exclusive o= ne. > > See amdgpu_gem_object_close(): > > ... > fence =3D dma_resv_get_excl(bo->tbo.base.resv); > if (fence) { > amdgpu_bo_fence(bo, fence, true); > fence =3D NULL; > } > ... > > We explicitly added that because resource management of some other > driver was going totally bananas without that. > > But I'm not sure which one that was. Maybe dig a bit in the git and > mailing history of that. Hm I looked and it's commit 82c416b13cb7d22b96ec0888b296a48dff8a09eb Author: Christian K=C3=B6nig Date: Thu Mar 12 12:03:34 2020 +0100 drm/amdgpu: fix and cleanup amdgpu_gem_object_close v4 That sounded more like amdgpu itself needing this, not another driver? But looking at amdgpu_vm_bo_update_mapping() it seems to pick the right fencing mode for gpu pte clearing, so I'm really not sure what the bug was that you worked around here?The implementation boils down to amdgpu_sync_resv() which syncs for the exclusive fence, always. And there's nothing else that I could find in public history at least, no references to bug reports or anything. I think you need to dig internally, because as-is I'm not seeing the problem here. Or am I missing something here? -Daniel --=20 Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch