Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1499301
| Path | csiph.com!news.mixmin.net!news.unit0.net!news.panservice.it!diesel.cu.mi.it!bofh.it!news.nic.it!robomod |
|---|---|
| From | Ruchi Kandoi <kandoiruchi@google.com> |
| Newsgroups | linux.kernel |
| Subject | [RFC 6/6] drivers: staging: ion: add ION_IOC_TAG ioctl |
| Date | Wed, 12 Oct 2016 02:00:01 +0200 |
| Message-ID | <srf7H-4Py-15@gated-at.bofh.it> (permalink) |
| References | <srf7H-4Py-7@gated-at.bofh.it> |
| X-Original-To | kandoiruchi@google.com, gregkh@linuxfoundation.org, arve@android.com, riandrews@android.com, sumit.semwal@linaro.org, arnd@arndb.de, labbott@redhat.com, viro@zeniv.linux.org.uk, jlayton@poochiereds.net, bfields@fieldses.org, mingo@redhat.com, peterz@infradead.org, akpm@linux-foundation.org, keescook@chromium.org, mhocko@suse.com, oleg@redhat.com, john.stultz@linaro.org, mguzik@redhat.com, jdanis@google.com, adobriyan@gmail.com, ghackmann@google.com, kirill.shutemov@linux.intel.com, vbabka@suse.cz, dave.hansen@linux.intel.com, dan.j.williams@intel.com, hannes@cmpxchg.org, iamjoonsoo.kim@lge.com, luto@kernel.org, tj@kernel.org, vdavydov.dev@gmail.com, ebiederm@xmission.com, linux-kernel@vger.kernel.org, devel@driverdev.osuosl.org, linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org |
| Dkim-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:subject:date:message-id:in-reply-to:references; bh=+rkvOaz1PnfYCxKvqeohoq0s4Wi3ry0L6k67WbobMMI=; b=XhcQarud56Ea5qlHKB9FFPkjIJizm0oCsd+l5keCJsD59Y87luFDTjSvHDtRNSpCLi uaKOkG1i8LU2sOaJXJLV8RJAtoCIUDjkJHZkqVvcoz2o5U2nOytqB29jNr2cB/bb0xuC u8wMLOkIDrTx4RV266SNsM4kPpoGlWVnnB2Sm5jpNBMKEVRi/ol9LgX2Y8pE5eicy7O9 u5bP0ho6nYaxXEVkzeJzGSLG2yF3AWfTf7O7KCrqm14PL1zb61PR7guI+hZUHvKmohiW IuOkVvTvF7kNHCaTCbb71M7LEzp8pqz3fiJN4jpYVrzI/m1QyxkfoqgnIqLfVDrsR0Ov TjpQ== |
| X-Google-Dkim-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=+rkvOaz1PnfYCxKvqeohoq0s4Wi3ry0L6k67WbobMMI=; b=AZ+X07+4x6MJMwlQC9TJFz9zN1D2CA4jEfOFCFGME1ms3Mzh+qqMrCkeuoROWdZp6L lK7sJjrGVcGiC00thBss6Lk1xdpty5DrdUCGpPb/diA/87RfxUrkCy8Et9uL8hibWHhk gk+jdKKObZjwQf2osU1Ay8MnnUUDRxQcDq3/Fl8mHrE97OVnOHAox55XUOAd1g3ktSVK wmK6CiEf50L5J4RcHvcRQhLblwUt3i9yfNcAK2Q/WugI2rKo5u3Aps9aQzj2nI6tKoeQ VU8r4RHnJ4yO06yw3EA0OQ0S2MB2rHNwr3jhaYuTk3jfk1poG+seLLbLxt1QJRv6/Oqj aqhw== |
| X-Gm-Message-State | AA6/9RmxHAeJMlasW8252QVircKH4QtNGAMtkGkU4SAyDSy2DoZz/rFaAFZfLrIJ3/Acijoh |
| X-Received | by 10.98.36.219 with SMTP id k88mr812877pfk.88.1476229848401; Tue, 11 Oct 2016 16:50:48 -0700 (PDT) |
| X-Mailer | git-send-email 2.8.0.rc3.226.g39d4020 |
| Sender | robomod@news.nic.it |
| List-ID | <linux-kernel.vger.kernel.org> |
| X-Mailing-List | linux-kernel@vger.kernel.org |
| Approved | robomod@news.nic.it |
| Lines | 91 |
| Organization | linux.* mail to news gateway |
| X-Original-Date | Tue, 11 Oct 2016 16:50:10 -0700 |
| X-Original-Message-ID | <1476229810-26570-7-git-send-email-kandoiruchi@google.com> |
| X-Original-References | <1476229810-26570-1-git-send-email-kandoiruchi@google.com> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| Xref | csiph.com linux.kernel:1499301 |
Show key headers only | View raw
From: Greg Hackmann <ghackmann@google.com>
ION_IOC_TAG provides a userspace interface for tagging buffers with
their memtrack usage after allocation.
Signed-off-by: Ruchi Kandoi <kandoiruchi@google.com>
---
drivers/staging/android/ion/ion-ioctl.c | 17 +++++++++++++++++
drivers/staging/android/uapi/ion.h | 25 +++++++++++++++++++++++++
2 files changed, 42 insertions(+)
diff --git a/drivers/staging/android/ion/ion-ioctl.c b/drivers/staging/android/ion/ion-ioctl.c
index 7e7431d..8745a85 100644
--- a/drivers/staging/android/ion/ion-ioctl.c
+++ b/drivers/staging/android/ion/ion-ioctl.c
@@ -28,6 +28,7 @@ union ion_ioctl_arg {
struct ion_handle_data handle;
struct ion_custom_data custom;
struct ion_heap_query query;
+ struct ion_tag_data tag;
};
static int validate_ioctl_arg(unsigned int cmd, union ion_ioctl_arg *arg)
@@ -162,6 +163,22 @@ long ion_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
case ION_IOC_HEAP_QUERY:
ret = ion_query_heaps(client, &data.query);
break;
+ case ION_IOC_TAG:
+ {
+#ifdef CONFIG_MEMTRACK
+ struct ion_handle *handle;
+
+ handle = ion_handle_get_by_id(client, data.tag.handle);
+ if (IS_ERR(handle))
+ return PTR_ERR(handle);
+ data.tag.tag[sizeof(data.tag.tag) - 1] = 0;
+ memtrack_buffer_set_tag(&handle->buffer->memtrack_buffer,
+ data.tag.tag);
+#else
+ ret = -ENOTTY;
+#endif
+ break;
+ }
default:
return -ENOTTY;
}
diff --git a/drivers/staging/android/uapi/ion.h b/drivers/staging/android/uapi/ion.h
index 14cd873..4c26196 100644
--- a/drivers/staging/android/uapi/ion.h
+++ b/drivers/staging/android/uapi/ion.h
@@ -115,6 +115,22 @@ struct ion_handle_data {
ion_user_handle_t handle;
};
+#define ION_MAX_TAG_LEN 32
+
+/**
+ * struct ion_fd_data - metadata passed from userspace for a handle
+ * @handle: a handle
+ * @tag: a string describing the buffer
+ *
+ * For ION_IOC_TAG userspace populates the handle field with
+ * the handle returned from ion alloc and type contains the memtrack_type which
+ * accurately describes the usage for the memory.
+ */
+struct ion_tag_data {
+ ion_user_handle_t handle;
+ char tag[ION_MAX_TAG_LEN];
+};
+
/**
* struct ion_custom_data - metadata passed to/from userspace for a custom ioctl
* @cmd: the custom ioctl function to call
@@ -217,6 +233,15 @@ struct ion_heap_query {
#define ION_IOC_SYNC _IOWR(ION_IOC_MAGIC, 7, struct ion_fd_data)
/**
+ * DOC: ION_IOC_TAG - adds a memtrack descriptor tag to memory
+ *
+ * Takes an ion_tag_data struct with the type field populated with a
+ * memtrack_type and handle populated with a valid opaque handle. The
+ * memtrack_type should accurately define the usage for the memory.
+ */
+#define ION_IOC_TAG _IOWR(ION_IOC_MAGIC, 8, struct ion_tag_data)
+
+/**
* DOC: ION_IOC_CUSTOM - call architecture specific ion ioctl
*
* Takes the argument of the architecture specific ioctl to call and
--
2.8.0.rc3.226.g39d4020
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[RFC 0/6] Module for tracking/accounting shared memory buffers Ruchi Kandoi <kandoiruchi@google.com> - 2016-10-12 02:00 +0200
[RFC 1/6] fs: add installed and uninstalled file_operations Ruchi Kandoi <kandoiruchi@google.com> - 2016-10-12 02:00 +0200
[RFC 4/6] memtrack: Adds the accounting to keep track of all mmaped/unmapped pages. Ruchi Kandoi <kandoiruchi@google.com> - 2016-10-12 02:00 +0200
[RFC 5/6] memtrack: Add memtrack accounting for forked processes. Ruchi Kandoi <kandoiruchi@google.com> - 2016-10-12 02:00 +0200
[RFC 6/6] drivers: staging: ion: add ION_IOC_TAG ioctl Ruchi Kandoi <kandoiruchi@google.com> - 2016-10-12 02:00 +0200
Re: [RFC 6/6] drivers: staging: ion: add ION_IOC_TAG ioctl "Hillf Danton" <hillf.zj@alibaba-inc.com> - 2016-10-12 05:40 +0200
[RFC 2/6] drivers: misc: add memtrack Ruchi Kandoi <kandoiruchi@google.com> - 2016-10-12 02:00 +0200
Re: [RFC 0/6] Module for tracking/accounting shared memory buffers Al Viro <viro@ZenIV.linux.org.uk> - 2016-10-12 02:50 +0200
Re: [RFC 0/6] Module for tracking/accounting shared memory buffers Rob Clark <robdclark@gmail.com> - 2016-10-12 03:20 +0200
Re: [RFC 0/6] Module for tracking/accounting shared memory buffers Dave Hansen <dave.hansen@linux.intel.com> - 2016-10-12 19:30 +0200
csiph-web