{"id":811061,"url":"http://patchwork.ozlabs.org/api/patches/811061/?format=json","web_url":"http://patchwork.ozlabs.org/project/linuxppc-dev/patch/20170907145148.24398-3-npiggin@gmail.com/","project":{"id":2,"url":"http://patchwork.ozlabs.org/api/projects/2/?format=json","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":"<20170907145148.24398-3-npiggin@gmail.com>","list_archive_url":"https://lore.kernel.org/linuxppc-dev/20170907145148.24398-3-npiggin@gmail.com/","date":"2017-09-07T14:51:42","name":"[RFC,2/8] powerpc/64s/radix: tlbie improve preempt handling","commit_ref":null,"pull_url":null,"state":"superseded","archived":true,"hash":"be006e161c15fbc0caa33f3b55d13ec60870d576","submitter":{"id":69518,"url":"http://patchwork.ozlabs.org/api/people/69518/?format=json","name":"Nicholas Piggin","email":"npiggin@gmail.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/linuxppc-dev/patch/20170907145148.24398-3-npiggin@gmail.com/mbox/","series":[{"id":2010,"url":"http://patchwork.ozlabs.org/api/series/2010/?format=json","web_url":"http://patchwork.ozlabs.org/project/linuxppc-dev/list/?series=2010","date":"2017-09-07T14:51:40","name":"Further radix TLB flush optimisations","version":1,"mbox":"http://patchwork.ozlabs.org/series/2010/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/811061/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/811061/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 3xp3TY5HLCz9s81\n\tfor <patchwork-incoming@ozlabs.org>;\n\tFri,  8 Sep 2017 00:57:37 +1000 (AEST)","from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 3xp3TY47NdzDrWl\n\tfor <patchwork-incoming@ozlabs.org>;\n\tFri,  8 Sep 2017 00:57:37 +1000 (AEST)","from mail-pf0-x242.google.com (mail-pf0-x242.google.com\n\t[IPv6:2607:f8b0:400e:c00::242])\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 3xp3MT298KzDrXg\n\tfor <linuxppc-dev@lists.ozlabs.org>;\n\tFri,  8 Sep 2017 00:52:21 +1000 (AEST)","by mail-pf0-x242.google.com with SMTP id h4so1228396pfk.0\n\tfor <linuxppc-dev@lists.ozlabs.org>;\n\tThu, 07 Sep 2017 07:52:21 -0700 (PDT)","from roar.au.ibm.com (203-219-56-202.tpgi.com.au. [203.219.56.202])\n\tby smtp.gmail.com with ESMTPSA id\n\ta6sm4642791pfa.76.2017.09.07.07.52.15\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tThu, 07 Sep 2017 07:52:18 -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=\"NmjH8Wfz\"; 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=\"NmjH8Wfz\"; dkim-atps=neutral","ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=gmail.com\n\t(client-ip=2607:f8b0:400e:c00::242; helo=mail-pf0-x242.google.com;\n\tenvelope-from=npiggin@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=\"NmjH8Wfz\"; 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=+ZPfAMcqXapAjldd/laEzBZTdN/wbTO5QIQ9HBhCkQI=;\n\tb=NmjH8Wfz668NU1Lr7uFplWcr79NM3opLoKSoVOJMOp6aMGj5YotGFNf1Il8rDLy+oe\n\tTYvNpj2ACXQEX15LJ/cPk+18QYiWv2GUilKUdUbPfBckdr88TNwnDJEZUM1SpDAWG0Uz\n\t6eNuDtnygZvr6iusF3nV2BYkYWX40FxLjxfw+O7IR7f7aThaN9mJ2VrYI9bt4zTet4tc\n\tJgyWN68Ew6FL8ixQHJVYy4syM1Jnd4zfJeeGoydo30hF5+/NsaKJKr1Hgdq8Oo6sd/aJ\n\tOnu3rEKdpRES2R8lfMjudL9V7iIalRFjxPvQpT/6fpyQGHr/1WaKpA+rcLAgR1yI124o\n\tjzBg==","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=+ZPfAMcqXapAjldd/laEzBZTdN/wbTO5QIQ9HBhCkQI=;\n\tb=QCH9kTpEhRkcx7LhAOGBTGjCNwgmSU3gq7hsp1SWCOAERBgMt2fJWfT1HOo6PRaPmj\n\t4YSFfeOunEqQuV1ys+MrIJB0X8asW+68O1gKBxoSl6pzO5DB7isGZGCOuaE5R4l1yjk2\n\txKx54Zjve1S5MlaNfU6KzkFl+0CYahhpe4M4pPA3ZnSWsApdYVczsWth9Ty0akj2aRgk\n\tpU4/jkp6CccpjsEBJhDmxYF5+r4lxgBazIoq5wMQpMPxdPq04i01k2I0qx34YxaqxDQL\n\tfoyfwCms8oqkHzDy/t3H9n99wN9pxCI848oZzhzcmWAcTZb2mvScrsCab7fNR8cKTnW7\n\txPMQ==","X-Gm-Message-State":"AHPjjUiEtVNUH3ix0EctYKIcpkwERXrS+CPzTWJ8ZrDtpGeL/X6i+rmE\n\tMhUDfiZiBdrEcgA2","X-Google-Smtp-Source":"ADKCNb40y624lVjDeMQfzwvn34BN+OckAcxTgwcUsBubehQzcKsSTPmwLPV4D+jsVFk6WCWphN/qpQ==","X-Received":"by 10.84.133.73 with SMTP id 67mr3289301plf.378.1504795939200;\n\tThu, 07 Sep 2017 07:52:19 -0700 (PDT)","From":"Nicholas Piggin <npiggin@gmail.com>","To":"linuxppc-dev@lists.ozlabs.org","Subject":"[RFC PATCH 2/8] powerpc/64s/radix: tlbie improve preempt handling","Date":"Fri,  8 Sep 2017 00:51:42 +1000","Message-Id":"<20170907145148.24398-3-npiggin@gmail.com>","X-Mailer":"git-send-email 2.13.3","In-Reply-To":"<20170907145148.24398-1-npiggin@gmail.com>","References":"<20170907145148.24398-1-npiggin@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":"\"Aneesh Kumar K . V\" <aneesh.kumar@linux.vnet.ibm.com>,\n\tNicholas Piggin <npiggin@gmail.com>, Anton Blanchard <anton@samba.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":"Preempt should be consistently disabled for mm_is_thread_local tests,\nso bring the rest of these under preempt_disable().\n\nPreempt does not need to be disabled for the mm->context.id tests, which\nallows simplification and removal of gotos.\n\nSigned-off-by: Nicholas Piggin <npiggin@gmail.com>\n---\n arch/powerpc/mm/tlb-radix.c | 47 +++++++++++++++++++++------------------------\n 1 file changed, 22 insertions(+), 25 deletions(-)","diff":"diff --git a/arch/powerpc/mm/tlb-radix.c b/arch/powerpc/mm/tlb-radix.c\nindex b3e849c4886e..1ed61baf58da 100644\n--- a/arch/powerpc/mm/tlb-radix.c\n+++ b/arch/powerpc/mm/tlb-radix.c\n@@ -186,16 +186,15 @@ void radix__flush_tlb_mm(struct mm_struct *mm)\n {\n \tunsigned long pid;\n \n-\tpreempt_disable();\n \tpid = mm->context.id;\n \tif (unlikely(pid == MMU_NO_CONTEXT))\n-\t\tgoto no_context;\n+\t\treturn;\n \n+\tpreempt_disable();\n \tif (!mm_is_thread_local(mm))\n \t\t_tlbie_pid(pid, RIC_FLUSH_TLB);\n \telse\n \t\t_tlbiel_pid(pid, RIC_FLUSH_TLB);\n-no_context:\n \tpreempt_enable();\n }\n EXPORT_SYMBOL(radix__flush_tlb_mm);\n@@ -204,16 +203,15 @@ static void radix__flush_all_mm(struct mm_struct *mm)\n {\n \tunsigned long pid;\n \n-\tpreempt_disable();\n \tpid = mm->context.id;\n \tif (unlikely(pid == MMU_NO_CONTEXT))\n-\t\tgoto no_context;\n+\t\treturn;\n \n+\tpreempt_disable();\n \tif (!mm_is_thread_local(mm))\n \t\t_tlbie_pid(pid, RIC_FLUSH_ALL);\n \telse\n \t\t_tlbiel_pid(pid, RIC_FLUSH_ALL);\n-no_context:\n \tpreempt_enable();\n }\n \n@@ -229,15 +227,14 @@ void radix__flush_tlb_page_psize(struct mm_struct *mm, unsigned long vmaddr,\n \tunsigned long pid;\n \tunsigned long ap = mmu_get_ap(psize);\n \n-\tpreempt_disable();\n \tpid = mm ? mm->context.id : 0;\n \tif (unlikely(pid == MMU_NO_CONTEXT))\n-\t\tgoto bail;\n+\t\treturn;\n+\tpreempt_disable();\n \tif (!mm_is_thread_local(mm))\n \t\t_tlbie_va(vmaddr, pid, ap, RIC_FLUSH_TLB);\n \telse\n \t\t_tlbiel_va(vmaddr, pid, ap, RIC_FLUSH_TLB);\n-bail:\n \tpreempt_enable();\n }\n \n@@ -322,46 +319,44 @@ void radix__flush_tlb_range_psize(struct mm_struct *mm, unsigned long start,\n {\n \tunsigned long pid;\n \tunsigned long addr;\n-\tint local = mm_is_thread_local(mm);\n+\tbool local;\n \tunsigned long ap = mmu_get_ap(psize);\n \tunsigned long page_size = 1UL << mmu_psize_defs[psize].shift;\n \n-\n-\tpreempt_disable();\n \tpid = mm ? mm->context.id : 0;\n \tif (unlikely(pid == MMU_NO_CONTEXT))\n-\t\tgoto err_out;\n+\t\treturn;\n \n+\tpreempt_disable();\n+\tlocal = mm_is_thread_local(mm);\n \tif (end == TLB_FLUSH_ALL ||\n \t    (end - start) > tlb_single_page_flush_ceiling * page_size) {\n \t\tif (local)\n \t\t\t_tlbiel_pid(pid, RIC_FLUSH_TLB);\n \t\telse\n \t\t\t_tlbie_pid(pid, RIC_FLUSH_TLB);\n-\t\tgoto err_out;\n-\t}\n-\tfor (addr = start; addr < end; addr += page_size) {\n+\t} else {\n+\t\tfor (addr = start; addr < end; addr += page_size) {\n \n-\t\tif (local)\n-\t\t\t_tlbiel_va(addr, pid, ap, RIC_FLUSH_TLB);\n-\t\telse\n-\t\t\t_tlbie_va(addr, pid, ap, RIC_FLUSH_TLB);\n+\t\t\tif (local)\n+\t\t\t\t_tlbiel_va(addr, pid, ap, RIC_FLUSH_TLB);\n+\t\t\telse\n+\t\t\t\t_tlbie_va(addr, pid, ap, RIC_FLUSH_TLB);\n+\t\t}\n \t}\n-err_out:\n \tpreempt_enable();\n }\n \n #ifdef CONFIG_TRANSPARENT_HUGEPAGE\n void radix__flush_tlb_collapsed_pmd(struct mm_struct *mm, unsigned long addr)\n {\n-\tint local = mm_is_thread_local(mm);\n \tunsigned long ap = mmu_get_ap(mmu_virtual_psize);\n \tunsigned long pid, end;\n-\n+\tbool local;\n \n \tpid = mm ? mm->context.id : 0;\n \tif (unlikely(pid == MMU_NO_CONTEXT))\n-\t\tgoto no_context;\n+\t\treturn;\n \n \t/* 4k page size, just blow the world */\n \tif (PAGE_SIZE == 0x1000) {\n@@ -369,6 +364,8 @@ void radix__flush_tlb_collapsed_pmd(struct mm_struct *mm, unsigned long addr)\n \t\treturn;\n \t}\n \n+\tpreempt_disable();\n+\tlocal = mm_is_thread_local(mm);\n \t/* Otherwise first do the PWC */\n \tif (local)\n \t\t_tlbiel_pid(pid, RIC_FLUSH_PWC);\n@@ -383,7 +380,7 @@ void radix__flush_tlb_collapsed_pmd(struct mm_struct *mm, unsigned long addr)\n \t\telse\n \t\t\t_tlbie_va(addr, pid, ap, RIC_FLUSH_TLB);\n \t}\n-no_context:\n+\n \tpreempt_enable();\n }\n #endif /* CONFIG_TRANSPARENT_HUGEPAGE */\n","prefixes":["RFC","2/8"]}