Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp1469007rwi; Wed, 19 Oct 2022 10:58:33 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4HZEuGg9V/Z0D+FOP+JZ7Oy89ZVJh41Eg0TkynLrxQfhGDOPjX3KOx2DoG/1BQ0QWiV3EM X-Received: by 2002:a50:ed86:0:b0:458:e1da:af2 with SMTP id h6-20020a50ed86000000b00458e1da0af2mr8356532edr.364.1666202312972; Wed, 19 Oct 2022 10:58:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666202312; cv=none; d=google.com; s=arc-20160816; b=GDcrJMYlbkS4t+nwFekDQGveit68e1V5TYooiTHXPrCyfe0fFXNIf/HAm2RjNGBT9n Dp2HWZzvcwCqO9vFNYBfnZ/ndd7+IQOTWK+ewGkZTHVP6GwOlK9c83x9PPvPF7EfgG+V jLa7zzuq2enFPJHnFW/Z18UAGtaKnqDNE5Bj+5kCiK72FNklvnRwQDUUWOQ/Aye7YgAF Nme3x+TlHmwrid9JEZlf1iQ8MUl9896FK8Duozwcbd9P0d+2oQKmKn9sUq7g4YpxakY0 TPANLbyBC++9QuW9EtgH6LVBISJVz3ehnE+0L9Q4so+Ncqo7J++hJUIkrxTm489lQYCh Y+ig== 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=kbfACSa5mB7jyETfg2PTHiogEqnNj2Y9dHr5Ki3RBHA=; b=svP+NcPWyLdgCL2TdpP2gel7p4sN9wpsbmGxQuo7LYWYj3Z4b0IZ7koyzpkaLxDO6a NlNQ+YJ7t1aM8uwN9ScooadukTLn1DvGnLqGf02ADhnKl4J2k8kK5b9mMxvggCDDLiuN P5APzCnX+QuMQvNwzdWmqlsRbz62CCqW9fTUpTnil1ehQX7zFfAPzcLpnazXdLXIpgUj Wjsxor8/9ppRMpjOtiQO9f10MfoXqp1ibI6dzEi0m+tM9Hxr/+nPRTNACNupMvHXuSBC L3OFBSAREErqjDhzOkIW7o+k1Sn8X1A+iaMqeoCUOSelnuqgeRXta1yzlYkg/BobKjr5 JTXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=cF7UvkPo; 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 we15-20020a170907234f00b00782393c36cfsi11220349ejb.336.2022.10.19.10.58.06; Wed, 19 Oct 2022 10:58:32 -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=cF7UvkPo; 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 S229649AbiJSRfN (ORCPT + 99 others); Wed, 19 Oct 2022 13:35:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33876 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231526AbiJSReS (ORCPT ); Wed, 19 Oct 2022 13:34:18 -0400 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7B43F1C7107; Wed, 19 Oct 2022 10:34:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1666200857; x=1697736857; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=U7LArZuNthshDvVK5CBxK7+jHExXUGsLdkjMMWrwBEw=; b=cF7UvkPoaPZs1sLj5+Z8tOqRHRkel9ouohTALHiU9QFb7AfUk3Trfd2K LPx276iMsuVEzA3HiOWz8ox2iSd8Gx4/tnh2u+JQKpL8q3Bit1ntKxibz b2rNz9seQ8ji1VVO9B1anafszowRZeciXIXUxA/czHj7xT2yM9wP4UFbj 6n2gAosJ+GAFzVf8t/hy/5LZV1YbzHBh8M+ZDU9fdR3jP+UP69Pq/hIeH ulKAQDHdou9ToBWFrXrlVgaVReQR+1CrRK627MiIZWcJDaDUb+Dmov7Qn rKxjhD9eeq2t2N1XN0WetSrYEINJSczM9wlyoQdChqAab8dSkpOiBRcom g==; X-IronPort-AV: E=McAfee;i="6500,9779,10505"; a="306474591" X-IronPort-AV: E=Sophos;i="5.95,196,1661842800"; d="scan'208";a="306474591" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Oct 2022 10:34:10 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10505"; a="607204910" X-IronPort-AV: E=Sophos;i="5.95,196,1661842800"; d="scan'208";a="607204910" Received: from mjmcener-mobl1.amr.corp.intel.com (HELO localhost.localdomain) ([10.213.233.40]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Oct 2022 10:34:07 -0700 From: Tvrtko Ursulin To: Intel-gfx@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: [RFC 15/17] drm/i915: Migrate client to new owner on context create Date: Wed, 19 Oct 2022 18:32:52 +0100 Message-Id: <20221019173254.3361334-16-tvrtko.ursulin@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221019173254.3361334-1-tvrtko.ursulin@linux.intel.com> References: <20221019173254.3361334-1-tvrtko.ursulin@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-5.5 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_HI,SPF_HELO_NONE,SPF_NONE 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 Some usage models pass a drm file descriptor from a creating process to the client which will actually use it. Use the core drm helper on GEM context create to account for this and ensure client's resource usage is tracked in the correct cgroup. Signed-off-by: Tvrtko Ursulin --- drivers/gpu/drm/i915/gem/i915_gem_context.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/gpu/drm/i915/gem/i915_gem_context.c b/drivers/gpu/drm/i915/gem/i915_gem_context.c index 1e29b1e6d186..5f6af306e147 100644 --- a/drivers/gpu/drm/i915/gem/i915_gem_context.c +++ b/drivers/gpu/drm/i915/gem/i915_gem_context.c @@ -69,6 +69,7 @@ #include #include +#include #include #include "gt/gen6_ppgtt.h" @@ -2300,6 +2301,8 @@ int i915_gem_context_create_ioctl(struct drm_device *dev, void *data, args->ctx_id = id; drm_dbg(&i915->drm, "HW context %d created\n", args->ctx_id); + drm_clients_migrate(file); + return 0; err_pc: -- 2.34.1