Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp127242rwl; Tue, 11 Apr 2023 15:37:29 -0700 (PDT) X-Google-Smtp-Source: AKy350bThYyR7ukH/ZeGP0U1sDIrOv99qLspqVL9ulpI9SQOBbJuftzfgCc5MvYwFtiPPNc5pByg X-Received: by 2002:a17:906:3da2:b0:8b1:820a:7b60 with SMTP id y2-20020a1709063da200b008b1820a7b60mr11342310ejh.6.1681252648967; Tue, 11 Apr 2023 15:37:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681252648; cv=none; d=google.com; s=arc-20160816; b=LwPZrv42ZxjaqfbWmHanTetrXUwVJrv1vzGAHC5Q34+SMF5AW7VejBAOLKZkW+V24T xvXJxMI30JslVwid+nZKt8x6SfxO23YRuVqXBD2+Rr8BScjIIZM1p/lebR7UPRL35/47 F8RCZpMDxAYsjbEXYKqt3MZOIh8+WjgYxAlE6Q9mdwRD8UIKilmte/Cdpn9sVDuhqvC7 6oftTrQhs7+VL0uu5KXqrM02QV0VK2LCy/OvXCB86Psld+mG+zV+KzYfSw7ySitnPN0r JHmM8xPRxnlu+QWXVWIdzKYJBa+7pWJqVubabFjQUb7bwLUmUOk8sliACaHptI9C1kMY bP7A== 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:to:content-language:subject:user-agent:mime-version:date :message-id:dkim-signature; bh=TpRKqnZMXK6Tv7TCCUc4EiuEiZjiXzT+ajSdnY8AiZU=; b=rJJQ8rsMcPYg1+O0YJfgJ/SgPYFX2RTpq8FM9pnPXgDjNCOWujM7swC1QPyAs6I5bN PzJRGceyktqSwGA4KHclKaO/OYmrBiLTE3qrtjLsfvtCmaiWfVZv9eSCIe2Fk0IVwqUq DELGcrhmvrpibqUxszUBKFl57mqJMtt5JztyrkPrtVu6RYYk1Demc/wTSIGUB9KeVezB 61oMUihzmFWScZMrDIFX2Yikw8FidfTPhslt8qcC+8L4Np+zwtjF/AM+XvVMmGI/oSHw 4L3GM05ry/S2+vup3Eyon7E5R5b2GPxdXYle/mjO7RrrjBHHRR1GNb1BKQAflEadyAR1 pXvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LJT3VzK+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qm5-20020a170907674500b00947e04bda8fsi13665589ejc.35.2023.04.11.15.37.01; Tue, 11 Apr 2023 15:37:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LJT3VzK+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229452AbjDKW1N (ORCPT + 99 others); Tue, 11 Apr 2023 18:27:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38944 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229667AbjDKW1M (ORCPT ); Tue, 11 Apr 2023 18:27:12 -0400 Received: from mail-lj1-x235.google.com (mail-lj1-x235.google.com [IPv6:2a00:1450:4864:20::235]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 435583C3F for ; Tue, 11 Apr 2023 15:27:10 -0700 (PDT) Received: by mail-lj1-x235.google.com with SMTP id b33so5703735ljf.2 for ; Tue, 11 Apr 2023 15:27:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1681252028; x=1683844028; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=TpRKqnZMXK6Tv7TCCUc4EiuEiZjiXzT+ajSdnY8AiZU=; b=LJT3VzK+eahxSGBqvFDgOxL6xaX/5f0CLONIFUCt9rrOwtxz2yEbAllAs5Tm00Fpyh T57duFZCM9B0MKngBZpNTJtrkcnMyFq/HFpJRGJWIAvlbxAgOIyxKcbISZrAFYojBvAL bwpRb5wdNhV1aIW8NUgGzRJ0QXBXBJ/xy2JUekeWErvkFJmjI4PgRetfhSH+rdYVLpc4 P6wLA7VWKGus/1fqMLUN8cPch525olVw9zz22V+Fvc4Kv8fzLMP5J2Vv4hUtiGyeXpPu PY1BMqoSYwVOmrdjBRVF5daX9Wj3zv1iGMBqkoi0FXbHYOMXtbMGB46HIjFfIbkCStAo vJjg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1681252028; x=1683844028; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=TpRKqnZMXK6Tv7TCCUc4EiuEiZjiXzT+ajSdnY8AiZU=; b=tpFPH0KpZX0x366T9qeurzPwz02DS3HljL3k/jW0T0S1oD/iot2MUYIvCEHfzzi5AB 5VZwaKOfeLKgbozvHjN/OpWroI6HaA5bKpz+hKIJBgy7VZ9IgpoCskM9iVdy0DhtXOEb wHROM1zdcZffEAeG81ALkmTKIIeDiNS8UZlTGcQnD135YWRZZs48nXafjEvrs8yPRFp6 v8pw6cyqcyeWBJEyZIbYZSYFemOJSIacJnrrf0CPATycret1eIHkgDWxKtSIRE4QiNQS y6j3KUjxQn1X64uEcljZtqw/vMiPaKAeYQqOkZpitKPY6tHd5a5VZC5D3yb43Lw2k1sQ APEw== X-Gm-Message-State: AAQBX9eWRyZ13HkVgg05ILZrqjNOU76p1iXKq24EknvfxP9t1x1xkipN q/SiX0Y2Pl7xgx0fpRf4mh0n7A== X-Received: by 2002:a2e:9e55:0:b0:299:c03a:1cf9 with SMTP id g21-20020a2e9e55000000b00299c03a1cf9mr3430659ljk.10.1681252028498; Tue, 11 Apr 2023 15:27:08 -0700 (PDT) Received: from ?IPV6:2001:14ba:a085:4d00::8a5? (dzccz6yyyyyyyyyyybcwt-3.rev.dnainternet.fi. [2001:14ba:a085:4d00::8a5]) by smtp.gmail.com with ESMTPSA id e7-20020a2e9847000000b002934b5d6a61sm2972876ljj.121.2023.04.11.15.27.07 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 11 Apr 2023 15:27:08 -0700 (PDT) Message-ID: <38ec5a59-bd7f-3c76-ae74-9a5c0560f325@linaro.org> Date: Wed, 12 Apr 2023 01:27:07 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.9.0 Subject: Re: [Freedreno] [PATCH v2 0/2] drm: fdinfo memory stats Content-Language: en-GB To: Rob Clark , Rob Clark , Tvrtko Ursulin , "open list:DOCUMENTATION" , linux-arm-msm@vger.kernel.org, Emil Velikov , Christopher Healy , dri-devel@lists.freedesktop.org, open list , Boris Brezillon , freedreno@lists.freedesktop.org, Sean Paul References: <20230410210608.1873968-1-robdclark@gmail.com> From: Dmitry Baryshkov In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/04/2023 21:26, Daniel Vetter wrote: > On Tue, Apr 11, 2023 at 08:35:48PM +0300, Dmitry Baryshkov wrote: >> On Tue, 11 Apr 2023 at 20:13, Rob Clark wrote: >>> >>> On Tue, Apr 11, 2023 at 9:53 AM Daniel Vetter wrote: >>>> >>>> On Tue, Apr 11, 2023 at 09:47:32AM -0700, Rob Clark wrote: >>>>> On Mon, Apr 10, 2023 at 2:06 PM Rob Clark wrote: >>>>>> >>>>>> From: Rob Clark >>>>>> >>>>>> Similar motivation to other similar recent attempt[1]. But with an >>>>>> attempt to have some shared code for this. As well as documentation. >>>>>> >>>>>> It is probably a bit UMA-centric, I guess devices with VRAM might want >>>>>> some placement stats as well. But this seems like a reasonable start. >>>>>> >>>>>> Basic gputop support: https://patchwork.freedesktop.org/series/116236/ >>>>>> And already nvtop support: https://github.com/Syllo/nvtop/pull/204 >>>>> >>>>> On a related topic, I'm wondering if it would make sense to report >>>>> some more global things (temp, freq, etc) via fdinfo? Some of this, >>>>> tools like nvtop could get by trawling sysfs or other driver specific >>>>> ways. But maybe it makes sense to have these sort of things reported >>>>> in a standardized way (even though they aren't really per-drm_file) >>>> >>>> I think that's a bit much layering violation, we'd essentially have to >>>> reinvent the hwmon sysfs uapi in fdinfo. Not really a business I want to >>>> be in :-) >>> >>> I guess this is true for temp (where there are thermal zones with >>> potentially multiple temp sensors.. but I'm still digging my way thru >>> the thermal_cooling_device stuff) >> >> It is slightly ugly. All thermal zones and cooling devices are virtual >> devices (so, even no connection to the particular tsens device). One >> can either enumerate them by checking >> /sys/class/thermal/thermal_zoneN/type or enumerate them through >> /sys/class/hwmon. For cooling devices again the only enumeration is >> through /sys/class/thermal/cooling_deviceN/type. >> >> Probably it should be possible to push cooling devices and thermal >> zones under corresponding providers. However I do not know if there is >> a good way to correlate cooling device (ideally a part of GPU) to the >> thermal_zone (which in our case is provided by tsens / temp_alarm >> rather than GPU itself). > > There's not even sysfs links to connect the pieces in both ways? I missed them in the most obvious place: /sys/class/thermal/thermal_zone1/cdev0 -> ../cooling_device0 So, there is a link from thermal zone to cooling device. > >>> But what about freq? I think, esp for cases where some "fw thing" is >>> controlling the freq we end up needing to use gpu counters to measure >>> the freq. >> >> For the freq it is slightly easier: /sys/class/devfreq/*, devices are >> registered under proper parent (IOW, GPU). So one can read >> /sys/class/devfreq/3d00000.gpu/cur_freq or >> /sys/bus/platform/devices/3d00000.gpu/devfreq/3d00000.gpu/cur_freq. >> >> However because of the components usage, there is no link from >> /sys/class/drm/card0 >> (/sys/devices/platform/soc@0/ae00000.display-subsystem/ae01000.display-controller/drm/card0) >> to /sys/devices/platform/soc@0/3d00000.gpu, the GPU unit. > > Hm ... do we need to make component more visible in sysfs, with _looooots_ > of links? Atm it's just not even there. Maybe. Or maybe we should use DPU (the component master and a parent of drm/card0) as devfreq parent too. > >> Getting all these items together in a platform-independent way would >> be definitely an important but complex topic. > > Yeah this sounds like some work. But also sounds like it's all generic > issues (thermal zones above and component here) that really should be > fixed at that level? > > Cheers, Daniel > > >>>> What might be needed is better glue to go from the fd or fdinfo to the >>>> right hw device and then crawl around the hwmon in sysfs automatically. I >>>> would not be surprised at all if we really suck on this, probably more >>>> likely on SoC than pci gpus where at least everything should be under the >>>> main pci sysfs device. >>> >>> yeah, I *think* userspace would have to look at /proc/device-tree to >>> find the cooling device(s) associated with the gpu.. at least I don't >>> see a straightforward way to figure it out just for sysfs >>> >>> BR, >>> -R >>> >>>> -Daniel >>>> >>>>> >>>>> BR, >>>>> -R >>>>> >>>>> >>>>>> [1] https://patchwork.freedesktop.org/series/112397/ >>>>>> >>>>>> Rob Clark (2): >>>>>> drm: Add fdinfo memory stats >>>>>> drm/msm: Add memory stats to fdinfo >>>>>> >>>>>> Documentation/gpu/drm-usage-stats.rst | 21 +++++++ >>>>>> drivers/gpu/drm/drm_file.c | 79 +++++++++++++++++++++++++++ >>>>>> drivers/gpu/drm/msm/msm_drv.c | 25 ++++++++- >>>>>> drivers/gpu/drm/msm/msm_gpu.c | 2 - >>>>>> include/drm/drm_file.h | 10 ++++ >>>>>> 5 files changed, 134 insertions(+), 3 deletions(-) >>>>>> >>>>>> -- >>>>>> 2.39.2 >>>>>> >>>> >>>> -- >>>> Daniel Vetter >>>> Software Engineer, Intel Corporation >>>> http://blog.ffwll.ch >> >> >> >> -- >> With best wishes >> Dmitry > -- With best wishes Dmitry