Received: by 10.213.65.68 with SMTP id h4csp2133832imn; Thu, 5 Apr 2018 09:30:38 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/eUBms7lR63UjyPySTa3XHzzOYh/BHLbwczJf0Qra7hespQsKFKpyicUIXm62DopYQcTIx X-Received: by 2002:a17:902:3381:: with SMTP id b1-v6mr23616590plc.214.1522945838900; Thu, 05 Apr 2018 09:30:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522945838; cv=none; d=google.com; s=arc-20160816; b=A35XWy8E45U+5vRGC32q0aACyQRx6iM3E8IN9o2fV8VW10eZvsDRz+sTNmHQLTyyMf J6x/9p4kIdaiOS01sqqoeBfG9iZWDYD0ZxKNeAqpOYP0j/TH/43VBdMugv8XSLXRie7f 90iatKfdSupa7H4CBh1yYtSlEDkycjGXJzkrOtc6Zc9IMh7ns3Lg0V91YL2uB+ubU/tN hXycLbZbeDEeVikq39AGCAnZdDDWQMDk/d8S3z+Ree78EQGTvqU+jGVPolyUJbtwNuvJ yMLgDHXbjZsREe9pZU2ZY1jTbB9MivYwO9cWDm1pGa36A3OnyQAd9YbCovkvqw4yrOrx g0XQ== 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 :message-id:to:from:cc:in-reply-to:subject:date:dkim-signature :arc-authentication-results; bh=fz1p2VUwjm71aAQKi9K5YJAe4hq8l0fICY4KrzEv2Nk=; b=TZiyhG6Le+GtMs6XU3sfzaJOA+UJNTPnXse+UBuu25Jun6CZxFSrZpxhNn8/ZBoVob IWYl8FTrd13QcglXsgKLqD0XLHTXynWmlZ5rpsgjaTYZk33J/Gzrl5UjXQIH91gfBa/V QlAEUfx2ZF+mqISdY/PXekgRyc/mgKq9PX4euz+e5CO4vk7R9jf8jfn8Hr3mf8Z2ywZ/ txS6gjeTo1lpQXj8OdGm1bp0vffeHExITSp+lgOIbf1WGtmOp/fZiQFbjSKvks+rg8Z/ iqyVLqZp7ngd0ZGImsqO+wTKceEm2v+KOkVDiwWkeBdigi1QH4sAs/yufYQHa5LjjEQo fazA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=V3nZ23mE; 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 f4si5499639pgs.439.2018.04.05.09.30.24; Thu, 05 Apr 2018 09:30:38 -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; dkim=pass header.i=@sifive.com header.s=google header.b=V3nZ23mE; 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 S1751410AbeDEQ3L (ORCPT + 99 others); Thu, 5 Apr 2018 12:29:11 -0400 Received: from mail-pl0-f68.google.com ([209.85.160.68]:45470 "EHLO mail-pl0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751361AbeDEQ3J (ORCPT ); Thu, 5 Apr 2018 12:29:09 -0400 Received: by mail-pl0-f68.google.com with SMTP id v18-v6so17882421ply.12 for ; Thu, 05 Apr 2018 09:29:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; h=date:subject:in-reply-to:cc:from:to:message-id:mime-version :content-transfer-encoding; bh=fz1p2VUwjm71aAQKi9K5YJAe4hq8l0fICY4KrzEv2Nk=; b=V3nZ23mEjIh3Qt+2/mehYvbFyikbd2nblZG7WNN4BqNAjhe/8dbF43Hib1aTmpsuuv Z0xKRnbGusrehQDDHvtUKLWbmQ1QgWgfs8IwG08i8frMHPjWl4R59qvxkiYf6fVbmEdf mna7hbt5u1D1NQgxhn/u62y6sLAE9vCAU6pTe8/69dwY3TaMZd3uaiuXV9KtpG1BiOwj KquUJvVPGAnHCgm6SrOKRaCbWCyX2fMY4kPm4NwE+c2OcXneeZNUgYgc8yr5a3OW1iWs J+x9eAA+gfshBmQdumi4Nszhb3BIe9utM1eSCqUxVKTOG2gZpz2q2bKT/AffZy0NCjRX 2h3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:subject:in-reply-to:cc:from:to:message-id :mime-version:content-transfer-encoding; bh=fz1p2VUwjm71aAQKi9K5YJAe4hq8l0fICY4KrzEv2Nk=; b=OB/AFcF/+RUt+teRc55wPDPpMPK62qaiYGTDWPRCL0C4OxLdDd+e7wy+z2HerjqGwd ydN42it0hxMotv2XzK16KY8lQTBqX8B/uSd3D+NoLK46TTl05Q7vTR2nFq8zQE67Q0kK eWcWWgQnISNzagcyMIxKm6tu50fsc9O8agLAn1uatf91dHhZoC0xRSG2g8b/xAsCBxZL E/YwEgDezCnhKr935fCU58t9l9Ja0yEn14MyvPnvUz3fOyCWkgc2Gu6BTcuj19i8Ni66 +Ufg4HYyEkiNaOmnrk0HQWpeZkDcmsVPi2GilX4lV6AN6xmzCZKJ5SPVoPik6P7h8WBo K+rw== X-Gm-Message-State: AElRT7Gu6j2a/oQcKile5+u0l0WwogfOuUZHIpeAPvVgSONU8uXNBnWm Be0RbR+8o+5MPSy8BCj+fKdhOw== X-Received: by 2002:a17:902:8d82:: with SMTP id v2-v6mr23858638plo.101.1522945748770; Thu, 05 Apr 2018 09:29:08 -0700 (PDT) Received: from localhost ([12.206.222.5]) by smtp.gmail.com with ESMTPSA id y69sm16159378pfb.52.2018.04.05.09.29.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 05 Apr 2018 09:29:08 -0700 (PDT) Date: Thu, 05 Apr 2018 09:29:08 -0700 (PDT) X-Google-Original-Date: Thu, 05 Apr 2018 09:26:47 PDT (-0700) Subject: Re: [PATCH 0/2] perf: riscv: Preliminary Perf Event Support on RISC-V In-Reply-To: <20180405050229.GA24451@andestech.com> CC: albert@sifive.com, peterz@infradead.org, mingo@redhat.com, acme@kernel.org, alexander.shishkin@linux.intel.com, jolsa@redhat.com, namhyung@kernel.org, sols@sifive.com, corbet@lwn.net, linux-riscv@lists.infradead.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org From: Palmer Dabbelt To: alankao@andestech.com Message-ID: Mime-Version: 1.0 (MHng) Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 04 Apr 2018 22:02:29 PDT (-0700), alankao@andestech.com wrote: > On Tue, Apr 03, 2018 at 03:45:17PM -0700, Palmer Dabbelt wrote: >> On Tue, 03 Apr 2018 07:29:02 PDT (-0700), alankao@andestech.com wrote: >> >On Mon, Apr 02, 2018 at 08:15:44PM -0700, Palmer Dabbelt wrote: >> >>On Mon, 02 Apr 2018 05:31:22 PDT (-0700), alankao@andestech.com wrote: >> >>>This implements the baseline PMU for RISC-V platforms. >> >>> >> >>>To ease future PMU portings, a guide is also written, containing >> >>>perf concepts, arch porting practices and some hints. >> >>> >> >>>Changes in v2: >> >>> - Fix the bug reported by Alex, which was caused by not sufficient >> >>> initialization. Check https://lkml.org/lkml/2018/3/31/251 for the >> >>> discussion. >> >>> >> >>>Alan Kao (2): >> >>> perf: riscv: preliminary RISC-V support >> >>> perf: riscv: Add Document for Future Porting Guide >> >>> >> >>> Documentation/riscv/pmu.txt | 249 +++++++++++++++++++ >> >>> arch/riscv/Kconfig | 12 + >> >>> arch/riscv/include/asm/perf_event.h | 76 +++++- >> >>> arch/riscv/kernel/Makefile | 1 + >> >>> arch/riscv/kernel/perf_event.c | 468 ++++++++++++++++++++++++++++++++++++ >> >>> 5 files changed, 802 insertions(+), 4 deletions(-) >> >>> create mode 100644 Documentation/riscv/pmu.txt >> >>> create mode 100644 arch/riscv/kernel/perf_event.c >> >> >> >>I'm having some trouble pulling this into my tree. I think you might have >> >>another patch floating around somewhere, as I don't have any >> >>arch/riscv/include/asm/perf_event.h right now. >> >> >> >>Do you mind rebasing this on top of linux-4.16 so I can look properly? >> >> >> >>Thanks! >> > >> >Sorry for the inconvenience, but this patch was based on Alex's patch at >> >https://github.com/riscv/riscv-linux/pull/124/files. I thought that one >> >had already been picked into your tree. >> > >> >Any ideas? >> >> Thanks, it applies on top of that. I'm going to play around with this a >> bit, but it looks generally good. > > Note that to make it work better when wraparound occurs, you should change the > value of *.counter_width* into the width of real hardware counters. This is > because this patch does not handle wraparound checking, so using a wider > bit mask may sometimes report a extremely large number. > > Ideally this should be done by adding a Kconfig option called > "Hifive Unleashed PMU" which automatically sets the width an reuses most of the > baseline codes. What do you think about this? We're working through this now :)