Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/800464/?format=api
{ "id": 800464, "url": "http://patchwork.ozlabs.org/api/patches/800464/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linuxppc-dev/patch/20170811082336.9560-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": "<20170811082336.9560-1-santosh@fossix.org>", "list_archive_url": "https://lore.kernel.org/linuxppc-dev/20170811082336.9560-1-santosh@fossix.org/", "date": "2017-08-11T08:23:36", "name": "powerpc/vdso64: Add support for CLOCK_{REALTIME/MONOTONIC}_COARSE", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "eb82822e74ca5a6d39a823ab82002c12ee6ce5dd", "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/20170811082336.9560-1-santosh@fossix.org/mbox/", "series": [], "comments": "http://patchwork.ozlabs.org/api/patches/800464/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/800464/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 3xTJ3Q1CpDz9t36\n\tfor <patchwork-incoming@ozlabs.org>;\n\tFri, 11 Aug 2017 18:25:22 +1000 (AEST)", "from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 3xTJ3P6zNvzDr2m\n\tfor <patchwork-incoming@ozlabs.org>;\n\tFri, 11 Aug 2017 18:25:21 +1000 (AEST)", "from mail-pg0-x243.google.com (mail-pg0-x243.google.com\n\t[IPv6:2607:f8b0:400e:c05::243])\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 3xTJ1f70k7zDqp7\n\tfor <linuxppc-dev@lists.ozlabs.org>;\n\tFri, 11 Aug 2017 18:23:50 +1000 (AEST)", "by mail-pg0-x243.google.com with SMTP id y192so2624122pgd.1\n\tfor <linuxppc-dev@lists.ozlabs.org>;\n\tFri, 11 Aug 2017 01:23:50 -0700 (PDT)", "from santosiv.in.ibm.com ([183.82.16.74])\n\tby smtp.gmail.com with ESMTPSA id\n\tm19sm1002742pfi.176.2017.08.11.01.23.45\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tFri, 11 Aug 2017 01:23:47 -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=\"gH7bsTnx\"; 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=\"gH7bsTnx\"; 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=\"gH7bsTnx\"; \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:in-reply-to:references;\n\tbh=HUOAdDwQwJiWXqXDsQbkuNct2PqApsvZlG3FEdu1MIU=;\n\tb=gH7bsTnxMFcql5zEfvDRarP7gBCoZwdvRAKwR/FoeyQbgaE8cVy19ZaAgL/wbM1alD\n\t3Y7oWR7ozB6ua07ZgymRFZ81zgpbr88IA8zDydoHZFiFd8pWX64XoE0Lu8KI1wycX7//\n\tFWHHEWLsrgYWuCGrlh+MmYxmZIMxIeG1EBYi/zuzcr61qcDAJxdrsC1jiQb8hgG6zD4J\n\tZkdg9wK2z4bcOHIPB8l5oiNVV8tM8WqH/MpXrd9lY3RTi97XSI+XClLL1UcGsHz+Cabd\n\tAcqeYFtV7rNqwTgmGpfRXLcUAsPA71GT+9TmDv3JU5EsdHjnA0jmMs8yTsEUJ+POR7HD\n\tqR4A==", "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:in-reply-to\n\t:references;\n\tbh=HUOAdDwQwJiWXqXDsQbkuNct2PqApsvZlG3FEdu1MIU=;\n\tb=gDWjyZMZLZacyZ/IhX9ptq0AuOefUz3eg9riWifq4tGpmhQt/ao3a8GUCuMvgjntne\n\tExfwwunxdz4nixAtsLVj3ib34OAVhj6rTdju3cIxwK54dg/wIjWWT6LZ6pU/xR/NzfN8\n\twelE5J8OFEcQWLIlXosFUxAxRmCzEQbcpLZCk73SvIReh7GloR5Jehzr8hxyA7yDuZU1\n\tZJJuu4r7k9mgKC7Gr3wQDV/8YIpTj/YMNy3JJuYN/9R81f/+yCiaLnR3R27OEKtXF4Sr\n\tXBbmpNm1fqISNSbmzOZKIXr9Rgz3puySYsZixb0kS7FQoBbFG+e1tyjKPdSRArrW9ERB\n\tX7Ew==", "X-Gm-Message-State": "AHYfb5iAtZRiNICxzL8CG4zBn/BSXUscDoaY0znG20J1pKsFCIlmw5pi\n\tx9sdFoU0ew0dokEWxn8=", "X-Received": "by 10.99.177.66 with SMTP id g2mr14918825pgp.296.1502439828238; \n\tFri, 11 Aug 2017 01:23:48 -0700 (PDT)", "From": "Santosh Sivaraj <santosh@fossix.org>", "To": "linuxppc-dev <linuxppc-dev@lists.ozlabs.org>", "Subject": "[PATCH] powerpc/vdso64: Add support for\n\tCLOCK_{REALTIME/MONOTONIC}_COARSE", "Date": "Fri, 11 Aug 2017 13:53:36 +0530", "Message-Id": "<20170811082336.9560-1-santosh@fossix.org>", "X-Mailer": "git-send-email 2.9.4", "In-Reply-To": "<20170721090944.16889-1-santosh@fossix.org>", "References": "<20170721090944.16889-1-santosh@fossix.org>", "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 | 73 ++++++++++++++++++++++++++++---\n 2 files changed, 68 insertions(+), 7 deletions(-)", "diff": "diff --git a/arch/powerpc/kernel/asm-offsets.c b/arch/powerpc/kernel/asm-offsets.c\nindex 6e95c2c..c6acaa5 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 3820213..5229d1e 100644\n--- a/arch/powerpc/kernel/vdso64/gettimeofday.S\n+++ b/arch/powerpc/kernel/vdso64/gettimeofday.S\n@@ -60,19 +60,26 @@ 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,50f\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-50:\tbl\tV_LOCAL_FUNC(__do_get_tspec)\t/* get time from tb & kernel */\n+50:\tbl\tV_LOCAL_FUNC(__get_datapage)\t/* get data page */\n+\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 \t/*\n@@ -110,6 +117,58 @@ 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+\t */\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": [] }