Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/811803/?format=api
{ "id": 811803, "url": "http://patchwork.ozlabs.org/api/patches/811803/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linuxppc-dev/patch/1504894024-2750-17-git-send-email-ldufour@linux.vnet.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": "<1504894024-2750-17-git-send-email-ldufour@linux.vnet.ibm.com>", "list_archive_url": "https://lore.kernel.org/linuxppc-dev/1504894024-2750-17-git-send-email-ldufour@linux.vnet.ibm.com/", "date": "2017-09-08T18:07:00", "name": "[v3,16/20] mm: Adding speculative page fault failure trace events", "commit_ref": null, "pull_url": null, "state": "not-applicable", "archived": false, "hash": "38604f27e59e0c018d992af433e93dacd168f06c", "submitter": { "id": 40248, "url": "http://patchwork.ozlabs.org/api/people/40248/?format=api", "name": "Laurent Dufour", "email": "ldufour@linux.vnet.ibm.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/linuxppc-dev/patch/1504894024-2750-17-git-send-email-ldufour@linux.vnet.ibm.com/mbox/", "series": [ { "id": 2269, "url": "http://patchwork.ozlabs.org/api/series/2269/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linuxppc-dev/list/?series=2269", "date": "2017-09-08T18:06:44", "name": "Speculative page faults", "version": 3, "mbox": "http://patchwork.ozlabs.org/series/2269/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/811803/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/811803/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 [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 3xpmjn2k3yz9t16\n\tfor <patchwork-incoming@ozlabs.org>;\n\tSat, 9 Sep 2017 04:55:41 +1000 (AEST)", "from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 3xpmjn1ZlyzDqgy\n\tfor <patchwork-incoming@ozlabs.org>;\n\tSat, 9 Sep 2017 04:55:41 +1000 (AEST)", "from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com\n\t[148.163.156.1])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby lists.ozlabs.org (Postfix) with ESMTPS id 3xplg40wy0zDrYm\n\tfor <linuxppc-dev@lists.ozlabs.org>;\n\tSat, 9 Sep 2017 04:08:15 +1000 (AEST)", "from pps.filterd (m0098394.ppops.net [127.0.0.1])\n\tby mx0a-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id\n\tv88I7Z4Q110201\n\tfor <linuxppc-dev@lists.ozlabs.org>; Fri, 8 Sep 2017 14:08:14 -0400", "from e06smtp10.uk.ibm.com (e06smtp10.uk.ibm.com [195.75.94.106])\n\tby mx0a-001b2d01.pphosted.com with ESMTP id 2cux2tea34-1\n\t(version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT)\n\tfor <linuxppc-dev@lists.ozlabs.org>; Fri, 08 Sep 2017 14:08:14 -0400", "from localhost\n\tby e06smtp10.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use\n\tOnly! Violators will be prosecuted\n\tfor <linuxppc-dev@lists.ozlabs.org> from <ldufour@linux.vnet.ibm.com>;\n\tFri, 8 Sep 2017 19:08:10 +0100", "from b06cxnps4076.portsmouth.uk.ibm.com (9.149.109.198)\n\tby e06smtp10.uk.ibm.com (192.168.101.140) with IBM ESMTP SMTP\n\tGateway: Authorized Use Only! Violators will be prosecuted; \n\tFri, 8 Sep 2017 19:08:03 +0100", "from d06av24.portsmouth.uk.ibm.com (mk.ibm.com [9.149.105.60])\n\tby b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with\n\tESMTP id v88I82G821430406; Fri, 8 Sep 2017 18:08:02 GMT", "from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1])\n\tby IMSVA (Postfix) with ESMTP id DB6BD4203F;\n\tFri, 8 Sep 2017 19:04:29 +0100 (BST)", "from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1])\n\tby IMSVA (Postfix) with ESMTP id B49B542042;\n\tFri, 8 Sep 2017 19:04:26 +0100 (BST)", "from nimbus.lab.toulouse-stg.fr.ibm.com (unknown [9.145.31.125])\n\tby d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP;\n\tFri, 8 Sep 2017 19:04:26 +0100 (BST)" ], "Authentication-Results": "ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=linux.vnet.ibm.com\n\t(client-ip=148.163.156.1; helo=mx0a-001b2d01.pphosted.com;\n\tenvelope-from=ldufour@linux.vnet.ibm.com; receiver=<UNKNOWN>)", "From": "Laurent Dufour <ldufour@linux.vnet.ibm.com>", "To": "paulmck@linux.vnet.ibm.com, peterz@infradead.org,\n\takpm@linux-foundation.org, kirill@shutemov.name, ak@linux.intel.com, \n\tmhocko@kernel.org, dave@stgolabs.net, jack@suse.cz,\n\tMatthew Wilcox <willy@infradead.org>, benh@kernel.crashing.org,\n\tmpe@ellerman.id.au, paulus@samba.org,\n\tThomas Gleixner <tglx@linutronix.de>, Ingo Molnar <mingo@redhat.com>, \n\thpa@zytor.com, Will Deacon <will.deacon@arm.com>,\n\tSergey Senozhatsky <sergey.senozhatsky@gmail.com>", "Subject": "[PATCH v3 16/20] mm: Adding speculative page fault failure trace\n\tevents", "Date": "Fri, 8 Sep 2017 20:07:00 +0200", "X-Mailer": "git-send-email 2.7.4", "In-Reply-To": "<1504894024-2750-1-git-send-email-ldufour@linux.vnet.ibm.com>", "References": "<1504894024-2750-1-git-send-email-ldufour@linux.vnet.ibm.com>", "X-TM-AS-GCONF": "00", "x-cbid": "17090818-0040-0000-0000-000003D89EA1", "X-IBM-AV-DETECTION": "SAVI=unused REMOTE=unused XFE=unused", "x-cbparentid": "17090818-0041-0000-0000-000025D9A567", "Message-Id": "<1504894024-2750-17-git-send-email-ldufour@linux.vnet.ibm.com>", "X-Proofpoint-Virus-Version": "vendor=fsecure engine=2.50.10432:, ,\n\tdefinitions=2017-09-08_12:, , signatures=0", "X-Proofpoint-Spam-Details": "rule=outbound_notspam policy=outbound score=0\n\tspamscore=0 suspectscore=0\n\tmalwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam\n\tadjust=0 reason=mlx scancount=1 engine=8.0.1-1707230000\n\tdefinitions=main-1709080270", "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@lists.ozlabs.org, x86@kernel.org,\n\tlinux-kernel@vger.kernel.org, npiggin@gmail.com, linux-mm@kvack.org,\n\tTim Chen <tim.c.chen@linux.intel.com>, \n\tharen@linux.vnet.ibm.com, khandual@linux.vnet.ibm.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": "This patch a set of new trace events to collect the speculative page fault\nevent failures.\n\nSigned-off-by: Laurent Dufour <ldufour@linux.vnet.ibm.com>\n---\n include/trace/events/pagefault.h | 87 ++++++++++++++++++++++++++++++++++++++++\n mm/memory.c | 59 ++++++++++++++++++++++-----\n 2 files changed, 135 insertions(+), 11 deletions(-)\n create mode 100644 include/trace/events/pagefault.h", "diff": "diff --git a/include/trace/events/pagefault.h b/include/trace/events/pagefault.h\nnew file mode 100644\nindex 000000000000..d7d56f8102d1\n--- /dev/null\n+++ b/include/trace/events/pagefault.h\n@@ -0,0 +1,87 @@\n+#undef TRACE_SYSTEM\n+#define TRACE_SYSTEM pagefault\n+\n+#if !defined(_TRACE_PAGEFAULT_H) || defined(TRACE_HEADER_MULTI_READ)\n+#define _TRACE_PAGEFAULT_H\n+\n+#include <linux/tracepoint.h>\n+#include <linux/mm.h>\n+\n+DECLARE_EVENT_CLASS(spf,\n+\n+\tTP_PROTO(unsigned long caller,\n+\t\t struct vm_area_struct *vma, unsigned long address),\n+\n+\tTP_ARGS(caller, vma, address),\n+\n+\tTP_STRUCT__entry(\n+\t\t__field(unsigned long, caller)\n+\t\t__field(unsigned long, vm_start)\n+\t\t__field(unsigned long, vm_end)\n+\t\t__field(unsigned long, address)\n+\t),\n+\n+\tTP_fast_assign(\n+\t\t__entry->caller\t\t= caller;\n+\t\t__entry->vm_start\t= vma->vm_start;\n+\t\t__entry->vm_end\t\t= vma->vm_end;\n+\t\t__entry->address\t= address;\n+\t),\n+\n+\tTP_printk(\"ip:%lx vma:%lu-%lx address:%lx\",\n+\t\t __entry->caller, __entry->vm_start, __entry->vm_end,\n+\t\t __entry->address)\n+);\n+\n+DEFINE_EVENT(spf, spf_pte_lock,\n+\n+\tTP_PROTO(unsigned long caller,\n+\t\t struct vm_area_struct *vma, unsigned long address),\n+\n+\tTP_ARGS(caller, vma, address)\n+);\n+\n+DEFINE_EVENT(spf, spf_vma_changed,\n+\n+\tTP_PROTO(unsigned long caller,\n+\t\t struct vm_area_struct *vma, unsigned long address),\n+\n+\tTP_ARGS(caller, vma, address)\n+);\n+\n+DEFINE_EVENT(spf, spf_vma_dead,\n+\n+\tTP_PROTO(unsigned long caller,\n+\t\t struct vm_area_struct *vma, unsigned long address),\n+\n+\tTP_ARGS(caller, vma, address)\n+);\n+\n+DEFINE_EVENT(spf, spf_vma_noanon,\n+\n+\tTP_PROTO(unsigned long caller,\n+\t\t struct vm_area_struct *vma, unsigned long address),\n+\n+\tTP_ARGS(caller, vma, address)\n+);\n+\n+DEFINE_EVENT(spf, spf_vma_notsup,\n+\n+\tTP_PROTO(unsigned long caller,\n+\t\t struct vm_area_struct *vma, unsigned long address),\n+\n+\tTP_ARGS(caller, vma, address)\n+);\n+\n+DEFINE_EVENT(spf, spf_vma_access,\n+\n+\tTP_PROTO(unsigned long caller,\n+\t\t struct vm_area_struct *vma, unsigned long address),\n+\n+\tTP_ARGS(caller, vma, address)\n+);\n+\n+#endif /* _TRACE_PAGEFAULT_H */\n+\n+/* This part must be outside protection */\n+#include <trace/define_trace.h>\ndiff --git a/mm/memory.c b/mm/memory.c\nindex 18b39f930ce1..c2a52ddc850b 100644\n--- a/mm/memory.c\n+++ b/mm/memory.c\n@@ -81,6 +81,9 @@\n \n #include \"internal.h\"\n \n+#define CREATE_TRACE_POINTS\n+#include <trace/events/pagefault.h>\n+\n #ifdef LAST_CPUPID_NOT_IN_PAGE_FLAGS\n #warning Unfortunate NUMA and NUMA Balancing config, growing page-frame for last_cpupid.\n #endif\n@@ -2428,15 +2431,20 @@ static bool pte_spinlock(struct vm_fault *vmf)\n \t}\n \n \tlocal_irq_disable();\n-\tif (vma_has_changed(vmf))\n+\tif (vma_has_changed(vmf)) {\n+\t\ttrace_spf_vma_changed(_RET_IP_, vmf->vma, vmf->address);\n \t\tgoto out;\n+\t}\n \n \tvmf->ptl = pte_lockptr(vmf->vma->vm_mm, vmf->pmd);\n-\tif (unlikely(!spin_trylock(vmf->ptl)))\n+\tif (unlikely(!spin_trylock(vmf->ptl))) {\n+\t\ttrace_spf_pte_lock(_RET_IP_, vmf->vma, vmf->address);\n \t\tgoto out;\n+\t}\n \n \tif (vma_has_changed(vmf)) {\n \t\tspin_unlock(vmf->ptl);\n+\t\ttrace_spf_vma_changed(_RET_IP_, vmf->vma, vmf->address);\n \t\tgoto out;\n \t}\n \n@@ -2466,8 +2474,10 @@ static bool pte_map_lock(struct vm_fault *vmf)\n \t * block on the PTL and thus we're safe.\n \t */\n \tlocal_irq_disable();\n-\tif (vma_has_changed(vmf))\n+\tif (vma_has_changed(vmf)) {\n+\t\ttrace_spf_vma_changed(_RET_IP_, vmf->vma, vmf->address);\n \t\tgoto out;\n+\t}\n \n \t/*\n \t * Same as pte_offset_map_lock() except that we call\n@@ -2480,11 +2490,13 @@ static bool pte_map_lock(struct vm_fault *vmf)\n \tpte = pte_offset_map(vmf->pmd, vmf->address);\n \tif (unlikely(!spin_trylock(ptl))) {\n \t\tpte_unmap(pte);\n+\t\ttrace_spf_pte_lock(_RET_IP_, vmf->vma, vmf->address);\n \t\tgoto out;\n \t}\n \n \tif (vma_has_changed(vmf)) {\n \t\tpte_unmap_unlock(pte, ptl);\n+\t\ttrace_spf_vma_changed(_RET_IP_, vmf->vma, vmf->address);\n \t\tgoto out;\n \t}\n \n@@ -4164,32 +4176,45 @@ int handle_speculative_fault(struct mm_struct *mm, unsigned long address,\n \t * Validate the VMA found by the lockless lookup.\n \t */\n \tdead = RB_EMPTY_NODE(&vma->vm_rb);\n+\tif (dead) {\n+\t\ttrace_spf_vma_dead(_RET_IP_, vma, address);\n+\t\tgoto unlock;\n+\t}\n+\n \tseq = raw_read_seqcount(&vma->vm_sequence); /* rmb <-> seqlock,vma_rb_erase() */\n-\tif ((seq & 1) || dead)\n+\tif (seq & 1) {\n+\t\ttrace_spf_vma_changed(_RET_IP_, vma, address);\n \t\tgoto unlock;\n+\t}\n \n \t/*\n \t * Can't call vm_ops service has we don't know what they would do\n \t * with the VMA.\n \t * This include huge page from hugetlbfs.\n \t */\n-\tif (vma->vm_ops)\n+\tif (vma->vm_ops) {\n+\t\ttrace_spf_vma_notsup(_RET_IP_, vma, address);\n \t\tgoto unlock;\n+\t}\n \n \t/*\n \t * __anon_vma_prepare() requires the mmap_sem to be held\n \t * because vm_next and vm_prev must be safe. This can't be guaranteed\n \t * in the speculative path.\n \t */\n-\tif (unlikely(!vma->anon_vma))\n+\tif (unlikely(!vma->anon_vma)) {\n+\t\ttrace_spf_vma_notsup(_RET_IP_, vma, address);\n \t\tgoto unlock;\n+\t}\n \n \tvmf.vma_flags = READ_ONCE(vma->vm_flags);\n \tvmf.vma_page_prot = READ_ONCE(vma->vm_page_prot);\n \n \t/* Can't call userland page fault handler in the speculative path */\n-\tif (unlikely(vmf.vma_flags & VM_UFFD_MISSING))\n+\tif (unlikely(vmf.vma_flags & VM_UFFD_MISSING)) {\n+\t\ttrace_spf_vma_notsup(_RET_IP_, vma, address);\n \t\tgoto unlock;\n+\t}\n \n #ifdef CONFIG_NUMA\n \t/*\n@@ -4199,25 +4224,32 @@ int handle_speculative_fault(struct mm_struct *mm, unsigned long address,\n \tpol = __get_vma_policy(vma, address);\n \tif (!pol)\n \t\tpol = get_task_policy(current);\n-\tif (pol && pol->mode == MPOL_INTERLEAVE)\n+\tif (pol && pol->mode == MPOL_INTERLEAVE) {\n+\t\ttrace_spf_vma_notsup(_RET_IP_, vma, address);\n \t\tgoto unlock;\n+\t}\n #endif\n \n-\tif (vmf.vma_flags & VM_GROWSDOWN || vmf.vma_flags & VM_GROWSUP)\n+\tif (vmf.vma_flags & VM_GROWSDOWN || vmf.vma_flags & VM_GROWSUP) {\n \t\t/*\n \t\t * This could be detected by the check address against VMA's\n \t\t * boundaries but we want to trace it as not supported instead\n \t\t * of changed.\n \t\t */\n+\t\ttrace_spf_vma_notsup(_RET_IP_, vma, address);\n \t\tgoto unlock;\n+\t}\n \n \tif (address < READ_ONCE(vma->vm_start)\n-\t || READ_ONCE(vma->vm_end) <= address)\n+\t || READ_ONCE(vma->vm_end) <= address) {\n+\t\ttrace_spf_vma_changed(_RET_IP_, vma, address);\n \t\tgoto unlock;\n+\t}\n \n \tif (!arch_vma_access_permitted(vma, flags & FAULT_FLAG_WRITE,\n \t\t\t\t flags & FAULT_FLAG_INSTRUCTION,\n \t\t\t\t flags & FAULT_FLAG_REMOTE)) {\n+\t\ttrace_spf_vma_access(_RET_IP_, vma, address);\n \t\tret = VM_FAULT_SIGSEGV;\n \t\tgoto unlock;\n \t}\n@@ -4225,10 +4257,12 @@ int handle_speculative_fault(struct mm_struct *mm, unsigned long address,\n \t/* This is one is required to check that the VMA has write access set */\n \tif (flags & FAULT_FLAG_WRITE) {\n \t\tif (unlikely(!(vmf.vma_flags & VM_WRITE))) {\n+\t\t\ttrace_spf_vma_access(_RET_IP_, vma, address);\n \t\t\tret = VM_FAULT_SIGSEGV;\n \t\t\tgoto unlock;\n \t\t}\n \t} else if (unlikely(!(vmf.vma_flags & (VM_READ|VM_EXEC|VM_WRITE)))) {\n+\t\ttrace_spf_vma_access(_RET_IP_, vma, address);\n \t\tret = VM_FAULT_SIGSEGV;\n \t\tgoto unlock;\n \t}\n@@ -4282,8 +4316,10 @@ int handle_speculative_fault(struct mm_struct *mm, unsigned long address,\n \t * We need to re-validate the VMA after checking the bounds, otherwise\n \t * we might have a false positive on the bounds.\n \t */\n-\tif (read_seqcount_retry(&vma->vm_sequence, seq))\n+\tif (read_seqcount_retry(&vma->vm_sequence, seq)) {\n+\t\ttrace_spf_vma_changed(_RET_IP_, vma, address);\n \t\tgoto unlock;\n+\t}\n \n \tret = handle_pte_fault(&vmf);\n \n@@ -4292,6 +4328,7 @@ int handle_speculative_fault(struct mm_struct *mm, unsigned long address,\n \treturn ret;\n \n out_walk:\n+\ttrace_spf_vma_notsup(_RET_IP_, vma, address);\n \tlocal_irq_enable();\n \tgoto unlock;\n }\n", "prefixes": [ "v3", "16/20" ] }