get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 813176,
    "url": "http://patchwork.ozlabs.org/api/patches/813176/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/linuxppc-dev/patch/20170913061049.13256-6-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": "<20170913061049.13256-6-bsingharora@gmail.com>",
    "list_archive_url": "https://lore.kernel.org/linuxppc-dev/20170913061049.13256-6-bsingharora@gmail.com/",
    "date": "2017-09-13T06:10:49",
    "name": "[v2,5/5] powerpc/mce: hookup memory_failure for UE errors",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "82a709fd6612e85085950288a1957b8efc846f8e",
    "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/20170913061049.13256-6-bsingharora@gmail.com/mbox/",
    "series": [
        {
            "id": 2813,
            "url": "http://patchwork.ozlabs.org/api/series/2813/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/linuxppc-dev/list/?series=2813",
            "date": "2017-09-13T06:10:44",
            "name": "Revisit MCE handling for UE Errors",
            "version": 2,
            "mbox": "http://patchwork.ozlabs.org/series/2813/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/813176/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/813176/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 3xsWnW5JkPz9sNr\n\tfor <patchwork-incoming@ozlabs.org>;\n\tWed, 13 Sep 2017 16:23:27 +1000 (AEST)",
            "from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 3xsWnW49QfzDrLH\n\tfor <patchwork-incoming@ozlabs.org>;\n\tWed, 13 Sep 2017 16:23:27 +1000 (AEST)",
            "from mail-pg0-x244.google.com (mail-pg0-x244.google.com\n\t[IPv6:2607:f8b0:400e:c05::244])\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 3xsWWT2rjyzDqlw\n\tfor <linuxppc-dev@lists.ozlabs.org>;\n\tWed, 13 Sep 2017 16:11:17 +1000 (AEST)",
            "by mail-pg0-x244.google.com with SMTP id d8so7219238pgt.3\n\tfor <linuxppc-dev@lists.ozlabs.org>;\n\tTue, 12 Sep 2017 23:11:17 -0700 (PDT)",
            "from firefly.ozlabs.ibm.com.ozlabs.ibm.com ([122.99.82.10])\n\tby smtp.gmail.com with ESMTPSA id\n\tt65sm22581016pfk.59.2017.09.12.23.11.13\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tTue, 12 Sep 2017 23:11: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=\"NaFPFXE4\"; 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=\"NaFPFXE4\"; dkim-atps=neutral",
            "ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=gmail.com\n\t(client-ip=2607:f8b0:400e:c05::244; helo=mail-pg0-x244.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=\"NaFPFXE4\"; 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=cECGM+0G/4eADdQdhvO66cUnmE3FepoBp80aqCAg8s0=;\n\tb=NaFPFXE4FMIcsppQK+LNXwALSf4d+97xMp+Auan0m6IPw6edKEqQg7QC0BR01xiliA\n\tS5Ltn+FDY/QrhCQ1OSdqwHJUZR2Kh6RmnMMU7iDluHtgXlSgYYW7+37szK4mPLJxzhb6\n\t5pEyl+vuh7H5wkvlRM06asonvR3IzsUe/ZXJc93bHUKM25vtXM/q/3i13zSZaKHWDeGB\n\t/D4ROprwfMlkNh7pvWtXW83DlHm7IEh9pqZlCk2sD8nw21hA+zmMjNP6Y8BLhVc5Ly+8\n\t9fc+BOmPjZOuUiGPn9XhYr7aJGGnKG/lPFGQVcmD7vzc4UL/2ExjFgzQf5Zjc1SfSPEr\n\te/Pg==",
        "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=cECGM+0G/4eADdQdhvO66cUnmE3FepoBp80aqCAg8s0=;\n\tb=ReSHeOp6eLeeEKB4Clb0Sqk7aHNPyYLM+AsaO1sIpGpX2kZqRcORZOMAUlqaGvpdFL\n\tm5PAVlCmrFeiffYixVWGmp3VQD9j6CCGp017eedV68LvPIPDDJXeZF5dxM/8r4PWJoFX\n\tkpK5E6AWEenVLUm8WErN7M3I48hElPq/T5P0WW8DMHEEQyGh0FO18Wq7tLoPe4l2vJoS\n\tXFo8Yl40FvORBBGxTg7hijcNgtSCUY0EmUWvV+KHWMOIANB0sUItNHwv+8T4FAyNFKwH\n\tNSaRNCWu3kNqRdOMdr8OlwkPxHgm+RM1+HeoWeE2LKvEuJ1zvDjmhNdu3o1R2LANv2mI\n\tCoQg==",
        "X-Gm-Message-State": "AHPjjUjj0t/fUHWYqTefImU37H/az9Niro5IWYSRu61g/jZuUc9IuOga\n\tuFYXuJUNpfa1eA==",
        "X-Google-Smtp-Source": "AOwi7QCcNznM1k99z3i8VvN61OEpgdcMtQIwIYSr1bBZvxW5JaOrFH8xLAOXZYIYNOmBoe/eMBVcMA==",
        "X-Received": "by 10.101.78.12 with SMTP id r12mr3918694pgt.289.1505283075564; \n\tTue, 12 Sep 2017 23:11:15 -0700 (PDT)",
        "From": "Balbir Singh <bsingharora@gmail.com>",
        "To": "mpe@ellerman.id.au,\n\tnpiggin@gmail.com,\n\tmahesh@linux.vnet.ibm.com",
        "Subject": "[PATCH v2 5/5] powerpc/mce: hookup memory_failure for UE errors",
        "Date": "Wed, 13 Sep 2017 16:10:49 +1000",
        "Message-Id": "<20170913061049.13256-6-bsingharora@gmail.com>",
        "X-Mailer": "git-send-email 2.9.5",
        "In-Reply-To": "<20170913061049.13256-1-bsingharora@gmail.com>",
        "References": "<20170913061049.13256-1-bsingharora@gmail.com>",
        "X-BeenThere": "linuxppc-dev@lists.ozlabs.org",
        "X-Mailman-Version": "2.1.24",
        "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@lists.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 | 67 ++++++++++++++++++++++++++++++++++++++++++++---\n 1 file changed, 64 insertions(+), 3 deletions(-)",
    "diff": "diff --git a/arch/powerpc/kernel/mce.c b/arch/powerpc/kernel/mce.c\nindex c7acc33..f20345a 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,36 @@ 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\telse\n+\t\t\t\tpr_warn(\"Failed to identify bad address from \"\n+\t\t\t\t\t\"where the uncorrectable error (UE) \"\n+\t\t\t\t\t\"was generated\\n\");\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 +287,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 +297,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": [
        "v2",
        "5/5"
    ]
}