Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp8039617rwd; Tue, 20 Jun 2023 09:20:17 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4hO5zLbtsqe8pG80/MBxplkUTL3+6FnWehxORPPYjCjOfwNyFsfxWyc0wlQOTDbp2TJ0ur X-Received: by 2002:a17:902:74c5:b0:1b0:6e16:b92c with SMTP id f5-20020a17090274c500b001b06e16b92cmr12924236plt.54.1687278016971; Tue, 20 Jun 2023 09:20:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687278016; cv=none; d=google.com; s=arc-20160816; b=KBLs4Pl2X5l7zqUwdQjM4Y5zjqbkI1OAPdkWQt14zOlJY/s+pHVX9u+pncCVsVu/pD SLtKoN0sr1+Mcv8kjx4WuHlFj2b2AA+aJG2BTWjL+sTr32QwJf13lliHM/bkbFLd1nhs l1QVHC8MAMmPDftRBzGhnkP1ybq4///niLUdDdNa8sGZk2p5bfYKuxLEmVW/fBfsp+Dy W3HM6V/lMf4qx6vVZRqhvShTTQL50LkqOy4qT+48ka2H9o7i8r6l5F6jCx0QtF89Ubjd BmkyTVO2GmWGuUaW7eKoSZlowQ91nLMI5dPiyPmD7yXKdFZXFLk2wMVg/V438iD+CRdH Tqdw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=lnCsoCnCh39b0s6m/fUfMAc2IwZb70n89X4sVjn81Co=; b=Achs83B0bCO+Ywu0Q9hAYDNsRP1771FqSjPW4RBStAIBRoX38WF3Bsq5BjVbzHtaFD mbzgxMYD1RCeeFt1RevBmLfUIEJ2knst9Ejktl5bmHVt4BDuEIdDogJyUSNSaArE773l tG9HZjGDCoCpwmTkOpyQMhKG0Jo6vsohZGEYWKlnxyP1r/4VA881AwA+5F4cYuCuTO9m NMmn+t8kZDsFTWt4YOsXYYq3GH8WSz0Kqy05eC9/d6eKCBWzJsY+kfq0epi6pSznQhyT GIXrFgpMqDv0BTfePMhpy/B8bPvBhLZexVnJ5yWW0lXWzPgemdj4/6aV+JQJlr2LMetO V1EA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v11-20020a170902d08b00b001b53c722e41si2137316plv.253.2023.06.20.09.20.01; Tue, 20 Jun 2023 09:20:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232934AbjFTP5Q (ORCPT + 99 others); Tue, 20 Jun 2023 11:57:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42498 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229954AbjFTP5K (ORCPT ); Tue, 20 Jun 2023 11:57:10 -0400 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4052AB4; Tue, 20 Jun 2023 08:57:08 -0700 (PDT) Received: from kwepemm600003.china.huawei.com (unknown [172.30.72.56]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4QlrqJ0mmXz1FDf8; Tue, 20 Jun 2023 23:57:00 +0800 (CST) Received: from localhost.localdomain (10.67.174.95) by kwepemm600003.china.huawei.com (7.193.23.202) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Tue, 20 Jun 2023 23:57:05 +0800 From: Yang Jihong To: , , , , , , , , , , CC: Subject: [PATCH 2/2] perf/core: deliver PERF_RECORD_COMM and PERF_RECORD_MMAP side-band events to all online cpus Date: Tue, 20 Jun 2023 15:55:15 +0000 Message-ID: <20230620155515.101222-3-yangjihong1@huawei.com> X-Mailer: git-send-email 2.30.GIT In-Reply-To: <20230620155515.101222-1-yangjihong1@huawei.com> References: <20230620155515.101222-1-yangjihong1@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.67.174.95] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To kwepemm600003.china.huawei.com (7.193.23.202) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Tasks are migrated between cores due to scheduling. If perf samples specified CPUs, PERF_RECORD_COMM and PERF_RECORD_MMAP events need be deliver to all cores to avoids the problem that the comm and symbols cannot be parsed due to task migration to the target core. The specific scenarios are as follows: CPU0 CPU1 perf record -C 0 start taskA starts to be created and executed -> PERF_RECORD_COMM and PERF_RECORD_MMAP events only deliver to CPU1 ...... | migrate to CPU0 | Running on CPU0 <----------/ ... perf record -C 0 stop Now perf samples the PC of taskA. However, perf does not record the PERF_RECORD_COMM and PERF_RECORD_COMM events of taskA. Therefore, the comm and symbols of taskA cannot be parsed. Signed-off-by: Yang Jihong --- kernel/events/core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/events/core.c b/kernel/events/core.c index 66dbca1ba577..a014b2063af1 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c @@ -8276,7 +8276,7 @@ static void perf_event_comm_event(struct perf_comm_event *comm_event) perf_iterate_sb(perf_event_comm_output, comm_event, NULL, - false); + true); } void perf_event_comm(struct task_struct *task, bool exec) @@ -8755,7 +8755,7 @@ static void perf_event_mmap_event(struct perf_mmap_event *mmap_event) perf_iterate_sb(perf_event_mmap_output, mmap_event, NULL, - false); + true); kfree(buf); } -- 2.30.GIT