Received: by 10.192.165.148 with SMTP id m20csp81173imm; Fri, 20 Apr 2018 03:26:01 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+pP/BmWtkxdCT5ogOK+zB3zPTEDxAMfRvNNSRkGEzYb+9trIU3ffojMYpLi+6h9bOPIdft X-Received: by 2002:a17:902:6086:: with SMTP id s6-v6mr9558449plj.307.1524219961148; Fri, 20 Apr 2018 03:26:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524219961; cv=none; d=google.com; s=arc-20160816; b=CekWgJgi+ieq15cfmMJxTgyYK00iHHkgId2bfiVUdboe8D6trdYJ/hcPZVEiUv3WMj 3tnSEIa/6OyAsha6zimZkLsOLRjM4uJhWEI+sqAeqbNGv7xax2uJulVXc29LIB/2CsPm EXMqOpq4k0JG3QlQ+dtoUhRECaZYhJ3FJfzQT3GW+mIq7l4sC8lUiQUryhSWngxvDNvO sOF71yAQrIVxyYsIEWNRGqUQqKXl3MCDoFop/n7vf6X/94yGdvNYWYr7HZ9l5KaM98Fo +lgnRjf37Mrwv9IXltP5Lztssmw5E0ay8THlXXTjwCAkcZ6A1t1sycVwNdKE+20x1JeL cEVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from:arc-authentication-results; bh=8RvqzZ4VuSqAiPIoQ3XpIuZkaRxH0csiOx4NTreaW2s=; b=D7edyMq1mZfGt0b10ZzCKZNc1yMhTgz9upAZCEnI1iXp7zNtM5ok9/R0Mkj2+UP3QH 11/FB7ERkjFtqvWYTDfyB0niaxVy5G6BwoD7dBmqW6Hx/DPrVBmfc10gR1w5k2HwynbO 6jl0VTGsp5HqSOh2wmLeP61yFTshmhaO490TI3HWQVrpY4ARJ77BZ+sFZnx6MUtQRgQY RJfeB4RV9blW5w6UyFC0gtqW97BgczMObrbxmpo1vS9uopdrlnEH386lnnHgF4m06K84 C7N7dxfZz0yyXIKTBs+xr71TU4x5kw4t15KruEaSDr+dEYg2I4cCnnrL/aGMMW50HpyT Nsug== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f5-v6si170375plj.86.2018.04.20.03.25.47; Fri, 20 Apr 2018 03:26:01 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754545AbeDTKXs (ORCPT + 99 others); Fri, 20 Apr 2018 06:23:48 -0400 Received: from 9pmail.ess.barracuda.com ([64.235.150.224]:58508 "EHLO 9pmail.ess.barracuda.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754321AbeDTKXq (ORCPT ); Fri, 20 Apr 2018 06:23:46 -0400 Received: from MIPSMAIL01.mipstec.com (mailrelay.mips.com [12.201.5.28]) by mx4.ess.sfj.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NO); Fri, 20 Apr 2018 10:23:00 +0000 Received: from mredfearn-linux.mipstec.com (192.168.155.41) by MIPSMAIL01.mipstec.com (10.20.43.31) with Microsoft SMTP Server (TLS) id 14.3.361.1; Fri, 20 Apr 2018 03:23:19 -0700 From: Matt Redfearn To: James Hogan , Ralf Baechle , Florian Fainelli CC: , Matt Redfearn , Peter Zijlstra , , Huacai Chen , , Paul Burton , Robert Richter , Jiri Olsa , Kate Stewart , Ingo Molnar , Greg Kroah-Hartman , "Maciej W. Rozycki" , Namhyung Kim , Alexander Shishkin , Arnaldo Carvalho de Melo Subject: [PATCH v3 0/7] MIPS: perf: MT fixes and improvements Date: Fri, 20 Apr 2018 11:23:02 +0100 Message-ID: <1524219789-31241-1-git-send-email-matt.redfearn@mips.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [192.168.155.41] X-BESS-ID: 1524219780-298555-31454-28399-1 X-BESS-VER: 2018.5-r1804181636 X-BESS-Apparent-Source-IP: 12.201.5.28 X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.192194 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.00 BSF_BESS_OUTBOUND META: BESS Outbound X-BESS-Outbound-Spam-Status: SCORE=0.00 using account:ESS59374 scores of KILL_LEVEL=7.0 tests=BSF_BESS_OUTBOUND X-BESS-BRTS-Status: 1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This series addresses a few issues with how the MIPS performance counters code supports the hardware multithreading MT ASE. Firstly, implementations of the MT ASE may implement performance counters per core or per thread(TC). MIPS Techologies implementations signal this via a bit in the implmentation specific CONFIG7 register. Since this register is implementation specific, checking it should be guarded by a PRID check. This also replaces a bit defined by a magic number. Secondly, the code currently uses vpe_id(), defined as smp_processor_id(), divided by 2, to share core performance counters between VPEs. This relies on a couple of assumptions of the hardware implementation to function correctly (always 2 VPEs per core, and the hardware reading only the least significant bit). Finally, the method of sharing core performance counters between VPEs is suboptimal since it does not allow one process running on a VPE to use all of the performance counters available to it, because the kernel will reserve half of the coutners for the other VPE even if it may never use them. This reservation at counter probe is replaced with an allocation on use strategy. Tested on a MIPS Creator CI40 (2C2T MIPS InterAptiv with per-TC counters, though for the purposes of testing the per-TC availability was hardcoded to allow testing both paths). Series applies to v4.16 Changes in v3: New patch to detect feature presence in cpu-probe.c Use flag in cpu_data set by cpu_probe.c to indicate feature presence. - rebase on new feature detection Changes in v2: Fix mipsxx_pmu_enable_event for !#ifdef CONFIG_MIPS_MT_SMP - Fix !#ifdef CONFIG_MIPS_PERF_SHARED_TC_COUNTERS build - re-use cpuc variable in mipsxx_pmu_alloc_counter, mipsxx_pmu_free_counter rather than having sibling_ version. Since BMIPS5000 does not implement per TC counters, we can remove the check on cpu_has_mipsmt_pertccounters. New patch to fix BMIPS5000 system mode perf. Matt Redfearn (7): MIPS: Probe for MIPS MT perf counters per TC MIPS: perf: More robustly probe for the presence of per-tc counters MIPS: perf: Use correct VPE ID when setting up VPE tracing MIPS: perf: Fix perf with MT counting other threads MIPS: perf: Allocate per-core counters on demand MIPS: perf: Fold vpe_id() macro into it's one last usage MIPS: perf: Fix BMIPS5000 system mode counting arch/mips/include/asm/cpu-features.h | 7 ++ arch/mips/include/asm/cpu.h | 2 + arch/mips/include/asm/mipsregs.h | 6 + arch/mips/kernel/cpu-probe.c | 12 ++ arch/mips/kernel/perf_event_mipsxx.c | 232 +++++++++++++++++++---------------- arch/mips/oprofile/op_model_mipsxx.c | 2 - 6 files changed, 150 insertions(+), 111 deletions(-) -- 2.7.4