get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 2235037,
    "url": "http://patchwork.ozlabs.org/api/1.2/patches/2235037/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/linuxppc-dev/patch/20260508131647.43868-2-frederic@kernel.org/",
    "project": {
        "id": 2,
        "url": "http://patchwork.ozlabs.org/api/1.2/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": "<20260508131647.43868-2-frederic@kernel.org>",
    "list_archive_url": "https://lore.kernel.org/linuxppc-dev/20260508131647.43868-2-frederic@kernel.org/",
    "date": "2026-05-08T13:16:33",
    "name": "[01/15] tick/sched: Fix TOCTOU in nohz idle time fetch",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "a4d22d9f72ab5c8394bb038662db453fb5222f5d",
    "submitter": {
        "id": 79411,
        "url": "http://patchwork.ozlabs.org/api/1.2/people/79411/?format=api",
        "name": "Frederic Weisbecker",
        "email": "frederic@kernel.org"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/linuxppc-dev/patch/20260508131647.43868-2-frederic@kernel.org/mbox/",
    "series": [
        {
            "id": 503389,
            "url": "http://patchwork.ozlabs.org/api/1.2/series/503389/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/linuxppc-dev/list/?series=503389",
            "date": "2026-05-08T13:16:32",
            "name": "tick/sched: Refactor idle cputime accounting",
            "version": 4,
            "mbox": "http://patchwork.ozlabs.org/series/503389/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/2235037/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2235037/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "\n <linuxppc-dev+bounces-20611-incoming=patchwork.ozlabs.org@lists.ozlabs.org>",
        "X-Original-To": [
            "incoming@patchwork.ozlabs.org",
            "linuxppc-dev@lists.ozlabs.org"
        ],
        "Delivered-To": "patchwork-incoming@legolas.ozlabs.org",
        "Authentication-Results": [
            "legolas.ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256\n header.s=k20201202 header.b=NmqMd9nq;\n\tdkim-atps=neutral",
            "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org\n (client-ip=2404:9400:21b9:f100::1; helo=lists.ozlabs.org;\n envelope-from=linuxppc-dev+bounces-20611-incoming=patchwork.ozlabs.org@lists.ozlabs.org;\n receiver=patchwork.ozlabs.org)",
            "lists.ozlabs.org;\n arc=none smtp.remote-ip=172.105.4.254",
            "lists.ozlabs.org;\n dmarc=pass (p=quarantine dis=none) header.from=kernel.org",
            "lists.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=NmqMd9nq;\n\tdkim-atps=neutral",
            "lists.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=kernel.org\n (client-ip=172.105.4.254; helo=tor.source.kernel.org;\n envelope-from=frederic@kernel.org; receiver=lists.ozlabs.org)"
        ],
        "Received": [
            "from lists.ozlabs.org (lists.ozlabs.org\n [IPv6:2404:9400:21b9:f100::1])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1 raw public key)\n server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4gBqRB6PtKz1yJq\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 08 May 2026 23:17:26 +1000 (AEST)",
            "from boromir.ozlabs.org (localhost [127.0.0.1])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 4gBqR31D2pz30RN;\n\tFri, 08 May 2026 23:17:19 +1000 (AEST)",
            "from tor.source.kernel.org (tor.source.kernel.org [172.105.4.254])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature RSA-PSS (2048 bits) server-digest\n SHA256)\n\t(No client certificate requested)\n\tby lists.ozlabs.org (Postfix) with ESMTPS id 4gBqR21jTbz2xQC\n\tfor <linuxppc-dev@lists.ozlabs.org>; Fri, 08 May 2026 23:17:18 +1000 (AEST)",
            "from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58])\n\tby tor.source.kernel.org (Postfix) with ESMTP id 604DE60052;\n\tFri,  8 May 2026 13:17:15 +0000 (UTC)",
            "by smtp.kernel.org (Postfix) with ESMTPSA id 2F370C2BCB8;\n\tFri,  8 May 2026 13:17:07 +0000 (UTC)"
        ],
        "ARC-Seal": "i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1778246239;\n\tcv=none;\n b=QqsRM1uC0kDEb8BuEi6CtjZvyPeR2jplxcVDeg8EnUPpR7AC/9Ax7wTMRWubuY1t2t5aqbS1qhW/vN7sfKeOft586IZnfT4E7BYGZQRAOX4U8BAOKcdGt4Ze2mtOHizQ+rqaeunmI0DRr3JPv6m2VmUCEMa4Dx4ygCSf6ZmvJX2igbU9dkDMjnmyaEE6fM7acKBGFl2brwPqMoa+of/FFal0zVxUGGioNPtPItVWpLMXwicUVVhZa61rff6yC8kDvoD4QargY13FhV4/tkETS+AMtxjIv0XCtb0fGFhYXCCBNd85C7oUGSMn+Iomhiy+aAmvVuWymJoPw8OVIQhv6A==",
        "ARC-Message-Signature": "i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707;\n\tt=1778246239; c=relaxed/relaxed;\n\tbh=AfCDR3WypzrS9UBfIYRWqQLV9CXwH0GTwCToV4zUyXY=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version;\n b=L3sV67sWZahBNwuvyZafnnWkr3po4kwSZCJLcim4QR+B/Dh+Hxr0Je78/z6Xp3Z2a5hMomN+LC1o2lnZyOI4GE6hELsOE5C7cROfSa1e1/6cyC5BND7kmFaGQyPKNKh9pTZmMGRPris1TZWPOrxVc/DJasazKt9zXH3/7VEVPF3zzOmijM9T3eXBFK56emodf9KyRBdLAUAdNRV9YTuAEszSe3jdi8OfBykEfX5tx1Xhs9rUPhZK6VQ9ttVBYliBVxUr1FZm+GtWuGQURo8u/m8k3GBWB0/GWi6YLHjaMN6ISuIJUiC41hW38seOz+0ZeRwp8KkCZU4HYQfsTRXAtg==",
        "ARC-Authentication-Results": "i=1; lists.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=NmqMd9nq; dkim-atps=neutral;\n spf=pass (client-ip=172.105.4.254; helo=tor.source.kernel.org;\n envelope-from=frederic@kernel.org;\n receiver=lists.ozlabs.org) smtp.mailfrom=kernel.org",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;\n\ts=k20201202; t=1778246235;\n\tbh=auNYKADD05SLlsp/9RYz5+LVvmnhMqjrsvSp8Ju4hXc=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=NmqMd9nq7hn4woGsz+DEgaq28CUB6LJXpklLRcwhPyjO9vgeTr1+3cmtj3FWbKsV/\n\t 5TkXkZ+SdTaVAeNvXcOr8pfQw8K+krvr+81SLj/aHPs1GBL86UBk6hNkLpoY9IQKVI\n\t nqFmsdeDcLO7sT7j26IJRNUZLe00M2AP6Qwnt4NfZt4l0DiBRrc755lwhpMlN4YCqs\n\t Vgj7bYiyp0bzNJFH7HcZnUprszddIl9TLq0FmW2TNdWYt/dAIwOxui9fbXYMdFTiBQ\n\t CJza4ccWbDGNwRDTCbBGx5b4BrcZ2ee5GPDcut1s1ZlRnZbRF3z6sEfXsXIe26hbaM\n\t LKiMXzlugQm9w==",
        "From": "Frederic Weisbecker <frederic@kernel.org>",
        "To": "LKML <linux-kernel@vger.kernel.org>",
        "Cc": "Frederic Weisbecker <frederic@kernel.org>,\n\t\"Christophe Leroy (CS GROUP)\" <chleroy@kernel.org>,\n\t\"Rafael J. Wysocki\" <rafael@kernel.org>,\n\tAlexander Gordeev <agordeev@linux.ibm.com>,\n\tAnna-Maria Behnsen <anna-maria@linutronix.de>,\n\tBen Segall <bsegall@google.com>, Boqun Feng <boqun.feng@gmail.com>,\n\tChristian Borntraeger <borntraeger@linux.ibm.com>,\n\tDietmar Eggemann <dietmar.eggemann@arm.com>,\n\tHeiko Carstens <hca@linux.ibm.com>, Ingo Molnar <mingo@kernel.org>,\n\tIngo Molnar <mingo@redhat.com>, Jan Kiszka <jan.kiszka@siemens.com>,\n\tJoel Fernandes <joelagnelf@nvidia.com>,\n\tJuri Lelli <juri.lelli@redhat.com>,\n\tKieran Bingham <kbingham@kernel.org>,\n\tMadhavan Srinivasan <maddy@linux.ibm.com>,\n\tMel Gorman <mgorman@suse.de>, Michael Ellerman <mpe@ellerman.id.au>,\n\tNeeraj Upadhyay <neeraj.upadhyay@kernel.org>,\n\tNicholas Piggin <npiggin@gmail.com>,\n\t\"Paul E . McKenney\" <paulmck@kernel.org>,\n\tPeter Zijlstra <peterz@infradead.org>, Sashiko@lists.ozlabs.org,\n\tShrikanth Hegde <sshegde@linux.ibm.com>,\n\tSteven Rostedt <rostedt@goodmis.org>,\n\tSven Schnelle <svens@linux.ibm.com>,\n\tThomas Gleixner <tglx@linutronix.de>,\n\tUladzislau Rezki <urezki@gmail.com>,\n\tValentin Schneider <vschneid@redhat.com>,\n\tVasily Gorbik <gor@linux.ibm.com>,\n\tVincent Guittot <vincent.guittot@linaro.org>,\n\tViresh Kumar <viresh.kumar@linaro.org>,\n\tXin Zhao <jackzxcui1989@163.com>, linux-pm@vger.kernel.org,\n\tlinux-s390@vger.kernel.org, linuxppc-dev@lists.ozlabs.org",
        "Subject": "[PATCH 01/15] tick/sched: Fix TOCTOU in nohz idle time fetch",
        "Date": "Fri,  8 May 2026 15:16:33 +0200",
        "Message-ID": "<20260508131647.43868-2-frederic@kernel.org>",
        "X-Mailer": "git-send-email 2.53.0",
        "In-Reply-To": "<20260508131647.43868-1-frederic@kernel.org>",
        "References": "<20260508131647.43868-1-frederic@kernel.org>",
        "X-Mailing-List": "linuxppc-dev@lists.ozlabs.org",
        "List-Id": "<linuxppc-dev.lists.ozlabs.org>",
        "List-Help": "<mailto:linuxppc-dev+help@lists.ozlabs.org>",
        "List-Owner": "<mailto:linuxppc-dev+owner@lists.ozlabs.org>",
        "List-Post": "<mailto:linuxppc-dev@lists.ozlabs.org>",
        "List-Archive": "<https://lore.kernel.org/linuxppc-dev/>,\n  <https://lists.ozlabs.org/pipermail/linuxppc-dev/>",
        "List-Subscribe": "<mailto:linuxppc-dev+subscribe@lists.ozlabs.org>,\n  <mailto:linuxppc-dev+subscribe-digest@lists.ozlabs.org>,\n  <mailto:linuxppc-dev+subscribe-nomail@lists.ozlabs.org>",
        "List-Unsubscribe": "<mailto:linuxppc-dev+unsubscribe@lists.ozlabs.org>",
        "Precedence": "list",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "X-Spam-Status": "No, score=-0.6 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,\n\tDKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS\n\tautolearn=disabled version=4.0.1 OzLabs 8",
        "X-Spam-Checker-Version": "SpamAssassin 4.0.1 (2024-03-25) on lists.ozlabs.org"
    },
    "content": "When the nohz idle time is fetched, the current clock timestamp is taken\noutside the seqcount, which can result in such a race as reported by\nSashiko:\n\n    get_cpu_sleep_time_us()                 tick_nohz_start_idle()\n    -----------------------                 ---------------------\n    now = ktime_get()\n                                            write_seqcount_begin(idle_sleeptime_seq);\n                                            idle_entrytime = ktime_get()\n                                            tick_sched_flag_set(ts, TS_FLAG_IDLE_ACTIVE);\n                                            write_seqcount_end(&ts->idle_sleeptime_seq);\n    read_seqcount_begin(idle_sleeptime_seq)\n    delta = now - idle_entrytime);\n    //!! But now < idle_entrytime\n    idle = *sleeptime +  delta;\n    read_seqcount_retry(&ts->idle_sleeptime_seq, seq)\n\nHere the read side fetches the timestamp before the write side and its\nupdate. As a result the time delta computed on the read side is negative\n(ktime_t is signed) and breaks the cputime monotonicity guarantee.\n\nThis could possibly be fixed with reading the current clock timestamp\ninside the seqcount but the reader overhead might then increase. Also\nsimply checking that the current timestamp is above the idle entry time\nis enough to prevent any issue of the like.\n\nReported-by: Sashiko\nFixes: 620a30fa0bd1 (\"timers/nohz: Protect idle/iowait sleep time under seqcount\")\nSigned-off-by: Frederic Weisbecker <frederic@kernel.org>\n---\n kernel/time/tick-sched.c | 11 ++++++-----\n 1 file changed, 6 insertions(+), 5 deletions(-)",
    "diff": "diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c\nindex cbbb87a0c6e7..171393367b5c 100644\n--- a/kernel/time/tick-sched.c\n+++ b/kernel/time/tick-sched.c\n@@ -797,15 +797,16 @@ static u64 get_cpu_sleep_time_us(struct tick_sched *ts, ktime_t *sleeptime,\n \t\t*last_update_time = ktime_to_us(now);\n \n \tdo {\n+\t\tktime_t delta = 0;\n+\n \t\tseq = read_seqcount_begin(&ts->idle_sleeptime_seq);\n \n \t\tif (tick_sched_flag_test(ts, TS_FLAG_IDLE_ACTIVE) && compute_delta) {\n-\t\t\tktime_t delta = ktime_sub(now, ts->idle_entrytime);\n-\n-\t\t\tidle = ktime_add(*sleeptime, delta);\n-\t\t} else {\n-\t\t\tidle = *sleeptime;\n+\t\t\tif (now > ts->idle_entrytime)\n+\t\t\t\tdelta = ktime_sub(now, ts->idle_entrytime);\n \t\t}\n+\n+\t\tidle = ktime_add(*sleeptime, delta);\n \t} while (read_seqcount_retry(&ts->idle_sleeptime_seq, seq));\n \n \treturn ktime_to_us(idle);\n",
    "prefixes": [
        "01/15"
    ]
}