Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp1772095ybn; Thu, 26 Sep 2019 01:53:53 -0700 (PDT) X-Google-Smtp-Source: APXvYqyY3kskTC6klS2ga6hKy9SnyqcvFtK5AH8ABwbAXB78UaSnepkS2y7Oj0ctR3PeEdasY+Nn X-Received: by 2002:aa7:c98a:: with SMTP id c10mr2379732edt.23.1569488033457; Thu, 26 Sep 2019 01:53:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569488033; cv=none; d=google.com; s=arc-20160816; b=Uq4GwUD4o7pxvYAY03O16KV+Le0JfSsAxq7tdQhozkUWCGM21aNS68QYc8fmWFDwrO XIgwtmT66i1C0/pPz9IvgWRK73LApvxLLOYqdcUfUAR9/bELRhyvnsLOBnUqa7YBjuIb G5vIA5SkY+zdKlt7p81TkRUchAhq7qhs0LjqJ7/x9jnud6UFsWjJR8j/OvKFFVM5kBum ycUr1atTII7dTRLQvFsJmUfziSoDLtP062QsR8b6DNz0ENJhBIAkja0Yf07dUcvbF+JG ylllyKuctMbtX6yr/BsZ3OCsTCQNLWKQD+GEfM9CPHnlzapadSy8LEOsZMEkJlSNpol3 oyKg== 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=811FoJkTdKfxdVlZjOoBvi6i8p7lv1j4t8KNrHPVVAU=; b=iQR/D3nd5ugteul4vcVtL4TqX/co/DbL7NniRTJedQVu45RkeKOM3w/702n11OnkFI oeOCPd6ZJKlHZg8l4qZuwDXBZXISwuh1iuJ+GxScwpcJg8zPpbe3EYWHr7TBw65wuYrC DpHLFw7KWEGquaE5bDkzWyjBY5PMSYtjPR6apyw4kEd2E/glvl6GqixpxeWZrxPaT75P vvkgKK5x8ACvy8oSXIg6vgAUWR+WAyB0ZQgSsXINyDpCDDwGjNN4HvmiBtRTRC53t1Co YyrhdEd6b4c1MReplbdzKq1jEhbI61ZQzsVCthMXJHjRl3Kf4ABt+uvN4tgNXFmY55vx r42w== 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 i38si899370eda.64.2019.09.26.01.53.30; Thu, 26 Sep 2019 01:53:53 -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 S2411002AbfIXVZg (ORCPT + 99 others); Tue, 24 Sep 2019 17:25:36 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:46332 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2410953AbfIXVZf (ORCPT ); Tue, 24 Sep 2019 17:25:35 -0400 Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x8OLMN5J011434; Tue, 24 Sep 2019 17:25:08 -0400 Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 2v7r8veb8f-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 24 Sep 2019 17:25:08 -0400 Received: from m0098410.ppops.net (m0098410.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.27/8.16.0.27) with SMTP id x8OLMR1S011655; Tue, 24 Sep 2019 17:25:07 -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 2v7r8veb7f-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 24 Sep 2019 17:25:07 -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 x8OLJsY7020037; Tue, 24 Sep 2019 21:25:06 GMT Received: from b03cxnp07029.gho.boulder.ibm.com (b03cxnp07029.gho.boulder.ibm.com [9.17.130.16]) by ppma05wdc.us.ibm.com with ESMTP id 2v5bg782bw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 24 Sep 2019 21:25:06 +0000 Received: from b03ledav006.gho.boulder.ibm.com (b03ledav006.gho.boulder.ibm.com [9.17.130.237]) by b03cxnp07029.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x8OLP4Td58261866 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 24 Sep 2019 21:25:04 GMT Received: from b03ledav006.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 98FDEC605A; Tue, 24 Sep 2019 21:25:04 +0000 (GMT) Received: from b03ledav006.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 01EC4C6057; Tue, 24 Sep 2019 21:25:00 +0000 (GMT) Received: from LeoBras.aus.stglabs.ibm.com (unknown [9.18.235.184]) by b03ledav006.gho.boulder.ibm.com (Postfix) with ESMTP; Tue, 24 Sep 2019 21:24:59 +0000 (GMT) From: Leonardo Bras To: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, kvm-ppc@vger.kernel.org, linux-arch@vger.kernel.org, linux-mm@kvack.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 , Greg Kroah-Hartman , Thomas Gleixner , Ganesh Goudar , Allison Randal , Mike Rapoport , YueHaibing , Ira Weiny , Jason Gunthorpe , John Hubbard , Keith Busch Subject: [PATCH v3 04/11] powerpc/mce_power: Applies counting method to monitor lockless pgtbl walks Date: Tue, 24 Sep 2019 18:24:21 -0300 Message-Id: <20190924212427.7734-5-leonardo@linux.ibm.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190924212427.7734-1-leonardo@linux.ibm.com> References: <20190924212427.7734-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-24_10:,, 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=738 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1908290000 definitions=main-1909240173 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 lockless pgtable walks on addr_to_pfn(). Signed-off-by: Leonardo Bras --- arch/powerpc/kernel/mce_power.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/arch/powerpc/kernel/mce_power.c b/arch/powerpc/kernel/mce_power.c index a814d2dfb5b0..0f2f87da4cd1 100644 --- a/arch/powerpc/kernel/mce_power.c +++ b/arch/powerpc/kernel/mce_power.c @@ -27,6 +27,7 @@ unsigned long addr_to_pfn(struct pt_regs *regs, unsigned long addr) { pte_t *ptep; unsigned long flags; + unsigned long pfn; struct mm_struct *mm; if (user_mode(regs)) @@ -34,15 +35,21 @@ unsigned long addr_to_pfn(struct pt_regs *regs, unsigned long addr) else mm = &init_mm; + start_lockless_pgtbl_walk(mm); local_irq_save(flags); if (mm == current->mm) ptep = find_current_mm_pte(mm->pgd, addr, NULL, NULL); else ptep = find_init_mm_pte(addr, NULL); - local_irq_restore(flags); + if (!ptep || pte_special(*ptep)) - return ULONG_MAX; - return pte_pfn(*ptep); + pfn = ULONG_MAX; + else + pfn = pte_pfn(*ptep); + + local_irq_restore(flags); + end_lockless_pgtbl_walk(mm); + return pfn; } /* flush SLBs and reload */ -- 2.20.1