Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp2195597pxb; Fri, 25 Mar 2022 12:49:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzSdp9H/kAXnEPQOOqdj4U79H14lvYZrHl/wa11qcET/cLJ6pnvWwoxEc2DooCYq6AEy5Il X-Received: by 2002:a65:55c4:0:b0:381:71f9:cd35 with SMTP id k4-20020a6555c4000000b0038171f9cd35mr915244pgs.94.1648237772052; Fri, 25 Mar 2022 12:49:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648237772; cv=none; d=google.com; s=arc-20160816; b=cyRg00XV5GKz+48+Qz8G6Oj/lIhY9XwtbAbZQn1732upOfOtULe4NRIGRg8Zcd+5LO vg71w/tbQv8+VnXqC7S0EOWmEig+ZA0aOTqX+JGkUHYZV2viKDEo1OwHVAC9JuRK6ZxW Dsotm/IlgCURSeCt/1B709UcQ0aFEFqRIqSMos85gwg2+iaz9JIJkgf1HTv/Dyo3m/h7 neoY+nh5L8pMbiqtY2V8DneIwyYIt9kwBRZ2fr9ZhMcNk3EW/5V6jKrXPIgvKRRNBBf9 x7PSaTWSQrdsH+4unManaWBkx59hEimBoH8VzvH5yXGI2yMc/Gs7Lb102J7Fl5+Nnxoi 4t8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=Tdk9CmGFg/6pCzD1YGaDIup6/7+OpbxsiJ4fnroxoRQ=; b=mNYRAc0J0SeKO9KOZLSS45VqHlEStM80Q2aG+GJ0Y3Jjwsjsix8GYUv2gg8EZQp5Bw riiBt8wBa/lnJzfLo0yjcrUgKYtmbCpIPlH8EgPH//i4BQrGf1bD3Vl73i2GBUtqYxja stCoPPsn18GTUaBwStV6uJjBNUr3MPyTBmNrNwvXDOrb5TvNN1Qp+Yu6QqkV+h7e/gtD KkX44GiDDLa5rDGkLgZieus76M5qViUAvYqRnezh94uMKPJJfMEqIxiZ6vL+qHaRPaJM auxmkZm7xRjzGTgJGCDybUkvXpy8IWbqCvkVJBNlgCUp9T3RXBGGFG5c25R1qYFaJN9D hedg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id b1-20020a170902d50100b00153b2d16561si3464930plg.361.2022.03.25.12.49.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Mar 2022 12:49:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 4563F279721; Fri, 25 Mar 2022 11:39:06 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347952AbiCXDWI (ORCPT + 99 others); Wed, 23 Mar 2022 23:22:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38128 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237620AbiCXDWH (ORCPT ); Wed, 23 Mar 2022 23:22:07 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3D4582D1ED; Wed, 23 Mar 2022 20:20:36 -0700 (PDT) Received: from kwepemi500007.china.huawei.com (unknown [172.30.72.56]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4KP9Rl2NqlzfZS0; Thu, 24 Mar 2022 11:18:59 +0800 (CST) Received: from kwepemm600003.china.huawei.com (7.193.23.202) by kwepemi500007.china.huawei.com (7.221.188.207) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21; Thu, 24 Mar 2022 11:20:33 +0800 Received: from ubuntu1804.huawei.com (10.67.174.61) by kwepemm600003.china.huawei.com (7.193.23.202) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21; Thu, 24 Mar 2022 11:20:32 +0800 From: Yang Jihong To: , , , , , , , , , , , , , CC: Subject: [PATCH] perf/x86: Unify format of events sysfs show Date: Thu, 24 Mar 2022 11:19:57 +0800 Message-ID: <20220324031957.135595-1-yangjihong1@huawei.com> X-Mailer: git-send-email 2.30.GIT MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.67.174.61] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To kwepemm600003.china.huawei.com (7.193.23.202) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Sysfs show formats of files in /sys/devices/cpu/events/ are not unified, some end with "\n", and some do not. Modify sysfs show format of events defined by EVENT_ATTR_STR to end with "\n". Before: $ ls /sys/devices/cpu/events/* | xargs -i sh -c 'echo -n "{}: "; cat -A {}; echo' branch-instructions: event=0xc4$ branch-misses: event=0xc5$ bus-cycles: event=0x3c,umask=0x01$ cache-misses: event=0x2e,umask=0x41$ cache-references: event=0x2e,umask=0x4f$ cpu-cycles: event=0x3c$ instructions: event=0xc0$ ref-cycles: event=0x00,umask=0x03$ slots: event=0x00,umask=0x4 topdown-bad-spec: event=0x00,umask=0x81 topdown-be-bound: event=0x00,umask=0x83 topdown-fe-bound: event=0x00,umask=0x82 topdown-retiring: event=0x00,umask=0x80 After: $ ls /sys/devices/cpu/events/* | xargs -i sh -c 'echo -n "{}: "; cat -A {}; echo' /sys/devices/cpu/events/branch-instructions: event=0xc4$ /sys/devices/cpu/events/branch-misses: event=0xc5$ /sys/devices/cpu/events/bus-cycles: event=0x3c,umask=0x01$ /sys/devices/cpu/events/cache-misses: event=0x2e,umask=0x41$ /sys/devices/cpu/events/cache-references: event=0x2e,umask=0x4f$ /sys/devices/cpu/events/cpu-cycles: event=0x3c$ /sys/devices/cpu/events/instructions: event=0xc0$ /sys/devices/cpu/events/ref-cycles: event=0x00,umask=0x03$ /sys/devices/cpu/events/slots: event=0x00,umask=0x4$ Signed-off-by: Yang Jihong --- arch/x86/events/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/events/core.c b/arch/x86/events/core.c index eef816fc216d..e3cc099886ab 100644 --- a/arch/x86/events/core.c +++ b/arch/x86/events/core.c @@ -1837,7 +1837,7 @@ ssize_t events_sysfs_show(struct device *dev, struct device_attribute *attr, cha /* string trumps id */ if (pmu_attr->event_str) - return sprintf(page, "%s", pmu_attr->event_str); + return sprintf(page, "%s\n", pmu_attr->event_str); return x86_pmu.events_sysfs_show(page, config); } -- 2.30.GIT