get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 812688,
    "url": "http://patchwork.ozlabs.org/api/patches/812688/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/linuxppc-dev/patch/20170912043859.32473-5-bsingharora@gmail.com/",
    "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": "<20170912043859.32473-5-bsingharora@gmail.com>",
    "list_archive_url": "https://lore.kernel.org/linuxppc-dev/20170912043859.32473-5-bsingharora@gmail.com/",
    "date": "2017-09-12T04:38:59",
    "name": "[v1,4/4] powerpc/mce: hookup memory_failure for UE errors",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "58792faee8d475e5548eae34ee78309adaddfed7",
    "submitter": {
        "id": 9347,
        "url": "http://patchwork.ozlabs.org/api/people/9347/?format=api",
        "name": "Balbir Singh",
        "email": "bsingharora@gmail.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/linuxppc-dev/patch/20170912043859.32473-5-bsingharora@gmail.com/mbox/",
    "series": [
        {
            "id": 2612,
            "url": "http://patchwork.ozlabs.org/api/series/2612/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/linuxppc-dev/list/?series=2612",
            "date": "2017-09-12T04:38:55",
            "name": "Revisit MCE handling for UE Errors",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/2612/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/812688/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/812688/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 3xrskl5yfMz9s1h\n\tfor <patchwork-incoming@ozlabs.org>;\n\tTue, 12 Sep 2017 14:48:47 +1000 (AEST)",
            "from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 3xrskl4MKNzDqZs\n\tfor <patchwork-incoming@ozlabs.org>;\n\tTue, 12 Sep 2017 14:48:47 +1000 (AEST)",
            "from mail-pf0-x243.google.com (mail-pf0-x243.google.com\n\t[IPv6:2607:f8b0:400e:c00::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 3xrsWy0YvZzDrJc\n\tfor <linuxppc-dev@lists.ozlabs.org>;\n\tTue, 12 Sep 2017 14:39:26 +1000 (AEST)",
            "by mail-pf0-x243.google.com with SMTP id f84so5793851pfj.3\n\tfor <linuxppc-dev@lists.ozlabs.org>;\n\tMon, 11 Sep 2017 21:39:25 -0700 (PDT)",
            "from firefly.ozlabs.ibm.com ([122.99.82.10])\n\tby smtp.gmail.com with ESMTPSA id\n\tc62sm1165226pfl.84.2017.09.11.21.39.21\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tMon, 11 Sep 2017 21:39:23 -0700 (PDT)"
        ],
        "Authentication-Results": [
            "ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"Kd1tPHZY\"; dkim-atps=neutral",
            "lists.ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"Kd1tPHZY\"; dkim-atps=neutral",
            "ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=gmail.com\n\t(client-ip=2607:f8b0:400e:c00::243; helo=mail-pf0-x243.google.com;\n\tenvelope-from=bsingharora@gmail.com; receiver=<UNKNOWN>)",
            "lists.ozlabs.org; dkim=pass (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"Kd1tPHZY\"; dkim-atps=neutral"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references;\n\tbh=USjdrazhYwnLQivP5P9GUvQcOAYun+BWk3bmmpiiTIw=;\n\tb=Kd1tPHZYHm92ZaUt4dNxsbHh71l1kHdBQSr0R4dtFUex/hZ5c9Vc+KibPi/27FidUz\n\tF/ZVRwJLZJ93P3VKv5vn3CAKC9Epd+SekvwFiZe6OdUXur77H+yrsienFAHE2nZIKPWN\n\tByDkYmhWuK/gOVMTuicCOZjc0LOA93aXj/eNy4vqjtXhATFgbJvi5q+vCIGVffCZ4mae\n\taoRNBZotTY+SxeMTVKRCBHRgY7H9RQF3HSr6pXU7+2QqSgJdt0VFBw22YAGY0Yh/Mpd7\n\tBYBwEuePOdxHbZcKpg4WcMH7aQL96yMYk9Bl1rfCKl95D+gIyAfO0+Fq8f0vUxbenKSn\n\tqnRw==",
        "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=USjdrazhYwnLQivP5P9GUvQcOAYun+BWk3bmmpiiTIw=;\n\tb=aA4zsASG95EcqvaTQJiF4QSzWyYWNTatxQ3sLzacRfuhk5VtvwGxcp7wdkJh1I8QZF\n\t0m1Q+O9pHHEJyE7YsMra7SCUuViz4jY4IWzsuCZ5AD3Rjy9KEsa9NNtq6KF3V3WEXfDn\n\ttamoMYQMMmbbJigGu49YAQic+lA46wFPE/+pogLuwp7lAFVcp8xmBdnCpYo8LoVI3+Mm\n\tCJ0OErZ26TYN0r/1bUT0byAvQxfsLrmpC0JE9i8RAjwlYmNp4CF/7ktvke+SjJE4K2kB\n\t96Qh6896HtbAqB6N5AZNnD+LpbodiRobGipJtBHDiPWpaZ1+Xml79mX05Qp0wq/950zj\n\tuJfA==",
        "X-Gm-Message-State": "AHPjjUh4qLTQ9htUroeBHdbryNJnP6lP7eStnFW7re8fj/o+WXRKXDai\n\tfjHff+zEMoXlZg==",
        "X-Google-Smtp-Source": "ADKCNb5Boj712f8Pre3anQOIEdwsOpoMZnUKk+5CTVmdnsivwJIAsqtFX/1WZohiLQRNjfo9IipLWg==",
        "X-Received": "by 10.98.32.92 with SMTP id g89mr13866165pfg.285.1505191164274; \n\tMon, 11 Sep 2017 21:39:24 -0700 (PDT)",
        "From": "Balbir Singh <bsingharora@gmail.com>",
        "To": "mpe@ellerman.id.au",
        "Subject": "[PATCH v1 4/4] powerpc/mce: hookup memory_failure for UE errors",
        "Date": "Tue, 12 Sep 2017 14:38:59 +1000",
        "Message-Id": "<20170912043859.32473-5-bsingharora@gmail.com>",
        "X-Mailer": "git-send-email 2.9.5",
        "In-Reply-To": "<20170912043859.32473-1-bsingharora@gmail.com>",
        "References": "<20170912043859.32473-1-bsingharora@gmail.com>",
        "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": "mahesh@linux.vnet.ibm.com, linuxppc-dev@lists.ozlabs.org,\n\tnpiggin@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": "If we are in user space and hit a UE error, we now have the\nbasic infrastructure to walk the page tables and find out\nthe effective address that was accessed, since the DAR\nis not valid.\n\nWe use a work_queue content to hookup the bad pfn, any\nother context causes problems, since memory_failure itself\ncan call into schedule() via lru_drain_ bits.\n\nWe could probably poison the struct page to avoid a race\nbetween detection and taking corrective action.\n\nSigned-off-by: Balbir Singh <bsingharora@gmail.com>\n---\n arch/powerpc/kernel/mce.c | 63 ++++++++++++++++++++++++++++++++++++++++++++---\n 1 file changed, 60 insertions(+), 3 deletions(-)",
    "diff": "diff --git a/arch/powerpc/kernel/mce.c b/arch/powerpc/kernel/mce.c\nindex f41a75d..d9be9e4 100644\n--- a/arch/powerpc/kernel/mce.c\n+++ b/arch/powerpc/kernel/mce.c\n@@ -39,11 +39,21 @@ static DEFINE_PER_CPU(struct machine_check_event[MAX_MC_EVT], mce_event);\n static DEFINE_PER_CPU(int, mce_queue_count);\n static DEFINE_PER_CPU(struct machine_check_event[MAX_MC_EVT], mce_event_queue);\n \n+/* Queue for delayed MCE UE events. */\n+static DEFINE_PER_CPU(int, mce_ue_count);\n+static DEFINE_PER_CPU(struct machine_check_event[MAX_MC_EVT],\n+\t\t\t\t\tmce_ue_event_queue);\n+\n static void machine_check_process_queued_event(struct irq_work *work);\n+void machine_check_ue_event(struct machine_check_event *evt);\n+static void machine_process_ue_event(struct work_struct *work);\n+\n static struct irq_work mce_event_process_work = {\n         .func = machine_check_process_queued_event,\n };\n \n+DECLARE_WORK(mce_ue_event_work, machine_process_ue_event);\n+\n static void mce_set_error_info(struct machine_check_event *mce,\n \t\t\t       struct mce_error_info *mce_err)\n {\n@@ -143,6 +153,7 @@ void save_mce_event(struct pt_regs *regs, long handled,\n \t\tif (phys_addr != ULONG_MAX) {\n \t\t\tmce->u.ue_error.physical_address_provided = true;\n \t\t\tmce->u.ue_error.physical_address = phys_addr;\n+\t\t\tmachine_check_ue_event(mce);\n \t\t}\n \t}\n \treturn;\n@@ -197,6 +208,26 @@ void release_mce_event(void)\n \tget_mce_event(NULL, true);\n }\n \n+\n+/*\n+ * Queue up the MCE event which then can be handled later.\n+ */\n+void machine_check_ue_event(struct machine_check_event *evt)\n+{\n+\tint index;\n+\n+\tindex = __this_cpu_inc_return(mce_ue_count) - 1;\n+\t/* If queue is full, just return for now. */\n+\tif (index >= MAX_MC_EVT) {\n+\t\t__this_cpu_dec(mce_ue_count);\n+\t\treturn;\n+\t}\n+\tmemcpy(this_cpu_ptr(&mce_ue_event_queue[index]), evt, sizeof(*evt));\n+\n+\t/* Queue work to process this event later. */\n+\tschedule_work(&mce_ue_event_work);\n+}\n+\n /*\n  * Queue up the MCE event which then can be handled later.\n  */\n@@ -219,7 +250,32 @@ void machine_check_queue_event(void)\n \t/* Queue irq work to process this event later. */\n \tirq_work_queue(&mce_event_process_work);\n }\n-\n+/*\n+ * process pending MCE event from the mce event queue. This function will be\n+ * called during syscall exit.\n+ */\n+static void machine_process_ue_event(struct work_struct *work)\n+{\n+\tint index;\n+\tstruct machine_check_event *evt;\n+\n+\twhile (__this_cpu_read(mce_ue_count) > 0) {\n+\t\tindex = __this_cpu_read(mce_ue_count) - 1;\n+\t\tevt = this_cpu_ptr(&mce_ue_event_queue[index]);\n+#ifdef CONFIG_MEMORY_FAILURE\n+\t\t/*\n+\t\t * This should probably queued elsewhere, but\n+\t\t * oh! well\n+\t\t */\n+\t\tif (evt->error_type == MCE_ERROR_TYPE_UE) {\n+\t\t\tif (evt->u.ue_error.physical_address_provided)\n+\t\t\t\tmemory_failure(evt->u.ue_error.physical_address,\n+\t\t\t\t\t\tSIGBUS, 0);\n+\t\t}\n+#endif\n+\t\t__this_cpu_dec(mce_ue_count);\n+\t}\n+}\n /*\n  * process pending MCE event from the mce event queue. This function will be\n  * called during syscall exit.\n@@ -227,6 +283,7 @@ void machine_check_queue_event(void)\n static void machine_check_process_queued_event(struct irq_work *work)\n {\n \tint index;\n+\tstruct machine_check_event *evt;\n \n \tadd_taint(TAINT_MACHINE_CHECK, LOCKDEP_NOW_UNRELIABLE);\n \n@@ -236,8 +293,8 @@ static void machine_check_process_queued_event(struct irq_work *work)\n \t */\n \twhile (__this_cpu_read(mce_queue_count) > 0) {\n \t\tindex = __this_cpu_read(mce_queue_count) - 1;\n-\t\tmachine_check_print_event_info(\n-\t\t\t\tthis_cpu_ptr(&mce_event_queue[index]), false);\n+\t\tevt = this_cpu_ptr(&mce_event_queue[index]);\n+\t\tmachine_check_print_event_info(evt, false);\n \t\t__this_cpu_dec(mce_queue_count);\n \t}\n }\n",
    "prefixes": [
        "v1",
        "4/4"
    ]
}