Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp5992240ybc; Wed, 27 Nov 2019 13:03:17 -0800 (PST) X-Google-Smtp-Source: APXvYqz25c5t4YUGHDEKmLCxY/mexaKdaXSQBZsw0ORdz8Frp9BSD/WllW579QRf/gQ9KidyTIah X-Received: by 2002:a50:9b1a:: with SMTP id o26mr33857681edi.208.1574888597572; Wed, 27 Nov 2019 13:03:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574888597; cv=none; d=google.com; s=arc-20160816; b=a3s+cLyGl6+MXDIM6I5qrSykEPsJbJslJBZBoVp8GhZTYeRdbYhSEsBWSKwplX5w3M GahRkVR9S+oP5yt+nmF2emAH+VG8siPMyxJEHzykztHWWHIRTeNrEX1Arzjx8HuCB5FE OyYU91N4de3nTjMljs8wt9HcNRAlXz/MygLhHcVz8C0e8JRkuoNBEE6mhUCoIbBGHRqM ghRoVLYcjUm2s+6O8JkgCyuSsADlLLsQy+fTn42utcvDTW1Xc/YAw0lTYVIywY4/an4u 28R5eg2KL7yogvMXNzM8H5owe8BMVaBuCWnRcci+k+XgegI7shbLKN775nrHgbkPxFB9 JlWQ== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=A+5hTJ3DYAK3bQxPaRjLVKcPfNnTRA3Zh+BmebIKBLQ=; b=w9UaTqf09mrFmFQxIl9uvynBhwTc3/69vq6f/bHbjDtwTlqNLtGbmusiLZyqq0v0uA JGcg5LEHfV53mLfjgUF+6tLYuKABW+D5/JHM1czRLQbZRmDpizlgB9XwmLN+g6AKpacM MAiIzHbJP/ZtEQr+3O4kLAUILBNbbBSG3UhUxs3K3m/pSEtpVTvW1cH6nZua6AxGzC5V Z22sw1YvTDkw73EH+YypTX2WGj+YZ7fpF0rTjWSJhxdeex33PJJrfD66TSvJHDyvRxgb ZhW++tyFnbEQlbWPN5t9bQhn/0RMiZaaXJDKFm3togiE/7msTWrWYGW1kJsU6xMvV0Yh 6BVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Rh4x1k3H; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h19si9928716ejx.34.2019.11.27.13.02.44; Wed, 27 Nov 2019 13:03:17 -0800 (PST) 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; dkim=pass header.i=@kernel.org header.s=default header.b=Rh4x1k3H; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731452AbfK0U7i (ORCPT + 99 others); Wed, 27 Nov 2019 15:59:38 -0500 Received: from mail.kernel.org ([198.145.29.99]:51108 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731429AbfK0U7d (ORCPT ); Wed, 27 Nov 2019 15:59:33 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id BE4CF20678; Wed, 27 Nov 2019 20:59:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574888373; bh=hi6mJMVKv1MtVb2EHx6lfLPaOf6PJf+kSEYgHZKgl5U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Rh4x1k3HiBmvQkSOL1hHvS2cBQc1M0pW0catKVxD1Yt/K8jnpvsTQvbEod5KEsp64 pXkBpPxiL7dYJ5zkRUru9olyWAsdwkKqv807tuhu8VGttmj1OcukNKom2T3ZIrzRV+ gpWoIM7nzqBUc9P6xQqIsBP846/uF47/MsN0anb4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Aravinda Prasad , Michael Ellerman , Sasha Levin Subject: [PATCH 4.19 110/306] powerpc/pseries: Export raw per-CPU VPA data via debugfs Date: Wed, 27 Nov 2019 21:29:20 +0100 Message-Id: <20191127203123.278063706@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191127203114.766709977@linuxfoundation.org> References: <20191127203114.766709977@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Aravinda Prasad [ Upstream commit c6c26fb55e8e4b3fc376be5611685990a17de27a ] This patch exports the raw per-CPU VPA data via debugfs. A per-CPU file is created which exports the VPA data of that CPU to help debug some of the VPA related issues or to analyze the per-CPU VPA related statistics. v3: Removed offline CPU check. v2: Included offline CPU check and other review comments. Signed-off-by: Aravinda Prasad Signed-off-by: Michael Ellerman Signed-off-by: Sasha Levin --- arch/powerpc/platforms/pseries/lpar.c | 54 +++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/arch/powerpc/platforms/pseries/lpar.c b/arch/powerpc/platforms/pseries/lpar.c index ea602f7f97ce1..49e3a88b6a0c1 100644 --- a/arch/powerpc/platforms/pseries/lpar.c +++ b/arch/powerpc/platforms/pseries/lpar.c @@ -48,6 +48,7 @@ #include #include #include +#include #include "pseries.h" @@ -1032,3 +1033,56 @@ static int __init reserve_vrma_context_id(void) return 0; } machine_device_initcall(pseries, reserve_vrma_context_id); + +#ifdef CONFIG_DEBUG_FS +/* debugfs file interface for vpa data */ +static ssize_t vpa_file_read(struct file *filp, char __user *buf, size_t len, + loff_t *pos) +{ + int cpu = (long)filp->private_data; + struct lppaca *lppaca = &lppaca_of(cpu); + + return simple_read_from_buffer(buf, len, pos, lppaca, + sizeof(struct lppaca)); +} + +static const struct file_operations vpa_fops = { + .open = simple_open, + .read = vpa_file_read, + .llseek = default_llseek, +}; + +static int __init vpa_debugfs_init(void) +{ + char name[16]; + long i; + static struct dentry *vpa_dir; + + if (!firmware_has_feature(FW_FEATURE_SPLPAR)) + return 0; + + vpa_dir = debugfs_create_dir("vpa", powerpc_debugfs_root); + if (!vpa_dir) { + pr_warn("%s: can't create vpa root dir\n", __func__); + return -ENOMEM; + } + + /* set up the per-cpu vpa file*/ + for_each_possible_cpu(i) { + struct dentry *d; + + sprintf(name, "cpu-%ld", i); + + d = debugfs_create_file(name, 0400, vpa_dir, (void *)i, + &vpa_fops); + if (!d) { + pr_warn("%s: can't create per-cpu vpa file\n", + __func__); + return -ENOMEM; + } + } + + return 0; +} +machine_arch_initcall(pseries, vpa_debugfs_init); +#endif /* CONFIG_DEBUG_FS */ -- 2.20.1