Received: by 2002:a25:b323:0:0:0:0:0 with SMTP id l35csp2345007ybj; Mon, 23 Sep 2019 02:07:19 -0700 (PDT) X-Google-Smtp-Source: APXvYqz2CeM+QFr4TvrfgsDytJefuJ/Sg5Lino41abUfxriqz7BMD4/Pd3Yhq7o8RSv6Ut3fY5jn X-Received: by 2002:a50:fa83:: with SMTP id w3mr35150311edr.262.1569229639463; Mon, 23 Sep 2019 02:07:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569229639; cv=none; d=google.com; s=arc-20160816; b=cMq/JUf8orkMZTrwqEwZ81i+AXPuw5WX1HzIWn5s98XxPx1ofhWb5rcigJId9Ffhcw QPWykCKFxikYwv4rH+jnr7hzZAp7QBOy0XWQt8IJxS+J58wxm5I14Ci4LOjpKbgDgAiX eM2bAegkDAWqfTMSTn2YURlDuM+QKCbHmB1xV5vnLLCRN6O+NWws+zOowDlw7vVw9lES pwvuyOkjbd6U0Zh7qkXijup51wKx2A/HUL/E7Zuo6ab6DQzRWOSv/U9k+FUr5+S3yWbh BiOQGD8wfJM/W1bSA2mmgufsO+e969wlVNMQZaavZDrEB7e/i1EBjDQZ3TZm79XbjolL MGnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=ezb22th+UpnqsgM9Ld1DjExUClGKB7ROL2P+p+8/dLM=; b=u2AVtovabM1viiwLrV25erwErfVPbu/hPCD9OqUvs77QTlYRmlnl5qIgzG8TwTLU12 HOzPVGpe1pQ8S2etzXR8sXTXZLnUiZmUy5HXcCM0O2Taxj/bmjtsWEL38pXy8gabg5zz lij/UM0fszAE0DGBB38UXOIagaG0xusajTr5ztmxWSza8vUyJVN5+836OclI3kJe9XaZ +liqHbgUaUcBlRs073le8zNVDOcrgWqLSyyc1FvoDgzZhJ4sV7afTviuITiDFmnjwyBG YzSULzI/oniDwvjwaVW+bK4bQ9TeYSPEX3SOaBmLCL3H7yP+caTZZNZ3VRPUV2y2c70R B1zw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c6si6618218edc.291.2019.09.23.02.06.56; Mon, 23 Sep 2019 02:07:19 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2436836AbfITTw3 (ORCPT + 99 others); Fri, 20 Sep 2019 15:52:29 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:38854 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2436819AbfITTwZ (ORCPT ); Fri, 20 Sep 2019 15:52:25 -0400 Received: from pps.filterd (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x8KJlwQP134589; Fri, 20 Sep 2019 15:51:50 -0400 Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 2v53ju40ew-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 20 Sep 2019 15:51:50 -0400 Received: from m0098404.ppops.net (m0098404.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.27/8.16.0.27) with SMTP id x8KJn4bt144821; Fri, 20 Sep 2019 15:51:50 -0400 Received: from ppma05wdc.us.ibm.com (1b.90.2fa9.ip4.static.sl-reverse.com [169.47.144.27]) by mx0a-001b2d01.pphosted.com with ESMTP id 2v53ju40e8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 20 Sep 2019 15:51:50 -0400 Received: from pps.filterd (ppma05wdc.us.ibm.com [127.0.0.1]) by ppma05wdc.us.ibm.com (8.16.0.27/8.16.0.27) with SMTP id x8KJoHCX015549; Fri, 20 Sep 2019 19:51:48 GMT Received: from b03cxnp08025.gho.boulder.ibm.com (b03cxnp08025.gho.boulder.ibm.com [9.17.130.17]) by ppma05wdc.us.ibm.com with ESMTP id 2v3vbu8p4d-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 20 Sep 2019 19:51:48 +0000 Received: from b03ledav004.gho.boulder.ibm.com (b03ledav004.gho.boulder.ibm.com [9.17.130.235]) by b03cxnp08025.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x8KJplkp52625704 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 20 Sep 2019 19:51:47 GMT Received: from b03ledav004.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 651037805E; Fri, 20 Sep 2019 19:51:47 +0000 (GMT) Received: from b03ledav004.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C7B6B78063; Fri, 20 Sep 2019 19:51:42 +0000 (GMT) Received: from LeoBras.aus.stglabs.ibm.com (unknown [9.18.235.184]) by b03ledav004.gho.boulder.ibm.com (Postfix) with ESMTP; Fri, 20 Sep 2019 19:51:42 +0000 (GMT) From: Leonardo Bras To: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Cc: Leonardo Bras , Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , Arnd Bergmann , "Aneesh Kumar K.V" , Christophe Leroy , Andrew Morton , Dan Williams , Nicholas Piggin , Mahesh Salgaonkar , Thomas Gleixner , Richard Fontana , Ganesh Goudar , Allison Randal , Greg Kroah-Hartman , Mike Rapoport , YueHaibing , Ira Weiny , Jason Gunthorpe , John Hubbard , Keith Busch Subject: [PATCH v2 06/11] powerpc/mm/book3s64/hash: Applies counting method to monitor lockless pgtbl walks Date: Fri, 20 Sep 2019 16:50:42 -0300 Message-Id: <20190920195047.7703-7-leonardo@linux.ibm.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190920195047.7703-1-leonardo@linux.ibm.com> References: <20190920195047.7703-1-leonardo@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-09-20_07:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=754 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1908290000 definitions=main-1909200161 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Applies the counting-based method for monitoring all hash-related functions that do lockless pagetable walks. Signed-off-by: Leonardo Bras --- arch/powerpc/mm/book3s64/hash_tlb.c | 2 ++ arch/powerpc/mm/book3s64/hash_utils.c | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/arch/powerpc/mm/book3s64/hash_tlb.c b/arch/powerpc/mm/book3s64/hash_tlb.c index 4a70d8dd39cd..5e5213c3f7c4 100644 --- a/arch/powerpc/mm/book3s64/hash_tlb.c +++ b/arch/powerpc/mm/book3s64/hash_tlb.c @@ -209,6 +209,7 @@ void __flush_hash_table_range(struct mm_struct *mm, unsigned long start, * to being hashed). This is not the most performance oriented * way to do things but is fine for our needs here. */ + start_lockless_pgtbl_walk(mm); local_irq_save(flags); arch_enter_lazy_mmu_mode(); for (; start < end; start += PAGE_SIZE) { @@ -230,6 +231,7 @@ void __flush_hash_table_range(struct mm_struct *mm, unsigned long start, } arch_leave_lazy_mmu_mode(); local_irq_restore(flags); + end_lockless_pgtbl_walk(mm); } void flush_tlb_pmd_range(struct mm_struct *mm, pmd_t *pmd, unsigned long addr) diff --git a/arch/powerpc/mm/book3s64/hash_utils.c b/arch/powerpc/mm/book3s64/hash_utils.c index b8ad14bb1170..299946cedc3a 100644 --- a/arch/powerpc/mm/book3s64/hash_utils.c +++ b/arch/powerpc/mm/book3s64/hash_utils.c @@ -1322,6 +1322,7 @@ int hash_page_mm(struct mm_struct *mm, unsigned long ea, #endif /* CONFIG_PPC_64K_PAGES */ /* Get PTE and page size from page tables */ + start_lockless_pgtbl_walk(mm); ptep = find_linux_pte(pgdir, ea, &is_thp, &hugeshift); if (ptep == NULL || !pte_present(*ptep)) { DBG_LOW(" no PTE !\n"); @@ -1438,6 +1439,7 @@ int hash_page_mm(struct mm_struct *mm, unsigned long ea, DBG_LOW(" -> rc=%d\n", rc); bail: + end_lockless_pgtbl_walk(mm); exception_exit(prev_state); return rc; } @@ -1547,10 +1549,12 @@ void hash_preload(struct mm_struct *mm, unsigned long ea, vsid = get_user_vsid(&mm->context, ea, ssize); if (!vsid) return; + /* * Hash doesn't like irqs. Walking linux page table with irq disabled * saves us from holding multiple locks. */ + start_lockless_pgtbl_walk(mm); local_irq_save(flags); /* @@ -1597,6 +1601,7 @@ void hash_preload(struct mm_struct *mm, unsigned long ea, pte_val(*ptep)); out_exit: local_irq_restore(flags); + end_lockless_pgtbl_walk(mm); } #ifdef CONFIG_PPC_MEM_KEYS @@ -1613,11 +1618,13 @@ u16 get_mm_addr_key(struct mm_struct *mm, unsigned long address) if (!mm || !mm->pgd) return 0; + start_lockless_pgtbl_walk(mm); local_irq_save(flags); ptep = find_linux_pte(mm->pgd, address, NULL, NULL); if (ptep) pkey = pte_to_pkey_bits(pte_val(READ_ONCE(*ptep))); local_irq_restore(flags); + end_lockless_pgtbl_walk(mm); return pkey; } -- 2.20.1