From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 23C88C433F5 for ; Thu, 25 Nov 2021 07:55:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=74NDZtzOkgfU6zddwCUhmHUbxRiRZSe9TImxi4GYOyA=; b=TDKZDrnLD5AGVt ZJDWt1NiGSOwGNAF2JffApxfMGf62+uisxrkvTjVJoCXS+ZY8lm3jH7N+P2N4WtIkKVkz7enf3TfR hPAevEomKtkSglB46YcJq/fWtaPXxb+yHN1XSWbSvc2/8UJCbFgyKUpITlh8ILb/twsGO4kQu7o5E iOc/I0q5knF43B7JEI2LTVgx+UxPvbvQbm9jCGN3JQFeo5MQ76CPUUGqJ31qTzUnidsW9RZ/PJF6Q 1qYJAhnQTX6WVoQ9vcqVFyRlWoVyoHWD8rz5TTyIQ/xNyqXEMkNLQlNN/aHZUyp4xuVaTS1tQZ0Yz uT+DU8TmMI8vjh1wvnlg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mq9aC-006eMl-1x; Thu, 25 Nov 2021 07:54:16 +0000 Received: from mail-pf1-x42b.google.com ([2607:f8b0:4864:20::42b]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mq9a7-006eKd-AO for linux-arm-kernel@lists.infradead.org; Thu, 25 Nov 2021 07:54:13 +0000 Received: by mail-pf1-x42b.google.com with SMTP id z6so5150299pfe.7 for ; Wed, 24 Nov 2021 23:54:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=8Wv822/jiFy6kR7lmixyoAId5E8/Qt673Ad/6b/9Axc=; b=EyBk6nqeZEB4YkZczQkzU0lrvLC3eGGModtukK2alJlo+0jTFZ4Nt7pIqB6ALbzxf9 tXJ/C0/6s6CO/HuuKBwTKG6BLEaPJ2vstMIXSpcCfl1HKvc3915ObU4lEmkZ3qOvaMK7 FWpTSYrQB3n74QRBzmT39CH/gJ0lH1nkpMZR53mvPZ0BBUnQ5w05St7l01VeU2y7MUiJ CXEi7659N+6GyeJjScXO2/W2kAmVUMfVBMzGuRnCAikp1xIZufB3bcDeVUHfm+PjA9BL CMb1GC6hXC0ZIjrVLfsy7pJ/yM8bJeoUpsMjA7/IgyEaR0u07ISE5wxWdh3VRPUfN1b4 wTYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=8Wv822/jiFy6kR7lmixyoAId5E8/Qt673Ad/6b/9Axc=; b=izmjEiemFN/ueadsDnOZdm/Ky7f2AIc1O7nD2sijwG+xkgT5FJGnBDxFGgN3l5gw4l 1b56CAduZP77gfAIodwR3EH+VvFdy8Bf+gPQLmQJ87oFaNQSC7NiZTTY4a3XL4UbLjjh My2JXYWiUndZUzGmOc5f6TC3LDV0bkz6dg6TQXqjyYpQsS5AnQFm9dQX3Tow10YeuRNp O4Kvmn/GwQHqBJ6R7C60/50Zba3q26rCCNTZmMJC9S/5923yCrIAUZmW5KZQNDUmp9Id zjeNaSC5YZOfTsoD0Yzv5nebCU47EIFPWBIULehqxEZwj5gt4QWbIXuiFiQP59GaVx5z IMrw== X-Gm-Message-State: AOAM531ms1YFxNTih5o9dQa65esjfj2zEkWsJINIz/of1HCYRn+bQ6VN 1nd837I4f18sa/Wnq0gIX5NtUA== X-Google-Smtp-Source: ABdhPJweeLGCcXw+DnNYd9KB0VW0F5kTCBoJcSRTiIoppce2exLhlc8gTsBBmnp7rSRmlhO1W+UdLQ== X-Received: by 2002:a05:6a00:2391:b0:4a2:cb64:2e43 with SMTP id f17-20020a056a00239100b004a2cb642e43mr12694041pfc.49.1637826849228; Wed, 24 Nov 2021 23:54:09 -0800 (PST) Received: from leoy-ThinkPad-X240s ([66.23.193.248]) by smtp.gmail.com with ESMTPSA id u30sm1483831pgo.60.2021.11.24.23.54.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Nov 2021 23:54:08 -0800 (PST) Date: Thu, 25 Nov 2021 15:53:58 +0800 From: Leo Yan To: German Gomez Cc: linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, acme@kernel.org, James Clark , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , John Garry , Will Deacon , Mathieu Poirier , linux-arm-kernel@lists.infradead.org Subject: Re: [RESEND PATCH 1/1] perf arm-spe: report all SPE records as "all" events Message-ID: <20211125075358.GA1599216@leoy-ThinkPad-X240s> References: <20211117142833.226629-1-german.gomez@arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20211117142833.226629-1-german.gomez@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211124_235411_430013_8807BFC9 X-CRM114-Status: GOOD ( 28.15 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, Nov 17, 2021 at 02:28:32PM +0000, German Gomez wrote: > From: James Clark > > Currently perf-report and perf-inject are dropping a large number of SPE > records because they don't contain any of the existing events, but the > contextual information of the records is still useful to keep. > > The synthesized event "all" is generated for every SPE record that is > processed, regardless of whether the record contains interesting events > or not. The event can be filtered with the flag "--itrace=o". > > Signed-off-by: James Clark > Signed-off-by: German Gomez > --- > tools/perf/Documentation/itrace.txt | 2 +- > tools/perf/util/arm-spe.c | 36 +++++++++++++++++++++++++++++ > tools/perf/util/auxtrace.h | 2 +- > 3 files changed, 38 insertions(+), 2 deletions(-) > > diff --git a/tools/perf/Documentation/itrace.txt b/tools/perf/Documentation/itrace.txt > index c52755481..57dc12b83 100644 > --- a/tools/perf/Documentation/itrace.txt > +++ b/tools/perf/Documentation/itrace.txt > @@ -6,7 +6,7 @@ > w synthesize ptwrite events > p synthesize power events (incl. PSB events for Intel PT) > o synthesize other events recorded due to the use > - of aux-output (refer to perf record) > + of aux-output (refer to perf record) (all events for Arm SPE) > e synthesize error events > d create a debug log > f synthesize first level cache events > diff --git a/tools/perf/util/arm-spe.c b/tools/perf/util/arm-spe.c > index ce77abf90..6428351db 100644 > --- a/tools/perf/util/arm-spe.c > +++ b/tools/perf/util/arm-spe.c > @@ -58,6 +58,7 @@ struct arm_spe { > u8 sample_branch; > u8 sample_remote_access; > u8 sample_memory; > + u8 sample_other; > > u64 l1d_miss_id; > u64 l1d_access_id; > @@ -68,6 +69,7 @@ struct arm_spe { > u64 branch_miss_id; > u64 remote_access_id; > u64 memory_id; > + u64 all_id; > > u64 kernel_start; > > @@ -351,6 +353,23 @@ static int arm_spe__synth_branch_sample(struct arm_spe_queue *speq, > return arm_spe_deliver_synth_event(spe, speq, event, &sample); > } > > +static int arm_spe__synth_other_sample(struct arm_spe_queue *speq, > + u64 spe_events_id) > +{ > + struct arm_spe *spe = speq->spe; > + struct arm_spe_record *record = &speq->decoder->record; > + union perf_event *event = speq->event_buf; > + struct perf_sample sample = { .ip = 0, }; > + > + arm_spe_prep_sample(spe, speq, event, &sample); > + > + sample.id = spe_events_id; > + sample.stream_id = spe_events_id; > + sample.addr = record->to_ip; After checked the event types, I think "other" samples would include below raw event types: EV_EXCEPTION_GEN EV_RETIRED EV_NOT_TAKEN EV_ALIGNMENT EV_PARTIAL_PREDICATE EV_EMPTY_PREDICATE I am just wander if we can use sample.transaction to store these event types, otherwise, we cannot distinguish the event type for the samples. And it's good fill more sample fields for complete info, like: sample.addr = record->virt_addr; sample.phys_addr = record->phys_addr; sample.data_src = data_src; Thanks, Leo > + > + return arm_spe_deliver_synth_event(spe, speq, event, &sample); > +} > + > #define SPE_MEM_TYPE (ARM_SPE_L1D_ACCESS | ARM_SPE_L1D_MISS | \ > ARM_SPE_LLC_ACCESS | ARM_SPE_LLC_MISS | \ > ARM_SPE_REMOTE_ACCESS) > @@ -480,6 +499,12 @@ static int arm_spe_sample(struct arm_spe_queue *speq) > return err; > } > > + if (spe->sample_other) { > + err = arm_spe__synth_other_sample(speq, spe->all_id); > + if (err) > + return err; > + } > + > return 0; > } > > @@ -1107,6 +1132,17 @@ arm_spe_synth_events(struct arm_spe *spe, struct perf_session *session) > return err; > spe->memory_id = id; > arm_spe_set_event_name(evlist, id, "memory"); > + id += 1; > + } > + > + if (spe->synth_opts.other_events) { > + spe->sample_other = true; > + > + err = arm_spe_synth_event(session, &attr, id); > + if (err) > + return err; > + spe->all_id = id; > + arm_spe_set_event_name(evlist, id, "all"); > } > > return 0; > diff --git a/tools/perf/util/auxtrace.h b/tools/perf/util/auxtrace.h > index bbf0d78c6..efe1bdc06 100644 > --- a/tools/perf/util/auxtrace.h > +++ b/tools/perf/util/auxtrace.h > @@ -74,7 +74,7 @@ enum itrace_period_type { > * @ptwrites: whether to synthesize events for ptwrites > * @pwr_events: whether to synthesize power events > * @other_events: whether to synthesize other events recorded due to the use of > - * aux_output > + * aux_output (all events for Arm SPE) > * @errors: whether to synthesize decoder error events > * @dont_decode: whether to skip decoding entirely > * @log: write a decoding log > -- > 2.25.1 > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel