@@ -66,20 +66,30 @@ question.
Unique value relating to the open DRM file descriptor used to distinguish
duplicated and shared file descriptors. Conceptually the value should map 1:1
to the in kernel representation of `struct drm_file` instances.
Uniqueness of the value shall be either globally unique, or unique within the
scope of each device, in which case `drm-pdev` shall be present as well.
Userspace should make sure to not double account any usage statistics by using
the above described criteria in order to associate data to individual clients.
+- drm-comm-override: <valstr>
+- drm-cmdline-override: <valstr>
+
+Returns the client comm (executable) or cmdline override strings. Some drivers
+support letting userspace override this in cases where the userspace is simply a
+"proxy". Such as is the case with virglrenderer drm native context, where the
+host process is just forwarding command submission, etc, from guest userspace.
+This allows the proxy to make visible the cmdline of the actual app in the VM
+guest.
+
Utilization
^^^^^^^^^^^
- drm-engine-<keystr>: <uint> ns
GPUs usually contain multiple execution engines. Each shall be given a stable
and unique name (keystr), with possible values documented in the driver specific
documentation.
Value shall be in specified time units which the respective GPU engine spent
@@ -171,20 +171,22 @@ struct drm_file *drm_file_alloc(struct drm_minor *minor)
mutex_init(&file->fbs_lock);
INIT_LIST_HEAD(&file->blobs);
INIT_LIST_HEAD(&file->pending_event_list);
INIT_LIST_HEAD(&file->event_list);
init_waitqueue_head(&file->event_wait);
file->event_space = 4096; /* set aside 4k for event buffer */
spin_lock_init(&file->master_lookup_lock);
mutex_init(&file->event_read_lock);
+ mutex_init(&file->override_lock);
+
if (drm_core_check_feature(dev, DRIVER_GEM))
drm_gem_open(dev, file);
if (drm_core_check_feature(dev, DRIVER_SYNCOBJ))
drm_syncobj_open(file);
drm_prime_init_file_private(&file->prime);
if (dev->driver->open) {
ret = dev->driver->open(dev, file);
@@ -285,20 +287,22 @@ void drm_file_free(struct drm_file *file)
drm_master_release(file);
if (dev->driver->postclose)
dev->driver->postclose(dev, file);
drm_prime_destroy_file_private(&file->prime);
WARN_ON(!list_empty(&file->event_list));
put_pid(file->pid);
+ kfree(file->override_comm);
+ kfree(file->override_cmdline);
kfree(file);
}
static void drm_close_helper(struct file *filp)
{
struct drm_file *file_priv = filp->private_data;
struct drm_device *dev = file_priv->minor->dev;
mutex_lock(&dev->filelist_mutex);
list_del(&file_priv->lhead);
@@ -988,20 +992,31 @@ void drm_show_fdinfo(struct seq_file *m, struct file *f)
drm_printf(&p, "drm-client-id:\t%llu\n", file->client_id);
if (dev_is_pci(dev->dev)) {
struct pci_dev *pdev = to_pci_dev(dev->dev);
drm_printf(&p, "drm-pdev:\t%04x:%02x:%02x.%d\n",
pci_domain_nr(pdev->bus), pdev->bus->number,
PCI_SLOT(pdev->devfn), PCI_FUNC(pdev->devfn));
}
+ mutex_lock(&file->override_lock);
+ if (file->override_comm) {
+ drm_printf(&p, "drm-comm-override:\t%s\n",
+ file->override_comm);
+ }
+ if (file->override_cmdline) {
+ drm_printf(&p, "drm-cmdline-override:\t%s\n",
+ file->override_cmdline);
+ }
+ mutex_unlock(&file->override_lock);
+
if (dev->driver->show_fdinfo)
dev->driver->show_fdinfo(&p, file);
}
EXPORT_SYMBOL(drm_show_fdinfo);
/**
* mock_drm_getfile - Create a new struct file for the drm device
* @minor: drm minor to wrap (e.g. #drm_device.primary)
* @flags: file creation mode (O_RDWR etc)
*
@@ -363,20 +363,39 @@ struct drm_file {
/** @event_read_lock: Serializes drm_read(). */
struct mutex event_read_lock;
/**
* @prime:
*
* Per-file buffer caches used by the PRIME buffer sharing code.
*/
struct drm_prime_file_private prime;
+ /**
+ * @comm: Overridden task comm
+ *
+ * Accessed under override_lock
+ */
+ char *override_comm;
+
+ /**
+ * @cmdline: Overridden task cmdline
+ *
+ * Accessed under override_lock
+ */
+ char *override_cmdline;
+
+ /**
+ * @override_lock: Serialize access to override_comm and override_cmdline
+ */
+ struct mutex override_lock;
+
/* private: */
#if IS_ENABLED(CONFIG_DRM_LEGACY)
unsigned long lock_count; /* DRI1 legacy lock count */
#endif
};
/**
* drm_is_primary_client - is this an open file of the primary node
* @file_priv: DRM file
*