Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 70375C433F5 for ; Tue, 8 Mar 2022 16:04:49 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7060510E19E; Tue, 8 Mar 2022 16:04:48 +0000 (UTC) Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e3e3]) by gabe.freedesktop.org (Postfix) with ESMTPS id 886E910E171 for ; Tue, 8 Mar 2022 16:04:47 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: dmitry.osipenko) with ESMTPSA id 577761F445B7 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1646755486; bh=hOiZ9ykiaBDPKQzbGHfm3j2FlBLb1AlaOgBoAKkcoPg=; h=Date:Subject:From:To:Cc:References:In-Reply-To:From; b=FBtBWn9E/pS7cuhC9BkGYA5+Me1Js9aqgIplk3YYC1XpdPiYgr4/OV47uPbqINlQ2 ePGG2EkSTYr/as5sSE0KgnvoLJs8H4t9MOXFrE/VCAYlOewQaXfLrZVIC1xFnCmJ3H +eS+TT3G+Ntg7T7LQxZkgEghutet5hVU/muOQ7z7nU+03X0Lh7dpQNLqsjmXRbN7qq 330vN5NO2lS2lsBQuKoaIc0ULCjmHKjrUQiLNgR0WLoopfs/3T4Rte7UH3uS9xJ2Sq GR/NFtcru+JD4/hatzxB+pmDr4oOWhoPoAQ1lN38owV+9Yj8AgmFi8/uWVZ0mXd5q7 tsTT0/7BvMSVw== Message-ID: Date: Tue, 8 Mar 2022 19:04:42 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Subject: Re: [PATCH v1 5/5] drm/virtio: Add memory shrinker Content-Language: en-US From: Dmitry Osipenko To: David Airlie , Gerd Hoffmann , Gurchetan Singh , Chia-I Wu , Daniel Vetter , Daniel Almeida , Gert Wollny References: <20220308131725.60607-1-dmitry.osipenko@collabora.com> <20220308131725.60607-6-dmitry.osipenko@collabora.com> In-Reply-To: <20220308131725.60607-6-dmitry.osipenko@collabora.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit 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: Tomeu Vizoso , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, virtualization@lists.linux-foundation.org, Gustavo Padovan , Dmitry Osipenko Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On 3/8/22 16:17, Dmitry Osipenko wrote: > @@ -246,20 +246,28 @@ static int virtio_gpu_plane_prepare_fb(struct drm_plane *plane, > struct virtio_gpu_device *vgdev = dev->dev_private; > struct virtio_gpu_framebuffer *vgfb; > struct virtio_gpu_object *bo; > + int err; > > if (!new_state->fb) > return 0; > > vgfb = to_virtio_gpu_framebuffer(new_state->fb); > bo = gem_to_virtio_gpu_obj(vgfb->base.obj[0]); > - if (!bo || (plane->type == DRM_PLANE_TYPE_PRIMARY && !bo->guest_blob)) > + > + err = virtio_gpu_gem_pin(bo); > + if (err) > + return err; I just noticed that this produces a refcount debug warning because I missed to initialize the refcount when BO is created. That warning splat was hidden by a huge lockdep splat produced by drm_aperture_remove_conflicting_pci_framebuffers(), which probably should be fixed. I'll correct it in v2.