Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp775013iog; Fri, 24 Jun 2022 13:56:38 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tUhR9pV52GiR6asEeXy+akWYgzU35T0yc97HwdOH6udE9QbryXwORBmMr7H9+pk+nsWj0J X-Received: by 2002:a05:6a00:1a48:b0:522:9716:4e0a with SMTP id h8-20020a056a001a4800b0052297164e0amr777365pfv.22.1656104197780; Fri, 24 Jun 2022 13:56:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656104197; cv=none; d=google.com; s=arc-20160816; b=KRLnRbH0aDcpUwbpbDiQ66KgtAAHMCRV+2LdlRblNVpodO4MCAYJfYMeP4h32zI0/j qstRmALy0bZteNzcxIRTZ3l81fdUOGpfDPaKJcDohEces+5EtaVamP37tZuGY+QAWBaQ Wot8sBmDzxDGG0jhusk0Q9h75kxZrmihXVYKbbveDvn9knE6hUwBD1DIX09mltFX+Dnl kctYCzdjskOila/E39OpLUjSxpAlMuteU6UcjQXSiriS294vYZrqxiTsU5osVLxlGije P2EsjMI1FIJngIry5F5MtAi2DrlgHfySpJzjrkCTgDovSpAQJMY1E24vS0ggMKgqorgJ fo8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=JOawYYsMmXVXjmJlEQmmHixFMSNq4rwAUlbsY6fSBgM=; b=wnx40hF0RM6eAxeehvrN8tGmQrW2ypvUN1iveP5rQNuv4AF6V7zDBhioL2Ox/uVMWB Y3YnU6tTs1THngWBEuYPIkbPL5gpKZ3T0w/l4KHEnzNOVx61e8OF91EOBJ0CRr5AaJRl trhMKR2pqWG6V6W0+353n1mYqc0biJBXlwpHsEiWxzG+RFU2/eIl5iyLBRJUmCxKrzdQ 3srvtL3YcBBuV2Q+58zxMJ1jbRihvUfJX5Jtlr5lzUUvMqbXtvAIO805dwelFZUICirr LniQU7W4QF7C4RvBK4Whz29b5/KzMgNEI0U1SynjLuZrvUoccJ7kfgSmhIfDMrl5vDi2 VDpg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=tg7SyNOO; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s12-20020a63450c000000b0040c702d1448si3523349pga.540.2022.06.24.13.56.23; Fri, 24 Jun 2022 13:56:37 -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=@google.com header.s=20210112 header.b=tg7SyNOO; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230487AbiFXUdC (ORCPT + 99 others); Fri, 24 Jun 2022 16:33:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42946 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231232AbiFXUdA (ORCPT ); Fri, 24 Jun 2022 16:33:00 -0400 Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0A7C9E53 for ; Fri, 24 Jun 2022 13:32:58 -0700 (PDT) Received: by mail-wr1-x429.google.com with SMTP id e7so4539986wrc.13 for ; Fri, 24 Jun 2022 13:32:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=JOawYYsMmXVXjmJlEQmmHixFMSNq4rwAUlbsY6fSBgM=; b=tg7SyNOOcpVv7QNLGjiD5KPi52/+81+/GdcF4vMbyPBIUjBBrCNv+tyegVY20uye/I 8Vyz/JGoeTKB1w5QEdFMlq0X9w98WbqAaklpSLN4EHbesVPHavlkpHILt1ZfuYLKpZ8W QWm+Maw4GPgy2ApKPUsawPdD52CVDNryzSvuJBVG/RGE1Y030n422Z6wuG4tFFvBcR27 LjOjXsrh4klnn1DcCwwhoI0t8TTxE908V6t7zZjTqlwnAGdcuAOVwj1XL6eJ5KD7NEWR SUf/6y2OeRLz1/Liz1zYe+r9C1qmHOr6YxgkPxXUsGyjo51BPVTKh4OJcFsWrx7rdii2 KEPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=JOawYYsMmXVXjmJlEQmmHixFMSNq4rwAUlbsY6fSBgM=; b=3sEpT1H7T3WOesORQahu0PlNheo8R65BT4CDPpwropnlzA9CXJKsx10NofDlKXF9p+ +kHkyjnpG2K9zJeBccYpEdwmtwvaWphmwnPUnULu/tR8oe/DDqvaZtxm2cS+dRj6UGcU xJ/bZtr4u5yPsL0uO4xSqtrl5Y95iuhw2LVAaUzFqos2fdTKKxjpRZB3KKbFMl6jp02E /zag7Lc4WbP24vbGcuqOIyMEzyyS198Tr7Ovr3tam1kERZqNlpi5U77vLCWJpbiqznN+ Qpj5vXVKbiapBT5pgOa/2Gx+drxqklHd40E+QwwLhRDIDpeWs3dX787vWn8MPEN0oKWE OdFg== X-Gm-Message-State: AJIora9GBPzJTDKpeA9Z1k+ee1w6UMBQKWx1AKMqoufAm1yy4Mpo51GQ reE6aqhUmFMj/X2V2cLZoJh0cMVrWF0F/KjuS3XF X-Received: by 2002:adf:efd2:0:b0:21b:91ae:68ca with SMTP id i18-20020adfefd2000000b0021b91ae68camr833768wrp.514.1656102776455; Fri, 24 Jun 2022 13:32:56 -0700 (PDT) MIME-Version: 1.0 References: <20220510235653.933868-1-tjmercier@google.com> <3365cd1d750e84fedc8e75d646a77ffd85619d35.camel@ndufresne.ca> <81026ef07c1ce20f8673b75b17bab79a2b39c548.camel@ndufresne.ca> In-Reply-To: From: John Stultz Date: Fri, 24 Jun 2022 13:32:45 -0700 Message-ID: Subject: Re: [PATCH v7 0/6] Proposal for a GPU cgroup controller To: "T.J. Mercier" , Tejun Heo , Nicolas Dufresne , Zefan Li , Johannes Weiner , Jonathan Corbet , Greg Kroah-Hartman , =?UTF-8?B?QXJ2ZSBIasO4bm5ldsOlZw==?= , Todd Kjos , Martijn Coenen , Joel Fernandes , Christian Brauner , Hridya Valsaraju , Suren Baghdasaryan , Sumit Semwal , =?UTF-8?Q?Christian_K=C3=B6nig?= , Benjamin Gaignard , Liam Mark , Laura Abbott , Brian Starkey , John Stultz , Shuah Khan , John Stultz , Carlos Llamas , Kalesh Singh , Kenny.Ho@amd.com, =?UTF-8?Q?Michal_Koutn=C3=BD?= , Shuah Khan , kernel-team@android.com, cgroups@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org, linux-kselftest@vger.kernel.org Cc: Daniel Vetter Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=unavailable 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 Fri, Jun 24, 2022 at 1:17 PM Daniel Vetter wrote: > > On Wed, Jun 15, 2022 at 10:31:21AM -0700, T.J. Mercier wrote: > > On Fri, May 20, 2022 at 9:25 AM T.J. Mercier wrote: > > > > > > On Fri, May 20, 2022 at 12:47 AM Tejun Heo wrote: > > > > > > > > Hello, > > > > > > > > On Tue, May 17, 2022 at 04:30:29PM -0700, T.J. Mercier wrote: > > > > > Thanks for your suggestion. This almost works. "dmabuf" as a key could > > > > > work, but I'd actually like to account for each heap. Since heaps can > > > > > be dynamically added, I can't accommodate every potential heap name by > > > > > hardcoding registrations in the misc controller. > > > > > > > > On its own, that's a pretty weak reason to be adding a separate gpu > > > > controller especially given that it doesn't really seem to be one with > > > > proper abstractions for gpu resources. We don't want to keep adding random > > > > keys to misc controller but can definitely add limited flexibility. What > > > > kind of keys do you need? > > > > > > > Well the dmabuf-from-heaps component of this is the initial use case. > > > I was envisioning we'd have additional keys as discussed here: > > > https://lore.kernel.org/lkml/20220328035951.1817417-1-tjmercier@google.com/T/#m82e5fe9d8674bb60160701e52dae4356fea2ddfa > > > So we'd end up with a well-defined core set of keys like "system", and > > > then drivers would be free to use their own keys for their own unique > > > purposes which could be complementary or orthogonal to the core set. > > > Yesterday I was talking with someone who is interested in limiting gpu > > > cores and bus IDs in addition to gpu memory. How to define core keys > > > is the part where it looks like there's trouble. > > > > > > For my use case it would be sufficient to have current and maximum > > > values for an arbitrary number of keys - one per heap. So the only > > > part missing from the misc controller (for my use case) is the ability > > > to register a new key at runtime as heaps are added. Instead of > > > keeping track of resources with enum misc_res_type, requesting a > > > resource handle/ID from the misc controller at runtime is what I think > > > would be required instead. > > > > > Quick update: I'm going to make an attempt to modify the misc > > controller to support a limited amount of dynamic resource > > registration/tracking in place of the new controller in this series. > > > > Thanks everyone for the feedback. > > Somehow I missed this entire chain here. > > I'm not a fan, because I'm kinda hoping we could finally unify gpu memory > account. Atm everyone just adds their one-off solution in a random corner: > - total tracking in misc cgroup controller > - dma-buf sysfs files (except apparently too slow so it'll get deleted > again) > - random other stuff on open device files os OOM killer can see it > > This doesn't look good. But I also think one could see it as "gpu memory" is the drm subsystem doing the same thing (in that it's artificially narrow to gpus). It seems we need something to account for buffers allocated by drivers, no matter which subsystem it was in (drm, v4l2, or networking or whatever). thanks -john