Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/806419/?format=api
{ "id": 806419, "url": "http://patchwork.ozlabs.org/api/patches/806419/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linuxppc-dev/patch/20170828074440.18766-1-santosh@fossix.org/", "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": "<20170828074440.18766-1-santosh@fossix.org>", "list_archive_url": "https://lore.kernel.org/linuxppc-dev/20170828074440.18766-1-santosh@fossix.org/", "date": "2017-08-28T07:44:40", "name": "[resend] powerpc/vdso64: Add support for CLOCK_{REALTIME/MONOTONIC}_COARSE", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "58421cb795e7f028ce3e5bd0826978829e86c0c7", "submitter": { "id": 71831, "url": "http://patchwork.ozlabs.org/api/people/71831/?format=api", "name": "Santosh Sivaraj", "email": "santosh@fossix.org" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/linuxppc-dev/patch/20170828074440.18766-1-santosh@fossix.org/mbox/", "series": [ { "id": 94, "url": "http://patchwork.ozlabs.org/api/series/94/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linuxppc-dev/list/?series=94", "date": "2017-08-28T07:44:40", "name": "[resend] powerpc/vdso64: Add support for CLOCK_{REALTIME/MONOTONIC}_COARSE", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/94/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/806419/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/806419/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 [103.22.144.68])\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 3xgkNf0JNFz9sNq\n\tfor <patchwork-incoming@ozlabs.org>;\n\tMon, 28 Aug 2017 17:46:26 +1000 (AEST)", "from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 3xgkNd6HcczDqG3\n\tfor <patchwork-incoming@ozlabs.org>;\n\tMon, 28 Aug 2017 17:46:25 +1000 (AEST)", "from mail-pg0-x244.google.com (mail-pg0-x244.google.com\n\t[IPv6:2607:f8b0:400e:c05::244])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128\n\tbits)) (No client certificate requested)\n\tby lists.ozlabs.org (Postfix) with ESMTPS id 3xgkLq5shpzDq5m\n\tfor <linuxppc-dev@lists.ozlabs.org>;\n\tMon, 28 Aug 2017 17:44:51 +1000 (AEST)", "by mail-pg0-x244.google.com with SMTP id r133so5778748pgr.2\n\tfor <linuxppc-dev@lists.ozlabs.org>;\n\tMon, 28 Aug 2017 00:44:51 -0700 (PDT)", "from santosiv.in.ibm.com ([125.16.167.56])\n\tby smtp.gmail.com with ESMTPSA id\n\tc4sm20693166pfm.114.2017.08.28.00.44.46\n\t(version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);\n\tMon, 28 Aug 2017 00:44:48 -0700 (PDT)" ], "Authentication-Results": [ "ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=fossix-org.20150623.gappssmtp.com\n\theader.i=@fossix-org.20150623.gappssmtp.com\n\theader.b=\"esveyHfk\"; dkim-atps=neutral", "lists.ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=fossix-org.20150623.gappssmtp.com\n\theader.i=@fossix-org.20150623.gappssmtp.com\n\theader.b=\"esveyHfk\"; dkim-atps=neutral", "lists.ozlabs.org; dkim=pass (2048-bit key;\n\tunprotected) header.d=fossix-org.20150623.gappssmtp.com\n\theader.i=@fossix-org.20150623.gappssmtp.com header.b=\"esveyHfk\"; \n\tdkim-atps=neutral" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=fossix-org.20150623.gappssmtp.com; s=20150623;\n\th=from:to:cc:subject:date:message-id;\n\tbh=ucWlJvtN2ZggpLPZuS13Zm43sTx4Rex3mFDP0vS4lPs=;\n\tb=esveyHfkf9+HhoJxmhMTUpS0JtHQFWCub6mEGG+sChUzXvDkMhgtKDoTwc1X5plJRD\n\t2QkLg9uZACJq5VsyymxWTsJLe90w+61oTvXEwgxR4t+XNsPC0oueq25hqHhI0JRs5hOz\n\tVSsmb+yKLju++owrLVTbmSuw/6ijnCIHyLvUX2UlNdEkJd1BeULm4X0H1okiPJsufI5w\n\tsV2GeJlRih2slqFb+joPK3pfsDYoRU1+dh2esAEqlH2yr38KKKRpM7F8UVXgguSktZzc\n\t5MHNDJFCKIoPIA/dakfs/CxD93t5RH4hOi+NKY+a6yoLthKzsQl5oPfuQcpPXOHtAZWI\n\tBEVA==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id;\n\tbh=ucWlJvtN2ZggpLPZuS13Zm43sTx4Rex3mFDP0vS4lPs=;\n\tb=LC7aGGeqvhgoEECuVbV/YMjvsnVVP+P1mAL0QzvXTGKP0P5w5A/NS4PQurH+o7T06I\n\trFJn7OC7Aw7vfG7T1LwppivWW/HvzrGxgKXMLm6PObUnV4abZbTm33n1R0b6KSolMwdp\n\tAcgwr1baNXACfOqLxvyCPbtqVQrLBiz3y+w4DxBgd89fpb9NcVHyiOdB8WbvaELt+BEk\n\tSPXqAjYm2yRaZBTnQslz/J1bO2b2u6fXbih5VoU5NO5+oFwwfRd+EWPNjIfqC0xzVCrW\n\t8iIAbzGwHF3Pbq7pJrP+ox54WoRBtr1wKRMVYMCQ2SJ8ISoeReV8AEYaei1Kfda+YlHO\n\tZvQA==", "X-Gm-Message-State": "AHYfb5gLOJqmb5+KUxQrvSmvTalU2+E/2Mhde5lHOJyQ5vLfzvvU8T+v\n\tqD4vHzIN32pR10dep/Y=", "X-Received": "by 10.84.215.130 with SMTP id l2mr7238457pli.116.1503906289262; \n\tMon, 28 Aug 2017 00:44:49 -0700 (PDT)", "From": "Santosh Sivaraj <santosh@fossix.org>", "To": "linuxppc-dev <linuxppc-dev@lists.ozlabs.org>", "Subject": "[PATCH resend] powerpc/vdso64: Add support for\n\tCLOCK_{REALTIME/MONOTONIC}_COARSE", "Date": "Mon, 28 Aug 2017 13:14:40 +0530", "Message-Id": "<20170828074440.18766-1-santosh@fossix.org>", "X-Mailer": "git-send-email 2.13.5", "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": "Thomas Gleixner <tglx@linutronix.de>,\n\tJohn Stultz <john.stultz@linaro.org>, \n\tFrederic Weisbecker <fweisbec@gmail.com>", "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": "Current vDSO64 implementation does not have support for coarse clocks\n(CLOCK_MONOTONIC_COARSE, CLOCK_REALTIME_COARSE), for which it falls back\nto system call, increasing the response time, vDSO implementation reduces\nthe cycle time. Below is a benchmark of the difference in execution time\nwith and without vDSO support.\n\n(Non-coarse clocks are also included just for completion)\n\nWithout vDSO support:\n--------------------\nclock-gettime-realtime: syscall: 172 nsec/call\nclock-gettime-realtime: libc: 26 nsec/call\nclock-gettime-realtime: vdso: 21 nsec/call\nclock-gettime-monotonic: syscall: 170 nsec/call\nclock-gettime-monotonic: libc: 30 nsec/call\nclock-gettime-monotonic: vdso: 24 nsec/call\nclock-gettime-realtime-coarse: syscall: 153 nsec/call\nclock-gettime-realtime-coarse: libc: 15 nsec/call\nclock-gettime-realtime-coarse: vdso: 9 nsec/call\nclock-gettime-monotonic-coarse: syscall: 167 nsec/call\nclock-gettime-monotonic-coarse: libc: 15 nsec/call\nclock-gettime-monotonic-coarse: vdso: 11 nsec/call\n\nCC: Benjamin Herrenschmidt <benh@kernel.crashing.org>\nSigned-off-by: Santosh Sivaraj <santosh@fossix.org>\n---\n arch/powerpc/kernel/asm-offsets.c | 2 +\n arch/powerpc/kernel/vdso64/gettimeofday.S | 70 ++++++++++++++++++++++++++++---\n 2 files changed, 66 insertions(+), 6 deletions(-)", "diff": "diff --git a/arch/powerpc/kernel/asm-offsets.c b/arch/powerpc/kernel/asm-offsets.c\nindex 6e95c2c19a7e..c6acaa5edd16 100644\n--- a/arch/powerpc/kernel/asm-offsets.c\n+++ b/arch/powerpc/kernel/asm-offsets.c\n@@ -396,6 +396,8 @@ int main(void)\n \t/* Other bits used by the vdso */\n \tDEFINE(CLOCK_REALTIME, CLOCK_REALTIME);\n \tDEFINE(CLOCK_MONOTONIC, CLOCK_MONOTONIC);\n+\tDEFINE(CLOCK_REALTIME_COARSE, CLOCK_REALTIME_COARSE);\n+\tDEFINE(CLOCK_MONOTONIC_COARSE, CLOCK_MONOTONIC_COARSE);\n \tDEFINE(NSEC_PER_SEC, NSEC_PER_SEC);\n \tDEFINE(CLOCK_REALTIME_RES, MONOTONIC_RES_NSEC);\n \ndiff --git a/arch/powerpc/kernel/vdso64/gettimeofday.S b/arch/powerpc/kernel/vdso64/gettimeofday.S\nindex 382021324883..bae197a81add 100644\n--- a/arch/powerpc/kernel/vdso64/gettimeofday.S\n+++ b/arch/powerpc/kernel/vdso64/gettimeofday.S\n@@ -60,18 +60,25 @@ V_FUNCTION_END(__kernel_gettimeofday)\n */\n V_FUNCTION_BEGIN(__kernel_clock_gettime)\n .cfi_startproc\n+\tmr\tr11,r4\t\t\t/* r11 saves tp */\n+\tmflr\tr12\t\t\t/* r12 saves lr */\n+\tlis\tr7,NSEC_PER_SEC@h\t/* want nanoseconds */\n+\tori\tr7,r7,NSEC_PER_SEC@l\n+\n \t/* Check for supported clock IDs */\n \tcmpwi\tcr0,r3,CLOCK_REALTIME\n \tcmpwi\tcr1,r3,CLOCK_MONOTONIC\n \tcror\tcr0*4+eq,cr0*4+eq,cr1*4+eq\n-\tbne\tcr0,99f\n+\tbeq\tcr0,49f\n \n-\tmflr\tr12\t\t\t/* r12 saves lr */\n+\tcmpwi\tcr0,r3,CLOCK_REALTIME_COARSE\n+\tcmpwi\tcr1,r3,CLOCK_MONOTONIC_COARSE\n+\tcror\tcr0*4+eq,cr0*4+eq,cr1*4+eq\n+\tbeq\tcr0,65f\n+\n+\tb\t99f\t\t/* Fallback to syscall */\n .cfi_register lr,r12\n-\tmr\tr11,r4\t\t\t/* r11 saves tp */\n-\tbl\tV_LOCAL_FUNC(__get_datapage)\t/* get data page */\n-\tlis\tr7,NSEC_PER_SEC@h\t/* want nanoseconds */\n-\tori\tr7,r7,NSEC_PER_SEC@l\n+49:\tbl\tV_LOCAL_FUNC(__get_datapage)\t/* get data page */\n 50:\tbl\tV_LOCAL_FUNC(__do_get_tspec)\t/* get time from tb & kernel */\n \tbne\tcr1,80f\t\t\t/* if not monotonic, all done */\n \n@@ -110,6 +117,57 @@ V_FUNCTION_BEGIN(__kernel_clock_gettime)\n 1:\tbge\tcr1,80f\n \taddi\tr4,r4,-1\n \tadd\tr5,r5,r7\n+\tb\t80f\n+\n+\t/*\n+\t * For coarse clocks we get data directly from the vdso data page, so\n+\t * we don't need to call __do_get_tspec, but we still need to do the\n+\t * counter trick.\n+\t */\n+65:\tbl\tV_LOCAL_FUNC(__get_datapage)\t/* get data page */\n+70:\tld\tr8,CFG_TB_UPDATE_COUNT(r3)\n+\tandi.\tr0,r8,1\t\t\t/* pending update ? loop */\n+\tbne-\t70b\n+\txor\tr0,r8,r8\t\t/* create dependency */\n+\tadd\tr3,r3,r0\n+\n+\t/*\n+\t * CLOCK_REALTIME_COARSE, below values are needed for MONOTONIC_COARSE\n+\t * too\n+\t */\n+\tld\tr4,STAMP_XTIME+TSPC64_TV_SEC(r3)\n+\tld\tr5,STAMP_XTIME+TSPC64_TV_NSEC(r3)\n+\tbne\tcr1,78f\n+\n+\t/* CLOCK_MONOTONIC_COARSE */\n+\tlwa\tr6,WTOM_CLOCK_SEC(r3)\n+\tlwa\tr9,WTOM_CLOCK_NSEC(r3)\n+\n+\t/* check if counter has updated */\n+78:\tor\tr0,r6,r9\n+\txor\tr0,r0,r0\n+\tadd\tr3,r3,r0\n+\tld\tr0,CFG_TB_UPDATE_COUNT(r3)\n+\tcmpld\tcr0,r0,r8\t\t/* check if updated */\n+\tbne-\t70b\n+\n+\t/* Counter has not updated, so continue calculating proper values for\n+\t * sec and nsec if monotonic coarse, or just return with the proper\n+\t * values for realtime.\n+\t */\n+\tbne\tcr1,80f\n+\n+\t/* Add wall->monotonic offset and check for overflow or underflow */\n+\tadd\tr4,r4,r6\n+\tadd\tr5,r5,r9\n+\tcmpd\tcr0,r5,r7\n+\tcmpdi\tcr1,r5,0\n+\tblt\t79f\n+\tsubf\tr5,r7,r5\n+\taddi\tr4,r4,1\n+79:\tbge\tcr1,80f\n+\taddi\tr4,r4,-1\n+\tadd\tr5,r5,r7\n \n 80:\tstd\tr4,TSPC64_TV_SEC(r11)\n \tstd\tr5,TSPC64_TV_NSEC(r11)\n", "prefixes": [ "resend" ] }