Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp5017677rwl; Mon, 3 Apr 2023 13:06:09 -0700 (PDT) X-Google-Smtp-Source: AKy350anpVYaoDZyiszz6sQIzPLP4gfiYpODM3vkDCRuySewBJzPl3D4VuvnbbJWWsjUXl0+OQqR X-Received: by 2002:a17:906:5288:b0:932:3d1b:b67a with SMTP id c8-20020a170906528800b009323d1bb67amr36805380ejm.41.1680552368934; Mon, 03 Apr 2023 13:06:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680552368; cv=none; d=google.com; s=arc-20160816; b=gplclAgG9s/ff9Wj7J+R+9vvcV3Jsrb5oezqc6hykSz7m0yO/CDxz491ihezvwX+lA KaC8raUQl4khYwpky3C2xXkDxETViBTubEAfPc3WekNZsTTn6FmZ8/YIkKFf54z541/M cNxgPAlQNPTnoR4N0rYIE1RMRdFRMyyVTsPlSoWL4wsIuaE56zvy5MgPOCm255wg9/rR L1wnOs01BBYvpA+na7oljdTefu50lhXHpszlojyUFJYgQPT8d4e1z3KYfTAnB+VcE7Y+ urMCWZ1ODB2iXWhrmr04B11OQjsiOJjTV/H9xp8kJp4vERNb8HKeuSSRuRBau13Y05c9 yH6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=AKesfVnWHqlR0xi3qnKPRYBVpILI+eA7R+hXtvVMwb4=; b=kPNW3Y5NpnA/o01leyMRaZY1WajieWuShRnDaRTCsYZnabt0v2rC5QppgBTFkxxxHW BIOjziEUl1QInJXII0z+B3MyrSfcUxN8W/RG2D1I2bzvdBAwDFypyIlMOtqLSot2Y5QQ VP0Q8X/0vJev4N4d3fAOnQnX/etJZGhhYryGalgS5d91uPZMLX69GUW7MZhJ4IFMvdou QUXbWrG/g2Fvjbvc/75lXVxyZITMWOgwJ8WeV+rY5nwEZvjky71kYWnXxGbQMveoHKRR FqRAJ8C51U4bnHqqk6mk3t/GfraQmm70qFbTnCW/ftmpAZ8+sXW4Wve6agK2wiigMk8j IxZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=gmZTC9Wg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id kd16-20020a17090798d000b00944bbbb1798si7291551ejc.678.2023.04.03.13.05.44; Mon, 03 Apr 2023 13:06:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=gmZTC9Wg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232587AbjDCT7m (ORCPT + 99 others); Mon, 3 Apr 2023 15:59:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39644 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232364AbjDCT7l (ORCPT ); Mon, 3 Apr 2023 15:59:41 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e5ab]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EF7DAD7 for ; Mon, 3 Apr 2023 12:59:40 -0700 (PDT) Received: from [192.168.2.163] (109-252-124-32.nat.spd-mgts.ru [109.252.124.32]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: dmitry.osipenko) by madras.collabora.co.uk (Postfix) with ESMTPSA id 4B534660313D; Mon, 3 Apr 2023 20:59:38 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1680551979; bh=zSQYwYndd2ZkXF8gAMJqDSt3JLQqZ/V49jQOay+yYh0=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=gmZTC9WgGEnkIJRbZHhDIpRyiFsupcwjPbNtMgslR/51LDLLd5HmQn8sqR/dESI+1 EconZcSC1VbR4oKxOMBOVjzgogZLjWd3LHkWimqGYNrO6oZKBjV7Kl0CquIQZjA6n1 X08RkSBI362i7jevCEn2j1MxdLj7K99mNfXNkBD6mEOtSEqEjNayEC2BZxUUUhz5KA EKKkdwpOtXymF7WmVTRPIrAIMCydIjYhd7WzwROta2zKBoJF/WnXXODKmoQpMGuFMk 2pgOQDEhIgWdf2nuISrD9pVw6124hOBt+tUXCYBTvRudhk3vII3t7bK/Jdz1dWSxgX gMNBSgm82G1/w== Message-ID: <699f2130-11be-e0db-5f7f-ff53dc3a46fc@collabora.com> Date: Mon, 3 Apr 2023 22:59:35 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.9.0 Subject: Re: [PATCH v4 1/2] drm/virtio: Refactor job submission code path Content-Language: en-US To: Emil Velikov Cc: David Airlie , Gerd Hoffmann , Gurchetan Singh , Chia-I Wu , Daniel Vetter , Rob Clark , =?UTF-8?B?TWFyZWsgT2zFocOhaw==?= , Pierre-Eric Pelloux-Prayer , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, kernel@collabora.com, virtualization@lists.linux-foundation.org References: <20230323230755.1094832-1-dmitry.osipenko@collabora.com> <20230323230755.1094832-2-dmitry.osipenko@collabora.com> From: Dmitry Osipenko In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.5 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 3/30/23 18:32, Emil Velikov wrote: >> +static int virtio_gpu_dma_fence_wait(struct virtio_gpu_submit *submit, >> + struct dma_fence *fence) >> +{ >> + struct dma_fence_unwrap itr; >> + struct dma_fence *f; >> + int err; >> + >> + dma_fence_unwrap_for_each(f, &itr, fence) { > The dma_fence_unwrap_for_each() change should be a separate patch, > highlighting why we want it. Good point, it actually should be a potential optimization for the in-fence waiting. >> + ret = virtio_gpu_init_submit(&submit, exbuf, dev, file, >> + fence_ctx, ring_idx); >> + if (ret) >> + goto cleanup; >> + >> + ret = virtio_gpu_wait_in_fence(&submit); >> + if (ret) >> + goto cleanup; >> + > We have reshuffled the order around in_fence waiting, out_fence install, > handles, cmdbuf, drm events, etc. Can we get that split up a bit, with > some comments. > > If it were me, I would keep the wait_in_fence early and inline > virtio_gpu_init_submit (the nesting/abstraction seems a bit much). This > means one can omit the virtio_gpu_submit::exbuf all together. I tried to inline and this variant makes code much less readable to me. The point of having wait_in_fence after submit_init is that it makes submit code path shorter. If we have to wait for in-fence, then once fence signals, there is no need to init and instead move directly to a further submission step. Perhaps won't hurt to also factor out the wait_fence from parse_deps in the second patch and do all the waits right before locking the buflist. -- Best regards, Dmitry