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=-2.1 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 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 1EEB5C48BCD for ; Wed, 9 Jun 2021 13:58:35 +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 D4E3761351 for ; Wed, 9 Jun 2021 13:58:34 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D4E3761351 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com 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 996966E3EB; Wed, 9 Jun 2021 13:58:30 +0000 (UTC) Received: from mail-wr1-x434.google.com (mail-wr1-x434.google.com [IPv6:2a00:1450:4864:20::434]) by gabe.freedesktop.org (Postfix) with ESMTPS id 30D986E314; Wed, 9 Jun 2021 13:58:29 +0000 (UTC) Received: by mail-wr1-x434.google.com with SMTP id a11so23741097wrt.13; Wed, 09 Jun 2021 06:58:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=EfUm8vlTyp6NaXGJjKaIc3nQYaOxrHl5v0EgWxKtuJQ=; b=tN90Yvjl3B/X/Wz0WgjnAv5FM8MiLzr0r4Glcug4yzxjf3rjKVNvO4m8EYWlCBHXxJ y7n+D2tAHc7pOq2clMAPpn9Ca881rOnSsh8L7oi6+WHWMj+vhZ74+tmlT0j5UQR86iAm ESb35eif8FG9EWdeb4R0xzlk/ea7fyJrpC3v1nopVoTBnuFfkWqOebE3OhLL90NL2+cQ /NwzAGpQTtwO6xYGzQa3omgyvtWKEXOnD7K/2KGvRhBuFuyxffrXGKGCJm08BCz5Pozt N3Df4NnD8EHFPSuhYEaGTPiIPZff/rMb9HaMwG7PSFSj0MGVkT+a/SI/PZtHEQ99DBga MuHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=EfUm8vlTyp6NaXGJjKaIc3nQYaOxrHl5v0EgWxKtuJQ=; b=OizZLMKJE5sFhGXTcTpKt2ZRR7SeJwF49WIXoEqzyMjskAQJMuJoldO9vRNmuCgWqD mNoQ+NgU+9Rti9TqdxOOvUF8WPiAVjcZVhVTkA5PXx/VUHu8phTqPiUD5fnMeO7vRAj6 lsqpZ69ti84SvJPuTgs9/Keq9b8GWAwrdpgdLpsHRA3EKFCLCUhN5p76skbF6XLo711O mw0Ht2QLBw2t4arB90Epq9jXEWQSWtuRZIlVPeOQmq+3uVlClBdhTfsyj6VAhbW2Olo8 FknzQe7WignUarSadtimWCxn85WDkqkOkXTwdnxKrPynZZX1R7ohtD3fQV2mG68D9dI0 kt8A== X-Gm-Message-State: AOAM530vX6N+G+I3fdHF7VOQDaUeiqqGHtGwvAv9gwAoIVBUsUikfVXN F5P2RkWmCND4aECK4T9Jt+BOVBq1DZM= X-Google-Smtp-Source: ABdhPJxLJOfu0qmjCn2x0fgjFzN2yGPBNl+ueUep+RSI5Cg2Mt2oGOtkgfj9Lp8NwB/6/oTWfuqgpQ== X-Received: by 2002:a5d:44d2:: with SMTP id z18mr28353890wrr.358.1623247107897; Wed, 09 Jun 2021 06:58:27 -0700 (PDT) Received: from ?IPv6:2a02:908:1252:fb60:3e79:91ff:ea38:2624? ([2a02:908:1252:fb60:3e79:91ff:ea38:2624]) by smtp.gmail.com with ESMTPSA id y8sm6360349wmi.45.2021.06.09.06.58.26 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 09 Jun 2021 06:58:27 -0700 (PDT) Subject: Re: [Mesa-dev] Linux Graphics Next: Userspace submission update To: Daniel Vetter References: <0fbb1197-fa88-c474-09db-6daec13d3004@gmail.com> <586edeb3-73df-3da2-4925-1829712cba8b@gmail.com> From: =?UTF-8?Q?Christian_K=c3=b6nig?= Message-ID: <1478737b-88aa-a24a-d2d7-cd3716df0cb0@gmail.com> Date: Wed, 9 Jun 2021 15:58:26 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US 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: =?UTF-8?B?TWFyZWsgT2zFocOhaw==?= , =?UTF-8?Q?Michel_D=c3=a4nzer?= , dri-devel , Jason Ekstrand , ML Mesa-dev Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Am 09.06.21 um 15:19 schrieb Daniel Vetter: > [SNIP] >> Yeah, we call this the lightweight and the heavyweight tlb flush. >> >> The lighweight can be used when you are sure that you don't have any of the >> PTEs currently in flight in the 3D/DMA engine and you just need to >> invalidate the TLB. >> >> The heavyweight must be used when you need to invalidate the TLB *AND* make >> sure that no concurrently operation moves new stuff into the TLB. >> >> The problem is for this use case we have to use the heavyweight one. > Just for my own curiosity: So the lightweight flush is only for in-between > CS when you know access is idle? Or does that also not work if userspace > has a CS on a dma engine going at the same time because the tlb aren't > isolated enough between engines? More or less correct, yes. The problem is a lightweight flush only invalidates the TLB, but doesn't take care of entries which have been handed out to the different engines. In other words what can happen is the following: 1. Shader asks TLB to resolve address X. 2. TLB looks into its cache and can't find address X so it asks the walker to resolve. 3. Walker comes back with result for address X and TLB puts that into its cache and gives it to Shader. 4. Shader starts doing some operation using result for address X. 5. You send lightweight TLB invalidate and TLB throws away cached values for address X. 6. Shader happily still uses whatever the TLB gave to it in step 3 to accesses address X See it like the shader has their own 1 entry L0 TLB cache which is not affected by the lightweight flush. The heavyweight flush on the other hand sends out a broadcast signal to everybody and only comes back when we are sure that an address is not in use any more. Christian. > -Daniel >