From patchwork Wed Feb 14 11:39:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 200921 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:bc8a:b0:106:860b:bbdd with SMTP id dn10csp1149003dyb; Wed, 14 Feb 2024 03:41:01 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUD8BdMmDbrWKra71veemfxqOmPVseiU/2WgwInWfTlA8DWG9AAMOGXUVCEhaYddSzGOc+jcpPO82KEE1EZD+0AC5qOPw== X-Google-Smtp-Source: AGHT+IHd/6My7vqLIirID8I+PyJy4EFsxy5F2j++qGrbziHJaKfa0eJLc0dnoyfu7rGdngNvQy5S X-Received: by 2002:ac8:5796:0:b0:42c:7591:8537 with SMTP id v22-20020ac85796000000b0042c75918537mr2841130qta.19.1707910861673; Wed, 14 Feb 2024 03:41:01 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707910861; cv=pass; d=google.com; s=arc-20160816; b=aUpTNMgkga7xy//FCYycSKVNGQ0K0wy744/mtNTIsyk89iJfjLjv2QIsE1mBoyC7w6 fXrNGOMrB/sJDLH8AKzxYMwAq8DOQ2RiGhecX4DMuzCQLmtXowZqXYQONHL1JfRRKJxn /kh9CW2W9zg8oUdqB9PsT+AMtrlLM+Sd6Nle3MlQWTQS8ABuREPgahxjelgDbfLGR5NH Wwe8TH5pdtxCcOvX5v7wsWDkMVkWBFns9xJzWwSDFiFkULvVC70b69cB/HYlxBLg2mDd Pff/RlZYn001itiV19oF9CVWLjio2sCYEEjcWtUyYB/Q8oHHJ9VueKHmjevd4s1xoB/+ /ifg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=VD63rmegeHIhLLGV64EOuqcCVX11XoTApOW/sI3SuGY=; fh=nvvKT1F6I824409Mq1G9mQpuHkb/HOOKkhKPK7k3QoM=; b=qmJBRf1dOxReUw/OpAGehovOEM9e0wJ+I59JmV4hvr1CAOZowUyWq8dsZfpgyKQLbM S31VNRulJOpgMHW9yxUOHQMYDnEEjJoimIABJ8OVLi3rfOj+xf2SNhMlUs04O9ZDqkwJ 7y/A9v1MnmzKJf9et5hMZSqk9zVXnHK9ycaGdXASi51LmHrtOOun/Dje8UQ2WbgCqU44 IRHFOPr98By9cbcMGvx4UBOYYy37TVce/3N0Jq2y1NAC49yLJe0r1J+9rvUxjZTZO8Vd ayt5hbwrk6gzkqcnt+9lXdQzlBWt46C5uBroYI2EQ0xjNwXLd9mB9qsnS7eOs9ZgZnLY qoiA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=Qoitnz4U; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-65149-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-65149-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev X-Forwarded-Encrypted: i=2; AJvYcCUUBX/wwpEfSAgMdcWYOu6wdJMsTZbU5ol82NOkLdycN7SY6G10C59l1OX+Ozf7h9UXQRbuHyq7pXV48XipBPOui4PDBA== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id c6-20020ac85a86000000b0042c4d7d5900si5442086qtc.716.2024.02.14.03.41.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Feb 2024 03:41:01 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-65149-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=Qoitnz4U; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-65149-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-65149-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id AEE091C26AC9 for ; Wed, 14 Feb 2024 11:40:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0F0361B81E; Wed, 14 Feb 2024 11:40:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="Qoitnz4U" Received: from out-173.mta0.migadu.com (out-173.mta0.migadu.com [91.218.175.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 12F5D1B593 for ; Wed, 14 Feb 2024 11:40:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707910821; cv=none; b=C3ap+XAmS7SYouiYtxiQknJO+m8U5lHMuj7bDw5i8izerEbJEYSf83dC3d1tz8vInPGUDesSt0Y1+KU6rHBo2WlyOuK+WnMZoLlf7IANWa8o0DQTcTlVZpWWIXnWqbRq0L2N+8S795gM1o/n1DXaApvejZppyY4cr6Yri405MPE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707910821; c=relaxed/simple; bh=x0tKh0h9jiEc+KxcZFZhTJt93jwtCYA79w+Ls4KWcgs=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=sshvIyc2vFsQQMKXKoaGG5pihuJDxsUqkbkxlpjKgtRBJCEFeBDsHQqI5egudrAkHO869jX964sNL8gvTAtD6jXTUcsquTwGU5sb4tamNa1/3b8kZ22SBMzszlgHXlHUUFDnXJlBNXC0WAjiPlMLx1c4EGJXCVe42Ft5NgWzip8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=Qoitnz4U; arc=none smtp.client-ip=91.218.175.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1707910818; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=VD63rmegeHIhLLGV64EOuqcCVX11XoTApOW/sI3SuGY=; b=Qoitnz4UP5hNcUavGMoMUemm8tfGEtUwTIwDldz/MawdEPqsfElc6milVX9Vr4uJ14t5tu jKyQlLzs5K/6MKFBpoQ4t/hExWMfhd73fjpBMPN5++7KvNey8dGfCiyo1Tt4y/Lt082eIj 7LG0CurF9nAeOF+L0NJyiPfBKt9jvCQ= From: Leo Yan To: Arnaldo Carvalho de Melo , Namhyung Kim , Jiri Olsa , Ian Rogers , 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 Cc: Leo Yan Subject: [PATCH v1 1/4] perf build: Remove unused CONFIG_PERF_REGS Date: Wed, 14 Feb 2024 19:39:44 +0800 Message-Id: <20240214113947.240957-2-leo.yan@linux.dev> In-Reply-To: <20240214113947.240957-1-leo.yan@linux.dev> References: <20240214113947.240957-1-leo.yan@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790874339614801859 X-GMAIL-MSGID: 1790874339614801859 CONFIG_PERF_REGS is not used, remove it. Signed-off-by: Leo Yan --- tools/perf/Makefile.config | 4 ---- 1 file changed, 4 deletions(-) diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config index aa55850fbc21..8b740c668ab7 100644 --- a/tools/perf/Makefile.config +++ b/tools/perf/Makefile.config @@ -105,10 +105,6 @@ ifeq ($(ARCH),mips) LIBUNWIND_LIBS = -lunwind -lunwind-mips endif -ifeq ($(NO_PERF_REGS),0) - $(call detected,CONFIG_PERF_REGS) -endif - # So far there's only x86 and arm libdw unwind support merged in perf. # Disable it on all other architectures in case libdw unwind # support is detected in system. Add supported architectures From patchwork Wed Feb 14 11:39:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 200934 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:bc8a:b0:106:860b:bbdd with SMTP id dn10csp1158899dyb; Wed, 14 Feb 2024 04:02:15 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUkFqPRTbgorZ0yBGQO4MOF1jXg90W0qdES+T3OXQQChIaQSbUaRFnCSH/FWjaGohJLREeP1+qIa9tCBRiEV3RaLB3NWQ== X-Google-Smtp-Source: AGHT+IEsK28vMGwf6cawv95MseEfUFkNWTccUEuqiXYi3GQTpT/y8WLtKeCLddeBucPpMGtCQ3zd X-Received: by 2002:a17:90b:1085:b0:290:33e7:9291 with SMTP id gj5-20020a17090b108500b0029033e79291mr2036553pjb.37.1707912135564; Wed, 14 Feb 2024 04:02:15 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707912135; cv=pass; d=google.com; s=arc-20160816; b=eYgbRrWiKBI6RKeWzx6rjRAT19sD4bXeDd0IZFvV91jmftoh1OZiI6sgOGOioT6bKv +P5JcSoFkeyoYl4eA+KTqT1SkKibYk0Cko8nrBpTXAzNTB6cq6NegmSyZ7SWLkHjT99q CANwzVPQBLkSfbInl2ZZ4fiDtxhqusx5CIr7N+PiNjStbO3QJIlHmVy5Vef5Y+fYtkxv m0bf5WJQhXGVa9EKcWlKowh5t9W6sHaaIkyRpuugKHFogIo1Dz9XYKfNNqpicSvlPIMq aYKR2eKtTKVTfxYZnX2IwkRun4jPUx+umLmHLF9G7UEE/1TYHJZk0mPevUhCwo8C4mhm LrAg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=E+jtmsFWXII41uvDY5Lu/Q/m21GTQe10cCp5uwl7EPc=; fh=W6qVyIn7jhiz6JhQiKkNgHyKPtp0ZhY6OFWEMU9o5M4=; b=TndyQ2a3pouOOOfF8yS2vbROZuMuj8gwik4qSbMeaLp1ZhR70jXif+lBkgbR9z2eY4 wSNHxuqNGvzem8X70eECAdbuuBmlpLxzQNYYDfOsIIDOsN34uMhZ8+dthAfipEEKZfMZ VI9T/0hYOMQMo029WjgbERqngwko8H9cCBhblpKp9gQMBwmaePsGZvDmFZ2RX42eq4dQ eiW0KvQNN7QeuRPUCOgK8//wpKtIs9ImOixPUNC6Lm5/QnK02C5eJoj1Z5joWMNWWYD6 x6MSfhkW0bAex6eJdlVZt0+Ww9IN3r3m9ehXI7ga4tvNH4E5XK5ywrj5cRlc69p5i8M1 4RMQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=hhqXvhqM; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-65150-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-65150-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev X-Forwarded-Encrypted: i=2; AJvYcCVNe4DtCLMxD7eR2iPup0iS63lnEUf0btir0rDHkEtYPpqeyt3Vz8Qts9uhJtrJPqLKZEkmluqSwxIXluoexQc4l1qLwA== Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id i10-20020a17090acf8a00b00296d045abe1si1040966pju.91.2024.02.14.04.02.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Feb 2024 04:02:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-65150-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=hhqXvhqM; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-65150-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-65150-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 24CC4B28D2B for ; Wed, 14 Feb 2024 11:41:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E38CC1BC23; Wed, 14 Feb 2024 11:40:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="hhqXvhqM" Received: from out-174.mta0.migadu.com (out-174.mta0.migadu.com [91.218.175.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AC2DD1B96E for ; Wed, 14 Feb 2024 11:40:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707910829; cv=none; b=ZvT/X35gqZiAdHppB0OSXbOP80BM44mrIlIWbxA6XXNHYyNAJXq6VEU57CyCfA8pvppffIhHLkKu3zeNJrpBLNcxQpD0kI/lDWVdIkC8Qj1Uu0oDRHBRKUIhcT1HzYFaH/rHR4h+mu8PkOqdmfOkYSGBm06ozMdFZbEpsxBYYOA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707910829; c=relaxed/simple; bh=sUVHJStUPDAf8x44uZgtpOx2qRPnBa4keaRUx4keBN0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=AKK4KpogV2IXTZigMaoxTRUwAIIdAmywP1+R4wSAMtgCsLhsfVy9pBnuleURVtMLoSZbOykWYPznJkutH8ackIaOcj2+J+4+4nu0Jrgj+VsnckQvGbO6AMC2fapyIAseREKHNEU5K23h4ppBDy1TxAoo7D70+BLTmlEcz6DHAEk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=hhqXvhqM; arc=none smtp.client-ip=91.218.175.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1707910825; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=E+jtmsFWXII41uvDY5Lu/Q/m21GTQe10cCp5uwl7EPc=; b=hhqXvhqMo0R0uQJ9/yon2V7+wZQm7vfh7AekzUup5HL44wksP9/4gAGJjhNB4Dy//NkcwL 49tqLDhCkilgzb3REtvqkSWtgH+D/9c0h0S0HlEcyXOx3bmRjrL5FXx5P9GbHTuuWkBFaj NcmvDungxvXJ+sX8MgbZThH6bLHUoVM= From: Leo Yan To: Arnaldo Carvalho de Melo , Namhyung Kim , Jiri Olsa , Ian Rogers , 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 Cc: Leo Yan Subject: [PATCH v1 2/4] perf parse-regs: Always build perf register functions Date: Wed, 14 Feb 2024 19:39:45 +0800 Message-Id: <20240214113947.240957-3-leo.yan@linux.dev> In-Reply-To: <20240214113947.240957-1-leo.yan@linux.dev> References: <20240214113947.240957-1-leo.yan@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790875675196378691 X-GMAIL-MSGID: 1790875675196378691 Currently, the macro HAVE_PERF_REGS_SUPPORT is used as a switch to turn on or turn off the code of perf registers. If any architecture cannot support perf register, it disables the perf register parsing, for both the native parsing and cross parsing for other architectures. To support both the native parsing and cross parsing, the tool should always build the perf regs functions. Thus, this patch removes HAVE_PERF_REGS_SUPPORT from the perf regs files. Signed-off-by: Leo Yan --- .../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 | 4 --- tools/perf/util/perf_regs.h | 31 ------------------- 11 files changed, 71 deletions(-) diff --git a/tools/perf/util/perf-regs-arch/perf_regs_aarch64.c b/tools/perf/util/perf-regs-arch/perf_regs_aarch64.c index 696566c54768..9dcda80d310f 100644 --- a/tools/perf/util/perf-regs-arch/perf_regs_aarch64.c +++ b/tools/perf/util/perf-regs-arch/perf_regs_aarch64.c @@ -1,7 +1,5 @@ // SPDX-License-Identifier: GPL-2.0 -#ifdef HAVE_PERF_REGS_SUPPORT - #include "../perf_regs.h" #include "../../../arch/arm64/include/uapi/asm/perf_regs.h" @@ -92,5 +90,3 @@ uint64_t __perf_reg_sp_arm64(void) { return PERF_REG_ARM64_SP; } - -#endif diff --git a/tools/perf/util/perf-regs-arch/perf_regs_arm.c b/tools/perf/util/perf-regs-arch/perf_regs_arm.c index 700fd07cd2aa..e29d130a587a 100644 --- a/tools/perf/util/perf-regs-arch/perf_regs_arm.c +++ b/tools/perf/util/perf-regs-arch/perf_regs_arm.c @@ -1,7 +1,5 @@ // SPDX-License-Identifier: GPL-2.0 -#ifdef HAVE_PERF_REGS_SUPPORT - #include "../perf_regs.h" #include "../../../arch/arm/include/uapi/asm/perf_regs.h" @@ -56,5 +54,3 @@ uint64_t __perf_reg_sp_arm(void) { return PERF_REG_ARM_SP; } - -#endif diff --git a/tools/perf/util/perf-regs-arch/perf_regs_csky.c b/tools/perf/util/perf-regs-arch/perf_regs_csky.c index a2841094e096..75b461ef2eba 100644 --- a/tools/perf/util/perf-regs-arch/perf_regs_csky.c +++ b/tools/perf/util/perf-regs-arch/perf_regs_csky.c @@ -1,7 +1,5 @@ // SPDX-License-Identifier: GPL-2.0 -#ifdef HAVE_PERF_REGS_SUPPORT - #include "../perf_regs.h" #include "../../arch/csky/include/uapi/asm/perf_regs.h" @@ -96,5 +94,3 @@ uint64_t __perf_reg_sp_csky(void) { return PERF_REG_CSKY_SP; } - -#endif diff --git a/tools/perf/util/perf-regs-arch/perf_regs_loongarch.c b/tools/perf/util/perf-regs-arch/perf_regs_loongarch.c index a9ba0f934123..043f97f4e3ac 100644 --- a/tools/perf/util/perf-regs-arch/perf_regs_loongarch.c +++ b/tools/perf/util/perf-regs-arch/perf_regs_loongarch.c @@ -1,7 +1,5 @@ // SPDX-License-Identifier: GPL-2.0 -#ifdef HAVE_PERF_REGS_SUPPORT - #include "../perf_regs.h" #include "../../../arch/loongarch/include/uapi/asm/perf_regs.h" @@ -87,5 +85,3 @@ uint64_t __perf_reg_sp_loongarch(void) { return PERF_REG_LOONGARCH_R3; } - -#endif diff --git a/tools/perf/util/perf-regs-arch/perf_regs_mips.c b/tools/perf/util/perf-regs-arch/perf_regs_mips.c index 5a45830cfbf5..793178fc3c78 100644 --- a/tools/perf/util/perf-regs-arch/perf_regs_mips.c +++ b/tools/perf/util/perf-regs-arch/perf_regs_mips.c @@ -1,7 +1,5 @@ // SPDX-License-Identifier: GPL-2.0 -#ifdef HAVE_PERF_REGS_SUPPORT - #include "../perf_regs.h" #include "../../../arch/mips/include/uapi/asm/perf_regs.h" @@ -83,5 +81,3 @@ uint64_t __perf_reg_sp_mips(void) { return PERF_REG_MIPS_R29; } - -#endif diff --git a/tools/perf/util/perf-regs-arch/perf_regs_powerpc.c b/tools/perf/util/perf-regs-arch/perf_regs_powerpc.c index 1f0d682db74a..08636bb09a3a 100644 --- a/tools/perf/util/perf-regs-arch/perf_regs_powerpc.c +++ b/tools/perf/util/perf-regs-arch/perf_regs_powerpc.c @@ -1,7 +1,5 @@ // SPDX-License-Identifier: GPL-2.0 -#ifdef HAVE_PERF_REGS_SUPPORT - #include "../perf_regs.h" #include "../../../arch/powerpc/include/uapi/asm/perf_regs.h" @@ -141,5 +139,3 @@ uint64_t __perf_reg_sp_powerpc(void) { return PERF_REG_POWERPC_R1; } - -#endif diff --git a/tools/perf/util/perf-regs-arch/perf_regs_riscv.c b/tools/perf/util/perf-regs-arch/perf_regs_riscv.c index e432630be4c5..337b687c655d 100644 --- a/tools/perf/util/perf-regs-arch/perf_regs_riscv.c +++ b/tools/perf/util/perf-regs-arch/perf_regs_riscv.c @@ -1,7 +1,5 @@ // SPDX-License-Identifier: GPL-2.0 -#ifdef HAVE_PERF_REGS_SUPPORT - #include "../perf_regs.h" #include "../../../arch/riscv/include/uapi/asm/perf_regs.h" @@ -88,5 +86,3 @@ uint64_t __perf_reg_sp_riscv(void) { return PERF_REG_RISCV_SP; } - -#endif diff --git a/tools/perf/util/perf-regs-arch/perf_regs_s390.c b/tools/perf/util/perf-regs-arch/perf_regs_s390.c index 1c7a46db778c..d69bba881080 100644 --- a/tools/perf/util/perf-regs-arch/perf_regs_s390.c +++ b/tools/perf/util/perf-regs-arch/perf_regs_s390.c @@ -1,7 +1,5 @@ // SPDX-License-Identifier: GPL-2.0 -#ifdef HAVE_PERF_REGS_SUPPORT - #include "../perf_regs.h" #include "../../../arch/s390/include/uapi/asm/perf_regs.h" @@ -92,5 +90,3 @@ uint64_t __perf_reg_sp_s390(void) { return PERF_REG_S390_R15; } - -#endif diff --git a/tools/perf/util/perf-regs-arch/perf_regs_x86.c b/tools/perf/util/perf-regs-arch/perf_regs_x86.c index 873c620f0634..708954a9d35d 100644 --- a/tools/perf/util/perf-regs-arch/perf_regs_x86.c +++ b/tools/perf/util/perf-regs-arch/perf_regs_x86.c @@ -1,7 +1,5 @@ // SPDX-License-Identifier: GPL-2.0 -#ifdef HAVE_PERF_REGS_SUPPORT - #include "../perf_regs.h" #include "../../../arch/x86/include/uapi/asm/perf_regs.h" @@ -94,5 +92,3 @@ uint64_t __perf_reg_sp_x86(void) { return PERF_REG_X86_SP; } - -#endif diff --git a/tools/perf/util/perf_regs.c b/tools/perf/util/perf_regs.c index e2275856b570..64724eb58dd5 100644 --- a/tools/perf/util/perf_regs.c +++ b/tools/perf/util/perf_regs.c @@ -21,8 +21,6 @@ uint64_t __weak arch__user_reg_mask(void) return 0; } -#ifdef HAVE_PERF_REGS_SUPPORT - const char *perf_reg_name(int id, const char *arch) { const char *reg_name = NULL; @@ -125,5 +123,3 @@ uint64_t perf_arch_reg_sp(const char *arch) pr_err("Fail to find SP register for arch %s, returns 0\n", arch); return 0; } - -#endif diff --git a/tools/perf/util/perf_regs.h b/tools/perf/util/perf_regs.h index ecd2a5362042..7fd0c7b4cec1 100644 --- a/tools/perf/util/perf_regs.h +++ b/tools/perf/util/perf_regs.h @@ -27,7 +27,6 @@ int arch_sdt_arg_parse_op(char *old_op, char **new_op); uint64_t arch__intr_reg_mask(void); uint64_t arch__user_reg_mask(void); -#ifdef HAVE_PERF_REGS_SUPPORT extern const struct sample_reg sample_reg_masks[]; const char *perf_reg_name(int id, const char *arch); @@ -67,34 +66,4 @@ static inline uint64_t DWARF_MINIMAL_REGS(const char *arch) return (1ULL << perf_arch_reg_ip(arch)) | (1ULL << perf_arch_reg_sp(arch)); } -#else - -static inline uint64_t DWARF_MINIMAL_REGS(const char *arch __maybe_unused) -{ - return 0; -} - -static inline const char *perf_reg_name(int id __maybe_unused, const char *arch __maybe_unused) -{ - return "unknown"; -} - -static inline int perf_reg_value(u64 *valp __maybe_unused, - struct regs_dump *regs __maybe_unused, - int id __maybe_unused) -{ - return 0; -} - -static inline uint64_t perf_arch_reg_ip(const char *arch __maybe_unused) -{ - return 0; -} - -static inline uint64_t perf_arch_reg_sp(const char *arch __maybe_unused) -{ - return 0; -} - -#endif /* HAVE_PERF_REGS_SUPPORT */ #endif /* __PERF_REGS_H */ From patchwork Wed Feb 14 11:39:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 200922 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:bc8a:b0:106:860b:bbdd with SMTP id dn10csp1149109dyb; Wed, 14 Feb 2024 03:41:19 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWLBMf4cDs7RgzaLyrJGytIhjuKIAZaHoGHbN3ubkD0AtGIo6258ivT+pt25AhKOFgPpfIwmWL5a0W8p+TEFKJvQLBJsQ== X-Google-Smtp-Source: AGHT+IGEwsEQ0xsbpUywldUwN3ntn6lc1DK19z+lG1HzUO08AkrkLn3ejshBvJZ04gw4Y6CS4IJo X-Received: by 2002:ad4:5c49:0:b0:685:8ac0:c027 with SMTP id a9-20020ad45c49000000b006858ac0c027mr2168843qva.23.1707910879153; Wed, 14 Feb 2024 03:41:19 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707910879; cv=pass; d=google.com; s=arc-20160816; b=ESKKCAUVqrSNV4zO2GMYj4ho/BjhGQu+zmmgkMgs0T+dnrYF8Wv1vjmCEAz6++EYUC PwrX56AP79SejHSxrM0x6q1UCH7icnG4K4tYFIW9kpVqbqH8kWYmXtBmw4/MxLoLD/5o k0ItMWdW4xvPpdZgs5mbcGBq5NOADsj8LcaCoeW2C4yr1muXDNB0x4OBWaI1c5m2/GKk iT85XJH0Y/F6F63Lc5Q8UPUkL7DcJB+Vw9jzROfgECFWicm+VgrVgN0MY9dmqxFh6nq+ puG/jQfmdCrudnNzj41oB828yvxRHjWle4wvG4JiX49QkoU2nBAnG1djhGevWpeFcTx9 oRWg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=6q0ZJ+/QgkBKiu+7vLI7Vww0Q4/7AWcn0562kHI25UM=; fh=NGymHZjq+knntmuD/SI2MH+AZFk/YHVoZDHGI4wmm2Q=; b=c/mpacJf+nCVcV0BiRJaC61itTSDwoGEjffptj4qv34bb3jJmrzb4h996zkgCYJq2v BR+QyxBsbCsjxx0lgl5fQmKaoIo9UErvJPDUlLJvjObm4r75ZJGdOeSPk9FSQ6lZDUih xbR3/gQ47njZEbnED3uj77R5IwKZZblfwrVL9vt4yP1ytmpALaPEq0Mmye9vcIgY2pfB iFiZVDuE+E9Ln5ZY5u7FNjOc2A0BaT3hGX7FRsnWEv9xfOoE2CY4n3Sc4f0b7TKVL+th /qt8RhAV28VmqFLlFVKdV47coejWr5pQhb2wkM8RLLkSDX2sCEYZb8y2U+SO0IqiniWy 8cSA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=k16JtjQ0; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-65151-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-65151-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev X-Forwarded-Encrypted: i=2; AJvYcCWmNBGWprdC8ls1mQdrU1V4DZYaKr5hDwUrTK6Qs9cKUWdBnzq/03Dg3fv1BxGvIQeeVnXrWiZSspwDim9TqM6BXbq13w== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id m10-20020a0562141bca00b0068c5a407f23si5100461qvc.603.2024.02.14.03.41.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Feb 2024 03:41:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-65151-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=k16JtjQ0; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-65151-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-65151-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id D7A921C21842 for ; Wed, 14 Feb 2024 11:41:15 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B4E361BC37; Wed, 14 Feb 2024 11:40:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="k16JtjQ0" Received: from out-185.mta0.migadu.com (out-185.mta0.migadu.com [91.218.175.185]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E1BEC1BC3A for ; Wed, 14 Feb 2024 11:40:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.185 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707910837; cv=none; b=XPfJcrjbF2vy/qsa2e6eZUnuU6xumPKMG+bQNVaBM3zp667SnDb4n3aOhIpdtn1D4ihOtXVdmKMkAaqaJidtQpSIhGH8Nw5h7r1iEMDgLuKow1FSunSJ8gHRSJxCuvB7kjsxjY0nCbx5KUBdL/hWd5qFEVNSkCuo47NefAGwh3E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707910837; c=relaxed/simple; bh=DJYjh7MgXUwnka/7RGMkLj9tcjN0l6NhK730MXgdb4M=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=gcYUkDhk4gdUbwmX48KPNoEWCLIsW6ol4YScaIBJRihrf7FFkSyHwge8lqYnkXnfkG5nU7wYy/2KNotvplIpPyIVVhj+a58BYAsEpAypxgdu+UPkyswwwQu7yUWmkGkKNxxaX/yutJplGwVEJ/MwUMdSyAWRmmDmD51vB+u7Scs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=k16JtjQ0; arc=none smtp.client-ip=91.218.175.185 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1707910833; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6q0ZJ+/QgkBKiu+7vLI7Vww0Q4/7AWcn0562kHI25UM=; b=k16JtjQ0Q0Cfr3s5i9zroS0QYD++HZIYliM0Vf8VwADRosR3o9l8gytGbENg/ogRvDx20Y 2ZC7z2tOdU9mPIG6hl0ru8vOVRqy2xwLV+u7bGQeT9SXDGrjpnkCHUQ5q2+oS+JLH7KqYP U7JdUdz/pZUY23oE++pJXZyUFNzF9+0= From: Leo Yan To: Arnaldo Carvalho de Melo , Namhyung Kim , Jiri Olsa , Ian Rogers , 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 Cc: Leo Yan Subject: [PATCH v1 3/4] perf parse-regs: Introduce a weak function arch__sample_reg_masks() Date: Wed, 14 Feb 2024 19:39:46 +0800 Message-Id: <20240214113947.240957-4-leo.yan@linux.dev> In-Reply-To: <20240214113947.240957-1-leo.yan@linux.dev> References: <20240214113947.240957-1-leo.yan@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790874357688190603 X-GMAIL-MSGID: 1790874357688190603 Every architecture can provide a register list for sampling. If an architecture doesn't support register sampling, it won't define the data structure 'sample_reg_masks'. Consequently, any code using this structure must be protected by the macro 'HAVE_PERF_REGS_SUPPORT'. This patch defines a weak function, arch__sample_reg_masks(), which will be replaced by an architecture-defined function for returning the architecture's register list. With this refactoring, the function always exists, the condition checking for 'HAVE_PERF_REGS_SUPPORT' is not needed anymore, so remove it. Signed-off-by: Leo Yan --- 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 ++------ tools/perf/util/perf_regs.c | 9 +++++++++ tools/perf/util/perf_regs.h | 3 +-- 13 files changed, 68 insertions(+), 17 deletions(-) diff --git a/tools/perf/arch/arm/util/perf_regs.c b/tools/perf/arch/arm/util/perf_regs.c index 2c56e8b56ddf..f94a0210c7b7 100644 --- a/tools/perf/arch/arm/util/perf_regs.c +++ b/tools/perf/arch/arm/util/perf_regs.c @@ -2,7 +2,7 @@ #include "perf_regs.h" #include "../../../util/perf_regs.h" -const struct sample_reg sample_reg_masks[] = { +static const struct sample_reg sample_reg_masks[] = { SMPL_REG_END }; @@ -15,3 +15,8 @@ uint64_t arch__user_reg_mask(void) { return PERF_REGS_MASK; } + +const struct sample_reg *arch__sample_reg_masks(void) +{ + return sample_reg_masks; +} diff --git a/tools/perf/arch/arm64/util/machine.c b/tools/perf/arch/arm64/util/machine.c index ba1144366e85..aab1cc2bc283 100644 --- a/tools/perf/arch/arm64/util/machine.c +++ b/tools/perf/arch/arm64/util/machine.c @@ -12,5 +12,7 @@ void arch__add_leaf_frame_record_opts(struct record_opts *opts) { + const struct sample_reg *sample_reg_masks = arch__sample_reg_masks(); + opts->sample_user_regs |= sample_reg_masks[PERF_REG_ARM64_LR].mask; } diff --git a/tools/perf/arch/arm64/util/perf_regs.c b/tools/perf/arch/arm64/util/perf_regs.c index 1b79d8eab22f..09308665e28a 100644 --- a/tools/perf/arch/arm64/util/perf_regs.c +++ b/tools/perf/arch/arm64/util/perf_regs.c @@ -16,7 +16,7 @@ #define HWCAP_SVE (1 << 22) #endif -const struct sample_reg sample_reg_masks[] = { +static const struct sample_reg sample_reg_masks[] = { SMPL_REG(x0, PERF_REG_ARM64_X0), SMPL_REG(x1, PERF_REG_ARM64_X1), SMPL_REG(x2, PERF_REG_ARM64_X2), @@ -175,3 +175,8 @@ uint64_t arch__user_reg_mask(void) } return PERF_REGS_MASK; } + +const struct sample_reg *arch__sample_reg_masks(void) +{ + return sample_reg_masks; +} diff --git a/tools/perf/arch/csky/util/perf_regs.c b/tools/perf/arch/csky/util/perf_regs.c index c0877c264d49..6b1665f41180 100644 --- a/tools/perf/arch/csky/util/perf_regs.c +++ b/tools/perf/arch/csky/util/perf_regs.c @@ -2,7 +2,7 @@ #include "perf_regs.h" #include "../../util/perf_regs.h" -const struct sample_reg sample_reg_masks[] = { +static const struct sample_reg sample_reg_masks[] = { SMPL_REG_END }; @@ -15,3 +15,8 @@ uint64_t arch__user_reg_mask(void) { return PERF_REGS_MASK; } + +const struct sample_reg *arch__sample_reg_masks(void) +{ + return sample_reg_masks; +} diff --git a/tools/perf/arch/loongarch/util/perf_regs.c b/tools/perf/arch/loongarch/util/perf_regs.c index 2c56e8b56ddf..f94a0210c7b7 100644 --- a/tools/perf/arch/loongarch/util/perf_regs.c +++ b/tools/perf/arch/loongarch/util/perf_regs.c @@ -2,7 +2,7 @@ #include "perf_regs.h" #include "../../../util/perf_regs.h" -const struct sample_reg sample_reg_masks[] = { +static const struct sample_reg sample_reg_masks[] = { SMPL_REG_END }; @@ -15,3 +15,8 @@ uint64_t arch__user_reg_mask(void) { return PERF_REGS_MASK; } + +const struct sample_reg *arch__sample_reg_masks(void) +{ + return sample_reg_masks; +} diff --git a/tools/perf/arch/mips/util/perf_regs.c b/tools/perf/arch/mips/util/perf_regs.c index c0877c264d49..6b1665f41180 100644 --- a/tools/perf/arch/mips/util/perf_regs.c +++ b/tools/perf/arch/mips/util/perf_regs.c @@ -2,7 +2,7 @@ #include "perf_regs.h" #include "../../util/perf_regs.h" -const struct sample_reg sample_reg_masks[] = { +static const struct sample_reg sample_reg_masks[] = { SMPL_REG_END }; @@ -15,3 +15,8 @@ uint64_t arch__user_reg_mask(void) { return PERF_REGS_MASK; } + +const struct sample_reg *arch__sample_reg_masks(void) +{ + return sample_reg_masks; +} diff --git a/tools/perf/arch/powerpc/util/perf_regs.c b/tools/perf/arch/powerpc/util/perf_regs.c index b38aa056eea0..e8e6e6fc6f17 100644 --- a/tools/perf/arch/powerpc/util/perf_regs.c +++ b/tools/perf/arch/powerpc/util/perf_regs.c @@ -17,7 +17,7 @@ #define PVR_POWER9 0x004E #define PVR_POWER10 0x0080 -const struct sample_reg sample_reg_masks[] = { +static const struct sample_reg sample_reg_masks[] = { SMPL_REG(r0, PERF_REG_POWERPC_R0), SMPL_REG(r1, PERF_REG_POWERPC_R1), SMPL_REG(r2, PERF_REG_POWERPC_R2), @@ -232,3 +232,8 @@ uint64_t arch__user_reg_mask(void) { return PERF_REGS_MASK; } + +const struct sample_reg *arch__sample_reg_masks(void) +{ + return sample_reg_masks; +} diff --git a/tools/perf/arch/riscv/util/perf_regs.c b/tools/perf/arch/riscv/util/perf_regs.c index c0877c264d49..6b1665f41180 100644 --- a/tools/perf/arch/riscv/util/perf_regs.c +++ b/tools/perf/arch/riscv/util/perf_regs.c @@ -2,7 +2,7 @@ #include "perf_regs.h" #include "../../util/perf_regs.h" -const struct sample_reg sample_reg_masks[] = { +static const struct sample_reg sample_reg_masks[] = { SMPL_REG_END }; @@ -15,3 +15,8 @@ uint64_t arch__user_reg_mask(void) { return PERF_REGS_MASK; } + +const struct sample_reg *arch__sample_reg_masks(void) +{ + return sample_reg_masks; +} diff --git a/tools/perf/arch/s390/util/perf_regs.c b/tools/perf/arch/s390/util/perf_regs.c index c0877c264d49..6b1665f41180 100644 --- a/tools/perf/arch/s390/util/perf_regs.c +++ b/tools/perf/arch/s390/util/perf_regs.c @@ -2,7 +2,7 @@ #include "perf_regs.h" #include "../../util/perf_regs.h" -const struct sample_reg sample_reg_masks[] = { +static const struct sample_reg sample_reg_masks[] = { SMPL_REG_END }; @@ -15,3 +15,8 @@ uint64_t arch__user_reg_mask(void) { return PERF_REGS_MASK; } + +const struct sample_reg *arch__sample_reg_masks(void) +{ + return sample_reg_masks; +} diff --git a/tools/perf/arch/x86/util/perf_regs.c b/tools/perf/arch/x86/util/perf_regs.c index b813502a2727..12fd93f04802 100644 --- a/tools/perf/arch/x86/util/perf_regs.c +++ b/tools/perf/arch/x86/util/perf_regs.c @@ -13,7 +13,7 @@ #include "../../../util/pmu.h" #include "../../../util/pmus.h" -const struct sample_reg sample_reg_masks[] = { +static const struct sample_reg sample_reg_masks[] = { SMPL_REG(AX, PERF_REG_X86_AX), SMPL_REG(BX, PERF_REG_X86_BX), SMPL_REG(CX, PERF_REG_X86_CX), @@ -276,6 +276,11 @@ int arch_sdt_arg_parse_op(char *old_op, char **new_op) return SDT_ARG_VALID; } +const struct sample_reg *arch__sample_reg_masks(void) +{ + return sample_reg_masks; +} + uint64_t arch__intr_reg_mask(void) { struct perf_event_attr attr = { diff --git a/tools/perf/util/parse-regs-options.c b/tools/perf/util/parse-regs-options.c index a4a100425b3a..cda1c620968e 100644 --- a/tools/perf/util/parse-regs-options.c +++ b/tools/perf/util/parse-regs-options.c @@ -46,22 +46,18 @@ __parse_regs(const struct option *opt, const char *str, int unset, bool intr) if (!strcmp(s, "?")) { fprintf(stderr, "available registers: "); -#ifdef HAVE_PERF_REGS_SUPPORT - for (r = sample_reg_masks; r->name; r++) { + for (r = arch__sample_reg_masks(); r->name; r++) { if (r->mask & mask) fprintf(stderr, "%s ", r->name); } -#endif fputc('\n', stderr); /* just printing available regs */ goto error; } -#ifdef HAVE_PERF_REGS_SUPPORT - for (r = sample_reg_masks; r->name; r++) { + for (r = arch__sample_reg_masks(); r->name; r++) { if ((r->mask & mask) && !strcasecmp(s, r->name)) break; } -#endif if (!r || !r->name) { ui__warning("Unknown register \"%s\", check man page or run \"perf record %s?\"\n", s, intr ? "-I" : "--user-regs="); diff --git a/tools/perf/util/perf_regs.c b/tools/perf/util/perf_regs.c index 64724eb58dd5..44b90bbf2d07 100644 --- a/tools/perf/util/perf_regs.c +++ b/tools/perf/util/perf_regs.c @@ -21,6 +21,15 @@ uint64_t __weak arch__user_reg_mask(void) return 0; } +static const struct sample_reg sample_reg_masks[] = { + SMPL_REG_END +}; + +const struct sample_reg * __weak arch__sample_reg_masks(void) +{ + return sample_reg_masks; +} + const char *perf_reg_name(int id, const char *arch) { const char *reg_name = NULL; diff --git a/tools/perf/util/perf_regs.h b/tools/perf/util/perf_regs.h index 7fd0c7b4cec1..f2d0736d65cc 100644 --- a/tools/perf/util/perf_regs.h +++ b/tools/perf/util/perf_regs.h @@ -26,8 +26,7 @@ enum { int arch_sdt_arg_parse_op(char *old_op, char **new_op); uint64_t arch__intr_reg_mask(void); uint64_t arch__user_reg_mask(void); - -extern const struct sample_reg sample_reg_masks[]; +const struct sample_reg *arch__sample_reg_masks(void); const char *perf_reg_name(int id, const char *arch); int perf_reg_value(u64 *valp, struct regs_dump *regs, int id); From patchwork Wed Feb 14 11:39:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 200930 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:bc8a:b0:106:860b:bbdd with SMTP id dn10csp1152544dyb; Wed, 14 Feb 2024 03:49:35 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUhmHVO5unCb6NPbY5d/namGZGONePKJPVHi7L7WqRYWnvqi3wM09kX+hhC1vkiMFCw7ass12NwPmgwI4GkeigfpDl0eA== X-Google-Smtp-Source: AGHT+IFRRVpHFxPiVMppamfHRVvNJ2ZnfWVZY9yY9lWHGWeS03TrqqK1XHip2/6+QUVQecpRZiAd X-Received: by 2002:a17:902:cec2:b0:1d8:ab27:d76c with SMTP id d2-20020a170902cec200b001d8ab27d76cmr2627862plg.51.1707911375407; Wed, 14 Feb 2024 03:49:35 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707911375; cv=pass; d=google.com; s=arc-20160816; b=L15TKRNznKKq4jSvsmzNIxsjn5QZvrmb2QY5+XGF+68bYSTfViam5ysRFSy7Mgd1y7 UdHAeWsR0lKZWzb/hHKKr24/EujLFIIQxO3PVjxM1navdSBpd8NcbZf3Pvbc4+orSiT/ olg2/uyKPHvb69i0Z1HNEBr0K26n7bzXJKrjj5AFql/C/kNdyktRY1Yw2Dy0NTQ0bCOw 8GuHLUNHlxMx6E/dEgqbpkXz7wDiFor3RGEXYt3Br0kbxvnzRDkDXN+FrC2R89LgV/JO iLcLJQ4UMbg6s1bPKJmcCVy56Hg68SUkG1zGUk5yB19NTIDxkvUT4LcqEVOrWcDw6sj5 uUbQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=ceIPkkMA3m3CUBnXP3Si9TKYLZlh1ovGGEt5qyffvMM=; fh=X04ESCXm733n3RyMTcYpPqB9XeWAVE9fEjXGvhbPYzg=; b=bbCVuJaQ8PdvTDssYiTnNwd96xNmh63cyvy33haPoRYswZ+eRC3cYtl8yz7AfCTU3S yWfXXEfLOAoA2Qyy4jjHBfWKquCeXOv8oez0Zetj0a2nNQG8Daq8n3DLRkTmpreo3aYd kbQmHur5qO237cUx8A5QaJy1seHgmXX14ncrG3XGel6C9ucJrzgEJ0BFjMOyEAqh7fuf N4w479io/mq9LQqyXPihFmNZ2pdm0nPVrrG8aAdsrdLys38qygp/LmnrbCLQ/dPpnvIO w8qk0r3we7KbAk3I3/iHzK+4H4i5xFduv/qIvGkGOpNoygItwf0bK+Oiu4iKCFJZ/gwc lXfg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=Vg3hlHC9; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-65152-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-65152-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev X-Forwarded-Encrypted: i=2; AJvYcCUiksjV7pByt0AxKzezE9h7g5/FpyJIY7Bw24Y+WX0lz+Qc/g09tlOxhVABrmJQZo6naDSpO19c8vKdpydyHmgFm/qw3Q== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id p5-20020a170902ebc500b001db5c13c670si1017923plg.495.2024.02.14.03.49.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Feb 2024 03:49:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-65152-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=Vg3hlHC9; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-65152-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-65152-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 7194D28FF56 for ; Wed, 14 Feb 2024 11:41:30 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 597B31BC5C; Wed, 14 Feb 2024 11:40:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="Vg3hlHC9" Received: from out-171.mta0.migadu.com (out-171.mta0.migadu.com [91.218.175.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 50B791BDC4 for ; Wed, 14 Feb 2024 11:40:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707910843; cv=none; b=g5Rwz6cUqJcbYKvgd7galuM9+3cKZdSM5j3lZFUJi1s2OYBpHDxit81D5FfQzK76de7nq3X5iFuk4auY0mjtuzt659nbFJRoJlVSnAH2hchrzVf8GuBbORncvaYj6MMcqi1ZKJhOQArT+OIleox7hTdL0e9FC0URHqVm52Ps8eA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707910843; c=relaxed/simple; bh=msK7Neyo95sifG/SfnjBvM2eXJ30OW6/HO1CpcE+9n4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=gxBd6/FG8M+L/doh98ETb8z56YwDJoTv5W9NRVkIXUWMtkc/JEwFuddTjGBOSgcw3e/P08tUHglI3vOnvcNW6nZYGZSlmPqyN7B8IVZP1Y6KR1/efSOJj6TH+OcFtrnktPLy2wxfukZ5Mk92U93f25V7vtxur0Ypf9LpwgqXqBY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=Vg3hlHC9; arc=none smtp.client-ip=91.218.175.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1707910840; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ceIPkkMA3m3CUBnXP3Si9TKYLZlh1ovGGEt5qyffvMM=; b=Vg3hlHC9ifATj2zwM4zqt65oYEOYkZjfvbjqdT7Vp7OLdAAhGPY8detKJ1ebR0CveIPXFl hPFbjlGoQ7ZhrUFFq6IWLcmgfTnjG4PuMg9WVQrJMe+jxmkeYjwVG/8+Hk5i9PRfmBeMR4 kiAH5tHAI0XeIRT9JImIt+/xV7SeY5g= From: Leo Yan To: Arnaldo Carvalho de Melo , Namhyung Kim , Jiri Olsa , Ian Rogers , 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 Cc: Leo Yan Subject: [PATCH v1 4/4] perf build: Cleanup perf register configuration Date: Wed, 14 Feb 2024 19:39:47 +0800 Message-Id: <20240214113947.240957-5-leo.yan@linux.dev> In-Reply-To: <20240214113947.240957-1-leo.yan@linux.dev> References: <20240214113947.240957-1-leo.yan@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790874878754891190 X-GMAIL-MSGID: 1790874878754891190 The target is to allow the tool to always enable the perf register feature for native parsing and cross parsing, and current code doesn't depend on the macro 'HAVE_PERF_REGS_SUPPORT'. This patch remove the variable 'NO_PERF_REGS' and the defined macro 'HAVE_PERF_REGS_SUPPORT' from the Makefile. Signed-off-by: Leo Yan --- tools/perf/Makefile.config | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config index 8b740c668ab7..7de7111c0226 100644 --- a/tools/perf/Makefile.config +++ b/tools/perf/Makefile.config @@ -28,8 +28,6 @@ include $(srctree)/tools/scripts/Makefile.arch $(call detected_var,SRCARCH) -NO_PERF_REGS := 1 - ifneq ($(NO_SYSCALL_TABLE),1) NO_SYSCALL_TABLE := 1 @@ -50,7 +48,6 @@ endif # Additional ARCH settings for ppc ifeq ($(SRCARCH),powerpc) - NO_PERF_REGS := 0 CFLAGS += -I$(OUTPUT)arch/powerpc/include/generated LIBUNWIND_LIBS := -lunwind -lunwind-ppc64 endif @@ -66,41 +63,27 @@ ifeq ($(SRCARCH),x86) else LIBUNWIND_LIBS = -lunwind-x86 -llzma -lunwind endif - NO_PERF_REGS := 0 endif ifeq ($(SRCARCH),arm) - NO_PERF_REGS := 0 LIBUNWIND_LIBS = -lunwind -lunwind-arm endif ifeq ($(SRCARCH),arm64) - NO_PERF_REGS := 0 CFLAGS += -I$(OUTPUT)arch/arm64/include/generated LIBUNWIND_LIBS = -lunwind -lunwind-aarch64 endif ifeq ($(SRCARCH),loongarch) - NO_PERF_REGS := 0 CFLAGS += -I$(OUTPUT)arch/loongarch/include/generated LIBUNWIND_LIBS = -lunwind -lunwind-loongarch64 endif -ifeq ($(SRCARCH),riscv) - NO_PERF_REGS := 0 -endif - -ifeq ($(SRCARCH),csky) - NO_PERF_REGS := 0 -endif - ifeq ($(ARCH),s390) - NO_PERF_REGS := 0 CFLAGS += -fPIC -I$(OUTPUT)arch/s390/include/generated endif ifeq ($(ARCH),mips) - NO_PERF_REGS := 0 CFLAGS += -I$(OUTPUT)arch/mips/include/generated LIBUNWIND_LIBS = -lunwind -lunwind-mips endif @@ -161,10 +144,6 @@ endif FEATURE_CHECK_CFLAGS-libopencsd := $(LIBOPENCSD_CFLAGS) FEATURE_CHECK_LDFLAGS-libopencsd := $(LIBOPENCSD_LDFLAGS) $(OPENCSDLIBS) -ifeq ($(NO_PERF_REGS),0) - CFLAGS += -DHAVE_PERF_REGS_SUPPORT -endif - # for linking with debug library, run like: # make DEBUG=1 LIBDW_DIR=/opt/libdw/ ifdef LIBDW_DIR