Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp38246826rwd; Wed, 12 Jul 2023 05:19:00 -0700 (PDT) X-Google-Smtp-Source: APBJJlHkVJJipOhKP8OyAFbuaIKsD5PZk/0sRUcKwru3Nedc9Wzzg6DzhK7hp997QBej+jJ+DGnl X-Received: by 2002:a17:90a:f2c4:b0:263:5efe:617 with SMTP id gt4-20020a17090af2c400b002635efe0617mr13504049pjb.40.1689164340456; Wed, 12 Jul 2023 05:19:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689164340; cv=none; d=google.com; s=arc-20160816; b=KD2oZYi7rm3n9WaKVjyKrUxYeeeNRNTXOHfl6m+afk0EMrR83ZmXPpRFBmloHmtrUG 2qLEShQrknJarttY5rHgTWppqBop0eMGVl3BrbmJVgF3j+Ssji8H2qOLq34hddP+UhaZ gS77WLmChEey7uKnv5xVQRhj8TYUqWGwW6ayg5hOUIJcHjNWwzcMYtVrsWIYgGZKRx5/ VqQT6w+e5W5UlnwLsLyXQBNRSDbTlSNiVZ4QV1hNfF6TRPKq9BY+UitO1CE8sk/W/X7E pgUPW2z+9ZZ4iQRxYvm8NVxgVsQ2byciV3x0pRyhlUrqg9CA4fozH9zk4JeTN2OI2GK3 DcpQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=dRCdeEm2VVbLQaD9KfbreUEYl09AWXQJj+bcbyOxgvs=; fh=AB6ahJ7aRRWBRwaRRWg5ebNaiYUkpi/4N4/J23sBvbI=; b=1Ho77g4a2cMLdnlEFpE2C1kgE7RbSb0hiI3U00FYGXPBDpe63ZYH5EbpR1XXyXh9rH RdURg8f73XQNvRZE+bN9lHTJsMw/rdkmSvgE2veknEz9eQq9lo2+n5+ir4Qx9cf23V1e rjo1kbEJKktS/68YOBHobV1cEieN+qdOA+MGlJBG15pyuONHHL0V2z2nWd3qW8NjSrC9 QgBzTNP9E7cyp815WEAD+Ezx/BN6i0h0TyLRJBHYsbPvvQJ0PHEmu9lSStFXOob614Ws i8Luae1kp7p9ruMY+hEVWAkAAzf5u4XCQ9KmXC1x8BdGcWXNRNY//f3LLJIyaMPqGA+b eHXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=FGQusYvy; 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=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id kx6-20020a170902f94600b001a64fa4eb27si3229185plb.230.2023.07.12.05.18.48; Wed, 12 Jul 2023 05:19:00 -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=@intel.com header.s=Intel header.b=FGQusYvy; 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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233552AbjGLLup (ORCPT + 99 others); Wed, 12 Jul 2023 07:50:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38452 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233534AbjGLLua (ORCPT ); Wed, 12 Jul 2023 07:50:30 -0400 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F13971BC0; Wed, 12 Jul 2023 04:48:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1689162540; x=1720698540; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=lKoMcXbN2L6Bp1UujVMkXfxYLgXbZyOn20AweTGZa3U=; b=FGQusYvyooIBMdm94c+Zt2bU4Hz1aq/sRc7UwSPKwcn45hCPJkJe24qo e87qKL8L6OwjpZqGoLE8I4f89jfVc/lwqzREUocGcG3n1mLAzSCCAv+E5 Nqki4YADqxuG5jyrrchowgt8uW+ubZY9LfevgCiLwu4LeYUyNHvFF7/tM hPFyvIMRhbphTAY7gVVQj5/KJfR8nUbgq7+oXqUMBkb9GVSg8OrpvKwKM UW1XRoonDqK87bezXXZnorL8vmglCeSrbb5zARrKUdZbymWjQ9z4bDb62 PD53dqx8FwtKBgKBwlQacQPs1ydC4GwHdMa2UH/KPw+SKYX7JxZTqNE2Q A==; X-IronPort-AV: E=McAfee;i="6600,9927,10768"; a="344469303" X-IronPort-AV: E=Sophos;i="6.01,199,1684825200"; d="scan'208";a="344469303" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jul 2023 04:46:58 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10768"; a="866094136" X-IronPort-AV: E=Sophos;i="6.01,199,1684825200"; d="scan'208";a="866094136" Received: from eamonnob-mobl1.ger.corp.intel.com (HELO localhost.localdomain) ([10.213.237.202]) by fmsmga001-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jul 2023 04:46:54 -0700 From: Tvrtko Ursulin To: Intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org Cc: cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, Tejun Heo , Johannes Weiner , Zefan Li , Dave Airlie , Daniel Vetter , Rob Clark , =?UTF-8?q?St=C3=A9phane=20Marchesin?= , "T . J . Mercier" , Kenny.Ho@amd.com, =?UTF-8?q?Christian=20K=C3=B6nig?= , Brian Welty , Tvrtko Ursulin Subject: [PATCH 11/17] drm/cgroup: Only track clients which are providing drm_cgroup_ops Date: Wed, 12 Jul 2023 12:45:59 +0100 Message-Id: <20230712114605.519432-12-tvrtko.ursulin@linux.intel.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230712114605.519432-1-tvrtko.ursulin@linux.intel.com> References: <20230712114605.519432-1-tvrtko.ursulin@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,HK_RANDOM_ENVFROM,HK_RANDOM_FROM, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_PASS,SPF_NONE,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED 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 From: Tvrtko Ursulin To reduce the number of tracking going on, especially with drivers which will not support any sort of control from the drm cgroup controller side, lets express the funcionality as opt-in and use the presence of drm_cgroup_ops as activation criteria. Signed-off-by: Tvrtko Ursulin --- kernel/cgroup/drm.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/kernel/cgroup/drm.c b/kernel/cgroup/drm.c index 68f31797c4f0..60e1f3861576 100644 --- a/kernel/cgroup/drm.c +++ b/kernel/cgroup/drm.c @@ -97,6 +97,9 @@ void drmcgroup_client_open(struct drm_file *file_priv) { struct drm_cgroup_state *drmcs; + if (!file_priv->minor->dev->driver->cg_ops) + return; + drmcs = css_to_drmcs(task_get_css(current, drm_cgrp_id)); mutex_lock(&drmcg_mutex); @@ -112,6 +115,9 @@ void drmcgroup_client_close(struct drm_file *file_priv) drmcs = css_to_drmcs(file_priv->__css); + if (!file_priv->minor->dev->driver->cg_ops) + return; + mutex_lock(&drmcg_mutex); list_del(&file_priv->clink); file_priv->__css = NULL; @@ -126,6 +132,9 @@ void drmcgroup_client_migrate(struct drm_file *file_priv) struct drm_cgroup_state *src, *dst; struct cgroup_subsys_state *old; + if (!file_priv->minor->dev->driver->cg_ops) + return; + mutex_lock(&drmcg_mutex); old = file_priv->__css; -- 2.39.2