Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/690686/?format=api
{ "id": 690686, "url": "http://patchwork.ozlabs.org/api/patches/690686/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linuxppc-dev/patch/20161103052308.GF8368@fergus.ozlabs.ibm.com/", "project": { "id": 2, "url": "http://patchwork.ozlabs.org/api/projects/2/?format=api", "name": "Linux PPC development", "link_name": "linuxppc-dev", "list_id": "linuxppc-dev.lists.ozlabs.org", "list_email": "linuxppc-dev@lists.ozlabs.org", "web_url": "https://github.com/linuxppc/wiki/wiki", "scm_url": "https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git", "webscm_url": "https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git/", "list_archive_url": "https://lore.kernel.org/linuxppc-dev/", "list_archive_url_format": "https://lore.kernel.org/linuxppc-dev/{}/", "commit_url_format": "https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git/commit/?id={}" }, "msgid": "<20161103052308.GF8368@fergus.ozlabs.ibm.com>", "list_archive_url": "https://lore.kernel.org/linuxppc-dev/20161103052308.GF8368@fergus.ozlabs.ibm.com/", "date": "2016-11-03T05:23:08", "name": "[4/4] powerpc/64: Copy as much as possible in __copy_tofrom_user", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "78637f49c72134676c57fd77599e6c27bc2da1cb", "submitter": { "id": 67079, "url": "http://patchwork.ozlabs.org/api/people/67079/?format=api", "name": "Paul Mackerras", "email": "paulus@ozlabs.org" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/linuxppc-dev/patch/20161103052308.GF8368@fergus.ozlabs.ibm.com/mbox/", "series": [], "comments": "http://patchwork.ozlabs.org/api/patches/690686/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/690686/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org>", "X-Original-To": [ "patchwork-incoming@ozlabs.org", "linuxppc-dev@lists.ozlabs.org" ], "Delivered-To": [ "patchwork-incoming@ozlabs.org", "linuxppc-dev@lists.ozlabs.org", "linuxppc-dev@ozlabs.org" ], "Received": [ "from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3t8YNz168Bz9t10\n\tfor <patchwork-incoming@ozlabs.org>;\n\tThu, 3 Nov 2016 16:26:43 +1100 (AEDT)", "from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 3t8YNz06gmzDvg1\n\tfor <patchwork-incoming@ozlabs.org>;\n\tThu, 3 Nov 2016 16:26:43 +1100 (AEDT)", "from ozlabs.org (ozlabs.org [103.22.144.67])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby lists.ozlabs.org (Postfix) with ESMTPS id 3t8YK160c6zDvQW\n\tfor <linuxppc-dev@lists.ozlabs.org>;\n\tThu, 3 Nov 2016 16:23:17 +1100 (AEDT)", "by ozlabs.org (Postfix)\n\tid 3t8YK15JXcz9t1Q; Thu, 3 Nov 2016 16:23:17 +1100 (AEDT)", "by ozlabs.org (Postfix, from userid 1003)\n\tid 3t8YK14mVxz9t2D; Thu, 3 Nov 2016 16:23:17 +1100 (AEDT)" ], "Date": "Thu, 3 Nov 2016 16:23:08 +1100", "From": "Paul Mackerras <paulus@ozlabs.org>", "To": "linuxppc-dev@ozlabs.org", "Subject": "[PATCH 4/4] powerpc/64: Copy as much as possible in\n\t__copy_tofrom_user", "Message-ID": "<20161103052308.GF8368@fergus.ozlabs.ibm.com>", "References": "<20161103051949.GC8368@fergus.ozlabs.ibm.com>", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=us-ascii", "Content-Disposition": "inline", "In-Reply-To": "<20161103051949.GC8368@fergus.ozlabs.ibm.com>", "User-Agent": "Mutt/1.5.24 (2015-08-30)", "X-BeenThere": "linuxppc-dev@lists.ozlabs.org", "X-Mailman-Version": "2.1.23", "Precedence": "list", "List-Id": "Linux on PowerPC Developers Mail List\n\t<linuxppc-dev.lists.ozlabs.org>", "List-Unsubscribe": "<https://lists.ozlabs.org/options/linuxppc-dev>,\n\t<mailto:linuxppc-dev-request@lists.ozlabs.org?subject=unsubscribe>", "List-Archive": "<http://lists.ozlabs.org/pipermail/linuxppc-dev/>", "List-Post": "<mailto:linuxppc-dev@lists.ozlabs.org>", "List-Help": "<mailto:linuxppc-dev-request@lists.ozlabs.org?subject=help>", "List-Subscribe": "<https://lists.ozlabs.org/listinfo/linuxppc-dev>,\n\t<mailto:linuxppc-dev-request@lists.ozlabs.org?subject=subscribe>", "Errors-To": "linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org", "Sender": "\"Linuxppc-dev\"\n\t<linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org>" }, "content": "In __copy_tofrom_user, if we encounter an exception on a store, we\nstop copying and return the number of bytes not copied. However,\nif the store is wider than one byte and is to an unaligned address,\nit is possible that the store operand overlaps a page boundary\nand the exception occurred on the latter part of the store operand,\nmeaning that it would be possible to copy a few more bytes. Since\ncopy_to_user is generally expected to copy as much as possible,\nit would be better to copy those extra few bytes. This adds code\nto do that. Since this edge case is not performance-critical,\nthe code has been written to be compact rather than as fast as\npossible.\n\nSigned-off-by: Paul Mackerras <paulus@ozlabs.org>\n---\n arch/powerpc/lib/copyuser_64.S | 29 +++++++++++++++++++++++------\n 1 file changed, 23 insertions(+), 6 deletions(-)", "diff": "diff --git a/arch/powerpc/lib/copyuser_64.S b/arch/powerpc/lib/copyuser_64.S\nindex 668d816..c479256 100644\n--- a/arch/powerpc/lib/copyuser_64.S\n+++ b/arch/powerpc/lib/copyuser_64.S\n@@ -409,8 +409,8 @@ stex;\tstb\tr0,0(r3)\n 99:\tblr\n \n /*\n- * exception handlers for stores: we just need to work\n- * out how many bytes weren't copied\n+ * exception handlers for stores: we need to work out how many bytes\n+ * weren't copied, and we may need to copy some more.\n * Note that the number of bytes of instructions for adjusting r3 needs\n * to equal the amount of the adjustment, due to the trick of using\n * .Lst_exc - r3_offset as the handler address.\n@@ -430,10 +430,27 @@ stex;\tstb\tr0,0(r3)\n \t/* adjust by 4 */\n \taddi\tr3,r3,4\n .Lst_exc:\n-\tld\tr6,-24(r1)\n-\tld\tr5,-8(r1)\n-\tadd\tr6,r6,r5\n-\tsubf\tr3,r3,r6\t/* #bytes not copied in r3 */\n+\tld\tr6,-24(r1)\t/* original destination pointer */\n+\tld\tr4,-16(r1)\t/* original source pointer */\n+\tld\tr5,-8(r1)\t/* original number of bytes */\n+\tadd\tr7,r6,r5\n+\t/*\n+\t * If the destination pointer isn't 8-byte aligned,\n+\t * we may have got the exception as a result of a\n+\t * store that overlapped a page boundary, so we may be\n+\t * able to copy a few more bytes.\n+\t */\n+17:\tandi.\tr0,r3,7\n+\tbeq\t19f\n+\tsubf\tr8,r6,r3\t/* #bytes copied */\n+\textable\t19f\n+\tlbzx\tr0,r8,r4\n+\textable\t19f\n+\tstb\tr0,0(r3)\n+\taddi\tr3,r3,1\n+\tcmpld\tr3,r7\n+\tblt\t17b\n+19:\tsubf\tr3,r3,r7\t/* #bytes not copied in r3 */\n \tblr\n \n /*\n", "prefixes": [ "4/4" ] }