Received: by 2002:a25:b323:0:0:0:0:0 with SMTP id l35csp2346571ybj; Mon, 23 Sep 2019 02:09:05 -0700 (PDT) X-Google-Smtp-Source: APXvYqxKGC9h0O47OC5eXhG5z/zd6CbJ4UnO7X5xg04u7mZ072ioM/2nfTbqiH9R0PnHRrnz5l2e X-Received: by 2002:aa7:d988:: with SMTP id u8mr20861665eds.116.1569229745427; Mon, 23 Sep 2019 02:09:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569229745; cv=none; d=google.com; s=arc-20160816; b=Ee8GfVu0n0kWwux3s2mCo1U0IE1QIRWvSzAdCmH6fIsXipF5gUqIgEShiUtqiwq+xs WN+WflQj7oDcpy6SeJUdKBqC+4p6XPI990Nyu8mCX+4XZbC6aAd6z9+TOLG0I1YCEgAX /ZRxWGzpvLk96t5mBE5KCg29J/3NZ3QglU1J4VYuS7Zc+dzZ8vRQqxBCADSUTZCpp33S LK1X+h2da2Ot9SINi8vjdoaieaEEPZEhD9yGC1XJmYa1ZxhKMN2iRV0yLo3uzhKBAAUI 7qzoMy53kCvlzERW81StaHYwk9xbnhfPaN3I+5eUBVeTeT4mUijIG1ZKKxtSW9z8mJHn /baA== 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=eyMFGMS6dtUDwhV+wsbHrdWzqo/2ZLLInutbUBPf1/SERYPeXSmeTiZRqtW5S+D/O2 l0C1LM69x2xpGNsXWSseeb72YbN3MsV+Z268taHq1Npo6i8DP0L5MHRBPVrJAsvU0GLv 7R+HcVCJXUL7sWont8iK20BwiUKYt38+GkZUAOUP+gF7DPViKnH12pJv9DFK0Qx43ZXh vqgwfCNe9p5hPCZpSiimKtBfYXaN9SqosHey7ZKB8CSLxkNTa4mmtOyzktgBLiZA7u/Y l9j71fXA1yumbAtv0ribuCE5RAWXBPTIFV/gf4bykMQ55aHaq5jBMN1fz9Uokwm98Hjy w9MQ== 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 g5si6274119edb.324.2019.09.23.02.08.42; Mon, 23 Sep 2019 02:09:05 -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 S2436802AbfITTwT (ORCPT + 99 others); Fri, 20 Sep 2019 15:52:19 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:32302 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726794AbfITTwR (ORCPT ); Fri, 20 Sep 2019 15:52:17 -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 x8KJlxXj045051; Fri, 20 Sep 2019 15:51:41 -0400 Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 2v51uh8djd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 20 Sep 2019 15:51:41 -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 x8KJm05T045158; Fri, 20 Sep 2019 15:51:40 -0400 Received: from ppma04wdc.us.ibm.com (1a.90.2fa9.ip4.static.sl-reverse.com [169.47.144.26]) by mx0a-001b2d01.pphosted.com with ESMTP id 2v51uh8dhw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 20 Sep 2019 15:51:40 -0400 Received: from pps.filterd (ppma04wdc.us.ibm.com [127.0.0.1]) by ppma04wdc.us.ibm.com (8.16.0.27/8.16.0.27) with SMTP id x8KJoH9X013693; Fri, 20 Sep 2019 19:51:39 GMT Received: from b03cxnp08027.gho.boulder.ibm.com (b03cxnp08027.gho.boulder.ibm.com [9.17.130.19]) by ppma04wdc.us.ibm.com with ESMTP id 2v3vc5rq49-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 20 Sep 2019 19:51:39 +0000 Received: from b03ledav004.gho.boulder.ibm.com (b03ledav004.gho.boulder.ibm.com [9.17.130.235]) by b03cxnp08027.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x8KJpb8v61342150 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 20 Sep 2019 19:51:37 GMT Received: from b03ledav004.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7571678063; Fri, 20 Sep 2019 19:51:37 +0000 (GMT) Received: from b03ledav004.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id DD06A78060; Fri, 20 Sep 2019 19:51:32 +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:32 +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 04/11] powerpc/mce_power: Applies counting method to monitor lockless pgtbl walks Date: Fri, 20 Sep 2019 16:50:40 -0300 Message-Id: <20190920195047.7703-5-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=755 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 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