Received: by 2002:a89:48b:0:b0:1f5:f2ab:c469 with SMTP id a11csp1063761lqd; Thu, 25 Apr 2024 05:15:08 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUSbYYxSco7GlDuzE1hoFMVjToYcZLk9jAHDJj4Teedr6WNbPpgk3PXyzHj2VjELUY5g+06rguNXCp05h0pFp8cN2u7VwbGjBckIdkOeQ== X-Google-Smtp-Source: AGHT+IEclVmIJHIQzyfOBOpwQnYSA4boDoYVIKGuaxiBzwi7BaevB6ayGN8PagyeGAGluyVs75sA X-Received: by 2002:a17:902:f688:b0:1e8:7906:5be3 with SMTP id l8-20020a170902f68800b001e879065be3mr4095952plg.18.1714047308622; Thu, 25 Apr 2024 05:15:08 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714047308; cv=pass; d=google.com; s=arc-20160816; b=ZxBib5f7qWmVGHKFQ1nJT46gSVOWhk+d58yhU1NMDFDckW3Fq4piq1HOwEXUrp37lR WFsc9Mp4BUbF4F6MFJ2d6k8j5K5KMAhKEDSrtvILf3ArFl6NGJme1/FSioct7AbM1GEp qUTdrqnZxoIyM9HCYqCupJjn06svTHpVdBVDEdbO4NIryWp7sQwJrIGwdXqCvGPAbzXL 3+lgwN41AoWy0xHcsC/zSu3JCHoWhwzeM0ZzjscPG2LiXDTh9+BZKW693DaL0Vw51h6R TGlizEse2z89vyi4suACVVYJNuiFoV5nnGRiJascuotcONvg86CEtz0tdjVPw2ddfes/ b6WQ== 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:message-id:date:subject:cc:to :from; bh=ljeMN6oGu9JeW8TI53eF6HxlbRhNvSg361nRkTNpdKE=; fh=9VgBqL1+V42ogSJ9ghPy8H+Z8lvQi6V4PWdXmWIzdv4=; b=hgevEzqrS9cZlGkynE3Lt2xlrZ7SNf5NKaIxOqhY9Wuc8zrfqnYfZO6DgOlxqwFzEw j3FACVXveBr3nW49fPgiMQH9pmBA+3UCdolYk7Mpv0x5LnLT3zpgKtel3FE9DHAJSL5d 3NtXkzgE0MEeeSRfnjOrE9En2JtJQ8fvBuZmCuQa4fpSOc6R8zWajbOgFFL/qbIgN395 yIMFe2nevqcEPrs67jFvocUlvldxd2LBjEiLnmKgXSxBhF2QuKcB/YiLYvl2uEBbQQnM EPk/HRQiJqy8BYof3aE8lmjxiGZji0zqJDrLD8vHhU6vaFyOXLE7KVMY97TpvFWxGyin aDpg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=loongson.cn); spf=pass (google.com: domain of linux-kernel+bounces-158508-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-158508-linux.lists.archive=gmail.com@vger.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 h6-20020a170902704600b001dd96e5febesi12926372plt.190.2024.04.25.05.15.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Apr 2024 05:15:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-158508-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; arc=pass (i=1 spf=pass spfdomain=loongson.cn); spf=pass (google.com: domain of linux-kernel+bounces-158508-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-158508-linux.lists.archive=gmail.com@vger.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 E9551286B2E for ; Thu, 25 Apr 2024 12:14:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7FA6812BF29; Thu, 25 Apr 2024 12:14:48 +0000 (UTC) Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 23CFB85274; Thu, 25 Apr 2024 12:14:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=114.242.206.163 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714047288; cv=none; b=n7gMlAXK0oFWMBoqnm4Zs/G6nDSCMK0F9A0bmX3hMawXgLU0/qNXt6IT8I9Q65iJzVQxuH75IcTenpJFfufUkQP8+vT9OZARaLZA9HObI2C0Y9BNMdF9dqaBXoksdLOR2kJLz2pzlIFlWC0O4POsutNhx5ua3P2uwAfHn/jonOo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714047288; c=relaxed/simple; bh=3vGb389ZmgV4GOiQ1rZ+LjSvyzxdXIH+pwBolR/mcC0=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=nULIJhjBzKc6oKK+R88k8kENaVambzz17MRGHf+mL3j59GGpNkWwwK1qGmoOoJFE8RzjZI+KcK9XXJN9a+o0olHHJneFXOxoW257JhLs+OO9wtqfgxnI0p1NYkiyBvQJfs126U9l9o6eobXWJR/jz7c3kgHtThY4TEh8Y56n+iw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=loongson.cn; spf=pass smtp.mailfrom=loongson.cn; arc=none smtp.client-ip=114.242.206.163 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=loongson.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=loongson.cn Received: from loongson.cn (unknown [10.2.5.213]) by gateway (Coremail) with SMTP id _____8BxmPA0SSpmbMsCAA--.13315S3; Thu, 25 Apr 2024 20:14:44 +0800 (CST) Received: from localhost.localdomain (unknown [10.2.5.213]) by localhost.localdomain (Coremail) with SMTP id AQAAf8AxLN4zSSpmGw4FAA--.17827S2; Thu, 25 Apr 2024 20:14:43 +0800 (CST) From: Bibo Mao To: Huacai Chen Cc: Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , WANG Xuerui , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, loongarch@lists.linux.dev Subject: [PATCH] LoongArch: Lately init pmu after smp is online Date: Thu, 25 Apr 2024 20:14:43 +0800 Message-Id: <20240425121443.1009824-1-maobibo@loongson.cn> X-Mailer: git-send-email 2.39.3 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID:AQAAf8AxLN4zSSpmGw4FAA--.17827S2 X-CM-SenderInfo: xpdruxter6z05rqj20fqof0/ X-Coremail-Antispam: 1Uk129KBjDUn29KB7ZKAUJUUUUU529EdanIXcx71UUUUU7KY7 ZEXasCq-sGcSsGvfJ3UbIjqfuFe4nvWSU5nxnvy29KBjDU0xBIdaVrnUUvcSsGvfC2Kfnx nUUI43ZEXa7xR_UUUUUUUUU== There is smp function call named reset_counters() to init PMU registers of every CPU in PMU initialization state. It requires that all CPUs are online. However there is early_initcall prefix with PMU init funciton init_hw_perf_events(), so that pmu init funciton is called in do_pre_smp_initcalls() and before function smp_init(). Function reset_counters() cannot work on other CPUs since they do not boot up still. Here replace prefix early_initcall with pure_initcall, so that PMU init function is called after every cpu is online. Signed-off-by: Bibo Mao --- arch/loongarch/kernel/perf_event.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/loongarch/kernel/perf_event.c b/arch/loongarch/kernel/perf_event.c index 3265c8f33223..f86a4b838dd7 100644 --- a/arch/loongarch/kernel/perf_event.c +++ b/arch/loongarch/kernel/perf_event.c @@ -874,4 +874,4 @@ static int __init init_hw_perf_events(void) return 0; } -early_initcall(init_hw_perf_events); +pure_initcall(init_hw_perf_events); base-commit: e88c4cfcb7b888ac374916806f86c17d8ecaeb67