Received: by 10.223.164.202 with SMTP id h10csp852398wrb; Tue, 7 Nov 2017 16:10:26 -0800 (PST) X-Google-Smtp-Source: ABhQp+TUJGt05jRHiDXKz7tepoAdntSYjD8Sxa0bAQA5liIbHObIeQ8Bb5y5gPxaZcPoc8zn35YL X-Received: by 10.101.93.9 with SMTP id e9mr427748pgr.302.1510099826106; Tue, 07 Nov 2017 16:10:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510099826; cv=none; d=google.com; s=arc-20160816; b=mpJ6GKfTYcXuig68hVsaCXtWMs+Fkz7D7XQoDT7buI2SrJgkttg9KKyULk/SlmhtkI JR+6nCwyTGEm/x9L5YpQDdULsAqmO4MwptPvzkLfcbe5Qus9Z8mSZEjb1j3u82XTnncm a3C+t1fTN5upD6yhXIcRIhH11VX8YwXafPWOUJD+TcjxeQMbNy/hlj4scAaCZHs/YB3K 83Vpkl50bq69MWvwumY30OJBebKWVZ+hlrcXIJPp81G8HUakczo2+M4DNX1euZrB9Cta IL0KIgVvBNYNbgYm4K9ThqYicFFAO+H53qOnjaRW0xKJD74cKhL1xGBma8eHLJJoehx1 yc9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :from:references:cc:to:subject:arc-authentication-results; bh=+LYxfgIfuKYf8VTnNuAakdcDVv1YsdShizWDC6e/pKs=; b=fRUMOw227vUMPO1lVpEBZnBYjEPY/UmzfTTBfXCfyu6pEitAAuWpBWdM0xguEgBJo1 fKR0+RLXtO4a+UZtmHI4esTnoxLuIJzQFQPPQ/eERxS3tQ/9/7lfaaBedfsnhsNG9Ezg TCWp4XvLBBKvtAFJsOgcAYwDBLi92NDuAuIh8Sinb4sTdjQgL+42RO8YgXLx95/F80xV LLN5ZdxCQNJ79MqIR8QatLruuFb8arEn1CyO/vjQOk0GQ8C0C7tr1heChT4VIF8yjJUe OlBkw5zurCzgfribnuOBV3FCCycbYsWiFJg3mOKVPnZh5RCVO1k6GlRxzf0Q1Rm4ui3R 63rA== 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 l9si2301418pgf.828.2017.11.07.16.09.43; Tue, 07 Nov 2017 16:10:26 -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; 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 S933467AbdKGMGR (ORCPT + 91 others); Tue, 7 Nov 2017 07:06:17 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:51410 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754746AbdKGMGP (ORCPT ); Tue, 7 Nov 2017 07:06:15 -0500 Received: from pps.filterd (m0098393.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id vA7C56up105202 for ; Tue, 7 Nov 2017 07:06:15 -0500 Received: from e15.ny.us.ibm.com (e15.ny.us.ibm.com [129.33.205.205]) by mx0a-001b2d01.pphosted.com with ESMTP id 2e3bhgkvf7-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Tue, 07 Nov 2017 07:06:14 -0500 Received: from localhost by e15.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 7 Nov 2017 07:06:11 -0500 Received: from b01cxnp23033.gho.pok.ibm.com (9.57.198.28) by e15.ny.us.ibm.com (146.89.104.202) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 7 Nov 2017 07:06:10 -0500 Received: from b01ledav001.gho.pok.ibm.com (b01ledav001.gho.pok.ibm.com [9.57.199.106]) by b01cxnp23033.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id vA7C6AUo56688892; Tue, 7 Nov 2017 12:06:10 GMT Received: from b01ledav001.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C931328046; Tue, 7 Nov 2017 07:06:02 -0500 (EST) Received: from [9.124.35.31] (unknown [9.124.35.31]) by b01ledav001.gho.pok.ibm.com (Postfix) with ESMTP id 9D83E2803D; Tue, 7 Nov 2017 07:06:01 -0500 (EST) Subject: Re: [PATCH v2] powerpc/kernel/sysfs: Export ldbar spr to sysfs To: Michael Ellerman Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, maddy@linux.vnet.ibm.com References: <1509466547-761-1-git-send-email-anju@linux.vnet.ibm.com> <87h8ue960z.fsf@concordia.ellerman.id.au> From: Anju T Sudhakar Date: Tue, 7 Nov 2017 17:36:08 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <87h8ue960z.fsf@concordia.ellerman.id.au> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-TM-AS-GCONF: 00 x-cbid: 17110712-0036-0000-0000-00000287EB1C X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00008025; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000239; SDB=6.00942405; UDB=6.00475382; IPR=6.00722693; BA=6.00005675; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00017894; XFM=3.00000015; UTC=2017-11-07 12:06:11 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17110712-0037-0000-0000-0000424F3B81 Message-Id: <48d62ebb-73b9-86c6-b1f2-39ee1d3ae846@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-11-07_04:,, 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=1011 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1707230000 definitions=main-1711070168 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi mpe, On Wednesday 01 November 2017 06:20 AM, Michael Ellerman wrote: > Anju T Sudhakar writes: > >> Add ldbar spr to sysfs. The spr will hold thread level In-Memory Collection (IMC) >> counter configuration data. > This is missing any justification for why we would want to expose this, > and in particular why we would make it *writable*. > > cheers Thank you for reviewing the patch. LDBAR, holds the thread-level counter configuration. Exposing this will help us to understand  the current status of thread-level counters in the system. Primarily, Bit 0 of ldbar tells whether the counters are enabled or not. And bit 1  tells the mode (if 0-Accumulation Mode/if 1-Trace Mode). But regarding the permission, you are right. On a reassessment I think that the permission should be read only, because it is possible that we may write an incorrect value to the ldbar, that is wrong. So I will change the permission here. Thanks, Anju > >> diff --git a/arch/powerpc/kernel/sysfs.c b/arch/powerpc/kernel/sysfs.c >> index 4437c70..f8caee0 100644 >> --- a/arch/powerpc/kernel/sysfs.c >> +++ b/arch/powerpc/kernel/sysfs.c >> @@ -485,6 +485,7 @@ SYSFS_PMCSETUP(mmcra, SPRN_MMCRA); >> SYSFS_SPRSETUP(purr, SPRN_PURR); >> SYSFS_SPRSETUP(spurr, SPRN_SPURR); >> SYSFS_SPRSETUP(pir, SPRN_PIR); >> +SYSFS_SPRSETUP(ldbar, SPRN_LDBAR); >> >> /* >> Lets only enable read for phyp resources and >> @@ -492,6 +493,7 @@ SYSFS_SPRSETUP(pir, SPRN_PIR); >> Lets be conservative and default to pseries. >> */ >> static DEVICE_ATTR(mmcra, 0600, show_mmcra, store_mmcra); >> +static DEVICE_ATTR(ldbar, 0600, show_ldbar, store_ldbar); >> static DEVICE_ATTR(spurr, 0400, show_spurr, NULL); >> static DEVICE_ATTR(purr, 0400, show_purr, store_purr); >> static DEVICE_ATTR(pir, 0400, show_pir, NULL); >> @@ -757,6 +759,9 @@ static int register_cpu_online(unsigned int cpu) >> device_create_file(s, &pmc_attrs[i]); >> >> #ifdef CONFIG_PPC64 >> + if (cpu_has_feature(CPU_FTR_ARCH_300)) >> + device_create_file(s, &dev_attr_ldbar); >> + >> if (cpu_has_feature(CPU_FTR_MMCRA)) >> device_create_file(s, &dev_attr_mmcra); >> >> @@ -842,6 +847,9 @@ static int unregister_cpu_online(unsigned int cpu) >> device_remove_file(s, &pmc_attrs[i]); >> >> #ifdef CONFIG_PPC64 >> + if (cpu_has_feature(CPU_FTR_ARCH_300)) >> + device_remove_file(s, &dev_attr_ldbar); >> + >> if (cpu_has_feature(CPU_FTR_MMCRA)) >> device_remove_file(s, &dev_attr_mmcra); >> >> -- >> 2.7.4 From 1582822806009262669@xxx Wed Nov 01 00:50:57 +0000 2017 X-GM-THRID: 1582790473974662008 X-Gmail-Labels: Inbox,Category Forums