Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp3536010pxp; Tue, 8 Mar 2022 16:53:27 -0800 (PST) X-Google-Smtp-Source: ABdhPJyyMe79oZMjS/BT4a6DjZFXCVW05hq31yeL9T7QS5XL00itVgW7qxbPqBKablDoY1w/AU8Y X-Received: by 2002:a17:902:f54d:b0:151:e73f:f1fc with SMTP id h13-20020a170902f54d00b00151e73ff1fcmr13751268plf.114.1646787207568; Tue, 08 Mar 2022 16:53:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646787207; cv=none; d=google.com; s=arc-20160816; b=BFCfwlwhzesC9ASIpJw387L6n3S9GKiq6T++vyTfhNlwUbwBfcnFa9rBpxPX5hodqG cpj2mV76PWcDqNbj/IS9C6iy8VHS1Yq5D/aem7iRhmwVft8pBs7Wom3IBVYQOvPwEJd1 VE0gihAmNLuVXFreVJ6tBSuUt47SU75GlwwGKg3XsgrtzInsQ1qyhrUw8pLNuaq/r/Zi s3mFmyggWj2q8fvxVYSJpzsdjzLiPTVGpT+MdanMS5x9RYqQdTXMWJ3v4GOQP5YePF3H pkrUCNkESPkODO+fPe6FriNMFg2vZBeV/Al7q6DzSCpZ4Q94uSYdtRi7ABIv5nxgWACR eaEQ== 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:references :cc:to:from:content-language:subject:user-agent:mime-version:date :message-id:dkim-signature; bh=uns2aORCnmCg7QDcChAh5NuaonuElGkliWtb6dVUpRY=; b=jU4wHTXNS0evfoVEJmjJNzftFlNNe8BCxZIFt71OKfS14vJEZR4m9+lzneYgn1vD4Z cGAw35fkhLJJvRJPxVGwZF6COohpioJ8yM92aqbGpW2CyUUaXchah2KELqrHfIMLa8iS nv4tU/emQ5n82ftbn408Kn1d5CSsU+8tW9uVd+DF4D6g8O1YeA3yprE4LVsQMpfB97nF Z5lqHNLxt1WohURY9H6p+CgKAmoW5X2IzSX5yw+eHCoexIkoKLlFwC1RtOJD9FCYbEym NkkzlbZNjmJ/gAsFWd29OfkqZnj84RmHNpKv0d8aefxTbsRScRe5KdNjNvdm9sV5yA7O rKhQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=FBtBWn9E; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id e5-20020a637445000000b00378af218f98si370974pgn.613.2022.03.08.16.53.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Mar 2022 16:53:27 -0800 (PST) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=FBtBWn9E; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E9B361662C0; Tue, 8 Mar 2022 16:08:44 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344539AbiCHQFt (ORCPT + 99 others); Tue, 8 Mar 2022 11:05:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47606 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243540AbiCHQFo (ORCPT ); Tue, 8 Mar 2022 11:05:44 -0500 Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e3e3]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 837544FC59 for ; Tue, 8 Mar 2022 08:04:47 -0800 (PST) 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 Cc: Tomeu Vizoso , linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org, Gustavo Padovan , dri-devel@lists.freedesktop.org, Dmitry Osipenko 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-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,RDNS_NONE,SPF_HELO_NONE, T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY autolearn=no 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/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.