Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp154146pxb; Thu, 2 Sep 2021 22:13:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyJ1dM1ZCFMwOgPLouuMe7JCnhGwxorNXx+H9GDWgam1aDNh3695iOzsMn+KQ7zefBNvQLW X-Received: by 2002:a92:db06:: with SMTP id b6mr1266597iln.305.1630645987529; Thu, 02 Sep 2021 22:13:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630645987; cv=none; d=google.com; s=arc-20160816; b=FSA9q5BdNZAp8WhRqJiKNwY5frjUOOqNRS8f/Vo1hlpLGg+0oem+2yse5ff3kWGSPQ 0w6tYteUQWOP5aESy2yS1rWEj34EsOZ2Rd1NMxPHhwbADVKHlAvl/Rh4JczochMs9BMU yvmt61hXtefGaIE227ipJLCQhRyVjgEvlnggKcy2cpRnxxr0pXr4e8Nu8dRWJbSVbdkN WikuJEYU9JLqOMU5GmzHjTI4rGNEz/GQhhp+uqbGyV6auA6OStOtbi/w/AnSyB3MBEnL qIhzq51AA8UuypYlMXnedhYIerCX+4e6N5HjXYCIJ7A9ON5wO1+UX/z+XuF+BDV++jTM /6SA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :message-id:date:subject:cc:to:from:dkim-signature; bh=K5iypGu1BbZpY7zplx5iSY2p+1Vmww0hXn2ePdVwiUM=; b=wmL8YtJ8yiJ+gfzoskqfGlXhCJeXCB41AXxcG5OkIqQJnbMYVSsDS0w9WBS1xYfL5T ebXUwmKy/AMUYVtjMf1ideRT9ktyMYGcVv3+VVoTZEYc7J19MLVxK7Yf3jzrbxS2ITz9 OXEMMXl6MfqR8vBbBOwRZ1y+Nj4SA7hFHPY+rx4v06rA+qi05ppxcbCp6/WDbKFPw0Ml Q7yG4g8EIsuQ9iVRUEhFwCDrS53IbBskqYlEkD7iatF+LofYJ97f3WL0kBGaFB+qwczz 0RuA7rlVTpUWGz7iaSEbVCPgWd8wgrldNfVbaMSGrkFSomOhVLjHDDkIdLTOUHqS5bTx 6Pog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=OzJr5Pss; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 70si4410638ioc.95.2021.09.02.22.12.55; Thu, 02 Sep 2021 22:13:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=OzJr5Pss; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232717AbhICFL3 (ORCPT + 99 others); Fri, 3 Sep 2021 01:11:29 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:20388 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S231705AbhICFL3 (ORCPT ); Fri, 3 Sep 2021 01:11:29 -0400 Received: from pps.filterd (m0098413.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 18355es4093505; Fri, 3 Sep 2021 01:09:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : content-transfer-encoding : mime-version; s=pp1; bh=K5iypGu1BbZpY7zplx5iSY2p+1Vmww0hXn2ePdVwiUM=; b=OzJr5PssvJLH1hnBVwpAz6yxfqOyMFZjhJbXEy4b1Vfh2n0ZYCEEczs0T7xAF1x1Uffl Zc9ZLY5Pi4OC6z2WfMLVaq0dktgxLmwK/OsjOgle+ZQFsbh1Mp5rQs3VcwLBz6LXdB5M L7tX0QDtbvJaS00IaY9+za6+h84pMtNQbsQUwQJjrjtAxx0Zr946D5BV+3DMgurSC7FB 0jUyEXaIXBz0xDlD49h9MfnHQOStN8+4rJ/Cq4h7k3EW8b+E8PJKKgtApErZz081T41U ac4QjwqyEf0b8lFigegvkI7s/psWtKiLSP8WKKB2EFtejAG1tnkeWPdxf7QVzADTFr9/ eg== Received: from ppma02fra.de.ibm.com (47.49.7a9f.ip4.static.sl-reverse.com [159.122.73.71]) by mx0b-001b2d01.pphosted.com with ESMTP id 3auc9vs73d-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 03 Sep 2021 01:09:53 -0400 Received: from pps.filterd (ppma02fra.de.ibm.com [127.0.0.1]) by ppma02fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 18356xFg027548; Fri, 3 Sep 2021 05:09:51 GMT Received: from b06cxnps4075.portsmouth.uk.ibm.com (d06relay12.portsmouth.uk.ibm.com [9.149.109.197]) by ppma02fra.de.ibm.com with ESMTP id 3au6pmtp9m-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 03 Sep 2021 05:09:51 +0000 Received: from d06av24.portsmouth.uk.ibm.com (d06av24.portsmouth.uk.ibm.com [9.149.105.60]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 18359m8151708244 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 3 Sep 2021 05:09:48 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1532542047; Fri, 3 Sep 2021 05:09:48 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id DA0BE42045; Fri, 3 Sep 2021 05:09:43 +0000 (GMT) Received: from localhost.localdomain.com (unknown [9.43.127.78]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 3 Sep 2021 05:09:43 +0000 (GMT) From: Kajol Jain To: mpe@ellerman.id.au, linuxppc-dev@lists.ozlabs.org, nvdimm@lists.linux.dev, linux-kernel@vger.kernel.org, peterz@infradead.org, dan.j.williams@intel.com, ira.weiny@intel.com, vishal.l.verma@intel.com Cc: maddy@linux.ibm.com, santosh@fossix.org, aneesh.kumar@linux.ibm.com, vaibhav@linux.ibm.com, atrajeev@linux.vnet.ibm.com, tglx@linutronix.de, kjain@linux.ibm.com, rnsastry@linux.ibm.com Subject: [RESEND PATCH v4 0/4] Add perf interface to expose nvdimm Date: Fri, 3 Sep 2021 10:39:10 +0530 Message-Id: <20210903050914.273525-1-kjain@linux.ibm.com> X-Mailer: git-send-email 2.31.1 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: 1nvoAyRcwUhd8VrFkEX528F0g9eu4eaF X-Proofpoint-GUID: 1nvoAyRcwUhd8VrFkEX528F0g9eu4eaF Content-Transfer-Encoding: 8bit X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391,18.0.790 definitions=2021-09-03_01:2021-09-03,2021-09-03 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 priorityscore=1501 clxscore=1011 impostorscore=0 suspectscore=0 mlxlogscore=999 phishscore=0 mlxscore=0 bulkscore=0 spamscore=0 adultscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2108310000 definitions=main-2109030031 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Patchset adds performance stats reporting support for nvdimm. Added interface includes support for pmu register/unregister functions. A structure is added called nvdimm_pmu to be used for adding arch/platform specific data such as supported events, cpumask pmu event functions like event_init/add/read/del. User could use the standard perf tool to access perf events exposed via pmu. Added implementation to expose IBM pseries platform nmem* device performance stats using this interface. Result from power9 pseries lpar with 2 nvdimm device: command:# perf list nmem nmem0/cchrhcnt/ [Kernel PMU event] nmem0/cchwhcnt/ [Kernel PMU event] nmem0/critrscu/ [Kernel PMU event] nmem0/ctlresct/ [Kernel PMU event] nmem0/ctlrestm/ [Kernel PMU event] nmem0/fastwcnt/ [Kernel PMU event] nmem0/hostlcnt/ [Kernel PMU event] nmem0/hostldur/ [Kernel PMU event] nmem0/hostscnt/ [Kernel PMU event] nmem0/hostsdur/ [Kernel PMU event] nmem0/medrcnt/ [Kernel PMU event] nmem0/medrdur/ [Kernel PMU event] nmem0/medwcnt/ [Kernel PMU event] nmem0/medwdur/ [Kernel PMU event] nmem0/memlife/ [Kernel PMU event] nmem0/noopstat/ [Kernel PMU event] nmem0/ponsecs/ [Kernel PMU event] nmem1/cchrhcnt/ [Kernel PMU event] nmem1/cchwhcnt/ [Kernel PMU event] nmem1/critrscu/ [Kernel PMU event] ... nmem1/noopstat/ [Kernel PMU event] nmem1/ponsecs/ [Kernel PMU event] Patch1: Introduces the nvdimm_pmu structure Patch2: Adds common interface to add arch/platform specific data includes supported events, pmu event functions. It also adds code for cpu hotplug support. Patch3: Add code in arch/powerpc/platform/pseries/papr_scm.c to expose nmem* pmu. It fills in the nvdimm_pmu structure with event attrs cpumask andevent functions and then registers the pmu by adding callbacks to register_nvdimm_pmu. Patch4: Sysfs documentation patch Changelog --- v3 -> v4 - Rebase code on top of current papr_scm code without any logical changes. - Added Acked-by tag from Peter Zijlstra and Reviewed by tag from Madhavan Srinivasan. - Link to the patchset v3: https://lkml.org/lkml/2021/6/17/605 v2 -> v3 - Added Tested-by tag. - Fix nvdimm mailing list in the ABI Documentation. - Link to the patchset v2: https://lkml.org/lkml/2021/6/14/25 v1 -> v2 - Fix hotplug code by adding pmu migration call incase current designated cpu got offline. As pointed by Peter Zijlstra. - Removed the retun -1 part from cpu hotplug offline function. - Link to the patchset v1: https://lkml.org/lkml/2021/6/8/500 Kajol Jain (4): drivers/nvdimm: Add nvdimm pmu structure drivers/nvdimm: Add perf interface to expose nvdimm performance stats powerpc/papr_scm: Add perf interface support powerpc/papr_scm: Document papr_scm sysfs event format entries Documentation/ABI/testing/sysfs-bus-papr-pmem | 31 ++ arch/powerpc/include/asm/device.h | 5 + arch/powerpc/platforms/pseries/papr_scm.c | 365 ++++++++++++++++++ drivers/nvdimm/Makefile | 1 + drivers/nvdimm/nd_perf.c | 230 +++++++++++ include/linux/nd.h | 46 +++ 6 files changed, 678 insertions(+) create mode 100644 drivers/nvdimm/nd_perf.c -- 2.26.2