All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4 0/8] cgroup private data and DRM/i915 integration
@ 2018-03-17  0:08 Matt Roper
  2018-03-17  0:08 ` [PATCH v4 1/8] cgroup: Allow registration and lookup of cgroup private data (v2) Matt Roper
                   ` (12 more replies)
  0 siblings, 13 replies; 27+ messages in thread
From: Matt Roper @ 2018-03-17  0:08 UTC (permalink / raw)
  To: dri-devel, intel-gfx, cgroups
  Cc: Tejun Heo, Roman Gushchin, Alexei Starovoitov

This is the fourth iteration of the work previously posted here:
  (v1) https://lists.freedesktop.org/archives/intel-gfx/2018-January/153156.html
  (v2) https://www.mail-archive.com/dri-devel@lists.freedesktop.org/msg208170.html
  (v3) https://lists.freedesktop.org/archives/intel-gfx/2018-March/157928.html

The high level goal of this work is to allow non-cgroup-controller parts
of the kernel (e.g., device drivers) to register their own private
policy data for specific cgroups.  That mechanism is then made use of in
the i915 graphics driver to allow GPU priority to be assigned according
to the cgroup membership of the owning process.  Please see the v1 cover
letter linked above for a more in-depth explanation and justification.

v4 of this series brings large changes to the cgroup core half of the
series and moderate changes to the i915 side.

cgroup core changes:

 * The cgroup private data interface and implementation has changed
   again.  The internal implementation is ida+radixtree based to allow
   much faster lookups than the previous hashtable approach.  Private
   data is now registered and looked up via kref, which should allow
   the same private data to be set on multiple cgroups at the same
   time.  The interface now looks like:

	- cgroup_priv_getkey()
	     Obtain an integer key that will be used to store/lookup
	     cgroup private data.  This only needs to be called once
	     at startup, driver init, etc.; after that the same key
	     is used to store private data against any cgroup

	- cgroup_priv_destroykey(key)
	     Release a private data key and drop references to any
	     private data associated with the key on all cgroups.  This
	     function is very heavy, but will generally only be called
	     by module-based users of the interface when the module is
	     unloaded.

	- cgroup_priv_install(cgrp, key, ref)
	     Store private data for a cgroup under the given key and
	     increment the reference count.

	- cgroup_priv_get(cgrp, key)
	     Take and return a reference to a cgroup's private data
	     associated with the given key.

	- cgroup_priv_get_current(key)
	     Same as cgroup_priv_get, but operates on the current
	     task's cgroup.

	- cgroup_priv_release(cgrp, key)
	     Remove private data from a cgroup and decrement its
	     reference count.

 * Dropped the cgroup_permission() function.  My i915 usage of this
   functionality will take a different approach for determining access
   control.
	
i915 cgroup-based priority changes:

 * cgroup priority offset is now bounded such that (context+cgroup)
   adjustments fall within the range [-0x7fffff,0x7fffff].  This
   only takes 24 bits, leaving several effective priority bits for
   future flags or bookkeeping.

 * Display boost is added as a second cgroup parameter; each cgroup's
   processes can get differing boosts if a display operation is waiting
   on their completion.  If we have non-overlapping cgroup priority
   ranges, this allows a system administrator to decide whether
   workloads from the lower priority cgroup(s) should still jump past
   the workloads in some/all of the higher priority cgroups.

 * Access control for cgroup settings has been changed.  Instead of
   following cgroup filesystem permissions, we now restrict the access
   to either the DRM master or capable(CAP_SYS_RESOURCE).

Cc: Tejun Heo <tj@kernel.org>
Cc: Alexei Starovoitov <ast@fb.com>
Cc: Roman Gushchin <guro@fb.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>

