Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp245746rwb; Tue, 25 Jul 2023 15:16:39 -0700 (PDT) X-Google-Smtp-Source: APBJJlFilG1dNi0M5YLwd8CEjX0P5GL3tNAmABFpXi7P+R4bvSWSDKaVmGGpbrZvuH9FmQyXdazU X-Received: by 2002:aa7:df8b:0:b0:522:1fd2:ca7a with SMTP id b11-20020aa7df8b000000b005221fd2ca7amr157933edy.29.1690323398768; Tue, 25 Jul 2023 15:16:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690323398; cv=none; d=google.com; s=arc-20160816; b=ISSdbihTElCUosFXo2yC60Tg0LwJhIWM1cL3gIx8EL74oIyJEbMVFLXyoaSmXktlc1 gkAHUheY1xfZ659mdKyzm5aDbCdKiPHMOmYgZX7PCJ6utGVwh7ZW4mUNEam/1RNcDnsf 79qdv3PlZhqH0HKrZ3tsnlE4n3+2DSOrngbrSMsSPMnIQ07Fzn2zqZ+qveM4TOk47SVG XEFrHFHWUcc3DP6/sfrbCKZ73fNplaAEhdm92sbI+16l3lG1h8zpolcxw2qQd5jW2ERY 9RcFEj4s7XyjXk0aa7pPRm+Ks3W7o4wyltdSafe04EviHgwP8BkVL5/AiT7nmHm44qrD NlBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:sender:dkim-signature; bh=LMF20IZtbfCz3aU/3bfXT+An6WYKlC9WFpBOERsbLtc=; fh=dZxOPVQL0KOwZfs8WeF5llXPjlMaWHBf8rWXA5n8yfs=; b=ADIZ088ccZn5Ta16vAd9RjGWHU4MmffKPKvSycgEKEvoRtZYYvLW9fnmGcIJHior5q kpjkJG/yO4OlSRT88Xpg0BkNMmsoOSCk3GTggh2Q8xeRYA56hQe6CdQKg9G+aI4KJ9W8 RT7v+aV14TzplpsIDC4cJsDtRXHVcr1SFbCQ444nRaBKTlNnfry0RP0k8R9KA3hb7trT BVXcCSUwf4fVbK83gatx0sPZWaDnzcEvCizZrKeLyA26aLKfAMBlRIjNJMeXeewfzd7L w9Ns5usYID1JdlSjEFERqEjigvn5ofRJeED0r6V9F2UNKuuSA7J/hXeUr0VYgp46h5Ng 8ZqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=cuSOP3cY; 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=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x2-20020aa7dac2000000b005224f599180si1351286eds.363.2023.07.25.15.16.13; Tue, 25 Jul 2023 15:16:38 -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=@gmail.com header.s=20221208 header.b=cuSOP3cY; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230270AbjGYVoR (ORCPT + 99 others); Tue, 25 Jul 2023 17:44:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38140 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229696AbjGYVoQ (ORCPT ); Tue, 25 Jul 2023 17:44:16 -0400 Received: from mail-pl1-x633.google.com (mail-pl1-x633.google.com [IPv6:2607:f8b0:4864:20::633]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5226B1FE6; Tue, 25 Jul 2023 14:44:15 -0700 (PDT) Received: by mail-pl1-x633.google.com with SMTP id d9443c01a7336-1bbc2e1c6b2so6062985ad.3; Tue, 25 Jul 2023 14:44:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690321455; x=1690926255; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:from:to:cc:subject:date:message-id :reply-to; bh=LMF20IZtbfCz3aU/3bfXT+An6WYKlC9WFpBOERsbLtc=; b=cuSOP3cY00kalmUDb+byhPR92kTHul30bSE157ciDmWkuI3153sw6DFVNwFXC73ZZH AMb7lJ2vBq3NfzlR75VP9ViihITZUUBuwZSP+iZbcnGqMdmLWEqXA3VleLVomwy1AQ7K ot9lBHyDBPxyHGh8V0vMqtTuB/kS4Flz9vR00TJzFanJ7/hOzkkIhAlOcCaVYUWR/q4O PXmqDHD51oaTBEblzjHQjFk3hcSdEHYiNZdxxP7RxHHD4HSfdG65/jyaMhgqcPMVdOgf DDMqgL1wXsE0INWvlim252xKspmHeBqwoIe1+prRY5UcjPYodxV6TTiAF6/c+R5lSC29 IUzg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690321455; x=1690926255; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=LMF20IZtbfCz3aU/3bfXT+An6WYKlC9WFpBOERsbLtc=; b=fForm67b0oLU27qRrk851xFbY90NicTru2j8/yxsFNmE/QVGhVKddxn+SAMc1NNgDJ l+zW5Qm1JALkNFteKVX0gnlMXZIQpm47aRyVylUE70OWdlLxihBRNS3a5jovC05rNmkh DE95oKpqkfhF7IwPYspeN/QFH8FlElpBP32GZX20IYp/sRrfaWaCd0IZ9aWBHMz1sv7y qUJGd8xJrYYU1ZoiPaGrcnjLibLS31zVfV36j21Em2n1AY0IKPhvZUk1k1XjW4VX9it2 VgnT+nS7fltvGJ8QtamaQvKOwUQMcvOoZAJRUFCuakjwliiX9hTD/pcYi4gIQr1yiK0q Cbcw== X-Gm-Message-State: ABy/qLbjMiQnbF9rhcg7B4f/T/toUGUBhEIOLDwJ2bkV2ms3a7sSpj0P MGXSrGrDhyvFVt1he8GRr8k= X-Received: by 2002:a17:902:e314:b0:1bb:c64f:9a5e with SMTP id q20-20020a170902e31400b001bbc64f9a5emr323769plc.5.1690321454499; Tue, 25 Jul 2023 14:44:14 -0700 (PDT) Received: from localhost ([2620:10d:c090:400::5:18d]) by smtp.gmail.com with ESMTPSA id l9-20020a170902d34900b001b86f1b5797sm2642688plk.302.2023.07.25.14.44.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Jul 2023 14:44:14 -0700 (PDT) Sender: Tejun Heo Date: Tue, 25 Jul 2023 11:44:12 -1000 From: Tejun Heo To: Tvrtko Ursulin Cc: Intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, Johannes Weiner , Zefan Li , Dave Airlie , Daniel Vetter , Rob Clark , =?iso-8859-1?Q?St=E9phane?= Marchesin , "T . J . Mercier" , Kenny.Ho@amd.com, Christian =?iso-8859-1?Q?K=F6nig?= , Brian Welty , Tvrtko Ursulin , Eero Tamminen Subject: Re: [PATCH 15/17] cgroup/drm: Expose GPU utilisation Message-ID: References: <20230712114605.519432-1-tvrtko.ursulin@linux.intel.com> <20230712114605.519432-16-tvrtko.ursulin@linux.intel.com> <3b96cada-3433-139c-3180-1f050f0f80f3@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3b96cada-3433-139c-3180-1f050f0f80f3@linux.intel.com> X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no 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 Hello, On Tue, Jul 25, 2023 at 03:08:40PM +0100, Tvrtko Ursulin wrote: > > Also, shouldn't this be keyed by the drm device? > > It could have that too, or it could come later. Fun with GPUs that it not > only could be keyed by the device, but also by the type of the GPU engine. > (Which are a) vendor specific and b) some aree fully independent, some > partially so, and some not at all - so it could get complicated semantics > wise really fast.) I see. > If for now I'd go with drm.stat/usage_usec containing the total time spent > how would you suggest adding per device granularity? Files as documented > are either flag or nested, not both at the same time. So something like: > > usage_usec 100000 > card0 usage_usec 50000 > card1 usage_usec 50000 > > Would or would not fly? Have two files along the lines of drm.stat and drm.dev_stat? Please follow one of the pre-defined formats. If you want to have card identifier and field key, it should be a nested keyed file like io.stat. > While on this general topic, you will notice that for memory stats I have > _sort of_ nested keyed per device format, for example on integrated Intel > GPU: > > $ cat drm.memory.stat > card0 region=system total=12898304 shared=0 active=0 resident=12111872 purgeable=167936 > card0 region=stolen-system total=0 shared=0 active=0 resident=0 purgeable=0 > > If one a discrete Intel GPU two more lines would appear with memory > regions of local and local-system. But then on some server class > multi-tile GPUs even further regions with more than one device local > memory region. And users do want to see this granularity for container use > cases at least. > > Anyway, this may not be compatible with the nested key format as > documented in cgroup-v2.rst, although it does not explicitly say. > > Should I cheat and create key names based on device and memory region name > and let userspace parse it? Like: > > $ cat drm.memory.stat > card0.system total=12898304 shared=0 active=0 resident=12111872 purgeable=167936 > card0.stolen-system total=0 shared=0 active=0 resident=0 purgeable=0 Yeah, this looks better to me. If they're reporting different values for the same fields, they're separate keys. Thanks. -- tejun