get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/1.2/patches/2221859/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 2221859,
    "url": "http://patchwork.ozlabs.org/api/1.2/patches/2221859/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/sparclinux/patch/20260410120318.320727701@kernel.org/",
    "project": {
        "id": 10,
        "url": "http://patchwork.ozlabs.org/api/1.2/projects/10/?format=api",
        "name": "Linux SPARC Development ",
        "link_name": "sparclinux",
        "list_id": "sparclinux.vger.kernel.org",
        "list_email": "sparclinux@vger.kernel.org",
        "web_url": null,
        "scm_url": null,
        "webscm_url": null,
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<20260410120318.320727701@kernel.org>",
    "list_archive_url": null,
    "date": "2026-04-10T12:19:21",
    "name": "[11/38] misc: sgi-gru: Remove get_cycles() [ab]use",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "10eec9b6f1f651211a03c914eb332f085db94ead",
    "submitter": {
        "id": 92397,
        "url": "http://patchwork.ozlabs.org/api/1.2/people/92397/?format=api",
        "name": "Thomas Gleixner",
        "email": "tglx@kernel.org"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/sparclinux/patch/20260410120318.320727701@kernel.org/mbox/",
    "series": [
        {
            "id": 499450,
            "url": "http://patchwork.ozlabs.org/api/1.2/series/499450/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/sparclinux/list/?series=499450",
            "date": "2026-04-10T12:18:27",
            "name": "treewide: Cleanup LATCH, CLOCK_TICK_RATE and get_cycles() [ab]use",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/499450/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/2221859/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2221859/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "\n <SRS0=bptK=CJ=vger.kernel.org=sparclinux+bounces-6659-patchwork-incoming=ozlabs.org@ozlabs.org>",
        "X-Original-To": [
            "incoming@patchwork.ozlabs.org",
            "sparclinux@vger.kernel.org"
        ],
        "Delivered-To": [
            "patchwork-incoming@legolas.ozlabs.org",
            "patchwork-incoming@ozlabs.org"
        ],
        "Authentication-Results": [
            "legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256\n header.s=k20201202 header.b=uunn/bCq;\n\tdkim-atps=neutral",
            "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=ozlabs.org\n (client-ip=2404:9400:2221:ea00::3; helo=mail.ozlabs.org;\n envelope-from=srs0=bptk=cj=vger.kernel.org=sparclinux+bounces-6659-patchwork-incoming=ozlabs.org@ozlabs.org;\n receiver=patchwork.ozlabs.org)",
            "gandalf.ozlabs.org;\n arc=pass smtp.remote-ip=\"2600:3c15:e001:75::12fc:5321\"\n arc.chain=subspace.kernel.org",
            "gandalf.ozlabs.org;\n dmarc=pass (p=quarantine dis=none) header.from=kernel.org",
            "gandalf.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256\n header.s=k20201202 header.b=uunn/bCq;\n\tdkim-atps=neutral",
            "gandalf.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=2600:3c15:e001:75::12fc:5321; helo=sin.lore.kernel.org;\n envelope-from=sparclinux+bounces-6659-patchwork-incoming=ozlabs.org@vger.kernel.org;\n receiver=ozlabs.org)",
            "smtp.subspace.kernel.org;\n\tdkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org\n header.b=\"uunn/bCq\"",
            "smtp.subspace.kernel.org;\n arc=none smtp.client-ip=10.30.226.201"
        ],
        "Received": [
            "from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fsbhd27zyz1yGb\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 10 Apr 2026 22:29:21 +1000 (AEST)",
            "from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3])\n\tby gandalf.ozlabs.org (Postfix) with ESMTP id 4fsbhd1dQBz4wCx\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 10 Apr 2026 22:29:21 +1000 (AEST)",
            "by gandalf.ozlabs.org (Postfix)\n\tid 4fsbhd1V3bz4wJV; Fri, 10 Apr 2026 22:29:21 +1000 (AEST)",
            "from sin.lore.kernel.org (sin.lore.kernel.org\n [IPv6:2600:3c15:e001:75::12fc:5321])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby gandalf.ozlabs.org (Postfix) with ESMTPS id 4fsbhZ01Thz4wCx\n\tfor <patchwork-incoming@ozlabs.org>; Fri, 10 Apr 2026 22:29:17 +1000 (AEST)",
            "from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby sin.lore.kernel.org (Postfix) with ESMTP id B78923040670\n\tfor <patchwork-incoming@ozlabs.org>; Fri, 10 Apr 2026 12:21:21 +0000 (UTC)",
            "from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id CB2713D16F6;\n\tFri, 10 Apr 2026 12:19:25 +0000 (UTC)",
            "from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org\n [10.30.226.201])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby smtp.subspace.kernel.org (Postfix) with ESMTPS id A1B0F3C6A5F;\n\tFri, 10 Apr 2026 12:19:25 +0000 (UTC)",
            "by smtp.kernel.org (Postfix) with ESMTPSA id 1A057C2BCB3;\n\tFri, 10 Apr 2026 12:19:24 +0000 (UTC)"
        ],
        "ARC-Seal": [
            "i=2; a=rsa-sha256; d=ozlabs.org; s=201707; t=1775824161; cv=pass;\n\tb=yTJDAW/T/SRK/aO4pjNLtw+cqU1yKTN6zpi8zXmErTIk1hoWlvb64NB9gsUrmOCgTlhVpPUF6ZVaNkuEnHWjWvoDSTRCyPIrSjcc78zOpWBZdz8KegmpkkzOqECiIh3oaEm48oC5YYpSkZvDWw1AgeBfMhF7R5AttsTAfDPOriYOVEmNXq95Zgqvytw4MWVqZFHj8GZQyapILCIukbVx/usbwjSeNgOM3kOn/HUdFNjGsJndgSeTX8XrWQJPW1Dhobc/K4FRpwIew5ur21I3YkbkY9IBAOyjqtIb6m41xzFUeoRUQuMGkeUkflTz7Z9OsfcEb8sZEC8y56kQpCDKnA==",
            "i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1775823565; cv=none;\n b=khBC9WsQQp4PBB1nP7lNqMcne0HAzWXEi5O1gcXdEeLR0ZhlpN5hMFWt/o1CmLVsckQEogH0ow50GK+/O0c8Wq9Y40bfolcOP9m2unAGdXrcFWeNAhrhGWZKJxhP1oe8+IBtod6MEvW9mW/MkMkG/nMGWr7BB9+RP9YxrZ+sVZg="
        ],
        "ARC-Message-Signature": [
            "i=2; a=rsa-sha256; d=ozlabs.org; s=201707;\n\tt=1775824161; c=relaxed/relaxed;\n\tbh=95Xzu/wrSKdgPqpES5U3P7913oi5C0HtUtRZ8A2JYug=;\n\th=Date:Message-ID:From:To:Subject:References:MIME-Version:\n\t Content-Type:cc;\n b=xZmcrLZFxExCZ0mbNMa9lXw5Bxo5T8enRM5E+3oU/c1gR2QMNZIgI3we0VZVaLATohlIzFmt5/ijf0wTmjFO/bBNeOHWkDlyNzzoAkpi+a4kEjQRkBsHIBvD81FnoGI80VOXV72JvSCRV4dwRoi/Nwv8GHPI/rhLGirOpzpkVXPDQRLJKIrot6GIlc5atY+fsu6so+T/w69SZF8eCzYixMpIGGuVi2/qsbDav8HdFHq3SBM6q27X4J1cGsPfsWTRHYYpUaurxQVtrLuqRzgD1c79J679RwJiZELt8LS49++fUxWbPq7Yi7jIIbWnGMrZGE7NkhXHCzBR+KjgBH77Kg==",
            "i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1775823565; c=relaxed/simple;\n\tbh=tLIpqPCaUi8Lfeqau43+rfn7UZ8vuvPykTPYNUPuuyU=;\n\th=Date:Message-ID:From:To:Subject:References:MIME-Version:\n\t Content-Type:cc;\n b=Jres9KWGihZd5HOXSG0kMYg/4Kndf3yrmtzyIvjR5YFsu6dLX5IaSU3wf8SIcDtfqUKAy+d493f3WHmB60G3yl2Clu7iiM9Dur0GEYVGUHS1Nh5D1erBf4kZRN1ikcJq6ypIDGcNahOSK3yUgwUtC2EOerc+gStYHuNFV3cYUO0="
        ],
        "ARC-Authentication-Results": [
            "i=2; gandalf.ozlabs.org;\n dmarc=pass (p=quarantine dis=none) header.from=kernel.org;\n dkim=pass (2048-bit key;\n unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256\n header.s=k20201202 header.b=uunn/bCq; dkim-atps=neutral;\n spf=pass (client-ip=2600:3c15:e001:75::12fc:5321; helo=sin.lore.kernel.org;\n envelope-from=sparclinux+bounces-6659-patchwork-incoming=ozlabs.org@vger.kernel.org;\n receiver=ozlabs.org) smtp.mailfrom=vger.kernel.org",
            "i=1; smtp.subspace.kernel.org;\n dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org\n header.b=uunn/bCq; arc=none smtp.client-ip=10.30.226.201"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;\n\ts=k20201202; t=1775823565;\n\tbh=tLIpqPCaUi8Lfeqau43+rfn7UZ8vuvPykTPYNUPuuyU=;\n\th=Date:From:To:Subject:References:cc:From;\n\tb=uunn/bCqpDYdqH3aqiI0+2U/qm27AeTQwxnXbKYibcvcv2ZEX2J7abPlER3gpmuTw\n\t CBdP5mMh40n2zp7Tno2Q99U//gHXFdOV0IBNQapDNZb3rSYwBD5TySsxa/Td7SLyaZ\n\t p+uL6Iv9jGq9ZtmZnt8i06X/J571L31cWnZuiDLMRsOKbpHdih8iJDMdVxjdr+94oH\n\t +kfrO2pFRZtB2b/jp8TX3WQWaL7ksYC/uaT6tTAybV37imt1fhiAkDjh2EPTnuViku\n\t 1P4aDmEJtrdQSxbhtiFRIYbjrzGEHTE4V2Fb8MxeAUFtdhNoavN7essScQIWwWoRqs\n\t j/BFBM5JmmtDw==",
        "Date": "Fri, 10 Apr 2026 14:19:21 +0200",
        "Message-ID": "<20260410120318.320727701@kernel.org>",
        "User-Agent": "quilt/0.68",
        "From": "Thomas Gleixner <tglx@kernel.org>",
        "To": "LKML <linux-kernel@vger.kernel.org>",
        "Subject": "[patch 11/38] misc: sgi-gru: Remove get_cycles() [ab]use",
        "References": "<20260410120044.031381086@kernel.org>",
        "Precedence": "bulk",
        "X-Mailing-List": "sparclinux@vger.kernel.org",
        "List-Id": "<sparclinux.vger.kernel.org>",
        "List-Subscribe": "<mailto:sparclinux+subscribe@vger.kernel.org>",
        "List-Unsubscribe": "<mailto:sparclinux+unsubscribe@vger.kernel.org>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=UTF-8",
        "cc": "Arnd Bergmann <arnd@arndb.de>,\n x86@kernel.org,\n Lu Baolu <baolu.lu@linux.intel.com>,\n iommu@lists.linux.dev,\n Michael Grzeschik <m.grzeschik@pengutronix.de>,\n netdev@vger.kernel.org,\n linux-wireless@vger.kernel.org,\n Herbert Xu <herbert@gondor.apana.org.au>,\n linux-crypto@vger.kernel.org,\n Vlastimil Babka <vbabka@kernel.org>,\n linux-mm@kvack.org,\n David Woodhouse <dwmw2@infradead.org>,\n Bernie Thompson <bernie@plugable.com>,\n linux-fbdev@vger.kernel.org,\n \"Theodore Tso\" <tytso@mit.edu>,\n linux-ext4@vger.kernel.org,\n Andrew Morton <akpm@linux-foundation.org>,\n Uladzislau Rezki <urezki@gmail.com>,\n Marco Elver <elver@google.com>,\n Dmitry Vyukov <dvyukov@google.com>,\n kasan-dev@googlegroups.com,\n Andrey Ryabinin <ryabinin.a.a@gmail.com>,\n Thomas Sailer <t.sailer@alumni.ethz.ch>,\n linux-hams@vger.kernel.org,\n \"Jason A. Donenfeld\" <Jason@zx2c4.com>,\n Richard Henderson <richard.henderson@linaro.org>,\n linux-alpha@vger.kernel.org,\n Russell King <linux@armlinux.org.uk>,\n linux-arm-kernel@lists.infradead.org,\n Catalin Marinas <catalin.marinas@arm.com>,\n Huacai Chen <chenhuacai@kernel.org>,\n loongarch@lists.linux.dev,\n Geert Uytterhoeven <geert@linux-m68k.org>,\n linux-m68k@lists.linux-m68k.org,\n Dinh Nguyen <dinguyen@kernel.org>,\n Jonas Bonn <jonas@southpole.se>,\n linux-openrisc@vger.kernel.org,\n Helge Deller <deller@gmx.de>,\n linux-parisc@vger.kernel.org,\n Michael Ellerman <mpe@ellerman.id.au>,\n linuxppc-dev@lists.ozlabs.org,\n Paul Walmsley <pjw@kernel.org>,\n linux-riscv@lists.infradead.org,\n Heiko Carstens <hca@linux.ibm.com>,\n linux-s390@vger.kernel.org,\n \"David S. Miller\" <davem@davemloft.net>,\n sparclinux@vger.kernel.org",
        "X-Spam-Status": "No, score=-1.2 required=5.0 tests=ARC_SIGNED,ARC_VALID,\n\tDKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DMARC_PASS,\n\tMAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=disabled\n\tversion=4.0.1",
        "X-Spam-Checker-Version": "SpamAssassin 4.0.1 (2024-03-25) on gandalf.ozlabs.org"
    },
    "content": "Calculating a timeout from get_cycles() is a historical leftover without\nany functional requirement.\n\nUse ktime_get() instead.\n\nSigned-off-by: Thomas Gleixner <tglx@kernel.org>\n---\n drivers/misc/sgi-gru/gruhandles.c   |   20 ++++++++------------\n drivers/misc/sgi-gru/grukservices.c |    3 ++-\n drivers/misc/sgi-gru/grutlbpurge.c  |    5 ++---\n 3 files changed, 12 insertions(+), 16 deletions(-)",
    "diff": "--- a/drivers/misc/sgi-gru/gruhandles.c\n+++ b/drivers/misc/sgi-gru/gruhandles.c\n@@ -6,26 +6,22 @@\n  */\n \n #include <linux/kernel.h>\n+#include <linux/timekeeping.h>\n #include \"gru.h\"\n #include \"grulib.h\"\n #include \"grutables.h\"\n \n-/* 10 sec */\n #include <linux/sync_core.h>\n-#include <asm/tsc.h>\n-#define GRU_OPERATION_TIMEOUT\t((cycles_t) tsc_khz*10*1000)\n-#define CLKS2NSEC(c)\t\t((c) * 1000000 / tsc_khz)\n+\n+#define GRU_OPERATION_TIMEOUT_NSEC\t(((ktime_t)10 * NSEC_PER_SEC))\n \n /* Extract the status field from a kernel handle */\n #define GET_MSEG_HANDLE_STATUS(h)\t(((*(unsigned long *)(h)) >> 16) & 3)\n \n struct mcs_op_statistic mcs_op_statistics[mcsop_last];\n \n-static void update_mcs_stats(enum mcs_op op, unsigned long clks)\n+static void update_mcs_stats(enum mcs_op op, unsigned long nsec)\n {\n-\tunsigned long nsec;\n-\n-\tnsec = CLKS2NSEC(clks);\n \tatomic_long_inc(&mcs_op_statistics[op].count);\n \tatomic_long_add(nsec, &mcs_op_statistics[op].total);\n \tif (mcs_op_statistics[op].max < nsec)\n@@ -58,21 +54,21 @@ static void report_instruction_timeout(v\n \n static int wait_instruction_complete(void *h, enum mcs_op opc)\n {\n+\tktime_t start_time = ktime_get();\n \tint status;\n-\tunsigned long start_time = get_cycles();\n \n \twhile (1) {\n \t\tcpu_relax();\n \t\tstatus = GET_MSEG_HANDLE_STATUS(h);\n \t\tif (status != CCHSTATUS_ACTIVE)\n \t\t\tbreak;\n-\t\tif (GRU_OPERATION_TIMEOUT < (get_cycles() - start_time)) {\n+\t\tif (GRU_OP_TIMEOUT_NSEC < (ktime_get() - start_time)) {\n \t\t\treport_instruction_timeout(h);\n-\t\t\tstart_time = get_cycles();\n+\t\t\tstart_time = ktime_get();\n \t\t}\n \t}\n \tif (gru_options & OPT_STATS)\n-\t\tupdate_mcs_stats(opc, get_cycles() - start_time);\n+\t\tupdate_mcs_stats(opc, (unsigned long)(ktime_get() - start_time));\n \treturn status;\n }\n \n--- a/drivers/misc/sgi-gru/grukservices.c\n+++ b/drivers/misc/sgi-gru/grukservices.c\n@@ -20,6 +20,7 @@\n #include <linux/uaccess.h>\n #include <linux/delay.h>\n #include <linux/export.h>\n+#include <linux/random.h>\n #include <asm/io_apic.h>\n #include \"gru.h\"\n #include \"grulib.h\"\n@@ -1106,7 +1107,7 @@ static int quicktest3(unsigned long arg)\n \tint ret = 0;\n \n \tmemset(buf2, 0, sizeof(buf2));\n-\tmemset(buf1, get_cycles() & 255, sizeof(buf1));\n+\tmemset(buf1, get_random_u32() & 255, sizeof(buf1));\n \tgru_copy_gpa(uv_gpa(buf2), uv_gpa(buf1), BUFSIZE);\n \tif (memcmp(buf1, buf2, BUFSIZE)) {\n \t\tprintk(KERN_DEBUG \"GRU:%d quicktest3 error\\n\", smp_processor_id());\n--- a/drivers/misc/sgi-gru/grutlbpurge.c\n+++ b/drivers/misc/sgi-gru/grutlbpurge.c\n@@ -22,13 +22,12 @@\n #include <linux/delay.h>\n #include <linux/timex.h>\n #include <linux/srcu.h>\n+#include <linux/random.h>\n #include <asm/processor.h>\n #include \"gru.h\"\n #include \"grutables.h\"\n #include <asm/uv/uv_hub.h>\n \n-#define gru_random()\tget_cycles()\n-\n /* ---------------------------------- TLB Invalidation functions --------\n  * get_tgh_handle\n  *\n@@ -49,7 +48,7 @@ static inline int get_off_blade_tgh(stru\n \tint n;\n \n \tn = GRU_NUM_TGH - gru->gs_tgh_first_remote;\n-\tn = gru_random() % n;\n+\tn = get_random_u32() % n;\n \tn += gru->gs_tgh_first_remote;\n \treturn n;\n }\n",
    "prefixes": [
        "11/38"
    ]
}