Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp783316iog; Fri, 24 Jun 2022 14:08:40 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vs26sOTNzeYkeHMz8QfSC+HPSejybVZsgR4/hFu42cqoUbFTQauGbbbayUH9KOXnrsDi3v X-Received: by 2002:a63:4c07:0:b0:40d:8b81:5638 with SMTP id z7-20020a634c07000000b0040d8b815638mr659718pga.449.1656104920457; Fri, 24 Jun 2022 14:08:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656104920; cv=none; d=google.com; s=arc-20160816; b=MZ4V3sP42AjzRNYuKIcdJLBjhQduG+f0WdpGokVeMfIYqvZQEuzc+tPdQfaVODZooo iB5iEezLmtW44t2wN1z2W9OIIYDcZupvpGLDaKtXZ7Sb2PfXkB5rk/2PxKymIxhkP0XO JQAa+obxyObeeuzLJvacOVIp/+AEAWXLZB6JOpvc70Is7wxShuZO3kyy05+tUAHzS1Wb DWifBD0tsGr/TfvFV8GKTuSWCPLIdkH3+5Lbh/Fyqybm59snzIxu7/ORQZCimo3ORJsF oS6hxzggfgteO/0Fuc3OjP2yXZRfBRFvt2/+rsVUf+ksiFzT7ZmB3Wcygwg5ujqPNzNZ UijA== 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:mail-followup-to:message-id:subject:cc:to:from:date :dkim-signature; bh=2ZlRpEdtEVnBuC7aEnd7d6UXgiUoHLzki+QPk6nXlJo=; b=G/XPf/Sbct3tTumf8gqZOs4+oU8HzEHLRvDxjHX1NfUwNGN/Lo/bK49rqOBScMMXhg GvfHJBcyHIyAePvJUBui6/7euuJpXN/19IGKp60wmKbHgt4xZdr9/HpGt+uHPbzIzFS8 8bW6+nQ45MyMTB5jLZFcj5Y/0AEi3PE79afyfq8ia2KT6+fFQNfBrzFwZzRQEPvv4QQH +iizhkxdV9BCPxYL/H40ah95uqH+FSCFXYxz5ToarGBrTwHe9sN8K/QHYdCNHNgo4RY5 0OOggPc3X0CaqTJDDBfXEBNHq9Ap5fFbC0Wvv3HPAJ2cCTaKYrutxr6p9LGQJbmyB6y9 oeVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ffwll.ch header.s=google header.b=grPNnukE; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y12-20020a1709029b8c00b00163cdf1a201si3969521plp.265.2022.06.24.14.08.28; Fri, 24 Jun 2022 14:08:40 -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=@ffwll.ch header.s=google header.b=grPNnukE; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230010AbiFXUgs (ORCPT + 99 others); Fri, 24 Jun 2022 16:36:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45712 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229607AbiFXUgp (ORCPT ); Fri, 24 Jun 2022 16:36:45 -0400 Received: from mail-ej1-x62c.google.com (mail-ej1-x62c.google.com [IPv6:2a00:1450:4864:20::62c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 62FFC3AA73 for ; Fri, 24 Jun 2022 13:36:44 -0700 (PDT) Received: by mail-ej1-x62c.google.com with SMTP id u15so6930332ejc.10 for ; Fri, 24 Jun 2022 13:36:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-disposition:in-reply-to; bh=2ZlRpEdtEVnBuC7aEnd7d6UXgiUoHLzki+QPk6nXlJo=; b=grPNnukEJPKIcNnJemOGDgxKea/T9pmQbUrVjX1fkdNW4DFFEep8GNYhuqPwoNbYjY XI+N5u6z+zW4ITmghCISZyzSC3ay1C1KDFluTGPgXVRWPyq/0p5zTh43/1KWbFJRI5zo gi6FaaNeRjLvD+bffmfq5EeP2MPq426xKwcM8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :in-reply-to; bh=2ZlRpEdtEVnBuC7aEnd7d6UXgiUoHLzki+QPk6nXlJo=; b=ErmszTGnlbn6RWG7VuKvIozL4fyHIp+foNw0w12tbbKFUGFX3ZHu22IG0mta3wV++U bfMDsD/Cu6PjQ6Z8cq26R9P07OuGpmaasQ1sY9zPuZjw4i/aFWUYqbLMvv5NGLfxOCI1 AeKv9FbgTdCZJm8JYM69gEgM/NXJIkKkROr6mwDfZtBxrGwXDTeIqY/qh5HchoPO9ER7 WsibqgHpiHCEPCy5Czr/n2F/HgNSIVmSq98LQaZBiWk8QJbjZGgYvErAIl5zsnmnaOrX NVqd9Qd0hYN9rT3kTnujhDPZDTnMxrNFaSMNInJGEw2Hh2HOixHifobWjIdgNRBMIvHX owYQ== X-Gm-Message-State: AJIora9qDaeYqC5XavRw/IwIvt9xrguvAsDTEFrqpV6DpBmMSznkKcor WQ9Nfc0IJKza/rZfMwDgBJCMoQ== X-Received: by 2002:a17:906:9c82:b0:6df:baa2:9f75 with SMTP id fj2-20020a1709069c8200b006dfbaa29f75mr833410ejc.762.1656103002903; Fri, 24 Jun 2022 13:36:42 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:57f4:0:efd0:b9e5:5ae6:c2fa]) by smtp.gmail.com with ESMTPSA id jl18-20020a17090775d200b006fec8e8eff6sm1661323ejc.176.2022.06.24.13.36.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jun 2022 13:36:42 -0700 (PDT) Date: Fri, 24 Jun 2022 22:36:40 +0200 From: Daniel Vetter To: John Stultz Cc: "T.J. Mercier" , Tejun Heo , Nicolas Dufresne , Zefan Li , Johannes Weiner , Jonathan Corbet , Greg Kroah-Hartman , Arve =?iso-8859-1?B?SGr4bm5lduVn?= , Todd Kjos , Martijn Coenen , Joel Fernandes , Christian Brauner , Hridya Valsaraju , Suren Baghdasaryan , Sumit Semwal , Christian =?iso-8859-1?Q?K=F6nig?= , Benjamin Gaignard , Liam Mark , Laura Abbott , Brian Starkey , John Stultz , Shuah Khan , Carlos Llamas , Kalesh Singh , Kenny.Ho@amd.com, Michal =?iso-8859-1?Q?Koutn=FD?= , 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, Daniel Vetter Subject: Re: [PATCH v7 0/6] Proposal for a GPU cgroup controller Message-ID: Mail-Followup-To: John Stultz , "T.J. Mercier" , Tejun Heo , Nicolas Dufresne , Zefan Li , Johannes Weiner , Jonathan Corbet , Greg Kroah-Hartman , Arve =?iso-8859-1?B?SGr4bm5lduVn?= , Todd Kjos , Martijn Coenen , Joel Fernandes , Christian Brauner , Hridya Valsaraju , Suren Baghdasaryan , Sumit Semwal , Christian =?iso-8859-1?Q?K=F6nig?= , Benjamin Gaignard , Liam Mark , Laura Abbott , Brian Starkey , John Stultz , Shuah Khan , Carlos Llamas , Kalesh Singh , Kenny.Ho@amd.com, Michal =?iso-8859-1?Q?Koutn=FD?= , 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 References: <81026ef07c1ce20f8673b75b17bab79a2b39c548.camel@ndufresne.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Operating-System: Linux phenom 5.10.0-8-amd64 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE 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 Fri, Jun 24, 2022 at 01:32:45PM -0700, John Stultz wrote: > 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). This is what the gpucg was. It wasn't called the dmabuf cg because we want to account also memory of other types (e.g. drm gem buffer objects which aren't exported), and I guess people didn't dare call it an xpu. But this was absolutely for a lot more than just "gpu drivers in drm". Better names welcome. -Daniel -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch