Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/805044/?format=api
{ "id": 805044, "url": "http://patchwork.ozlabs.org/api/patches/805044/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linuxppc-dev/patch/ae2205dedfe437e4df2dd0cc7605d62189833221.1503277387.git.christophe.leroy@c-s.fr/", "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": "<ae2205dedfe437e4df2dd0cc7605d62189833221.1503277387.git.christophe.leroy@c-s.fr>", "list_archive_url": "https://lore.kernel.org/linuxppc-dev/ae2205dedfe437e4df2dd0cc7605d62189833221.1503277387.git.christophe.leroy@c-s.fr/", "date": "2017-08-23T14:54:38", "name": "[4/4] powerpc/32: remove a NOP from memset()", "commit_ref": "ad1b0122bdc96cbcfcfbc9ef59f9bf3658802a72", "pull_url": null, "state": "accepted", "archived": false, "hash": "f27bca3af00ca03905d2141d9987277adef0fce5", "submitter": { "id": 5234, "url": "http://patchwork.ozlabs.org/api/people/5234/?format=api", "name": "Christophe Leroy", "email": "christophe.leroy@c-s.fr" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/linuxppc-dev/patch/ae2205dedfe437e4df2dd0cc7605d62189833221.1503277387.git.christophe.leroy@c-s.fr/mbox/", "series": [], "comments": "http://patchwork.ozlabs.org/api/patches/805044/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/805044/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" ], "Received": [ "from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3])\n\t(using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xcrMt4V1Pz9s8J\n\tfor <patchwork-incoming@ozlabs.org>;\n\tThu, 24 Aug 2017 01:05:46 +1000 (AEST)", "from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 3xcrMt2wTQzDqkd\n\tfor <patchwork-incoming@ozlabs.org>;\n\tThu, 24 Aug 2017 01:05:46 +1000 (AEST)", "from pegase1.c-s.fr (pegase1.c-s.fr [93.17.236.30])\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 3xcr771F5zzDqhL\n\tfor <linuxppc-dev@lists.ozlabs.org>;\n\tThu, 24 Aug 2017 00:54:42 +1000 (AEST)", "from localhost (mailhub1-int [192.168.12.234])\n\tby localhost (Postfix) with ESMTP id 3xcr6r2Mcqz9ttFR;\n\tWed, 23 Aug 2017 16:54:28 +0200 (CEST)", "from pegase1.c-s.fr ([192.168.12.234])\n\tby localhost (pegase1.c-s.fr [192.168.12.234]) (amavisd-new,\n\tport 10024)\n\twith ESMTP id YkU6lBew2Ots; Wed, 23 Aug 2017 16:54:28 +0200 (CEST)", "from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192])\n\tby pegase1.c-s.fr (Postfix) with ESMTP id 3xcr6r1Q7Lz9ttBy;\n\tWed, 23 Aug 2017 16:54:28 +0200 (CEST)", "from localhost (localhost [127.0.0.1])\n\tby messagerie.si.c-s.fr (Postfix) with ESMTP id F2EC38B80C;\n\tWed, 23 Aug 2017 16:54:38 +0200 (CEST)", "from messagerie.si.c-s.fr ([127.0.0.1])\n\tby localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new,\n\tport 10023)\n\twith ESMTP id UqTUdvUFBUoa; Wed, 23 Aug 2017 16:54:38 +0200 (CEST)", "from po15668-vm-win7.idsi0.si.c-s.fr (po15451.idsi0.si.c-s.fr\n\t[172.25.231.1])\n\tby messagerie.si.c-s.fr (Postfix) with ESMTP id B851C8B802;\n\tWed, 23 Aug 2017 16:54:38 +0200 (CEST)", "by po15668-vm-win7.idsi0.si.c-s.fr (Postfix, from userid 0)\n\tid A6A97679CE; Wed, 23 Aug 2017 16:54:38 +0200 (CEST)" ], "X-Virus-Scanned": [ "Debian amavisd-new at c-s.fr", "amavisd-new at c-s.fr" ], "Message-Id": "<ae2205dedfe437e4df2dd0cc7605d62189833221.1503277387.git.christophe.leroy@c-s.fr>", "In-Reply-To": "<cover.1503277387.git.christophe.leroy@c-s.fr>", "References": "<cover.1503277387.git.christophe.leroy@c-s.fr>", "From": "Christophe Leroy <christophe.leroy@c-s.fr>", "Subject": "[PATCH 4/4] powerpc/32: remove a NOP from memset()", "To": "Benjamin Herrenschmidt <benh@kernel.crashing.org>,\n\tPaul Mackerras <paulus@samba.org>,\n\tMichael Ellerman <mpe@ellerman.id.au>, Scott Wood <oss@buserror.net>", "Date": "Wed, 23 Aug 2017 16:54:38 +0200 (CEST)", "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>", "Cc": "linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org", "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": "memset() is patched after initialisation to activate the\noptimised part which uses cache instructions.\n\nToday we have a 'b 2f' to skip the optimised patch, which then gets\nreplaced by a NOP, implying a useless cycle consumption.\nAs we have a 'bne 2f' just before, we could use that instruction\nfor the live patching, hence removing the need to have a\ndedicated 'b 2f' to be replaced by a NOP.\n\nThis patch changes the 'bne 2f' by a 'b 2f'. During init, that\n'b 2f' is then replaced by 'bne 2f'\n\nSigned-off-by: Christophe Leroy <christophe.leroy@c-s.fr>\n---\n arch/powerpc/kernel/setup_32.c | 7 ++++++-\n arch/powerpc/lib/copy_32.S | 7 +++++--\n 2 files changed, 11 insertions(+), 3 deletions(-)", "diff": "diff --git a/arch/powerpc/kernel/setup_32.c b/arch/powerpc/kernel/setup_32.c\nindex 2f88f6cf1a42..51ebc01fff52 100644\n--- a/arch/powerpc/kernel/setup_32.c\n+++ b/arch/powerpc/kernel/setup_32.c\n@@ -98,6 +98,9 @@ extern unsigned int memset_nocache_branch; /* Insn to be replaced by NOP */\n \n notrace void __init machine_init(u64 dt_ptr)\n {\n+\tunsigned int *addr = &memset_nocache_branch;\n+\tunsigned long insn;\n+\n \t/* Configure static keys first, now that we're relocated. */\n \tsetup_feature_keys();\n \n@@ -105,7 +108,9 @@ notrace void __init machine_init(u64 dt_ptr)\n \tudbg_early_init();\n \n \tpatch_instruction((unsigned int *)&memcpy, PPC_INST_NOP);\n-\tpatch_instruction(&memset_nocache_branch, PPC_INST_NOP);\n+\n+\tinsn = create_cond_branch(addr, branch_target(addr), 0x820000);\n+\tpatch_instruction(addr, insn);\t/* replace b by bne cr0 */\n \n \t/* Do some early initialization based on the flat device tree */\n \tearly_init_devtree(__va(dt_ptr));\ndiff --git a/arch/powerpc/lib/copy_32.S b/arch/powerpc/lib/copy_32.S\nindex 05aaee20590f..da425bb6b369 100644\n--- a/arch/powerpc/lib/copy_32.S\n+++ b/arch/powerpc/lib/copy_32.S\n@@ -103,9 +103,12 @@ _GLOBAL(memset)\n \tadd\tr5,r0,r5\n \tsubf\tr6,r0,r3\n \tcmplwi\t0,r4,0\n-\tbne\t2f\t/* Use normal procedure if r4 is not zero */\n+\t/*\n+\t * Skip optimised bloc until cache is enabled. Will be replaced\n+\t * by 'bne' during boot to use normal procedure if r4 is not zero\n+\t */\n _GLOBAL(memset_nocache_branch)\n-\tb\t2f\t/* Skip optimised bloc until cache is enabled */\n+\tb\t2f\n \n \tclrlwi\tr7,r6,32-LG_CACHELINE_BYTES\n \tadd\tr8,r7,r5\n", "prefixes": [ "4/4" ] }