Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp3146539rwb; Thu, 29 Sep 2022 22:16:03 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6Sy7LDFxtsVr2AysOktJEuCQhCcMKzJOILXwuDZ67HtHxxW5K0ddsX3ou68hVmm+Jda4sl X-Received: by 2002:a17:907:3e0f:b0:782:dc11:da99 with SMTP id hp15-20020a1709073e0f00b00782dc11da99mr5067162ejc.499.1664514963011; Thu, 29 Sep 2022 22:16:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664514963; cv=none; d=google.com; s=arc-20160816; b=HeANxTppqGc9S1jM3KHta5JWsUfpe/5lDf1uLnC/AFJLpOWy/4sBvo2qrCTh5dPgoy UJRKJK1/7jXrM72rxqzPLxcTGsFaJZHrjqV5hidAx6x2J8LKcXVygnmGS1gWCH9xVwp5 nZLqRNJ51Esq5qQZqW+4dAh12mTwcmqaUf0C4OmiCT3z9EWXcRh7X9GSIXnaNLHpYH1x NogXFlvlindGThrd1emco72+U22YbJgcKf50401RJI3ki5WaBPqnkHu1TG7cXC47ex8j F8nAMn7qcUMyJ+czPbxwfn7KZghVwMrtXPisEc6vQyNMsLkoxJoC0VsOsMp3nu9oFYRH EA6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version; bh=eouRZA3yJ2rz1sAdNkk8ipLdjxkcaTNBWJyAvbZ4KPQ=; b=gnaPC2JzETbvcYd5fphVPhm0//aT+puRE5yM3/hp39CQRDkN6KBihwKb4WF9IWDmWT Qcl+ez7YhgFSDSwbbRgwy3r8NkdUqi7bv3D9UMxs1AcOAVgNJ5TWm5h10sYMY8hlw+ud d23fT3aHl4Go72PbL00ZulH5seBJDULjqHx7qXviWt4JpZG4XU4R6U7CGJVqGSn/9TC8 mcoGCEE0X6ow3i7PzZQS3NlVo62Wzpa4IRq65IA+DUPBQDjsLtJphC9FSGajA778PmfY 9UwCy88ITduMh/Uwy2HH4R2HoX3TfMWAURwIqpRXyKQE5AqJRLhS68ca7Oo8kvuGh0Uf I11g== 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w9-20020a05640234c900b0045793b0060dsi1378884edc.345.2022.09.29.22.15.37; Thu, 29 Sep 2022 22:16:03 -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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229987AbiI3E75 (ORCPT + 99 others); Fri, 30 Sep 2022 00:59:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51518 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229505AbiI3E7y (ORCPT ); Fri, 30 Sep 2022 00:59:54 -0400 Received: from mail-oa1-f43.google.com (mail-oa1-f43.google.com [209.85.160.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 81419399DC; Thu, 29 Sep 2022 21:59:52 -0700 (PDT) Received: by mail-oa1-f43.google.com with SMTP id 586e51a60fabf-131b7bb5077so4248996fac.2; Thu, 29 Sep 2022 21:59:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date; bh=eouRZA3yJ2rz1sAdNkk8ipLdjxkcaTNBWJyAvbZ4KPQ=; b=ofqfQ2vI8FlfaKtNuuvzoflEemuBUnH1MQQk//t1zqVh6cTh3QGyfKBXamjAcgn7JS k4lfa+psFwwpnUMruoNNEz2M6SpFyhxvlNftxbzuEx7xC7Ye1+bCpk7HmEa2hUIBzuAp y2P7W2iTBvhRu1pS/LDSun/0864gpezRty6gxdxUAwbyoW7s2smVD9dpIcTJe2hy60vz y2i0ybEpqFmqbhgNQvHq5ZQgwWomSlazXl0Wrh1Fpw+ykS/IIemaXpiDaJH/69Yoftdj wLUTlZ0dge2cOkVtMqO4UuYvmUrXjbr5BZx8ylNRPmcVBoktxgXBhn3NZOzUj6Xa5ke2 1Pdw== X-Gm-Message-State: ACrzQf33mGM7noKPofeP8J+rnK8ayilXwGy+5q2H2KG67cZ5e/EhJ8L8 vuXgtbQGUEup/FLFmTnGaKwhq1FDzgbqA4nxZTE= X-Received: by 2002:a05:6870:a70f:b0:127:666a:658 with SMTP id g15-20020a056870a70f00b00127666a0658mr3921859oam.218.1664513991796; Thu, 29 Sep 2022 21:59:51 -0700 (PDT) MIME-Version: 1.0 References: <20220928095805.596-1-ravi.bangoria@amd.com> <20220928095805.596-7-ravi.bangoria@amd.com> In-Reply-To: <20220928095805.596-7-ravi.bangoria@amd.com> From: Namhyung Kim Date: Thu, 29 Sep 2022 21:59:40 -0700 Message-ID: Subject: Re: [PATCH v3 06/15] perf/x86/amd: Support PERF_SAMPLE_PHY_ADDR To: Ravi Bangoria Cc: Peter Zijlstra , Arnaldo Carvalho de Melo , Jiri Olsa , Stephane Eranian , Ian Rogers , Joe Mario , Leo Yan , alisaidi@amazon.com, Andi Kleen , Kan Liang , dave.hansen@linux.intel.com, "H. Peter Anvin" , Ingo Molnar , Mark Rutland , Alexander Shishkin , Thomas Gleixner , Borislav Petkov , x86@kernel.org, linux-perf-users , linux-kernel , Sandipan Das , ananth.narayan@amd.com, Kim Phillips , santosh.shukla@amd.com Content-Type: text/plain; charset="UTF-8" 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_NONE,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 On Wed, Sep 28, 2022 at 3:00 AM Ravi Bangoria wrote: > > IBS_DC_PHYSADDR provides the physical data address for the tagged load/ > store operation. Populate perf sample physical address using it. > > Signed-off-by: Ravi Bangoria > --- > arch/x86/events/amd/ibs.c | 8 +++++++- > kernel/events/core.c | 3 ++- > 2 files changed, 9 insertions(+), 2 deletions(-) > > diff --git a/arch/x86/events/amd/ibs.c b/arch/x86/events/amd/ibs.c > index 0ad49105c154..3271735f0070 100644 > --- a/arch/x86/events/amd/ibs.c > +++ b/arch/x86/events/amd/ibs.c > @@ -989,6 +989,11 @@ static void perf_ibs_parse_ld_st_data(__u64 sample_type, > data->addr = ibs_data->regs[ibs_op_msr_idx(MSR_AMD64_IBSDCLINAD)]; > data->sample_flags |= PERF_SAMPLE_ADDR; > } > + > + if (sample_type & PERF_SAMPLE_PHYS_ADDR && op_data3.dc_phy_addr_valid) { > + data->phys_addr = ibs_data->regs[ibs_op_msr_idx(MSR_AMD64_IBSDCPHYSAD)]; > + data->sample_flags |= PERF_SAMPLE_PHYS_ADDR; > + } > } > > static int perf_ibs_get_offset_max(struct perf_ibs *perf_ibs, u64 sample_type, > @@ -998,7 +1003,8 @@ static int perf_ibs_get_offset_max(struct perf_ibs *perf_ibs, u64 sample_type, > (perf_ibs == &perf_ibs_op && > (sample_type & PERF_SAMPLE_DATA_SRC || > sample_type & PERF_SAMPLE_WEIGHT_TYPE || > - sample_type & PERF_SAMPLE_ADDR))) > + sample_type & PERF_SAMPLE_ADDR || > + sample_type & PERF_SAMPLE_PHYS_ADDR))) > return perf_ibs->offset_max; > else if (check_rip) > return 3; > diff --git a/kernel/events/core.c b/kernel/events/core.c > index e1ffdb861b53..49bc3b5e6c8a 100644 > --- a/kernel/events/core.c > +++ b/kernel/events/core.c > @@ -7435,7 +7435,8 @@ void perf_prepare_sample(struct perf_event_header *header, > header->size += size; > } > > - if (sample_type & PERF_SAMPLE_PHYS_ADDR) > + if (sample_type & PERF_SAMPLE_PHYS_ADDR && > + filtered_sample_type & PERF_SAMPLE_PHYS_ADDR) It'd be enough to check the filtered_sample_type only. Thanks, Namhyung > data->phys_addr = perf_virt_to_phys(data->addr); > > #ifdef CONFIG_CGROUP_PERF > -- > 2.31.1 >