Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp1732702rdb; Wed, 20 Sep 2023 19:20:43 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGX5mdXFv5ib7vHa0L7/PD3quooJKAaa5mjZd+oAmTawYslSQuTTa03tNLGJLkpavEuxSFt X-Received: by 2002:a05:6a20:7d9b:b0:140:61f8:53f6 with SMTP id v27-20020a056a207d9b00b0014061f853f6mr6284447pzj.29.1695262842908; Wed, 20 Sep 2023 19:20:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695262842; cv=none; d=google.com; s=arc-20160816; b=JDXsNMZope+bxtHTo1FnW+1oN5KEnHSlII5IYTpJyYJJ8UNiMTVuonwOL+dz1/rji4 A0AHU+C7acYFROZA63iEtmLS7n9DVdhblqHLMPLexk/r9SEvGfaIPNy8ixQfJQeC5EtC AP8tt5FHDqXxJju9hs1Xd8w14F5IX9JyTt7WpKLeFx8LUvdNYRWth3erSCXjcreltKVc VOYq2UkC22+0aRDvtZuitq3dK87OThsyvfzMEGA+6mVAjp9+t3OntAI/wK4EGPqbyRO/ 2yr0MuIIRjkoEU+81wKLsseKN5YZo3t8kus43cCawwmJFZGEEQzAKt6ZjUnDUC0PsEyb QmHg== 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 :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=a+a1kI4jKJWWj7xndBW+1+U03R++zrBCWjtRAEPpO6w=; fh=atLkUeDu9rIhTU4xIKZ8PYQSc9JoBayF2Ic3XzSaONY=; b=LKxfDZcSzvpZScJzr0d1AafqloOhQSZAVf6Cd0MSeC7QY/EUR+CsTnZs5kB6Ca5Gfr /jTNSgifgGpulLlyBVRi66ZbXpRlzh4KvmJFpH4smgmL6XZcs0Mi1XfqGSvBcvFF6Vam pPymHyPdOd1vQ6GzoZVm3HgeSrrfBAcSB7+I38tJk4UBG6PB17LURvarZxsvbmZ0TP+j hS5dYdYzZwTD3RGFa8ESiIqZkRrNdwy53g2x3ZDYnJDgYp7jFukDP0nN5EMw3+O7Jlh2 XqJ2RUllyMyQ63YB3eXaRSPYjKqLdrblmsMmYL1h5YpzqKljYnr3lv74s22d4bQpuGAr mvng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=OVtEQlBJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 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 agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id cb3-20020a056a00430300b0068fb986fcf3si412638pfb.377.2023.09.20.19.20.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Sep 2023 19:20:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=OVtEQlBJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 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 agentk.vger.email (Postfix) with ESMTP id 48CC781B5D02; Wed, 20 Sep 2023 14:14:07 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229757AbjITVOH (ORCPT + 99 others); Wed, 20 Sep 2023 17:14:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41014 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229566AbjITVOF (ORCPT ); Wed, 20 Sep 2023 17:14:05 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e5ab]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 12A8DB9 for ; Wed, 20 Sep 2023 14:14:00 -0700 (PDT) Received: from [192.168.2.59] (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 9A50F6607243; Wed, 20 Sep 2023 22:13:57 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1695244438; bh=AEY7xSy+XlWvC67wCNaiGkWUgOsbIuFYHHmnxBCjy3I=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=OVtEQlBJBAtJi9tb4FkbfpRmsugl2ETOMWGjfNX2zARe4zatOkyv2qFJys4qpZtAF +Pd04c3WENeHGNveAmVQjypZBCeUc+c3fmfZbTJ2yHcQiA7cdicWuFvMkGH+n3TRTC xMNh9WWDUw4RunEtbk8xx8tLFjrKDMQJOSJGXl9t3FkCbgj0JSaYOa8v/SiZtqvHp2 EcMhgaMKvguYPbjpwINvIxme70frCQjPc81NrM7RCkxjaGlNIzwfyrePkf6ASLYE+o mf9DkAuGVNsiaI/F26kgzkV66Gg9aLL+UXmsce2VOVwbfv1f+LeTqxhXQFWC8u9ttg 75roO4Mdw5y1Q== Message-ID: Date: Thu, 21 Sep 2023 00:13:54 +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] drm/virtio: clean out_fence on complete_submit Content-Language: en-US To: =?UTF-8?Q?Jos=c3=a9_Pekkarinen?= , airlied@redhat.com, kraxel@redhat.com, skhan@linuxfoundation.org Cc: linux-kernel-mentees@lists.linuxfoundation.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, gurchetansingh@chromium.org, virtualization@lists.linux-foundation.org, christian.koenig@amd.com, Rob Clark References: <20230912060824.5210-1-jose.pekkarinen@foxhound.fi> From: Dmitry Osipenko In-Reply-To: <20230912060824.5210-1-jose.pekkarinen@foxhound.fi> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email 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 (agentk.vger.email [0.0.0.0]); Wed, 20 Sep 2023 14:14:07 -0700 (PDT) On 9/12/23 09:08, José Pekkarinen wrote: > The removed line prevents the following cleanup function > to execute a dma_fence_put on the out_fence to free its > memory, producing the following output in kmemleak: > > unreferenced object 0xffff888126d8ee00 (size 128): > comm "kwin_wayland", pid 981, jiffies 4295380296 (age 390.060s) > hex dump (first 32 bytes): > c8 a1 c2 27 81 88 ff ff e0 14 a9 c0 ff ff ff ff ...'............ > 30 1a e1 2e a6 00 00 00 28 fc 5b 17 81 88 ff ff 0.......(.[..... > backtrace: > [<0000000011655661>] kmalloc_trace+0x26/0xa0 > [<0000000055f15b82>] virtio_gpu_fence_alloc+0x47/0xc0 [virtio_gpu] > [<00000000fa6d96f9>] virtio_gpu_execbuffer_ioctl+0x1a8/0x800 [virtio_gpu] > [<00000000e6cb5105>] drm_ioctl_kernel+0x169/0x240 [drm] > [<000000005ad33e27>] drm_ioctl+0x399/0x6b0 [drm] > [<00000000a19dbf65>] __x64_sys_ioctl+0xc5/0x100 > [<0000000011fa801e>] do_syscall_64+0x5b/0xc0 > [<0000000065c76d8a>] entry_SYSCALL_64_after_hwframe+0x6e/0xd8 > unreferenced object 0xffff888121930500 (size 128): > comm "kwin_wayland", pid 981, jiffies 4295380313 (age 390.096s) > hex dump (first 32 bytes): > c8 a1 c2 27 81 88 ff ff e0 14 a9 c0 ff ff ff ff ...'............ > f9 ec d7 2f a6 00 00 00 28 fc 5b 17 81 88 ff ff .../....(.[..... > backtrace: > [<0000000011655661>] kmalloc_trace+0x26/0xa0 > [<0000000055f15b82>] virtio_gpu_fence_alloc+0x47/0xc0 [virtio_gpu] > [<00000000fa6d96f9>] virtio_gpu_execbuffer_ioctl+0x1a8/0x800 [virtio_gpu] > [<00000000e6cb5105>] drm_ioctl_kernel+0x169/0x240 [drm] > [<000000005ad33e27>] drm_ioctl+0x399/0x6b0 [drm] > [<00000000a19dbf65>] __x64_sys_ioctl+0xc5/0x100 > [<0000000011fa801e>] do_syscall_64+0x5b/0xc0 > [<0000000065c76d8a>] entry_SYSCALL_64_after_hwframe+0x6e/0xd8 > [...] > > This memleak will grow quickly, being possible to see the > following line in dmesg after few minutes of life in the > virtual machine: > > [ 706.217388] kmemleak: 10731 new suspected memory leaks (see /sys/kernel/debug/kmemleak) > > The patch will remove the line to allow the cleanup > function do its job. > > Signed-off-by: José Pekkarinen > --- > drivers/gpu/drm/virtio/virtgpu_submit.c | 1 - > 1 file changed, 1 deletion(-) Added fixes tag and pushed to misc-fixes -- Best regards, Dmitry