Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp1292253ybi; Sun, 30 Jun 2019 11:57:46 -0700 (PDT) X-Google-Smtp-Source: APXvYqw0dlN+5oI3uQIuJCpBgHgumC9V+zZAFnU+YTpJDgU49rcClfjtYoaYL3x/PmrnIkMQxdhh X-Received: by 2002:a63:6f8f:: with SMTP id k137mr1621241pgc.90.1561921065856; Sun, 30 Jun 2019 11:57:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561921065; cv=none; d=google.com; s=arc-20160816; b=mrWLUsaYWL629RKWZsf6RFSwo7rOAK1Gq/cHTOXDJBulMBQ2YyOg2j9dBE9pjBCtUG /aySidpQxc/0QjQ9rV1RuFkjR85EJ6KWMPf7ASskLXxsc2po3+7er0Bs6d1H5DLLauIO Z+WaUMrYvuka99OYQC9GboHf245wCMLL9IURFnphke8vo9iTNd62e/7OX+osTM4rz3Je s/D0PPDw/+JhgCJu2xiZv5DtZQ6EZbCtbR9Sl78sRbrv3xNz2Y1dx2ZiTF+FACrFzxpU ksHGnOEeRhZitcOmtl6eDsT5WdsHrvAGhuoQAVQp96lZvVGOShbHwLUToWXhKfJw6HOo RNoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=NaLfjipo68BMwPOD4vQyPZ7y9beiaLM//1SyGkkxM5c=; b=FtTPmHWKMu150sQHiXxi4tWfy4+oXzGh2le6LtB151PBBcMJT1nJ6cxfnm14vCTjYE aZVyrroXhpdjItdreGdRK78wWAfWdXj7a3tmVgtGfzX8XRW0yojpZgrQ7/H01Zig8ZUV l5eFgy4+UcPSDyG+MHutPamFhydCYGF6/E9NAu3jLkmd/Dm4DizO5EoRTpHzNHPGVLh7 Tp0Mx1pYkYYkFPQmlTCX3WR4rrB0BV0udvI6m9mKkXEUzmT+NX96YYLoIsMqUzNz8S8A NVFEdsP5wCF3jC/aZxYWJhEXpmvfrkFiSVQLQdGd8P1ZkDXFwKFllwqbFOMTxNhBe4KS dpqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=PyWYVlQn; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 92si8325469plc.217.2019.06.30.11.57.27; Sun, 30 Jun 2019 11:57:45 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=PyWYVlQn; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726693AbfF3S4s (ORCPT + 99 others); Sun, 30 Jun 2019 14:56:48 -0400 Received: from mail-io1-f67.google.com ([209.85.166.67]:34929 "EHLO mail-io1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726572AbfF3S4s (ORCPT ); Sun, 30 Jun 2019 14:56:48 -0400 Received: by mail-io1-f67.google.com with SMTP id m24so23750295ioo.2 for ; Sun, 30 Jun 2019 11:56:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=NaLfjipo68BMwPOD4vQyPZ7y9beiaLM//1SyGkkxM5c=; b=PyWYVlQnOFkdzGkNDuulU3+I3bDzqoT+eDsFc0z4yLtmvtxmJ/GdhMghXfjmwT1xgC TF2ruQzrIphDlACAApiQEeYhyAjvzd9h5mL6OOFa/Fn769cuxA7ZA11qLgAm9Ptvd25U E2N2W2Cr9L5yzfU5wHxu3NuDf5NxlhNrNwnyDk/BjYS4VzIFKxj6WXXQTdOHmAE7K2Lz pUKulussCCkCqtWGc8E6CqaHrupQk5Ud5w5IS+rn82WIjjS4yMDZAy8HYqKwrsufY/ft IAvz9rdJ2/e40j98btngjeo7Uf6fSW4vEpir2BhF1wbT1RI5+UiObopDQkJrgn1PMnfT lzBA== 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; bh=NaLfjipo68BMwPOD4vQyPZ7y9beiaLM//1SyGkkxM5c=; b=liEoB8kSxlMaW9SIzIX/wFIQsSXrU8uvxAly8MYWxAKtZNcjByk4udTfLr170Ud+tu xSfGvxj2a0YECR9JeYHCZYAqY+lj/AVwyK7AV35m4rFcwswb4QZ9+MgKccoOJ/vqPxf4 ebn/GOKtHLwwTKOyiCKUnjM0m1u946xESoQHp6u55Bv9IY/fDDOW7SsvkDMOMShxof03 RBC6BTWD/malVnSq2AYBnAgGWkiLtKD2VmXfDvPSaCheb5k/zxwwGxQyC3Bo9qCQYRWK OXQIsDMyIg8w9UdxjMSjMBCdQoIKElQkwUIgX8n5eVbAgXN+JatZ0ioH3Grua6nuzhjG MXLQ== X-Gm-Message-State: APjAAAWKNoTMOTtwflQzU74TMo7oHGVbmAerDV8dpyUD6WlX1VVrQCt0 TzrF1xM5vmyLo7/rC4PxnmgeqQZoZuwV34J6cNU= X-Received: by 2002:a02:9f84:: with SMTP id a4mr18440799jam.20.1561921007426; Sun, 30 Jun 2019 11:56:47 -0700 (PDT) MIME-Version: 1.0 References: <20190620060726.926-1-kraxel@redhat.com> <20190620060726.926-3-kraxel@redhat.com> <20190628100516.yrtiuxemyt4hvyra@sirius.home.kraxel.org> In-Reply-To: <20190628100516.yrtiuxemyt4hvyra@sirius.home.kraxel.org> From: Chia-I Wu Date: Sun, 30 Jun 2019 11:56:36 -0700 Message-ID: Subject: Re: [PATCH v4 02/12] drm/virtio: switch virtio_gpu_wait_ioctl() to gem helper. To: Gerd Hoffmann Cc: ML dri-devel , David Airlie , open list , "open list:VIRTIO GPU DRIVER" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jun 28, 2019 at 3:05 AM Gerd Hoffmann wrote: > > On Wed, Jun 26, 2019 at 04:55:20PM -0700, Chia-I Wu wrote: > > On Wed, Jun 19, 2019 at 11:07 PM Gerd Hoffmann wrote: > > > > > > Use drm_gem_reservation_object_wait() in virtio_gpu_wait_ioctl(). > > > This also makes the ioctl run lockless. > > The userspace has a BO cache to avoid freeing BOs immediately but to > > reuse them on next allocations. The BO cache checks if a BO is busy > > before reuse, and I am seeing a big negative perf impact because of > > slow virtio_gpu_wait_ioctl. I wonder if this helps. > > Could help indeed (assuming it checks with NOWAIT). Yeah, that is the case. > > How many objects does userspace check in one go typically? Maybe it > makes sense to add an ioctl which checks a list, to reduce the system > call overhead. One. The cache sorts BOs by the time they are freed, and checks only the first (compatible) BO. If it is idle, cache hit. Otherwise, cache miss. A new ioctl probably won't help. > > > > + if (args->flags & VIRTGPU_WAIT_NOWAIT) { > > > + obj = drm_gem_object_lookup(file, args->handle); > > Don't we need a NULL check here? > > Yes, we do. Will fix. > > thanks, > Gerd >