Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp5501335rdb; Sat, 16 Sep 2023 22:35:22 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHP7qWWwIoFIKwBDqrrGztWCeq2QQGSJSU0GTlc7S10vToF2dqShuWGAqCKzXEB7/F6t7/S X-Received: by 2002:a05:6a20:d90b:b0:15a:4c23:86fd with SMTP id jd11-20020a056a20d90b00b0015a4c2386fdmr5513659pzb.19.1694928921754; Sat, 16 Sep 2023 22:35:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694928921; cv=none; d=google.com; s=arc-20160816; b=RDwlSzf39mTspDmTOpv4pJXd5m/J91IqnJOpl2J0O+JWGpDJLBHi7jRHq/TA/mfPBV e9K+4K0Z+NNyGZmVg2g559/l5lbhTh2qJ7GhntZ7387x3AczRlA2XVRerBQ5rV1UNtjX BPpLh5EStoRN/STYqcJAl8Mc+7E569EvO00wLZ1UDY2qLP3DJcfFcupmo9f+elMHt4Ih tnoN29nYEW6pYHY3cPwUP58fdit3rcBUWmBhDEuSFlMYV8BG1GfCuaj9LFoTNbaYLm4M sdh5Vr1qYdFr143tJWqU/+cGgz6ZdfJFBGnFC4/6rNStKZ99yAJPPEEHkVuNod8FV4Tm Bezw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version; bh=lAs/F5hVTAsKAR1swfJKK2C7XAU5hy8Mygcqq8bktXA=; fh=YH53jOUCu0QrxcnCRbCDpt78/VNxWuDsC4oMqRQixKA=; b=XmY269qK9aOIKZpg2eIXH1JxhOaIhJ86ccToKLgjLZuGqq0jH2MXXnzuXyNPai2cQb xwFHdNYFPSkJkDS+vs4eybeyqSe35iQnPj9u94iN4MAnI6IXpVUC169J1JIpsZ1kq62d lHFiqd80sFxuqywK+4FxwLN8G3pcNGrsAf51RmonYQYvHkGxdBxPqWMX5f4+2CpFexrx MueYBGLyBsaSX4x60xCwecGHR/c8NeU6kRo65/vqnoIFyxROtoFsGnoxCHaeDFdceHDI S18wj7FTeR/EM+OMpSfyChJjZ0ee/yznZ60T8d/YktT5HWh04mn78XOMXCXL7tdjJeLS G4Dw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id m18-20020a170902c45200b001b4fc117bf0si5906997plm.116.2023.09.16.22.35.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Sep 2023 22:35:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 8CE7E8584675; Sat, 16 Sep 2023 22:35:20 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231910AbjIQFev convert rfc822-to-8bit (ORCPT + 99 others); Sun, 17 Sep 2023 01:34:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56100 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231886AbjIQFei (ORCPT ); Sun, 17 Sep 2023 01:34:38 -0400 Received: from mail-io1-f54.google.com (mail-io1-f54.google.com [209.85.166.54]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0041F19F; Sat, 16 Sep 2023 22:34:32 -0700 (PDT) Received: by mail-io1-f54.google.com with SMTP id ca18e2360f4ac-79d1fbeeb41so21953739f.3; Sat, 16 Sep 2023 22:34:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694928872; x=1695533672; 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=GxY0Ht6R0I62ky/tGjQSPNcYGfHuwyIcdRzQUOW8tgc=; b=EnwrtBeiJXZ/BmqBfWfDNHr6VXaBknsdxaTDAFTIlBzRI02W5mT0zkEz/CH+ul5s1K d+oY5FwSzi9bJSwNOttkCKUV3BpTxLLvJhI0VXeBqaci5Zh9fuoMGv9zGGIFPqcB4lU0 EVzkheX9+t6LUtXSMKgKS6M6T4d9TcTA/N2oy2F73g54HrHRCvKP81yd3xnSEnnygn7b ypaT00xXvS3W/Fg8k/yvLWoqxTlH0IuoBq+tv9siM4UqZa09B2vJWtJmoe56ElS6n61W PUdhHw4bYfeOh02bHrFQDU/KFwUSGlKn+iIDub4Bb5E/hweqTX61LTiyDJ4TgEv+qTch 4Zbw== X-Gm-Message-State: AOJu0YzQoi2R9NE8DLq85gtKo0CM1hf0GPwRPUi+QA2XVfEmVAM2qMDs NxH72Nr68bKWclrdm17lhaKwefHsVaq2CvUPlFA= X-Received: by 2002:a5d:8784:0:b0:787:822:30f1 with SMTP id f4-20020a5d8784000000b00787082230f1mr7311988ion.1.1694928872220; Sat, 16 Sep 2023 22:34:32 -0700 (PDT) MIME-Version: 1.0 References: <20230904023340.12707-1-yangjihong1@huawei.com> <453bd95c-932d-c60a-bd7b-96f87bc7779a@amd.com> In-Reply-To: From: Namhyung Kim Date: Sat, 16 Sep 2023 22:34:20 -0700 Message-ID: Subject: Re: [PATCH v8 0/6] perf record: Track sideband events for all CPUs when tracing selected CPUs To: Yang Jihong Cc: Arnaldo Carvalho de Melo , Ravi Bangoria , peterz@infradead.org, mingo@redhat.com, mark.rutland@arm.com, alexander.shishkin@linux.intel.com, jolsa@kernel.org, irogers@google.com, adrian.hunter@intel.com, kan.liang@linux.intel.com, james.clark@arm.com, tmricht@linux.ibm.com, ak@linux.intel.com, anshuman.khandual@arm.com, linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Sat, 16 Sep 2023 22:35:20 -0700 (PDT) On Sat, Sep 16, 2023 at 2:24 AM Yang Jihong wrote: > > Hello, > > On 2023/9/16 8:14, Namhyung Kim wrote: > > Hello, > > > > On Tue, Sep 12, 2023 at 1:32 PM Arnaldo Carvalho de Melo > > wrote: > >> > >> Em Tue, Sep 12, 2023 at 02:41:56PM +0530, Ravi Bangoria escreveu: > >>> On 04-Sep-23 8:03 AM, Yang Jihong wrote: > >>>> User space tasks can migrate between CPUs, track sideband events for all > >>>> CPUs. > >>>> > >>>> 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. > >>>> > >>>> The sys_perf_event_open invoked is as follows: > >>>> > >>>> # perf --debug verbose=3 record -e cpu-clock -C 1 true > >>>> > >>>> Opening: cpu-clock > >>>> ------------------------------------------------------------ > >>>> perf_event_attr: > >>>> type 1 (PERF_TYPE_SOFTWARE) > >>>> size 136 > >>>> config 0 (PERF_COUNT_SW_CPU_CLOCK) > >>>> { sample_period, sample_freq } 4000 > >>>> sample_type IP|TID|TIME|CPU|PERIOD|IDENTIFIER > >>>> read_format ID|LOST > >>>> disabled 1 > >>>> inherit 1 > >>>> freq 1 > >>>> sample_id_all 1 > >>>> exclude_guest 1 > >>>> ------------------------------------------------------------ > >>>> sys_perf_event_open: pid -1 cpu 1 group_fd -1 flags 0x8 = 5 > >>>> Opening: dummy:u > >>>> ------------------------------------------------------------ > >>>> perf_event_attr: > >>>> type 1 (PERF_TYPE_SOFTWARE) > >>>> size 136 > >>>> config 0x9 (PERF_COUNT_SW_DUMMY) > >>>> { sample_period, sample_freq } 1 > >>>> sample_type IP|TID|TIME|CPU|IDENTIFIER > >>>> read_format ID|LOST > >>>> inherit 1 > >>>> exclude_kernel 1 > >>>> exclude_hv 1 > >>>> mmap 1 > >>>> comm 1 > >>>> task 1 > >>>> sample_id_all 1 > >>>> exclude_guest 1 > >>>> mmap2 1 > >>>> comm_exec 1 > >>>> ksymbol 1 > >>>> bpf_event 1 > >>>> ------------------------------------------------------------ > >>>> sys_perf_event_open: pid -1 cpu 0 group_fd -1 flags 0x8 = 6 > >>>> sys_perf_event_open: pid -1 cpu 1 group_fd -1 flags 0x8 = 7 > >>>> sys_perf_event_open: pid -1 cpu 2 group_fd -1 flags 0x8 = 9 > >>>> sys_perf_event_open: pid -1 cpu 3 group_fd -1 flags 0x8 = 10 > >>>> sys_perf_event_open: pid -1 cpu 4 group_fd -1 flags 0x8 = 11 > >>>> sys_perf_event_open: pid -1 cpu 5 group_fd -1 flags 0x8 = 12 > >>>> sys_perf_event_open: pid -1 cpu 6 group_fd -1 flags 0x8 = 13 > >>>> sys_perf_event_open: pid -1 cpu 7 group_fd -1 flags 0x8 = 14 > >>>> > >>>> > >>>> Changes since_v7: > >>>> - The condition for requiring system_wide sideband is changed to > >>>> "as long as a non-dummy event exists" (patch4). > >>>> - Modify the corresponding test case to record only dummy event (patch6). > >>>> - Thanks to tested-by tag from Ravi, but because the solution is modified, > >>>> the tested-by tag of Ravi is not added to this version. > >>> > >>> I've re-tested v8 with my simple test. > >>> > >>> Tested-by: Ravi Bangoria > >> > >> > >> Thanks, applied to the csets that were still sitting in an umpublished > >> perf-tools-next local branch, soon public. > > > > Now I'm seeing a perf test failure on perf-tools-next. > > Uh.. the kernel I was using before didn't support PERF_FORMAT_LOST, so > forget about supporting PERF_FORMAT_LOST. I've updated the kernel and > retested it. > > The link to the fixed patch is as follows: > https://lore.kernel.org/all/20230916091641.776031-1-yangjihong1@huawei.com/ Thank you for the quick fix! Namhyung