get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 871,
    "url": "http://patchwork.ozlabs.org/api/patches/871/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/linuxppc-dev/patch/200809221841.27993.srinivasa@in.ibm.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": "<200809221841.27993.srinivasa@in.ibm.com>",
    "list_archive_url": "https://lore.kernel.org/linuxppc-dev/200809221841.27993.srinivasa@in.ibm.com/",
    "date": "2008-09-22T13:11:27",
    "name": "[RFC] Demultiplexing SIGTRAP signal",
    "commit_ref": null,
    "pull_url": null,
    "state": "rfc",
    "archived": true,
    "hash": "5f04221403a4d310b8408ce47d443d6f44c32728",
    "submitter": {
        "id": 390,
        "url": "http://patchwork.ozlabs.org/api/people/390/?format=api",
        "name": "Srinivasa Ds",
        "email": "srinivasa@in.ibm.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/linuxppc-dev/patch/200809221841.27993.srinivasa@in.ibm.com/mbox/",
    "series": [],
    "comments": "http://patchwork.ozlabs.org/api/patches/871/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/871/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@ozlabs.org>",
        "X-Original-To": [
            "patchwork-incoming@ozlabs.org",
            "linuxppc-dev@ozlabs.org"
        ],
        "Delivered-To": [
            "patchwork-incoming@ozlabs.org",
            "linuxppc-dev@ozlabs.org"
        ],
        "Received": [
            "from ozlabs.org (localhost [127.0.0.1])\n\tby ozlabs.org (Postfix) with ESMTP id 62A96DDFC3\n\tfor <patchwork-incoming@ozlabs.org>;\n\tMon, 22 Sep 2008 23:11:31 +1000 (EST)",
            "from e23smtp02.au.ibm.com (E23SMTP02.au.ibm.com [202.81.18.163])\n\t(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\n\t(Client CN \"e23smtp02.au.ibm.com\", Issuer \"Equifax\" (verified OK))\n\tby ozlabs.org (Postfix) with ESMTPS id 31282DDF11\n\tfor <linuxppc-dev@ozlabs.org>; Mon, 22 Sep 2008 23:11:17 +1000 (EST)",
            "from sd0109e.au.ibm.com (d23rh905.au.ibm.com [202.81.18.225])\n\tby e23smtp02.au.ibm.com (8.13.1/8.13.1) with ESMTP id m8MDAQsH025626\n\tfor <linuxppc-dev@ozlabs.org>; Mon, 22 Sep 2008 23:10:26 +1000",
            "from d23av02.au.ibm.com (d23av02.au.ibm.com [9.190.235.138])\n\tby sd0109e.au.ibm.com (8.13.8/8.13.8/NCO v9.1) with ESMTP id\n\tm8MDAbFn211470\n\tfor <linuxppc-dev@ozlabs.org>; Mon, 22 Sep 2008 23:10:59 +1000",
            "from d23av02.au.ibm.com (loopback [127.0.0.1])\n\tby d23av02.au.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id\n\tm8MDAbxo001866\n\tfor <linuxppc-dev@ozlabs.org>; Mon, 22 Sep 2008 23:10:37 +1000",
            "from srinivasa-009124031087.in.ibm.com\n\t(Srinivasa-009124031087.in.ibm.com [9.124.31.87])\n\tby d23av02.au.ibm.com (8.12.11.20060308/8.12.11) with ESMTP id\n\tm8MDAZGC001626; Mon, 22 Sep 2008 23:10:35 +1000"
        ],
        "From": "Srinivasa Ds <srinivasa@in.ibm.com>",
        "Organization": "IBM",
        "To": "Ingo Molnar <mingo@elte.hu>",
        "Subject": "Re: [RFC][PATCH] Demultiplexing SIGTRAP signal",
        "Date": "Mon, 22 Sep 2008 18:41:27 +0530",
        "User-Agent": "KMail/1.9.9",
        "References": "<200809221602.32616.srinivasa@in.ibm.com>\n\t<20080922104202.GE30137@elte.hu>",
        "In-Reply-To": "<20080922104202.GE30137@elte.hu>",
        "MIME-Version": "1.0",
        "Content-Disposition": "inline",
        "Message-Id": "<200809221841.27993.srinivasa@in.ibm.com>",
        "Cc": "linux-parisc@vger.kernel.org, linux-kernel@vger.kernel.org,\n\tlinuxppc-dev@ozlabs.org, paulus@samba.org,\n\t\"H. Peter Anvin\" <hpa@zytor.com>, akpm@linux-foundation.org,\n\tThomas Gleixner <tglx@linutronix.de>, Roland McGrath <roland@redhat.com>",
        "X-BeenThere": "linuxppc-dev@ozlabs.org",
        "X-Mailman-Version": "2.1.11",
        "Precedence": "list",
        "List-Id": "Linux on PowerPC Developers Mail List <linuxppc-dev.ozlabs.org>",
        "List-Unsubscribe": "<https://ozlabs.org/mailman/options/linuxppc-dev>,\n\t<mailto:linuxppc-dev-request@ozlabs.org?subject=unsubscribe>",
        "List-Archive": "<http://ozlabs.org/pipermail/linuxppc-dev>",
        "List-Post": "<mailto:linuxppc-dev@ozlabs.org>",
        "List-Help": "<mailto:linuxppc-dev-request@ozlabs.org?subject=help>",
        "List-Subscribe": "<https://ozlabs.org/mailman/listinfo/linuxppc-dev>,\n\t<mailto:linuxppc-dev-request@ozlabs.org?subject=subscribe>",
        "Content-Type": "text/plain; charset=\"us-ascii\"",
        "Content-Transfer-Encoding": "7bit",
        "Sender": "linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@ozlabs.org",
        "Errors-To": "linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@ozlabs.org"
    },
    "content": "On Monday 22 September 2008 16:12:02 Ingo Molnar wrote:\n> no fundamental objections - assuming existing x86 apps have not grown an\n> ABI dependency on the existing send_sigtrap() semantics. (Debuggers and\n> JITs would be a candidate for such dependencies.)\n>\n\nAssuming that no ABI dependency exist between x86 apps and send_sigtrap(),\nAnd implementing some of the Ingo's suggestions, Iam resending the patch.\n\nStill waiting for Roland's reply.\n\n\nCurrently a SIGTRAP can denote any one of below reasons.\n\t- Breakpoint hit\n\t- H/W debug register hit\n\t- Single step\n\t- Signal sent through kill() or rasie()\n\nArchitectures like powerpc/parisc provides infrastructure to demultiplex\nSIGTRAP signal by passing down the information for receiving SIGTRAP through\nsi_code of siginfot_t strucutre. Here is an attempt is generalise this \ninfrasturcutre by extending it to x86 and x86_64 archs. \n\nSigned-off-by: Srinivasa DS <srinivasa@in.ibm.com>\n\n---\n arch/ia64/include/asm/siginfo.h    |    5 -----\n arch/powerpc/include/asm/siginfo.h |    5 -----\n arch/x86/kernel/ptrace.c           |    7 ++++---\n arch/x86/kernel/traps_32.c         |    4 +++-\n arch/x86/kernel/traps_64.c         |    2 +-\n include/asm-generic/siginfo.h      |    2 ++\n include/asm-parisc/siginfo.h       |    5 -----\n include/asm-x86/ptrace.h           |    2 +-\n include/asm-x86/traps.h            |   10 ++++++++++\n 9 files changed, 21 insertions(+), 21 deletions(-)",
    "diff": "Index: linux-2.6.27-rc7/arch/ia64/include/asm/siginfo.h\n===================================================================\n--- linux-2.6.27-rc7.orig/arch/ia64/include/asm/siginfo.h\n+++ linux-2.6.27-rc7/arch/ia64/include/asm/siginfo.h\n@@ -113,11 +113,6 @@ typedef struct siginfo {\n #undef NSIGSEGV\n #define NSIGSEGV\t3\n \n-/*\n- * SIGTRAP si_codes\n- */\n-#define TRAP_BRANCH\t(__SI_FAULT|3)\t/* process taken branch trap */\n-#define TRAP_HWBKPT\t(__SI_FAULT|4)\t/* hardware breakpoint or watchpoint */\n #undef NSIGTRAP\n #define NSIGTRAP\t4\n \nIndex: linux-2.6.27-rc7/arch/powerpc/include/asm/siginfo.h\n===================================================================\n--- linux-2.6.27-rc7.orig/arch/powerpc/include/asm/siginfo.h\n+++ linux-2.6.27-rc7/arch/powerpc/include/asm/siginfo.h\n@@ -15,11 +15,6 @@\n \n #include <asm-generic/siginfo.h>\n \n-/*\n- * SIGTRAP si_codes\n- */\n-#define TRAP_BRANCH\t(__SI_FAULT|3)\t/* process taken branch trap */\n-#define TRAP_HWBKPT\t(__SI_FAULT|4)\t/* hardware breakpoint or watchpoint */\n #undef NSIGTRAP\n #define NSIGTRAP\t4\n \nIndex: linux-2.6.27-rc7/arch/x86/kernel/traps_32.c\n===================================================================\n--- linux-2.6.27-rc7.orig/arch/x86/kernel/traps_32.c\n+++ linux-2.6.27-rc7/arch/x86/kernel/traps_32.c\n@@ -891,6 +891,7 @@ void __kprobes do_debug(struct pt_regs *\n {\n \tstruct task_struct *tsk = current;\n \tunsigned int condition;\n+\tint si_code;\n \n \ttrace_hardirqs_fixup();\n \n@@ -935,8 +936,9 @@ void __kprobes do_debug(struct pt_regs *\n \t\t\tgoto clear_TF_reenable;\n \t}\n \n+\tsi_code = get_si_code((unsigned long*)&condition);\n \t/* Ok, finally something we can handle */\n-\tsend_sigtrap(tsk, regs, error_code);\n+\tsend_sigtrap(tsk, regs, error_code, si_code);\n \n \t/*\n \t * Disable additional traps. They'll be re-enabled when\nIndex: linux-2.6.27-rc7/arch/x86/kernel/traps_64.c\n===================================================================\n--- linux-2.6.27-rc7.orig/arch/x86/kernel/traps_64.c\n+++ linux-2.6.27-rc7/arch/x86/kernel/traps_64.c\n@@ -936,7 +936,7 @@ asmlinkage void __kprobes do_debug(struc\n \ttsk->thread.error_code = error_code;\n \tinfo.si_signo = SIGTRAP;\n \tinfo.si_errno = 0;\n-\tinfo.si_code = TRAP_BRKPT;\n+\tinfo.si_code = get_si_code(&condition);\n \tinfo.si_addr = user_mode(regs) ? (void __user *)regs->ip : NULL;\n \tforce_sig_info(SIGTRAP, &info, tsk);\n \nIndex: linux-2.6.27-rc7/include/asm-generic/siginfo.h\n===================================================================\n--- linux-2.6.27-rc7.orig/include/asm-generic/siginfo.h\n+++ linux-2.6.27-rc7/include/asm-generic/siginfo.h\n@@ -199,6 +199,8 @@ typedef struct siginfo {\n  */\n #define TRAP_BRKPT\t(__SI_FAULT|1)\t/* process breakpoint */\n #define TRAP_TRACE\t(__SI_FAULT|2)\t/* process trace trap */\n+#define TRAP_BRANCH     (__SI_FAULT|3)  /* process taken branch trap */\n+#define TRAP_HWBKPT     (__SI_FAULT|4)  /* hardware breakpoint or watchpoint \n*/\n #define NSIGTRAP\t2\n \n /*\nIndex: linux-2.6.27-rc7/include/asm-parisc/siginfo.h\n===================================================================\n--- linux-2.6.27-rc7.orig/include/asm-parisc/siginfo.h\n+++ linux-2.6.27-rc7/include/asm-parisc/siginfo.h\n@@ -3,11 +3,6 @@\n \n #include <asm-generic/siginfo.h>\n \n-/*\n- * SIGTRAP si_codes\n- */\n-#define TRAP_BRANCH\t(__SI_FAULT|3)\t/* process taken branch trap */\n-#define TRAP_HWBKPT\t(__SI_FAULT|4)\t/* hardware breakpoint or watchpoint */\n #undef NSIGTRAP\n #define NSIGTRAP\t4\n \nIndex: linux-2.6.27-rc7/arch/x86/kernel/ptrace.c\n===================================================================\n--- linux-2.6.27-rc7.orig/arch/x86/kernel/ptrace.c\n+++ linux-2.6.27-rc7/arch/x86/kernel/ptrace.c\n@@ -1357,7 +1357,8 @@ const struct user_regset_view *task_user\n #endif\n }\n \n-void send_sigtrap(struct task_struct *tsk, struct pt_regs *regs, int \nerror_code)\n+void send_sigtrap(struct task_struct *tsk, struct pt_regs *regs, int \nerror_code,\n+\t\t\t\t\t\t\t          int si_code)\n {\n \tstruct siginfo info;\n \n@@ -1366,7 +1367,7 @@ void send_sigtrap(struct task_struct *ts\n \n \tmemset(&info, 0, sizeof(info));\n \tinfo.si_signo = SIGTRAP;\n-\tinfo.si_code = TRAP_BRKPT;\n+\tinfo.si_code = si_code;\n \n \t/* User-mode ip? */\n \tinfo.si_addr = user_mode_vm(regs) ? (void __user *) regs->ip : NULL;\n@@ -1476,5 +1477,5 @@ asmregparm void syscall_trace_leave(stru\n \t */\n \tif (test_thread_flag(TIF_SINGLESTEP) &&\n \t    (current->ptrace & PT_PTRACED))\n-\t\tsend_sigtrap(current, regs, 0);\n+\t\tsend_sigtrap(current, regs, 0, TRAP_BRKPT);\n }\nIndex: linux-2.6.27-rc7/include/asm-x86/traps.h\n===================================================================\n--- linux-2.6.27-rc7.orig/include/asm-x86/traps.h\n+++ linux-2.6.27-rc7/include/asm-x86/traps.h\n@@ -36,6 +36,16 @@ void do_invalid_op(struct pt_regs *, lon\n void do_general_protection(struct pt_regs *, long);\n void do_nmi(struct pt_regs *, long);\n \n+int get_si_code(unsigned long *condition)\n+{\n+\tif (*condition & DR_STEP)\n+\t\treturn TRAP_TRACE;\n+\telse if (*condition & (DR_TRAP0|DR_TRAP1|DR_TRAP2|DR_TRAP3))\n+\t\treturn TRAP_HWBKPT;\n+\telse\n+\t\treturn TRAP_BRKPT;\n+}\n+\n extern int panic_on_unrecovered_nmi;\n extern int kstack_depth_to_print;\n \nIndex: linux-2.6.27-rc7/include/asm-x86/ptrace.h\n===================================================================\n--- linux-2.6.27-rc7.orig/include/asm-x86/ptrace.h\n+++ linux-2.6.27-rc7/include/asm-x86/ptrace.h\n@@ -143,7 +143,7 @@ convert_ip_to_linear(struct task_struct \n \n #ifdef CONFIG_X86_32\n extern void send_sigtrap(struct task_struct *tsk, struct pt_regs *regs,\n-\t\t\t int error_code);\n+\t\t\t int error_code, int si_code);\n #else\n void signal_fault(struct pt_regs *regs, void __user *frame, char *where);\n #endif\n",
    "prefixes": [
        "RFC"
    ]
}