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 X-Spam-Level: X-Spam-Status: No, score=-0.7 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 41E55C43603 for ; Thu, 19 Dec 2019 16:18:20 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 1D2AE24672 for ; Thu, 19 Dec 2019 16:18:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1D2AE24672 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=collabora.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 86A4D6E366; Thu, 19 Dec 2019 16:18:19 +0000 (UTC) Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [46.235.227.227]) by gabe.freedesktop.org (Postfix) with ESMTPS id C856D6E366 for ; Thu, 19 Dec 2019 16:18:17 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: shadeslayer) with ESMTPSA id 21BB829309C From: Rohan Garg To: dri-devel@lists.freedesktop.org, Yiwei Zhang Subject: Re: Proposal to report GPU private memory allocations with sysfs nodes [plain text version] Date: Thu, 19 Dec 2019 17:18:13 +0100 Message-ID: <2981882.gi1CFgH74X@saphira> In-Reply-To: References: <20191112201808.GE31272@redhat.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alistair Delva , Prahlad Kilambi , dri-devel , Jerome Glisse , Kenny Ho , Gerd Hoffmann , Sean Paul , Chris Forbes , Android Kernel Team Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Hey > Is it reasonable to add another ioctl or something equivalent to label > a BO with what PID makes the allocation? When the BO gets shared to > other processes, this information also needs to be bookkept somewhere > for tracking. Basically I wonder if it's possible for upstream to > track BOs in a similar way Android tracks dmabuf. Then there's a node > implemented by cgroup in proc listing all the BOs per process with > information like label, refcount, etc. Then Android GPU vendors can > implement the same nodes which is going to be compatible even if they > later adopts drm subsystem. > > So my sketch idea for the nodes are: > (1) /proc/gpu0_meminfo, /proc/gpu1_meminfo > This is a list of all BOs with pids holding a reference to it and the > current label of each BO > (2) /proc//gpu0_meminfo, /proc//gpu1_meminfo > This is a list of all BOs this process holds a reference to. > (3) Is it reasonable to implement another nodes for {total, > total_unmapped} counters? or just surface through /proc/meminfo? > This would be tricky to implement because: (1) PID's are not unique, PID namespaces allow linux userspace to potentially share the same PID. (2) Specifically in the case of mesa, there isn't a way to (AFAIK) associate a BO with a PID. Cheers Rohan Garg _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel