Received: from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 06E6A277017 for ; Mon, 2 Mar 2026 15:31:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.97.179.56 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772465462; cv=none; b=d2qGSEmuMi29ikr+go6Ky0EnaVe6DnN+JJ4k9XVXwhe3xbVtlprYV8J3Pbb9niO01ejv8I10hkJAShcI+V10M+nJNm2b6NGM9FsLj8OEsawej32JCB7K1zdrb2DymD/xXLJrZXMCUOM8HcMg5vmXJW4TxD/6cJX2XzI1jkms2Ak= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772465462; c=relaxed/simple; bh=CZ6xyGshjxzWr0Q7t23+cll3ZWcgfE3yOdnQMl2jMOc=; h=Message-ID:Date:MIME-Version:Subject:To:References:From: In-Reply-To:Content-Type; b=cMZkD5RndU4lnGJTDmEm2Ya4GfS6KSy2XxTbnNdCyyKLv61XB+tejijuUZA/aG4rkfg0YcOk+vm6zcFcrmDBy/WRvjlS9AD3YWgIjqbWXF3566xyfqhs9X5UkqtIeKKF4f29opslMNsd2ebQFzeycHEejzP4jFBs4CCbpbT5opU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=igalia.com; spf=pass smtp.mailfrom=igalia.com; dkim=pass (2048-bit key) header.d=igalia.com header.i=@igalia.com header.b=XtTwHhye; arc=none smtp.client-ip=213.97.179.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=igalia.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=igalia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=igalia.com header.i=@igalia.com header.b="XtTwHhye" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:Content-Type:In-Reply-To:From: References:To:Subject:MIME-Version:Date:Message-ID:Sender:Reply-To:Cc: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=bSlGVVy+IOTuUkS8T0LulvKPSc3SFlfUuzrGbkL1Er4=; b=XtTwHhyeTsJe+eU2fET3ojkI5f LbyViRRDWtI2aMJ4G21vo93Pq7jMGe7+oTrEMD/0V6O2uKiAhwx6eOvBKwivGYsCk0b7jtdeKpelQ +cmgdDEdsFxl2SZ/YV/8o4SkoMESMWWxAQVQq2Kg6NigOoDQgLN1RFXRnQGsLic+M5vkkwCqRKF1t maew5JtaDa3tfrErx7CkB6akIWbZXSkorkCnpZ0+NDBQv+gBHu9XHLXIuccoVkNBf2icM0CoxKDvE vNTn9f8q188F/3jwZDga+GNlGRiLmjCM5zfqq73nOJWVH5U7zTjR7Q8jikZc8tFp/tg0NzpxRWiuJ lwM94mkQ==; Received: from [90.240.106.137] (helo=[192.168.0.101]) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_128_GCM:128) (Exim) id 1vx5EY-007x35-UU; Mon, 02 Mar 2026 16:30:58 +0100 Message-ID: Date: Mon, 2 Mar 2026 15:30:58 +0000 Precedence: bulk X-Mailing-List: criu@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [RFC 20/26] plugins/amdgpu: amdgpu_plugin_drm_restore_file() does not need to use libdrm To: "Francis, David" , "criu@lists.linux.dev" References: <20260220120514.4540-1-tvrtko.ursulin@igalia.com> <20260220120514.4540-21-tvrtko.ursulin@igalia.com> Content-Language: en-GB From: Tvrtko Ursulin In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 02/03/2026 14:59, Francis, David wrote: > > I think we used those major, minor values somewhere once > but now that we don't, this looks sensible > > This patch is > Reviewed-By: David Francis Thank you! And if the major and minor will be needed in the future I think they can be obtained more simply by fstat. Regards, Tvrtko > ________________________________________ > From: Tvrtko Ursulin > Sent: Friday, February 20, 2026 7:05 AM > To: criu@lists.linux.dev > Cc: Francis, David; Tvrtko Ursulin > Subject: [RFC 20/26] plugins/amdgpu: amdgpu_plugin_drm_restore_file() does not need to use libdrm > > There is no need to initialize and de-initialize libdrm only to use the > duplicated fd for calls to drmPrimeFDToHandle(). From the kernel's > perspective it is exactly the same file so operation is identical to just > using the passed in file descriptor. > > Signed-off-by: Tvrtko Ursulin > --- > plugins/amdgpu/amdgpu_plugin_drm.c | 18 +++--------------- > 1 file changed, 3 insertions(+), 15 deletions(-) > > diff --git a/plugins/amdgpu/amdgpu_plugin_drm.c b/plugins/amdgpu/amdgpu_plugin_drm.c > index de6d6f178d51..99a6804f51eb 100644 > --- a/plugins/amdgpu/amdgpu_plugin_drm.c > +++ b/plugins/amdgpu/amdgpu_plugin_drm.c > @@ -454,9 +454,7 @@ int amdgpu_plugin_drm_restore_file(int fd, CriuRenderNode *rd) > { > int ret = 0; > bool retry_needed = false; > - uint32_t major, minor; > - amdgpu_device_handle h_dev; > - int device_fd, *dmabufs; > + int *dmabufs; > > dmabufs = xzalloc(sizeof(int) * rd->num_of_bos); > if (!dmabufs) { > @@ -464,14 +462,6 @@ int amdgpu_plugin_drm_restore_file(int fd, CriuRenderNode *rd) > return -ENOMEM; > } > > - ret = amdgpu_device_initialize(fd, &major, &minor, &h_dev); > - if (ret) { > - pr_info("Error in init amdgpu device\n"); > - goto exit; > - } > - > - device_fd = amdgpu_device_get_fd(h_dev); > - > for (int i = 0; i < rd->num_of_bos; i++) { > DrmBoEntry *boinfo = rd->bo_entries[i]; > int dmabuf_fd = -1; > @@ -495,7 +485,7 @@ int amdgpu_plugin_drm_restore_file(int fd, CriuRenderNode *rd) > } > > if (boinfo->is_import) { > - drmPrimeFDToHandle(device_fd, dmabuf_fd, &handle); > + drmPrimeFDToHandle(fd, dmabuf_fd, &handle); > } else { > union drm_amdgpu_gem_create create_args = { 0 }; > > @@ -511,7 +501,7 @@ int amdgpu_plugin_drm_restore_file(int fd, CriuRenderNode *rd) > } > handle = create_args.out.handle; > > - drmPrimeHandleToFD(device_fd, handle, 0, &dmabuf_fd); > + drmPrimeHandleToFD(fd, handle, 0, &dmabuf_fd); > } > > change_args.handle = handle; > @@ -572,8 +562,6 @@ int amdgpu_plugin_drm_restore_file(int fd, CriuRenderNode *rd) > if (ret) > goto exit; > > - ret = amdgpu_device_deinitialize(h_dev); > - > if (rd->num_of_bos > 0) { > ret = restore_bo_contents_drm(rd->drm_render_minor, rd, fd, dmabufs); > if (ret) > -- > 2.52.0 >