get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 809919,
    "url": "http://patchwork.ozlabs.org/api/patches/809919/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/linuxppc-dev/patch/20170905041555.27696-4-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": "<20170905041555.27696-4-bsingharora@gmail.com>",
    "list_archive_url": "https://lore.kernel.org/linuxppc-dev/20170905041555.27696-4-bsingharora@gmail.com/",
    "date": "2017-09-05T04:15:55",
    "name": "[rfc,3/3] powerpc/mce: hookup memory_failure for UE errors",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "a04180b472c4056a3f54132e252689d2cc2fd167",
    "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/20170905041555.27696-4-bsingharora@gmail.com/mbox/",
    "series": [
        {
            "id": 1484,
            "url": "http://patchwork.ozlabs.org/api/series/1484/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/linuxppc-dev/list/?series=1484",
            "date": "2017-09-05T04:15:52",
            "name": "Revisit MCE handling for UE errors",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/1484/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/809919/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/809919/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",
            "linuxppc-dev@ozlabs.org"
        ],
        "Received": [
            "from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3])\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 3xmYVk3dLGz9s9Y\n\tfor <patchwork-incoming@ozlabs.org>;\n\tTue,  5 Sep 2017 14:23: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 3xmYVk2GVZzDrCc\n\tfor <patchwork-incoming@ozlabs.org>;\n\tTue,  5 Sep 2017 14:23:26 +1000 (AEST)",
            "from ozlabs.org (bilbo.ozlabs.org [103.22.144.67])\n\t(using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby lists.ozlabs.org (Postfix) with ESMTPS id 3xmYLV1ZCJzDrFs\n\tfor <linuxppc-dev@lists.ozlabs.org>;\n\tTue,  5 Sep 2017 14:16:18 +1000 (AEST)",
            "from ozlabs.org (ozlabs.org [IPv6:2401:3900:2:1::2])\n\tby bilbo.ozlabs.org (Postfix) with ESMTP id 3xmYLT6blDz8t2N\n\tfor <linuxppc-dev@lists.ozlabs.org>;\n\tTue,  5 Sep 2017 14:16:17 +1000 (AEST)",
            "by ozlabs.org (Postfix)\n\tid 3xmYLT5kNVz9sPk; Tue,  5 Sep 2017 14:16:17 +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 ozlabs.org (Postfix) with ESMTPS id 3xmYLT1wsLz9s9Y\n\tfor <linuxppc-dev@ozlabs.org>; Tue,  5 Sep 2017 14:16:17 +1000 (AEST)",
            "by mail-pf0-x243.google.com with SMTP id q76so1096876pfq.5\n\tfor <linuxppc-dev@ozlabs.org>; Mon, 04 Sep 2017 21:16:17 -0700 (PDT)",
            "from firefly.ozlabs.ibm.com.ozlabs.ibm.com ([122.99.82.10])\n\tby smtp.gmail.com with ESMTPSA id\n\tw6sm11634415pfb.13.2017.09.04.21.16.13\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tMon, 04 Sep 2017 21:16:15 -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=\"WHkJRuys\"; 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=\"WHkJRuys\"; dkim-atps=neutral",
            "lists.ozlabs.org; dkim=pass (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"WHkJRuys\"; 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>)",
            "ozlabs.org; dkim=pass (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"WHkJRuys\"; 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=VPjUmjjSefPl+etqJghvHPnjnp8xpvT28eia49hq/JU=;\n\tb=WHkJRuysaP5YSeAAxdRw0Oj/p/YrXOc7d9EPIBAYUNiOJ6f53O50qZF8Vg2moH+8fK\n\t8mow5fl876L3f3dDzoEmRAW4BsJ4wcBnJnUBRG7gfm+9K5EEK4CkPArk2wCbv9pTmgXE\n\tUxmZOI9VO7u9T+vkT4mUl8S0vvZaCCFIppBhQfi2fp/azdaU6YYHCrNpeHK6TxwdvvlM\n\tQNuumgpmfp4w+w6xr7rgke/GSR2mhXla14legpaUOO0aiPxIaJmY7owmzrOAm5zV8eO4\n\tqPncMOoYAJdnOy8YteIv59F4y4nLArj71o1qRKSo/Xaddnd6Lb1vdGwxOujzZB3YYCfe\n\tudUQ==",
        "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=VPjUmjjSefPl+etqJghvHPnjnp8xpvT28eia49hq/JU=;\n\tb=Pp8WTiTePtsXEIVX+cAA3h3mbeu9/VNkmoKRj88iiCcTKBqm5v8ZJ6V0NsZ7tbPlOj\n\tRqR71LJe1DnRG02sAjx1IlXE6zl0Jo7aueO4LT1K4RIIxFjO3WZWY4tkfWdZOPcBJrwD\n\tkGgzSvVlkBKFNNpqZPBdUocRSIvm9TIs3nejtYUPWh6vtc7YWKaOQoIxuWbDuq7nFaZA\n\tpJVmO1qWD0Z70x32QDKSv31UZ3g3NRqXXlHCzdmEx5oVlrLi1IHeACexzw/cn7f1RdYY\n\tZIa8wY3hwkUYt3qSmXQz9nB0F6sTWGa3dpBK78/Rgasrs3+hqelWtIv/ZIPKQZIJqUHp\n\tKDvg==",
        "X-Gm-Message-State": "AHPjjUhkNeKXMrdljUbjOVlqKMTi09/SuDF0pHZoI8aBCw+L8j7s2+j7\n\tcdL6+F9DVPDIZw==",
        "X-Google-Smtp-Source": "ADKCNb6MnaLWTNKG6WvLr9yumXysPZsSQhxjYXm2eZMtAnUqA3Noi7u0ojN/RGcRDtV2Estcx/lwVA==",
        "X-Received": "by 10.101.77.197 with SMTP id q5mr2660158pgt.108.1504584975720; \n\tMon, 04 Sep 2017 21:16:15 -0700 (PDT)",
        "From": "Balbir Singh <bsingharora@gmail.com>",
        "To": "npiggin@gmail.com,\n\tmahesh@linux.vnet.ibm.com,\n\talistair@popple.id.au",
        "Subject": "[rfc 3/3] powerpc/mce: hookup memory_failure for UE errors",
        "Date": "Tue,  5 Sep 2017 14:15:55 +1000",
        "Message-Id": "<20170905041555.27696-4-bsingharora@gmail.com>",
        "X-Mailer": "git-send-email 2.9.5",
        "In-Reply-To": "<20170905041555.27696-1-bsingharora@gmail.com>",
        "References": "<20170905041555.27696-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": "linuxppc-dev@ozlabs.org",
        "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 | 62 ++++++++++++++++++++++++++++++++++++++++++++---\n 1 file changed, 59 insertions(+), 3 deletions(-)",
    "diff": "diff --git a/arch/powerpc/kernel/mce.c b/arch/powerpc/kernel/mce.c\nindex f41a75d..39986d5 100644\n--- a/arch/powerpc/kernel/mce.c\n+++ b/arch/powerpc/kernel/mce.c\n@@ -39,11 +39,20 @@ 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], mce_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 +152,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 +207,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 +249,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 +282,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 +292,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": [
        "rfc",
        "3/3"
    ]
}