Matt Roper (8):
  cgroup: Allow registration and lookup of cgroup private data (v2)
  cgroup: Introduce task_get_dfl_cgroup() (v2)
  cgroup: Introduce cgroup_priv_get_current
  drm/i915: Adjust internal priority definitions
  drm/i915: cgroup integration (v3)
  drm/i915: Introduce 'priority offset' for GPU contexts (v3)
  drm/i915: Introduce per-cgroup display boost setting
  drm/i915: Add context priority & priority offset to debugfs (v2)

 drivers/gpu/drm/i915/Makefile           |   1 +
 drivers/gpu/drm/i915/i915_cgroup.c      | 205 +++++++++++++++++++++++++++++++
 drivers/gpu/drm/i915/i915_debugfs.c     |   3 +
 drivers/gpu/drm/i915/i915_drv.c         |   7 ++
 drivers/gpu/drm/i915/i915_drv.h         |  33 ++++-
 drivers/gpu/drm/i915/i915_gem_context.c |  11 +-
 drivers/gpu/drm/i915/i915_gem_context.h |   9 ++
 drivers/gpu/drm/i915/i915_request.h     |  18 ++-
 drivers/gpu/drm/i915/intel_display.c    |   5 +-
 include/linux/cgroup-defs.h             |   8 ++
 include/linux/cgroup.h                  |  37 ++++++
 include/uapi/drm/i915_drm.h             |  14 +++
 kernel/cgroup/cgroup.c                  | 208 +++++++++++++++++++++++++++++++-
 13 files changed, 545 insertions(+), 14 deletions(-)
 create mode 100644 drivers/gpu/drm/i915/i915_cgroup.c

-- 
2.14.3

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 27+ messages in thread

end of thread, other threads:[~2018-04-05 17:32 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-17  0:08 [PATCH v4 0/8] cgroup private data and DRM/i915 integration Matt Roper
2018-03-17  0:08 ` [PATCH v4 1/8] cgroup: Allow registration and lookup of cgroup private data (v2) Matt Roper
2018-03-19  5:41   ` [Intel-gfx] " kbuild test robot
2018-03-19  5:41   ` [RFC PATCH] cgroup: cgroup_idr_lock can be static kbuild test robot
2018-03-17  0:08 ` [PATCH v4 2/8] cgroup: Introduce task_get_dfl_cgroup() (v2) Matt Roper
2018-03-17  0:09 ` [PATCH v4 3/8] cgroup: Introduce cgroup_priv_get_current Matt Roper
2018-03-17  0:09 ` [PATCH v4 4/8] drm/i915: Adjust internal priority definitions Matt Roper
2018-03-17  0:09 ` [PATCH v4 5/8] drm/i915: cgroup integration (v3) Matt Roper
2018-03-17  0:09 ` [PATCH v4 6/8] drm/i915: Introduce 'priority offset' for GPU contexts (v3) Matt Roper
2018-03-17  0:09 ` [PATCH v4 7/8] drm/i915: Introduce per-cgroup display boost setting Matt Roper
2018-03-17  0:09 ` [PATCH v4 8/8] drm/i915: Add context priority & priority offset to debugfs (v2) Matt Roper
2018-03-17  0:16 ` [PATCH i-g-t] tests: Introduce drv_cgroup (v2) Matt Roper
2018-03-17  0:28 ` ✗ Fi.CI.CHECKPATCH: warning for cgroup private data and DRM/i915 integration Patchwork
2018-03-19  7:43   ` Jani Nikula
2018-03-17  0:45 ` ✓ Fi.CI.BAT: success " Patchwork
2018-03-17  1:04 ` ✓ Fi.CI.BAT: success for tests: Introduce drv_cgroup (v2) Patchwork
2018-03-23 12:15 ` [PATCH v4 0/8] cgroup private data and DRM/i915 integration Joonas Lahtinen
2018-03-23 15:46   ` Matt Roper
2018-03-26  7:30     ` Joonas Lahtinen
2018-03-30  0:43       ` Matt Roper
2018-04-05 13:46         ` DRM cgroups integration (Was: Re: [PATCH v4 0/8] cgroup private data and DRM/i915 integration) Joonas Lahtinen
2018-04-05 14:15           ` Joonas Lahtinen
2018-04-05 14:49             ` Matt Roper
2018-04-05 15:06               ` Matt Roper
2018-04-05 15:48                 ` Matt Roper
2018-04-05 17:32                   ` Felix Kuehling
2018-04-05 17:32                     ` Felix Kuehling

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.