Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp1181952ybk; Thu, 14 May 2020 02:31:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxjk5+34Q2R1qdJD69Dlf4RrL04uc5lpR9SOrejwusXwjjeKqkNhEINmEkoBioHIUXVzlhh X-Received: by 2002:a17:906:4d88:: with SMTP id s8mr3008846eju.193.1589448696070; Thu, 14 May 2020 02:31:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589448696; cv=none; d=google.com; s=arc-20160816; b=zYAuAyfIzebeDh0moCxLUSG60T4kFlfepvVW+vikWSzpSugbU9hlXRdbDU8PVU9KwV mtV2kU1+4x1luRGFcVtEgl22YEfBX0hTkBQ5x9IJXmhqUeP9u/HZfFDd1ytOcKbZlmV/ o7+ikPmOaHcpJcLsVRw0gPQ5dHJLTXTDmXg5R5rYQB3IVSCgN2krXTmMEjTLa/X1r9ug cDHZAz8vjiuaBTpUJr2qHzN3bP6gQ2kOFCVuAVBmqCKqhdO+/u3Uqd8IHNrQiraRowzY kd46ZilAgOoSvZ2zxwvVG/CnLr+MQICidH52vloNemyny9hvdm0XUfZ4aqCehzBkYzqb comw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=wCiVumaq6wcVuq/rN4Y5EIzrDgqgEOQzKlYptSZX3oI=; b=wzp9UvdTOmlcZ1Dav4fC72hIh5u1X6Grx7np5m/z1REZrf+W0ayiHzBXaSmkWm2H90 CUVY219T9HNnmFidboSR/F3eqsehqOOZVwPe3kPczV38et3WSiiV2erTCkRxUz12F0LP Bns2ba/io9M5GopuqpE3ftHYzVb1LbDU59YdRl124DNjMaiGku1EqoMkLx/5ipn+HBnb YAaH2rVqbSa/Zlz0m9wQWW9XYqvja3kouC1wKKGeiDUYBBbkSgtM1Oc4GaLv0SsAZvDE OkS59ctZ3aLLwiq0seVVGCVvLrrE/Omey88QB1ycxIfLwvzcT1+0iN4QeXCTc1Z6epOK PqtQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=M+DpRLIR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x6si1575359eju.117.2020.05.14.02.31.12; Thu, 14 May 2020 02:31:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=M+DpRLIR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725974AbgENJ3p (ORCPT + 99 others); Thu, 14 May 2020 05:29:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45120 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1725878AbgENJ3p (ORCPT ); Thu, 14 May 2020 05:29:45 -0400 Received: from mail-oi1-x241.google.com (mail-oi1-x241.google.com [IPv6:2607:f8b0:4864:20::241]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D497DC061A0C for ; Thu, 14 May 2020 02:29:44 -0700 (PDT) Received: by mail-oi1-x241.google.com with SMTP id c12so23001108oic.1 for ; Thu, 14 May 2020 02:29:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=wCiVumaq6wcVuq/rN4Y5EIzrDgqgEOQzKlYptSZX3oI=; b=M+DpRLIR1KWirx3ozNZP183Wa9bvcBtupJ5hvzmrcyfFPbUkajYX+pFLOP4Vjb4X3Q FawvRVJjskYpkc8utMwVe7ZNMW2Inj1BKHHE2LnEYcmYwkWaNLk9n5d1FVKTxgNhfB3l UeLQstW6MTljDRR8YXBVCjxQJ3MgwzrCqTMcpxplnwe6OKYeQvVdg+RFBOnKN9G8xvgA YQDSlyR5MhpVKtpbxiTan5wbl1+Ib4nZ/PKuukIXE2aP2T0U5iQmkiEegUxC8DZRHHJV zrnt1YMrwrTw5F9/2w2yf3NHl+5iAs6d9DFayhdpxRNlJD8LKx0cobudOvyhGXHYb7wu gRKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=wCiVumaq6wcVuq/rN4Y5EIzrDgqgEOQzKlYptSZX3oI=; b=Jz0o8wqUXt7+KVWuUpNS/mlV/vMlXehQ4zYgITrLJOnJ21br06Edz3iSVfuLLnqFeZ vO0+aWZ+y3L4FOlrythQUnWbKhotESbGXyW68rlkzbRAjB+qiVXmpS1WB6B9B9M0eMyi J43emVkeW8USU4VzY6PgupBD+8mUF9U6ervzKuvsUfZGOTrXOGpaxPLaEfsJKeLkf29/ 2NyCAczUMgEUFh0yKSKAJvxsFay4cdq7ZlKuRKTPurnyBXahXg/1w4klArlccDgkSUsw DmHn3gn9T+9DrxOXG1azCY1eO4w1qmfz+oUAHG/uYBGBJo41ytSfIPHIm5w4Fy8xtbrf aUTw== X-Gm-Message-State: AOAM530QziVwK+19N9uILJwJfqwQdthm5FqXMol27X4TonjD33rm+xzm xLWc6xRHwIX13lRNk6p293ovjKOE7QbTTj9MpQHhcg== X-Received: by 2002:aca:3585:: with SMTP id c127mr4674008oia.32.1589448584196; Thu, 14 May 2020 02:29:44 -0700 (PDT) MIME-Version: 1.0 References: <20200514060243.106976-1-zong.li@sifive.com> In-Reply-To: <20200514060243.106976-1-zong.li@sifive.com> From: Zong Li Date: Thu, 14 May 2020 17:29:33 +0800 Message-ID: Subject: Re: [PATCH] riscv: perf: fix build error for dependency issue To: Paul Walmsley , Palmer Dabbelt , Andrew Morton , linux-riscv , "linux-kernel@vger.kernel.org List" , Kefeng Wang Cc: Greentime Hu Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, May 14, 2020 at 2:03 PM Zong Li wrote: > > CONFIG_RISCV_BASE_PMU can be selected or unselected, but in fact, > CONFIG_RISCV_BASE_PMU must be always selected when selecting > CONFIG_PERF_EVENTS on current perf implementation, otherwise, it > would cause the build error when only selecting CONFIG_PERF_EVENTS. > The build case is applied randconfig which generated by kbuild test. > > This patch removes the unnecessary configuration and implementations. > Eventually, the number of counters should be determinated at runtime, > such as DTB, so we don't need to re-build kernel for various platform > which has got different number of hpmcounters. > > Signed-off-by: Zong Li > Signed-off-by: Greentime Hu > --- > arch/riscv/Kconfig | 13 ------------- > arch/riscv/include/asm/perf_event.h | 16 +++------------- > 2 files changed, 3 insertions(+), 26 deletions(-) > > diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig > index 74f82cf4f781..7d5123576953 100644 > --- a/arch/riscv/Kconfig > +++ b/arch/riscv/Kconfig > @@ -283,19 +283,6 @@ config RISCV_ISA_C > > If you don't know what to do here, say Y. > > -menu "supported PMU type" > - depends on PERF_EVENTS > - > -config RISCV_BASE_PMU > - bool "Base Performance Monitoring Unit" > - def_bool y > - help > - A base PMU that serves as a reference implementation and has limited > - feature of perf. It can run on any RISC-V machines so serves as the > - fallback, but this option can also be disable to reduce kernel size. > - > -endmenu > - > config FPU > bool "FPU support" > default y > diff --git a/arch/riscv/include/asm/perf_event.h b/arch/riscv/include/asm/perf_event.h > index 0234048b12bc..8e5b1d81112c 100644 > --- a/arch/riscv/include/asm/perf_event.h > +++ b/arch/riscv/include/asm/perf_event.h > @@ -16,15 +16,11 @@ > > /* > * The RISCV_MAX_COUNTERS parameter should be specified. > + * Currently, we only support base PMU, so just make > + * RISCV_MAX_COUNTERS be equal to RISCV_BASE_COUNTERS. > */ > > -#ifdef CONFIG_RISCV_BASE_PMU > -#define RISCV_MAX_COUNTERS 2 > -#endif > - > -#ifndef RISCV_MAX_COUNTERS > -#error "Please provide a valid RISCV_MAX_COUNTERS for the PMU." > -#endif > +#define RISCV_MAX_COUNTERS RISCV_BASE_COUNTERS > > /* > * These are the indexes of bits in counteren register *minus* 1, > @@ -38,12 +34,6 @@ > */ > #define RISCV_PMU_CYCLE 0 > #define RISCV_PMU_INSTRET 1 > -#define RISCV_PMU_MHPMCOUNTER3 2 > -#define RISCV_PMU_MHPMCOUNTER4 3 > -#define RISCV_PMU_MHPMCOUNTER5 4 > -#define RISCV_PMU_MHPMCOUNTER6 5 > -#define RISCV_PMU_MHPMCOUNTER7 6 > -#define RISCV_PMU_MHPMCOUNTER8 7 > > #define RISCV_OP_UNSUPP (-EOPNOTSUPP) > > -- > 2.26.2 > Hi all, I don't notice that there was a patch already to fix this issue by Kefeng, (https://lore.kernel.org/linux-riscv/mhng-58148e77-03b6-4c56-98ea-0d0cbf99d522@palmerdabbelt-glaptop1/T/#u). Even though it was a different way, but I also think it was good for the present. As my comment in this patch, eventually, the number of counters should be decided at runtime, such as DTB, then we don't need to re-build kernel for various platform which has got a different number of hpmcounters.