Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp3678061rdb; Wed, 13 Sep 2023 21:53:55 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHri23+/6C+XRoZSUI4lWs8fpThwA+boQkyKekrZpdoa/ZwlvbrGuCEgSNqfr551nfzgJGz X-Received: by 2002:a05:6a21:328c:b0:13e:1d49:7249 with SMTP id yt12-20020a056a21328c00b0013e1d497249mr4861950pzb.2.1694667235437; Wed, 13 Sep 2023 21:53:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694667235; cv=none; d=google.com; s=arc-20160816; b=yw1O5VEV4tVg4WPEceMtfPiWWBUopN8yJG4E2pYTIjp1uwV52xVlDrngTl7/08AUDG 3HZ+HwW2O8vDiwfgneZ2vwiJoT66x/nSAWQr2BnIUcjZ3JYuiRpo6UWL8oWzDitNfjb7 xoPA5qTXb5gKrIC+OoeFH/8t9UFDg6ChydbkopQZ4ENYeGOXPsWxc0Nq3sTRFFXveCsQ Gyo7i80IPUTmxTnTIGRR6PzqTOol1mpm3sPkc1KKpQWGycApDm1D8Tg0LfHzVQMgRYpb fCJ+3rLNyFtlM6K+pbPW+jroUesJgeJ3Owt9y27T07AsBIdxUcnMgLQc+HzwlYeN0B6d mDRQ== 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 :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=Vao1cw9elrfL5pI4sedAu6zd2XfpXbT2LWzVlZx5ASA=; fh=TLdaYVTYpkOucWp2gi2TZIRkEiwPxZ330gpwGOOjymo=; b=BlMVI7Oz5lxLZavw/p2Opj9yyocUUDhOY0w7K3LBni3QvVB8BPFpUZvmUcY6kvCpKm Ux2hTfFYoxwPdhsSIPkg7PQvSBnZbvMS1EtUzdD3RCQseFKrjSMZMJJ/+ekT7xxkhof0 wYOq1XKpCNKQSiszYKXu4xhuYtzWh0WR7HBLBBVM99OYwntoAGeqHO+uBOi2ra56u60f UKRRibnSVSPIn0gClGqo8s1a8XFE/H/3yyOORaBqbP9LGiFxneXsoxswGfSaWKB8a/0y IKKn1RHD9v1pbpq9YXOw4EX+LUvWVFtpYxxufq05o+mRYwW8vKF5yEPrzUtZokCo0Z5g 1+xg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=hXycm77p; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id nl10-20020a17090b384a00b002684bc84493si955902pjb.131.2023.09.13.21.53.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Sep 2023 21:53:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=hXycm77p; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id B60B983A716C; Mon, 11 Sep 2023 21:51:00 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.8 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230486AbjILE2Y (ORCPT + 99 others); Tue, 12 Sep 2023 00:28:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33206 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233746AbjILE2K (ORCPT ); Tue, 12 Sep 2023 00:28:10 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A83F61B8834 for ; Mon, 11 Sep 2023 19:09:25 -0700 (PDT) Received: from [192.168.2.112] (109-252-153-31.dynamic.spd-mgts.ru [109.252.153.31]) (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 5E86C6607083; Tue, 12 Sep 2023 00:32:17 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1694475138; bh=zku9FPqZQ4BrwWJHClmLRwHVmO9XDaBWXmy1+OJPxnE=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=hXycm77pWg7XeNR1ChG9zPOOuBn1yRIZIPb8G4mjVbjBwYX1nirACTsOsliqnXuU5 2bjV3ovPHyrGyxaA/7n5sIe1ujIg+lVFt3nO3YOc8zWIj89RUIL4ZcTWKeJvwsCzBV wlVg1DcxtxR3GbpJL66VZoxjO+7IMk8b88bmUzXt51/E1F53fsorj2gLNoDFPySbb7 7zyjOtLMSo/ZFHnIJPeVZVDJeczI2TX4bcyierD8kkZHRCOgjNxmNSZXc22+6LfZpn 1dLzWLhvHDbMeQ8PTCDCceJWMQw3hl2oz2FhvFUbEUlSGjTBXz+1QEd9v3E2J1sJHM 9SedzEO/6oQRQ== Message-ID: Date: Tue, 12 Sep 2023 02:32:14 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: [PATCH v16 06/20] drm/virtio: Replace drm_gem_shmem_free() with drm_gem_object_put() To: Boris Brezillon Cc: David Airlie , Gerd Hoffmann , Gurchetan Singh , Chia-I Wu , Daniel Vetter , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , =?UTF-8?Q?Christian_K=c3=b6nig?= , Qiang Yu , Steven Price , Emma Anholt , Melissa Wen , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, kernel@collabora.com, virtualization@lists.linux-foundation.org References: <20230903170736.513347-1-dmitry.osipenko@collabora.com> <20230903170736.513347-7-dmitry.osipenko@collabora.com> <20230905092028.182f8ed8@collabora.com> Content-Language: en-US From: Dmitry Osipenko In-Reply-To: <20230905092028.182f8ed8@collabora.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Mon, 11 Sep 2023 21:51:01 -0700 (PDT) On 9/5/23 10:20, Boris Brezillon wrote: > On Sun, 3 Sep 2023 20:07:22 +0300 > Dmitry Osipenko wrote: > >> Prepare virtio_gpu_object_create() to addition of memory shrinker support >> by replacing open-coded drm_gem_shmem_free() with drm_gem_object_put() that >> decrements GEM refcount to 0, which becomes important for drm-shmem because >> it will start to use GEM's refcount during the shmem's BO freeing time in >> order to prevent spurious lockdep warning about resv lock ordering vs >> fs_reclaim code paths. > > I think I'm okay with the change (assuming virtio_gpu_free_object() > can deal with partially initialized objects), not with the explanation > :-). I don't really see why we need to take the resv lock in > drm_gem_shmem_free(). As said in my v15 review, I think we should > replace the drm_gem_shmem_put_pages() call we have in > drm_gem_shmem_free() by a call to a new drm_gem_shmem_free_pages() > helper that does exactly what drm_gem_shmem_put_pages() does without > the refcounting/locking, because all that should remain at the time > drm_gem_shmem_free() is called is the implicit pages ref owned by > shmem->sgt, and there's no risk of other threads accessing the GEM > object at that point. Apparently I forgot to drop these drm_gem_object_put() patches by accident in v16, the drm_gem_shmem_free() doesn't touch resv lock anymore. Will re-check for v17. -- Best regards, Dmitry