Received: by 2002:ab2:4a89:0:b0:1f4:a8b6:6e69 with SMTP id w9csp220901lqj; Wed, 10 Apr 2024 08:35:30 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUF8zjEMfQjgeSE+SgBcuKtlYjCo4+sdYRQU7S9kAxLMMzpnCGRI0GTh2a2tcgUCJm7yJ1KL2iRWNWeOmM4pHyZLQaK6anTCCCIJ0ZIFA== X-Google-Smtp-Source: AGHT+IFGmV8AVt5iGInxGF5F+6eW+cLh5QYe9IoR35BH6R/o0XKuAkD0TXwEvpfVDMvfIrJdRgoJ X-Received: by 2002:a17:902:f552:b0:1e2:8eee:ca5a with SMTP id h18-20020a170902f55200b001e28eeeca5amr3430922plf.52.1712763330304; Wed, 10 Apr 2024 08:35:30 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712763330; cv=pass; d=google.com; s=arc-20160816; b=vDMu0iA+Z5cjDyUktwUI9INxUnNeDo72zNeVUdsMBvsmVJ5NY7bOtFN/2puzRfzez+ 1mSSCPY/54XWiUVX88La75a0J0NnnF6S94WqAAfbxbLuUCFxWMzhQNobzTU4aOlnqVnY W0TU77OBahVbqeANNwq29Q+MapDwpvkiYttcyOJDyr8jK9woziH+ojKGuIjk90KwlyxO YLwZ/cnxYH49FM78/NPEYGpSmWMBP6tu3leDWep5ZvwZT1TVVCwk+PiCpokbpd8IeSGN 3/1ulVOvVMoLoohlSbtLVB0vIe8mdvXP9HE0mfLVEcQQa6q8vCFvgqtAHr33ZokfRE+p ix6w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=user-agent:in-reply-to:content-disposition:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:references :message-id:subject:cc:to:from:date:dkim-signature; bh=hn8z4k/BYSsYdiCZwteimf3OPYp2GFq4jBiPCYb56GA=; fh=NKGQZQZWiv82/NbJkCdiNdsgyriL9klSaHeSA1kMA48=; b=ChEiXKRbAS/PmEBdPdVyWMQu2l34hujmeeWWVdl2D8beM5+dlxd7VY+ToPWdv2YTtY gTyXNuBzQYF5Of6GcnXVjDeTfb9uBVr7jOvagxf53r4r9MCI7UcMpAmUGBsdaCWC3j2M 357PHiIJekOqBjNamcQCAIfPOKUCpY574aoXYwCIaVt3dQoX79btyQ2iVMBEjBd8yvD2 GJI/ONycHttVo59XPggs/t33MQr+GvHv1xRu3V4IesIFlu8aIfSu30SU++mEVDDqUIYS wOLOKAINHTzUOLdUDTmVMk33eMoX/HrTvbJEIBbgr/k5NVB8cns50jnSLlk0B4PQhhET agYA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=CVbAmK+8; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-138888-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-138888-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id i15-20020a170902c94f00b001e4063f59a4si7305033pla.581.2024.04.10.08.35.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Apr 2024 08:35:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-138888-linux.lists.archive=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=@kernel.org header.s=k20201202 header.b=CVbAmK+8; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-138888-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-138888-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 B7443282813 for ; Wed, 10 Apr 2024 15:34:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 778A516EC1B; Wed, 10 Apr 2024 15:34:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="CVbAmK+8" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 A3BBA16E871 for ; Wed, 10 Apr 2024 15:34:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712763265; cv=none; b=e7iagwR7vJK3UVcIDTOmP6jDP6w1c2Hh/eLfefMYPNjdM7vcMaOIoRvLU5fA78hMmtqHZJZ12utVv3YImS08EJRCmkmfyHT7hCZ8/ZpflBjYPBF+U5APaU+Zn+Jqy3b/vqtJbRrogQFEqvUHu5b+4QAoct6Mo/lPNdsmbQwyzHI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712763265; c=relaxed/simple; bh=HnzozCvOS1q27gnKJVvpU7CHZz9gMEPBCAW7+Cc7CVs=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=JAwdYxz78MkZxi2hFDM2AsACnc5T6VK8ZLF9FX3C8ued7A3e0pnKiryQKKodgY9DBdnx2HpujHVhWmh9Fd0aIPvYLzEjmWYeP9a5MIibut4ajaypYT084J4uRmuH01/UvfKQGlpo99bhutik/sCxni4dac4zd5zutPv6aTlJs3o= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=CVbAmK+8; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 88590C433F1; Wed, 10 Apr 2024 15:34:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1712763265; bh=HnzozCvOS1q27gnKJVvpU7CHZz9gMEPBCAW7+Cc7CVs=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=CVbAmK+8SUeJoukHHawbCIya8ngLTbHf6Eg59RFqOJ5x5ulWk3u8qtRwZwRJAd+nh GpLmyqE2v9zegDypKQ1HJ83rAh/j+CAsf3CbVAiS2QtmmaFFBK/7CO1cGrgW9F6DrN oPc9Yk/dWpQglCJT9OU9dfkTjIfrcGHwwjo/x1phTjufzt5dkl/zpZQ/Zzaqtcx7Di 7JHxqPh3rsy6LSxAjjHdJDjCJfmZwXuYvgwlWp8HUf54Y+TNs8/pnzvMkmcCZPiexG 4BE7eDFabQGKPAShg6pUZR23tNxa0Pfd3sNx5uOrmiyGfWjj8gMM/J4ThnUk+etzA5 9QY4KWuUWa0KQ== Date: Wed, 10 Apr 2024 16:34:19 +0100 From: Will Deacon To: Yicong Yang Cc: mark.rutland@arm.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, jonathan.cameron@huawei.com, prime.zeng@hisilicon.com, linuxarm@huawei.com, yangyicong@hisilicon.com Subject: Re: [PATCH 1/2] perf: arm_pmu: Only show online CPUs in device's "cpus" attribute Message-ID: <20240410153419.GA25171@willie-the-truck> References: <20240410095833.63934-1-yangyicong@huawei.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240410095833.63934-1-yangyicong@huawei.com> User-Agent: Mutt/1.10.1 (2018-07-13) On Wed, Apr 10, 2024 at 05:58:32PM +0800, Yicong Yang wrote: > From: Yicong Yang > > When there're CPUs offline after system booting, perf will failed: > [root@localhost ~]# /home/yang/perf stat -a -e armv8_pmuv3_0/cycles/ > Error: > The sys_perf_event_open() syscall returned with 19 (No such device) for event (cpu-clock). > /bin/dmesg | grep -i perf may provide additional information. > > This is due to PMU's "cpus" is not updated and still contains offline > CPUs and perf will try to open perf event on the offlined CPUs. > > Make "cpus" attribute only shows online CPUs and introduced a new > "supported_cpus" where users can get the range of the CPUs this > PMU supported monitoring. > > Signed-off-by: Yicong Yang > --- > drivers/perf/arm_pmu.c | 24 +++++++++++++++++++++++- > 1 file changed, 23 insertions(+), 1 deletion(-) Hmm. Is the complexity in the driver really worth it here? CPUs can be onlined and offlined after the perf_event_open() syscall has been executed, so this feels like something userspace should be aware of and handle on a best-effort basis anyway. Does x86 get away with this because CPU0 is never offlined? Will