From mboxrd@z Thu Jan 1 00:00:00 1970 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 25032C7EE26 for ; Mon, 22 May 2023 13:28:11 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9D27710E32A; Mon, 22 May 2023 13:28:06 +0000 (UTC) Received: from madras.collabora.co.uk (madras.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e5ab]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9D0A910E158; Mon, 22 May 2023 13:28:03 +0000 (UTC) Received: from [192.168.2.171] (109-252-147-95.dynamic.spd-mgts.ru [109.252.147.95]) (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 4B93C6606D84; Mon, 22 May 2023 14:27:58 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1684762079; bh=keD/935Zu/vg8AvzQ/mBIJs8+l9o00PBHzFnRJHLzSg=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=DIyoGQY28KPe9vMso5QxUo+B+LjI47cH/U4JwbRsIiakuaiBSF/Y7imIYc/jDeXp8 +wc9lthaCS+AlUh+d5looWfz4hmwb0n/H5azQr5MVPfR8jaUD0R1SXwnufnJTrVL69 lIBXFbCYtxb4/OQ0m3YJveSKWwZ9TPETWj8txE4eYmPaSpI8XCkV+N8L/IHlhJPafV 59NZeqgqi1BB3nFLZVrnu28Pi4a+LFs8cpygwYjTK3JjRmaL/WujfMnZlzN7hVte1B 71W3VJWvV4T+e7VJJgD7pcZyh2Ry2S0QAlJtUkubAkrX9ypCaFK2g6cfDyKmqSBVwG YSaELA4697lcw== Message-ID: Date: Mon, 22 May 2023 16:27:50 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 To: Emil Velikov References: <20230521205112.150206-1-dmitry.osipenko@collabora.com> <20230521205112.150206-7-dmitry.osipenko@collabora.com> Content-Language: en-US From: Dmitry Osipenko In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: Re: [Intel-gfx] [PATCH v3 6/6] drm/shmem-helper: Switch to reservation lock X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: dri-devel@lists.freedesktop.org, John Stultz , Gerd Hoffmann , kernel@collabora.com, Sumit Semwal , Marek Szyprowski , Benjamin Gaignard , linux-media@vger.kernel.org, Daniel Vetter , Arnd Bergmann , intel-gfx@lists.freedesktop.org, linux-tegra@vger.kernel.org, Mauro Carvalho Chehab , Tomi Valkeinen , linux-kernel@vger.kernel.org, Liam Mark , Tomasz Figa , Thomas Zimmermann , =?UTF-8?Q?Christian_K=c3=b6nig?= Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" On 5/22/23 16:02, Emil Velikov wrote: > Hi Dmitry, > > Saw v3 fly by, so I had a quick look. Original RB still stands, > although I noticed a couple of non-blocking nitpicks. > > On Sun, 21 May 2023 at 22:00, Dmitry Osipenko > wrote: > >> -static int drm_gem_shmem_get_pages_locked(struct drm_gem_shmem_object *shmem) >> +static int drm_gem_shmem_get_pages(struct drm_gem_shmem_object *shmem) >> { > > Should this getter have a dma_resv_assert_held(shmem->base.resv); like > it's put brethren? > > >> -void drm_gem_shmem_put_pages(struct drm_gem_shmem_object *shmem) >> +static int drm_gem_shmem_pin_locked(struct drm_gem_shmem_object *shmem) >> +{ >> + int ret; >> + >> + dma_resv_assert_held(shmem->base.resv); >> + >> + ret = drm_gem_shmem_get_pages(shmem); >> + >> + return ret; > > With the assert_held in the getter, it would be less confusing to > inline this and the unpin_locked functions. > >> +} >> + >> +static void drm_gem_shmem_unpin_locked(struct drm_gem_shmem_object *shmem) >> { >> - mutex_lock(&shmem->pages_lock); >> - drm_gem_shmem_put_pages_locked(shmem); >> - mutex_unlock(&shmem->pages_lock); >> + dma_resv_assert_held(shmem->base.resv); >> + >> + drm_gem_shmem_put_pages(shmem); > > Side note: the putter has an assert_held so the extra one here seems quite odd. > > As said at the top - with or w/o these nitpicks, the original RB still stands. Good catch. I actually added assert_held to get_pages(), but in a later patch that is not part of this series. -- Best regards, Dmitry