From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f181.google.com (mail-pl1-f181.google.com [209.85.214.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EFF371864C for ; Wed, 14 Feb 2024 22:43:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.181 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707950592; cv=none; b=NQ4umrf2g9FAHy8fNa3h5tP5oqPC2Kg0UwKEKUBIfLrs8BpZi/TG5w7Lxhdgu9EADevwGLUTrWvs0jkXVe23JLL/ZErz3uTDpVwCOpboQHRZO0S5CneXfXv8rzfuNdBpV3jX5xlg0UZH7Q7h1L2Uq5oosduQbwxjpRaHAfpmT+k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707950592; c=relaxed/simple; bh=iqpK3bPt1feEPfmct6sF2oKoz18fS9zOtT8gSIo6F24=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=elzpJbrFAeGZgZbb9QDm9fCCWVUGCrK7O2z2iJ6ZUZgTyZ8AYooK6l+xQOZd7iESYqa1X7gbRxZENzvWeHSVvU/gm1bySgPcnWoA+WEo+NlCO/6gr7dPOxKIcah1YLnWUZg1RKtE8zeqUBN/+TIfJtPgNDr6yuNSmydvVAcx7R0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=QJQItLxn; arc=none smtp.client-ip=209.85.214.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="QJQItLxn" Received: by mail-pl1-f181.google.com with SMTP id d9443c01a7336-1d5ce88b51cso33685ad.0 for ; Wed, 14 Feb 2024 14:43:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1707950590; x=1708555390; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=NNsPK+5tLWvdv+gYlhpHEpHeZeAqpOS89g5+h/Xob8s=; b=QJQItLxnKo1IMO3sGw8Hz/U2admm+PaFEmnUJBUPaqLUOEs8X2kaBNQC/n+vJGVKmm hC/WVoRZaBxbaV0tpE4vefpjbG034G2rvLzn3JVIdfCdAUV3yqx/3kFWKvkeYsYJn6gJ YSuzE5HYAnnjViLgiM7bXxHsuOVQHDfom7XUirq2ImEV7oRe4xNA3BjO8q8YvjkWhiOq 0A0y8JVhTs5mHIouXhUV/pDhW+dc/JQ99GXERsi9ITzSLTOo9JzhC++8UzLKAcI6J0bP E0llw0oBJexNEG+Dhkzm8AMoDD+ogKMaDNqGQYIqox6dMWPHi5hlUyEH63iXAHGCR+0G YJwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707950590; x=1708555390; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=NNsPK+5tLWvdv+gYlhpHEpHeZeAqpOS89g5+h/Xob8s=; b=OsRxkQJyQiudxqLkXuqhP7Y4nazOL1DZOlxaZF0g0fr2YsJyjpOMeig4arFf6TN/+z Ejvf4oucGAsHA6/h0Q4C2zttPEjLYcYegQEquTiR27xxZ/Yz+EcO2v2Y1XNwkX5jsylJ 56IpFNOI4Fia+oW+d82aSg3V5kZ6GQsdwDJ3SzLO/DH5v/L3TAA0Mt28ti9yNe+ZwCWB t2UQsa2y+JJ1KYY27sWf7gq7hsfRPEYsFymbdjXev82DgB8pIqT0ait0u/8IGGNmXgmw twfS26Eaxj7SrtGpXr+SytgqaqZyJ/6THCx/wjXqtUYrTYDI4MYA3JGz2bWDrP9tAOt+ Cyqw== X-Forwarded-Encrypted: i=1; AJvYcCVJeyFbpS+I5R3WnWajR57pjhf2Rk04VXvhw5j3wxQUz9CqMb3pWgBFxn6TRjRvyDz48PwXfmxf7f7Ze3/dw8Yl2/s33nJXTh7/7UM+Nz0gxg== X-Gm-Message-State: AOJu0Yx1DS3r7C/m9qz4MAoFE7IXA6gxk5ylMR59oHcUFwuypt0oyd2g VfkRFhxX0MJHAYL9KSPIrNhnNv5sITgoopnN3DmJxxS8lR3Iwl2+5phrpXjLinz8rpjM2ZesAn2 1+5zZ1Hn/Zy9zunpFR6c5dXFMXQApLckk6op2 X-Google-Smtp-Source: AGHT+IEWmx9o20zsYkRXJyB8zKsCSkKFNQNuZGphQlbFdMF3zSOKzL3jAFucrutS57uN43pDOJxLmDOolU9Ayg9Z7HM= X-Received: by 2002:a17:903:42cd:b0:1d9:aa55:e4bd with SMTP id jy13-20020a17090342cd00b001d9aa55e4bdmr401175plb.6.1707950589903; Wed, 14 Feb 2024 14:43:09 -0800 (PST) Precedence: bulk X-Mailing-List: linux-perf-users@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240214113947.240957-1-leo.yan@linux.dev> In-Reply-To: <20240214113947.240957-1-leo.yan@linux.dev> From: Ian Rogers Date: Wed, 14 Feb 2024 14:42:55 -0800 Message-ID: Subject: Re: [PATCH v1 0/4] perf parse-regs: Cleanup config and building To: Leo Yan Cc: Arnaldo Carvalho de Melo , Namhyung Kim , Jiri Olsa , Adrian Hunter , Alexander Shishkin , John Garry , Will Deacon , James Clark , Mike Leach , Guo Ren , Paul Walmsley , Palmer Dabbelt , Albert Ou , Huacai Chen , Ming Wang , Kan Liang , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, linux-csky@vger.kernel.org, linux-riscv@lists.infradead.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, Feb 14, 2024 at 3:40=E2=80=AFAM Leo Yan wrote: > > Currently, the perf building enables register parsing based on the > target architecture has supported register feature. > > Furthermore, the perf building system needs to maintain a variable > 'NO_PERF_REGS' and defines macro 'HAVE_PERF_REGS_SUPPORT' for statically > compiling the tool. > > As a result, the perf has no flexibilty for parsing register if an > architecture doesn't support it. And the source files use the macro > 'HAVE_PERF_REGS_SUPPORT' to switch on and off the register parsing > related code, which is not a good practice. > > This series is to remove the static building for register parsing. In > theory, we should can dynamically detect if an arch has support this > feature and functions can return errors when the feature is not > supported. > > The first patch is to remove unused build configuration > CONFIG_PERF_REGS. > > The second patch is to build perf register functions, without using the > macro 'HAVE_PERF_REGS_SUPPORT' to statically turn on or off code. > > The third patch is to introduce a weak function arch__sample_reg_masks(), > this function can allow the target arch to return its sample register > list. With this change, we can totally remove the macro > 'HAVE_PERF_REGS_SUPPORT' in the source file. > > The forth patch is to clean up the Makefile for removing relevant > configuration and macro definition, as they are not useful anymore. > > I tested this patch set on Arm64 and x86 for building and did a cross > register parsing ('perf record' on Arm64 and 'perf report' on x86). > > > Leo Yan (4): > perf build: Remove unused CONFIG_PERF_REGS > perf parse-regs: Always build perf register functions > perf parse-regs: Introduce a weak function arch__sample_reg_masks() > perf build: Cleanup perf register configuration Thanks Leo, this is great cleanup! Series: Reviewed-by: Ian Rogers Ian > tools/perf/Makefile.config | 25 -------------- > tools/perf/arch/arm/util/perf_regs.c | 7 +++- > tools/perf/arch/arm64/util/machine.c | 2 ++ > tools/perf/arch/arm64/util/perf_regs.c | 7 +++- > tools/perf/arch/csky/util/perf_regs.c | 7 +++- > tools/perf/arch/loongarch/util/perf_regs.c | 7 +++- > tools/perf/arch/mips/util/perf_regs.c | 7 +++- > tools/perf/arch/powerpc/util/perf_regs.c | 7 +++- > tools/perf/arch/riscv/util/perf_regs.c | 7 +++- > tools/perf/arch/s390/util/perf_regs.c | 7 +++- > tools/perf/arch/x86/util/perf_regs.c | 7 +++- > tools/perf/util/parse-regs-options.c | 8 ++--- > .../util/perf-regs-arch/perf_regs_aarch64.c | 4 --- > .../perf/util/perf-regs-arch/perf_regs_arm.c | 4 --- > .../perf/util/perf-regs-arch/perf_regs_csky.c | 4 --- > .../util/perf-regs-arch/perf_regs_loongarch.c | 4 --- > .../perf/util/perf-regs-arch/perf_regs_mips.c | 4 --- > .../util/perf-regs-arch/perf_regs_powerpc.c | 4 --- > .../util/perf-regs-arch/perf_regs_riscv.c | 4 --- > .../perf/util/perf-regs-arch/perf_regs_s390.c | 4 --- > .../perf/util/perf-regs-arch/perf_regs_x86.c | 4 --- > tools/perf/util/perf_regs.c | 11 ++++-- > tools/perf/util/perf_regs.h | 34 +------------------ > 23 files changed, 67 insertions(+), 112 deletions(-) > > -- > 2.34.1 >