All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matt Roper <matthew.d.roper@intel.com>
To: dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org,
	cgroups@vger.kernel.org
Subject: [PATCH v3 0/6] DRM/i915 cgroup integration
Date: Tue,  6 Mar 2018 15:46:54 -0800	[thread overview]
Message-ID: <20180306234700.6562-1-matthew.d.roper@intel.com> (raw)

This is the third 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

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.

Key changes in v3 of this series:

 * The cgroup core interfaces have been redesigned as suggested by
   Tejun.  The cgroup core now supports the following:

        void cgroup_priv_install(struct cgroup *cgrp,
                                 struct cgroup_priv *priv);
        struct cgroup_priv *cgroup_priv_lookup(struct cgroup *cgrp,
                                               const void *key);
        void cgroup_priv_free(struct cgroup *cgrp, const void *key);

 * Consumers of this interface may want to test the filesystem
   permissions of a cgroup to decide whether to allow custom syscalls or
   ioctls to operate on a cgroup's private data.  A new
   cgroup_permission(cgrp_fd, mask) function has been added to make this
   easier.

 * The i915 code looks up cgroup private data for 'current' rather than
   drm_file->pid to account for the device handle passing done by DRI3
   (i.e., the process that opened the device filehandle isn't
   necessarily the same process issuing ioctl's on it).

 * Other minor updates/changes based on feedback from Chris Wilson and
   Tejun Heo.


One open question on the i915 side of this work is whether we need to
limit the "priority offset" that can be assigned via cgroup (and if so,
what it should be limited to).  At the moment we make the assumption
that cgroup-based priority will be assigned by a privileged system
administrator / system integrator, so we accept any integer value they
choose to assign to the priority, even if it doesn't make sense.

As noted on previous iterations, the i915 userspace consumer for the
ioctl here is a simple i-g-t tool that will be sent shortly as a
followup on the intel-gfx list.  The tool itself is pretty trivial, but
that's intetional; the "real" userspace consumer of this work would
usually be something like a sysv-init script or systemd recipe that
would call that simple tool in an appropriate way to accomplish the
desired policy for a specific system.


Matt Roper (6):
  cgroup: Allow registration and lookup of cgroup private data
  cgroup: Introduce task_get_dfl_cgroup()
  cgroup: Introduce cgroup_permission()
  drm/i915: cgroup integration
  drm/i915: Introduce 'priority offset' for GPU contexts
  drm/i915: Add context priority & priority offset to debugfs (v2)

 drivers/gpu/drm/i915/Makefile           |   1 +
 drivers/gpu/drm/i915/i915_cgroup.c      | 214 ++++++++++++++++++++++++++++++++
 drivers/gpu/drm/i915/i915_debugfs.c     |   3 +
 drivers/gpu/drm/i915/i915_drv.c         |   5 +
 drivers/gpu/drm/i915/i915_drv.h         |  25 ++++
 drivers/gpu/drm/i915/i915_gem_context.c |   7 +-
 drivers/gpu/drm/i915/i915_gem_context.h |   9 ++
 include/linux/cgroup-defs.h             |  38 ++++++
 include/linux/cgroup.h                  | 102 +++++++++++++++
 include/uapi/drm/i915_drm.h             |  13 ++
 kernel/cgroup/cgroup.c                  |  56 +++++++++
 11 files changed, 470 insertions(+), 3 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

             reply	other threads:[~2018-03-06 23:46 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-06 23:46 Matt Roper [this message]
2018-03-06 23:46 ` [PATCH v3 1/6] cgroup: Allow registration and lookup of cgroup private data Matt Roper
2018-03-13 20:50   ` Tejun Heo
2018-03-13 21:27     ` Alexei Starovoitov
2018-03-13 21:37       ` Roman Gushchin
2018-03-13 21:47         ` Alexei Starovoitov
2018-03-13 22:09           ` Roman Gushchin
2018-03-13 22:13           ` Tejun Heo
2018-03-13 22:42             ` Alexei Starovoitov
2018-03-13 22:52               ` Roman Gushchin
2018-03-06 23:46 ` [PATCH v3 2/6] cgroup: Introduce task_get_dfl_cgroup() Matt Roper
2018-03-13 20:41   ` Tejun Heo
2018-03-06 23:46 ` [PATCH v3 3/6] cgroup: Introduce cgroup_permission() Matt Roper
2018-03-13 20:43   ` Tejun Heo
2018-03-06 23:46 ` [PATCH v3 4/6] drm/i915: cgroup integration (v2) Matt Roper
2018-03-06 23:46 ` [PATCH v3 5/6] drm/i915: Introduce 'priority offset' for GPU contexts (v2) Matt Roper
2018-03-08 11:32   ` Chris Wilson
2018-03-08 13:11     ` Chris Wilson
2018-03-08 18:22       ` Matt Roper
2018-03-08 18:48         ` Chris Wilson
2018-03-08 18:55           ` Chris Wilson
2018-03-08 19:31             ` Matt Roper
2018-03-06 23:47 ` [PATCH v3 6/6] drm/i915: Add context priority & priority offset to debugfs (v2) Matt Roper
2018-03-06 23:49 ` [PATCH i-g-t 1/2] tools: Introduce intel_cgroup tool Matt Roper
2018-03-06 23:49   ` [PATCH i-g-t 2/2] tests: Introduce drv_cgroup Matt Roper
2018-03-06 23:59 ` ✗ Fi.CI.SPARSE: warning for DRM/i915 cgroup integration Patchwork
2018-03-07  0:14 ` ✓ Fi.CI.BAT: success " Patchwork
2018-03-07  5:16 ` ✗ Fi.CI.IGT: failure " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180306234700.6562-1-matthew.d.roper@intel.com \
    --to=matthew.d.roper@intel.com \
    --cc=cgroups@vger.kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.