Received: by 10.213.65.68 with SMTP id h4csp1047929imn; Wed, 14 Mar 2018 08:06:04 -0700 (PDT) X-Google-Smtp-Source: AG47ELsbYlKzq/O6HrOTku3sP3BuMagrST/Ur6mFylDE40oMPmN+TyGRt2T+KUS5ooX7MnrHIwwb X-Received: by 10.99.114.77 with SMTP id c13mr4014354pgn.8.1521039964565; Wed, 14 Mar 2018 08:06:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521039964; cv=none; d=google.com; s=arc-20160816; b=fEq00uW6JrbVpeNdnbDeHnzWOWmZ0LpDUhgndQ8XkgkR/n4t05HdRmKEC40BxXO0H+ s05eB9h6k1nxwLU3ZH3G2iMtfVX9DZFHPIgcHty87TEg837u2qjzj8+lxDmWlXBPm5mJ XWZ7k9H/UOY0RzMUG6hm+xM6ArVBegas5zjUwGieny2brhPMA2c8PWbNUWUvRZmFEBft Q4wYFrIKgZKxrh9Qn7d5WjOtoFkOA+T7psMZnrxkoPqQj7fHIhrfNWlHn2YfEGzvT8Av MEENZbRURxap4VSYtvNE4c6/rBfQjQa3nMq/xFGtOVocEuS7pD6EBznDSpfYRKJwxE73 17HQ== 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-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :organization:from:references:cc:to:subject :arc-authentication-results; bh=qSQ3iPA+yGv2qPA4PadvDR0roUvhiis40nyAamSMaPw=; b=YeNN6xa/TiVxiVcdiyn3Wq20Oe0xK2DNM8skEQOuk0RkyeOo/It8yTS9dEQY893Yu8 ZwGVWQ753i3zqy5XwxxzhehyVq01MXa5iO9ur++LJ1GEw1qDgIRAG8lZEPFddL0DidAF p4+mRMQiTzewIQVZBBK2lD71JcujO2BcTr1uXi6XoQe8PXU1XqiNCq8RKymY5OXVg7mT HVDCZ0US4Vx7yv936dXVbv75e1yMSDZhNA6u9qa9y/1CMOQEjvEEO4pqjWfgpa3ufh3d Gdywq1q05LdtVBnFg8pkxzG8sJQNJTR5h1q0t7IDPsK1jd/6uxkGhqa5c9WpWc3FjS3I bc7Q== 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 70-v6si2079723ple.639.2018.03.14.08.05.49; Wed, 14 Mar 2018 08:06:04 -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 S1752392AbeCNPDm (ORCPT + 99 others); Wed, 14 Mar 2018 11:03:42 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:52364 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752373AbeCNPDj (ORCPT ); Wed, 14 Mar 2018 11:03:39 -0400 Received: from pps.filterd (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w2EF2ikW070728 for ; Wed, 14 Mar 2018 11:03:39 -0400 Received: from e06smtp13.uk.ibm.com (e06smtp13.uk.ibm.com [195.75.94.109]) by mx0a-001b2d01.pphosted.com with ESMTP id 2gq5c6a9vg-1 (version=TLSv1.2 cipher=AES256-SHA256 bits=256 verify=NOT) for ; Wed, 14 Mar 2018 11:03:38 -0400 Received: from localhost by e06smtp13.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 14 Mar 2018 15:03:35 -0000 Received: from b06cxnps4074.portsmouth.uk.ibm.com (9.149.109.196) by e06smtp13.uk.ibm.com (192.168.101.143) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 14 Mar 2018 15:03:32 -0000 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w2EF3WQG52166760; Wed, 14 Mar 2018 15:03:32 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 28009AE051; Wed, 14 Mar 2018 14:53:59 +0000 (GMT) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id CE89BAE05D; Wed, 14 Mar 2018 14:53:58 +0000 (GMT) Received: from oc3784624756.ibm.com (unknown [9.152.212.106]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 14 Mar 2018 14:53:58 +0000 (GMT) Subject: Re: [PATCH] perf stat: Add support for s390 transaction counters To: Arnaldo Carvalho de Melo Cc: Andi Kleen , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, brueckner@linux.vnet.ibm.com, schwidefsky@de.ibm.com, heiko.carstens@de.ibm.com References: <20180312103807.45069-1-tmricht@linux.vnet.ibm.com> <87tvtk64ld.fsf@linux.intel.com> <20180314131850.GA27335@kernel.org> From: Thomas-Mich Richter Organization: IBM LTC Date: Wed, 14 Mar 2018 16:03:31 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <20180314131850.GA27335@kernel.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-IE Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 x-cbid: 18031415-0012-0000-0000-000005BE69E1 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18031415-0013-0000-0000-0000193A6F1B Message-Id: X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2018-03-14_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 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1803140170 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 03/14/2018 02:18 PM, Arnaldo Carvalho de Melo wrote: > Em Wed, Mar 14, 2018 at 09:34:48AM +0100, Thomas-Mich Richter escreveu: >> On 03/13/2018 04:23 AM, Andi Kleen wrote: >>> Thomas Richter writes: > >>>> Right now there is only hard coded support for x86. > >>> That's not true. There is support for generic transaction events in perf. > >>> As far as I can tell your events would map 1:1 to the generic tx-* events. > >> I might be wrong, but when I look at function add_default_attributes() >> in file buildin-stat.c the string variables transaction_attrs >> and transaction_limited_attrs are used when flag T is specified on command line: > >> /* Default events used for perf stat -T */ >> static const char *transaction_attrs = { >> "task-clock," >> "{" >> "instructions," >> "cycles," >> "cpu/cycles-t/," >> "cpu/tx-start/," >> "cpu/el-start/," >> "cpu/cycles-ct/" >> "}" >> }; > >> These PMU events show up on my x86 notebook but no on the s390. >> That's why I came to this conclusion. I have not tried other architectures. > > So, I think Andi is saying that the s/390 kernel should map the generic > transaction events (cpu/cycles-t/, cpu/tx-start/, etc) to the events you > want to make 'perf stat -T' use, that way 'perf stat' doesn't have to be > changed, it will continue asking for the generic transaction event names > and then the kernel does the translation. > > Just like we map "cycles" to different underlying events in different > architectures, right? > > - Arnaldo S390 has no support for Elision and uses transaction begin/end/abort instructions. The CPU measurement counter facility provides counters for transaction end and transaction abort. This means s390 counter facility device driver in arch/s390/kernel/perf_cpum_cf.c could support the tx_abort and tx_commit symbolic counter names. I have used this table (taken from arch/x86/events/intel/core.c) as giudeline: /* Haswell special events */ EVENT_ATTR_STR(tx-start, tx_start, "event=0xc9,umask=0x1"); EVENT_ATTR_STR(tx-commit, tx_commit, "event=0xc9,umask=0x2"); EVENT_ATTR_STR(tx-abort, tx_abort, "event=0xc9,umask=0x4"); EVENT_ATTR_STR(tx-capacity, tx_capacity, "event=0x54,umask=0x2"); EVENT_ATTR_STR(tx-conflict, tx_conflict, "event=0x54,umask=0x1"); EVENT_ATTR_STR(el-start, el_start, "event=0xc8,umask=0x1"); EVENT_ATTR_STR(el-commit, el_commit, "event=0xc8,umask=0x2"); EVENT_ATTR_STR(el-abort, el_abort, "event=0xc8,umask=0x4"); EVENT_ATTR_STR(el-capacity, el_capacity, "event=0x54,umask=0x2"); EVENT_ATTR_STR(el-conflict, el_conflict, "event=0x54,umask=0x1"); EVENT_ATTR_STR(cycles-t, cycles_t, "event=0x3c,in_tx=1"); EVENT_ATTR_STR(cycles-ct, cycles_ct, "event=0x3c,in_tx=1,in_tx_cp=1"); So s390 can only support tx_commit and tx-abort symbolic names. None of them show up in the transactions_attrs and transaction_limited_attrs string variables used in builtin-stat.c file. That is the reason why I introduced the patch set v2. -- Thomas Richter, Dept 3303, IBM LTC Boeblingen Germany -- Vorsitzende des Aufsichtsrats: Martina Koederitz Geschäftsführung: Dirk Wittkopp Sitz der Gesellschaft: Böblingen / Registergericht: Amtsgericht Stuttgart, HRB 243294