Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/808322/?format=api
{ "id": 808322, "url": "http://patchwork.ozlabs.org/api/patches/808322/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-imx/patch/1504198860-12951-2-git-send-email-Dave.Martin@arm.com/", "project": { "id": 19, "url": "http://patchwork.ozlabs.org/api/projects/19/?format=api", "name": "Linux IMX development", "link_name": "linux-imx", "list_id": "linux-imx-kernel.lists.patchwork.ozlabs.org", "list_email": "linux-imx-kernel@lists.patchwork.ozlabs.org", "web_url": null, "scm_url": null, "webscm_url": null, "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<1504198860-12951-2-git-send-email-Dave.Martin@arm.com>", "list_archive_url": null, "date": "2017-08-31T17:00:33", "name": "[v2,01/28] regset: Add support for dynamically sized regsets", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "13d0dccad569e55d78f6542d1cf1d99889508842", "submitter": { "id": 26612, "url": "http://patchwork.ozlabs.org/api/people/26612/?format=api", "name": "Dave Martin", "email": "Dave.Martin@arm.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/linux-imx/patch/1504198860-12951-2-git-send-email-Dave.Martin@arm.com/mbox/", "series": [ { "id": 883, "url": "http://patchwork.ozlabs.org/api/series/883/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-imx/list/?series=883", "date": "2017-08-31T17:00:33", "name": "ARM Scalable Vector Extension (SVE)", "version": 2, "mbox": "http://patchwork.ozlabs.org/series/883/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/808322/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/808322/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org>", "X-Original-To": "incoming-imx@patchwork.ozlabs.org", "Delivered-To": "patchwork-incoming-imx@bilbo.ozlabs.org", "Authentication-Results": [ "ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=lists.infradead.org\n\t(client-ip=65.50.211.133; helo=bombadil.infradead.org;\n\tenvelope-from=linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org;\n\treceiver=<UNKNOWN>)", "ozlabs.org; dkim=pass (2048-bit key;\n\tunprotected) header.d=lists.infradead.org\n\theader.i=@lists.infradead.org\n\theader.b=\"HZ4Wducv\"; dkim-atps=neutral" ], "Received": [ "from bombadil.infradead.org (bombadil.infradead.org\n\t[65.50.211.133])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xjpZB00Whz9sRY\n\tfor <incoming-imx@patchwork.ozlabs.org>;\n\tFri, 1 Sep 2017 03:01:53 +1000 (AEST)", "from localhost ([127.0.0.1] helo=bombadil.infradead.org)\n\tby bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux))\n\tid 1dnSqj-0007Pl-UL; Thu, 31 Aug 2017 17:01:49 +0000", "from foss.arm.com ([217.140.101.70])\n\tby bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux))\n\tid 1dnSqU-0007En-Tj for linux-arm-kernel@lists.infradead.org;\n\tThu, 31 Aug 2017 17:01:37 +0000", "from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249])\n\tby usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 38A0C13D5;\n\tThu, 31 Aug 2017 10:01:16 -0700 (PDT)", "from e103592.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com\n\t[10.72.51.249])\n\tby usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id\n\t44A793F58F; Thu, 31 Aug 2017 10:01:14 -0700 (PDT)" ], "DKIM-Signature": "v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;\n\td=lists.infradead.org; s=bombadil.20170209; h=Sender:\n\tContent-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post:\n\tList-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:\n\tMessage-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description:\n\tResent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:\n\tList-Owner; bh=n+bTka0efg4qjnKxUNkAV8Xyf/3nMOBt3XjR819XZg8=;\n\tb=HZ4Wducv1AjfdZ\n\tUprLsu1XWDgxDjwwTkle381gXvrdoD3W+Qfdo0Yup6L+WuL2OTugI1G/DeiZc/chBFo0sBXJFt99i\n\t1l4XjsbJktUbZnMoxETCZLhuJc4ebGkAxknl5s45mjVs+9dKCSI4tOiQ/ND+4VcVyhca9Zdal8uDo\n\tnUwy49rOEpMAdLgQN73kpS2lCcf7cgr7y702mf2yiO/D3JFXGNBN2Dblf9IbzmgNey5wpV0VEd8qv\n\tMSjAeuUerWOv3e7ft7A04s53piJzTqnJkUJIUtIhRM2vHhGJ8QaOva5/VnC/fm73popXSM9BRmJEk\n\tRLVhPR00NqmP9xSAVuUw==;", "From": "Dave Martin <Dave.Martin@arm.com>", "To": "linux-arm-kernel@lists.infradead.org", "Subject": "[PATCH v2 01/28] regset: Add support for dynamically sized regsets", "Date": "Thu, 31 Aug 2017 18:00:33 +0100", "Message-Id": "<1504198860-12951-2-git-send-email-Dave.Martin@arm.com>", "X-Mailer": "git-send-email 2.1.4", "In-Reply-To": "<1504198860-12951-1-git-send-email-Dave.Martin@arm.com>", "References": "<1504198860-12951-1-git-send-email-Dave.Martin@arm.com>", "MIME-Version": "1.0", "X-CRM114-Version": "20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 ", "X-CRM114-CacheID": "sfid-20170831_100135_038204_7970DFF2 ", "X-CRM114-Status": "GOOD ( 17.12 )", "X-Spam-Score": "-6.9 (------)", "X-Spam-Report": "SpamAssassin version 3.4.1 on bombadil.infradead.org summary:\n\tContent analysis details: (-6.9 points)\n\tpts rule name description\n\t---- ----------------------\n\t--------------------------------------------------\n\t-5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/,\n\thigh trust [217.140.101.70 listed in list.dnswl.org]\n\t-0.0 SPF_PASS SPF: sender matches SPF record\n\t-0.0 RP_MATCHES_RCVD Envelope sender domain matches handover relay\n\tdomain\n\t-1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1%\n\t[score: 0.0000]", "X-BeenThere": "linux-arm-kernel@lists.infradead.org", "X-Mailman-Version": "2.1.21", "Precedence": "list", "List-Unsubscribe": "<http://lists.infradead.org/mailman/options/linux-arm-kernel>,\n\t<mailto:linux-arm-kernel-request@lists.infradead.org?subject=unsubscribe>", "List-Archive": "<http://lists.infradead.org/pipermail/linux-arm-kernel/>", "List-Post": "<mailto:linux-arm-kernel@lists.infradead.org>", "List-Help": "<mailto:linux-arm-kernel-request@lists.infradead.org?subject=help>", "List-Subscribe": "<http://lists.infradead.org/mailman/listinfo/linux-arm-kernel>,\n\t<mailto:linux-arm-kernel-request@lists.infradead.org?subject=subscribe>", "Cc": "linux-arch@vger.kernel.org, libc-alpha@sourceware.org, Ard Biesheuvel\n\t<ard.biesheuvel@linaro.org>, Szabolcs Nagy <szabolcs.nagy@arm.com>,\n\tCatalin Marinas\n\t<catalin.marinas@arm.com>, Will Deacon <will.deacon@arm.com>, Oleg\n\tNesterov <oleg@redhat.com>, Alexander Viro <viro@zeniv.linux.org.uk>, \n\tRichard Sandiford <richard.sandiford@arm.com>, \n\t=?utf-8?q?Alex_Benn=C3=A9e?= <alex.bennee@linaro.org>,\n\tkvmarm@lists.cs.columbia.edu", "Content-Type": "text/plain; charset=\"utf-8\"", "Content-Transfer-Encoding": "base64", "Sender": "\"linux-arm-kernel\" <linux-arm-kernel-bounces@lists.infradead.org>", "Errors-To": "linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org", "List-Id": "linux-imx-kernel.lists.patchwork.ozlabs.org" }, "content": "Currently the regset API doesn't allow for the possibility that\nregsets (or at least, the amount of meaningful data in a regset)\nmay change in size.\n\nIn particular, this results in useless padding being added to\ncoredumps in a regset's current size is smaller than its\ntheoretical maximum size.\n\nThis patch adds a get_size() function to struct user_regset.\nIndividual regset implementations can implement this function to\nreturn the current size of the regset data. A regset_size()\nfunction is added to provide callers with an abstract interface for\ndetermining the size of a regset without needing to know whether\nthe regset is dynamically sized or not.\n\nThe only affected user of this interface is the ELF coredump code:\nThis patch ports ELF coredump to dump regsets with their actual\nsize in the coredump. This has no effect except for new regsets\nthat are dynamically sized and provide a get_size() implementation.\n\nSigned-off-by: Dave Martin <Dave.Martin@arm.com>\nReviewed-by: Alex Bennée <alex.bennee@linaro.org>\n---\n fs/binfmt_elf.c | 6 ++---\n include/linux/regset.h | 67 ++++++++++++++++++++++++++++++++++++++++++++------\n 2 files changed, 63 insertions(+), 10 deletions(-)", "diff": "diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c\nindex 6466153..94ca285 100644\n--- a/fs/binfmt_elf.c\n+++ b/fs/binfmt_elf.c\n@@ -1696,7 +1696,7 @@ static int fill_thread_core_info(struct elf_thread_core_info *t,\n \t\t\t\t long signr, size_t *total)\n {\n \tunsigned int i;\n-\tunsigned int regset_size = view->regsets[0].n * view->regsets[0].size;\n+\tunsigned int size = regset_size(t->task, &view->regsets[0]);\n \n \t/*\n \t * NT_PRSTATUS is the one special case, because the regset data\n@@ -1705,7 +1705,7 @@ static int fill_thread_core_info(struct elf_thread_core_info *t,\n \t * We assume that regset 0 is NT_PRSTATUS.\n \t */\n \tfill_prstatus(&t->prstatus, t->task, signr);\n-\t(void) view->regsets[0].get(t->task, &view->regsets[0], 0, regset_size,\n+\t(void) view->regsets[0].get(t->task, &view->regsets[0], 0, size,\n \t\t\t\t &t->prstatus.pr_reg, NULL);\n \n \tfill_note(&t->notes[0], \"CORE\", NT_PRSTATUS,\n@@ -1725,7 +1725,7 @@ static int fill_thread_core_info(struct elf_thread_core_info *t,\n \t\tif (regset->core_note_type && regset->get &&\n \t\t (!regset->active || regset->active(t->task, regset))) {\n \t\t\tint ret;\n-\t\t\tsize_t size = regset->n * regset->size;\n+\t\t\tsize_t size = regset_size(t->task, regset);\n \t\t\tvoid *data = kmalloc(size, GFP_KERNEL);\n \t\t\tif (unlikely(!data))\n \t\t\t\treturn 0;\ndiff --git a/include/linux/regset.h b/include/linux/regset.h\nindex 8e0c9fe..494ceda 100644\n--- a/include/linux/regset.h\n+++ b/include/linux/regset.h\n@@ -107,6 +107,28 @@ typedef int user_regset_writeback_fn(struct task_struct *target,\n \t\t\t\t int immediate);\n \n /**\n+ * user_regset_get_size_fn - type of @get_size function in &struct user_regset\n+ * @target:\tthread being examined\n+ * @regset:\tregset being examined\n+ *\n+ * This call is optional; usually the pointer is %NULL.\n+ *\n+ * When provided, this function must return the current size of regset\n+ * data, as observed by the @get function in &struct user_regset. The\n+ * value returned must be a multiple of @size. The returned size is\n+ * required to be valid only until the next time (if any) @regset is\n+ * modified for @target.\n+ *\n+ * This function is intended for dynamically sized regsets. A regset\n+ * that is statically sized does not need to implement it.\n+ *\n+ * This function should not be called directly: instead, callers should\n+ * call regset_size() to determine the current size of a regset.\n+ */\n+typedef unsigned int user_regset_get_size_fn(struct task_struct *target,\n+\t\t\t\t\t const struct user_regset *regset);\n+\n+/**\n * struct user_regset - accessible thread CPU state\n * @n:\t\t\tNumber of slots (registers).\n * @size:\t\tSize in bytes of a slot (register).\n@@ -117,19 +139,33 @@ typedef int user_regset_writeback_fn(struct task_struct *target,\n * @set:\t\tFunction to store values.\n * @active:\t\tFunction to report if regset is active, or %NULL.\n * @writeback:\t\tFunction to write data back to user memory, or %NULL.\n+ * @get_size:\t\tFunction to return the regset's size, or %NULL.\n *\n * This data structure describes a machine resource we call a register set.\n * This is part of the state of an individual thread, not necessarily\n * actual CPU registers per se. A register set consists of a number of\n * similar slots, given by @n. Each slot is @size bytes, and aligned to\n- * @align bytes (which is at least @size).\n+ * @align bytes (which is at least @size). For dynamically-sized\n+ * regsets, @n must contain the maximum possible number of slots for the\n+ * regset, and @get_size must point to a function that returns the\n+ * current regset size.\n *\n- * These functions must be called only on the current thread or on a\n- * thread that is in %TASK_STOPPED or %TASK_TRACED state, that we are\n- * guaranteed will not be woken up and return to user mode, and that we\n- * have called wait_task_inactive() on. (The target thread always might\n- * wake up for SIGKILL while these functions are working, in which case\n- * that thread's user_regset state might be scrambled.)\n+ * Callers that need to know only the current size of the regset and do\n+ * not care about its internal structure should call regset_size()\n+ * instead of inspecting @n or calling @get_size.\n+ *\n+ * For backward compatibility, the @get and @set methods must pad to, or\n+ * accept, @n * @size bytes, even if the current regset size is smaller.\n+ * The precise semantics of these operations depend on the regset being\n+ * accessed.\n+ *\n+ * The functions to which &struct user_regset members point must be\n+ * called only on the current thread or on a thread that is in\n+ * %TASK_STOPPED or %TASK_TRACED state, that we are guaranteed will not\n+ * be woken up and return to user mode, and that we have called\n+ * wait_task_inactive() on. (The target thread always might wake up for\n+ * SIGKILL while these functions are working, in which case that\n+ * thread's user_regset state might be scrambled.)\n *\n * The @pos argument must be aligned according to @align; the @count\n * argument must be a multiple of @size. These functions are not\n@@ -156,6 +192,7 @@ struct user_regset {\n \tuser_regset_set_fn\t\t*set;\n \tuser_regset_active_fn\t\t*active;\n \tuser_regset_writeback_fn\t*writeback;\n+\tuser_regset_get_size_fn\t\t*get_size;\n \tunsigned int\t\t\tn;\n \tunsigned int \t\t\tsize;\n \tunsigned int \t\t\talign;\n@@ -371,5 +408,21 @@ static inline int copy_regset_from_user(struct task_struct *target,\n \treturn regset->set(target, regset, offset, size, NULL, data);\n }\n \n+/**\n+ * regset_size - determine the current size of a regset\n+ * @target:\tthread to be examined\n+ * @regset:\tregset to be examined\n+ *\n+ * Note that the returned size is valid only until the next time\n+ * (if any) @regset is modified for @target.\n+ */\n+static inline unsigned int regset_size(struct task_struct *target,\n+\t\t\t\t const struct user_regset *regset)\n+{\n+\tif (!regset->get_size)\n+\t\treturn regset->n * regset->size;\n+\telse\n+\t\treturn regset->get_size(target, regset);\n+}\n \n #endif\t/* <linux/regset.h> */\n", "prefixes": [ "v2", "01/28" ] }