Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp3320832rdb; Sun, 10 Dec 2023 00:16:59 -0800 (PST) X-Google-Smtp-Source: AGHT+IFTuOmOtW0QJH1nJK5WvCcjy8sb8ZvHOEgKZxzq5d55p7YhQhvOxJc8OQKYp37FKu8u03/C X-Received: by 2002:a05:6808:2e4e:b0:3b8:b063:8272 with SMTP id gp14-20020a0568082e4e00b003b8b0638272mr4431956oib.116.1702196219299; Sun, 10 Dec 2023 00:16:59 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1702196219; cv=pass; d=google.com; s=arc-20160816; b=JEWGXuahrcybaxnxsV65I5EK+UiLD1+tjHKlxwvZ1WWitQUc1VzuquENCGXvByrQyV O4uEeppWS0muA0Hd+hrH2gH4ziaGgV1Z2NzSQbsjwkGjv7aGyujLLwVQOK0S5wrBQbyU fLxxu6Btn97LKojhzs5f5CAn9ewZPi6cwKfE3NIEjD9ILPFyQPg5FAKBWjKzu+hvcI2B rDvXkEDjGw364RZ5NZGVzcqMJK9wOeUwfC5NSRhc35wklnTTKftf1ll1fvWfkdjm4Nhs 68Yo6otoWq9kHikfBGCUsImqCzeolSZWx8MvT3prqpuga5kBiankAom8/3JUDy+7FlJf ASLg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Mhds1yoBbjrhkjhv8XPbO4OPO72aaoNMvMxayRbgsR4=; fh=HIpGW3XNt20YYDdrqGWTdutDMTXUX2EnMhGwR8EwV4c=; b=0HZQ8/GjK1jjZk31YJ6/Eu+rOYXu+bdAQiLj4rdvUrQ0s11sT6QigksIFo9FvIBIG6 tX13eGE8dvH9e6rp6Q5T4j9TgRKK35gKFemNoHqFm91Pt1jzHlGSeoezkyEDyEvDZ/aV L7Wo3e+bDGcvHN2HDHnnUfh5sb35e/wi+FXiUaZi4YbS6oO8ZFfYtX3XckWD7QHAvJTH 6rgJdFf+2yDixNOdCMwhamMCcYm+4UV3xbFYH3WEMDkp8GD6X0lzIQAO1Bk2vlGhxGiC +3EAq8AzdkKWDqNz/aGo1H/RGlA2idEr4EbtCEqHNlWWgNFCuke5dPmQeP8jJ1Eq0HD5 jI4w== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@outlook.com header.s=selector1 header.b=czuqyxI+; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=outlook.com Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id u15-20020a65670f000000b005b3bcd9d7f8si4207050pgf.808.2023.12.10.00.16.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 Dec 2023 00:16:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@outlook.com header.s=selector1 header.b=czuqyxI+; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=outlook.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id D72AD8060511; Sun, 10 Dec 2023 00:16:56 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231868AbjLJIQl (ORCPT + 99 others); Sun, 10 Dec 2023 03:16:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42684 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231653AbjLJIQk (ORCPT ); Sun, 10 Dec 2023 03:16:40 -0500 Received: from AUS01-SY4-obe.outbound.protection.outlook.com (mail-sy4aus01olkn2174.outbound.protection.outlook.com [40.92.62.174]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A88D7E3; Sun, 10 Dec 2023 00:16:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Mj7clTcRpmfwzuRoAM2B6W3luIjSu7oVWJ08o0LokHbqJWcbKerHEzHo2+uduiaaHohLMg/FFiUoq7u+k1dCAvXFCuaBRJRtlAkEYe2PJpBgA6VVPWK6ilkRk6cIp6pK9b7H02u4WVNQ/UUQo1b1ULotD03+qqRh5NLpTqqr0LdcOvApLk3aMfpzbKeB4nTWmwUDdw9t4400LuygtROOH/tgHCG1zwPCUp7HHW6HKEBnCXe4YaKgEkiUvcd1DI6WecfNZC1Qg7z5+KKsFcFjlOtCq/wYUD9s9ZVzvk0RfH/wKxr1AjD0CV25h3wbnyOpUEUmaZHWGhjkih0/3ghaMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Mhds1yoBbjrhkjhv8XPbO4OPO72aaoNMvMxayRbgsR4=; b=MRClbKtrKhZpjDdAAOpgwOjwoU8o3wE5WJveyCYqWIpUX1rONUmCyFPvbRTg48/ilYO73ZYqZn1iqLO6+NK57/cEc6HdgHjOBM2im2TVUnuQBW0m5ewtGGkUBURMTNpZKU2xWpEdELGo7sQY4cJyw6JF/DG1I/AkF+2y3Dumg0ihmAH58amWObIYMvSfC1JQeUB6gWBZKLnZJPA66WSwvtLdLT0mSHFE2KuI8fWFq2hNJx6E3adFZdW1WDRFbx001y9LlrYg3iZAqbsysMYOXMwEd2rDI1pLcBm96sbeZeJhyV7/bfe1B8vbhXl8uu2hJ3aZF6o6+7VKINSzRJZZpg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Mhds1yoBbjrhkjhv8XPbO4OPO72aaoNMvMxayRbgsR4=; b=czuqyxI+/jLrCtACYpUdol1ZJojbdl0voVkq3eixcteJ/IE90MsP6luwZCfzcMzdvTlKYVTLbi5tJb+h9aNfrVOFxJnH69DNtENmv6KffJaUTdtGodx0F49pTD4Dzcip3O1KqcGcKmlT5mycXGQMnohF+kTO1Qf1L+EnrwUNk0sh62pgFgjjjSbLWXJ+lr7Nl+J/gy5BSRK7yEOzl9t52m+9lBpceHVArMqZjv1Ic68R2Y+A7mmvQvwd3fS/tnoSjD4f8Fga9Lom5WRg9u8wILwMvi8lg4WBYpPrXsbKSCYTtSAwfKqIF61Rtvi0pE1LjckqfSW8kxu8aSHGSAefmw== Received: from SYBPR01MB6870.ausprd01.prod.outlook.com (2603:10c6:10:13d::10) by MEYPR01MB7339.ausprd01.prod.outlook.com (2603:10c6:220:15f::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7068.31; Sun, 10 Dec 2023 08:16:38 +0000 Received: from SYBPR01MB6870.ausprd01.prod.outlook.com ([fe80::be5a:160f:5418:9deb]) by SYBPR01MB6870.ausprd01.prod.outlook.com ([fe80::be5a:160f:5418:9deb%5]) with mapi id 15.20.7068.030; Sun, 10 Dec 2023 08:16:38 +0000 From: Tianyi Liu To: seanjc@google.com, pbonzini@redhat.com, peterz@infradead.org, mingo@redhat.com, acme@kernel.org Cc: linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, kvm@vger.kernel.org, x86@kernel.org, mark.rutland@arm.com, mlevitsk@redhat.com, maz@kernel.org, alexander.shishkin@linux.intel.com, jolsa@kernel.org, namhyung@kernel.org, irogers@google.com, adrian.hunter@intel.com, Tianyi Liu Subject: [PATCH v3 5/5] perf tools: Support PERF_CONTEXT_GUEST_* flags Date: Sun, 10 Dec 2023 16:16:14 +0800 Message-ID: X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Content-Transfer-Encoding: 8bit Content-Type: text/plain X-TMN: [8UVhiSmk+ilYe9quhayyz4kLLAPhV41H68ne61CRE+RkAwuHwNnW+A==] X-ClientProxiedBy: SG2P153CA0040.APCP153.PROD.OUTLOOK.COM (2603:1096:4:c6::9) To SYBPR01MB6870.ausprd01.prod.outlook.com (2603:10c6:10:13d::10) X-Microsoft-Original-Message-ID: <20231210081614.2435-1-i.pear@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SYBPR01MB6870:EE_|MEYPR01MB7339:EE_ X-MS-Office365-Filtering-Correlation-Id: ea4a1d05-76d7-4776-7e34-08dbf958554b X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 8KlL61KGK3844bxqcw2mjgws6tBrdbjGDYJLTUij/sCbrkbRQ9yEaxqamA5ScAvluCCmn5N/sVhI7etP8Grtx20mq9nYuREuuIRcf7sQoX35ZkFcaWWTmEmAolzKfhhy9YTa3GIow3x1DrR26RpnEDOhFOMuNMT9ndbUXrdTO1tijtCixldnQ+sEU1TotpzLEfbkByd1J5N5n4yiWMs+LTR0D6uwehA8ypOw9t3SYl8abVWwTxPQkS4YrvIIATv+9isVIdC8MNnxmTY2280yuRPce74WnF9T1W6rPo8+yS5+vNHkEhbetC/Lt8RDf4siTWmeqNdKmPSYoaeuVUIW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HFjkaaPd/7M5rOsaIfvZtWuclQ7LYq?= =?us-ascii?Q?kGw/mWXNsWCRKc4Q7pArjkJPiI9Y1TP5bzOJLpzjbafdFLBs7K7TPYyJ7gId?= =?us-ascii?Q?/OJuFp63Ps3K6FZ+AZIsNh1LB5QC+/nbX6nB80qtK2YKdW2l3cNPaVNJ07ay?= =?us-ascii?Q?ApbjN69a/hI5LsVWo40l7CMyKLaJ3bUTPmwZC0Z4TwurZrrYqUWWA5RuIFac?= =?us-ascii?Q?IglBm0TTopp8zQ4eRlBTKjPAFg07ryA9EOPLOmFiqRUQWbksE6/8Z5XmceA5?= =?us-ascii?Q?mvCuW5ITzyP5KTUtRUjUizWqgIa7N5T+fujzcTkannuCKNZ61Bqa7DpewIz4?= =?us-ascii?Q?xWCjTelW71QJre1aWOtoDSygZAKj5iwZoB5aPnVkoT5eDojCyC+rNQ6XZT5U?= =?us-ascii?Q?5alCoAl/5P+XrA8PSUUeeLVaU4BxPXkeCNFcTUc26/yZ2APDg/QfP8romr/l?= =?us-ascii?Q?onN/Zoy1faXmhBL7iD8qSQQDMfBQ4ndz7h1VibyWE6zn+CYsdBv4uyAibKxr?= =?us-ascii?Q?/HszVvkGTJc5Zu6eaS8XFojieu6AzEuzDMV6pEyhq3m0zQ9wdPmBRuQGm6QW?= =?us-ascii?Q?PTSzhpeIloU0y1PvZhjJJgnOhrLPJN6ldj5cEBxiRkc7HmKWmPnZoQAHa6Lq?= =?us-ascii?Q?hotUe9DY2aYNWhHlxUjKUz7vDGFn/3Wl25fqPQiWOUZndr1zJsdvrZZY0uAS?= =?us-ascii?Q?9VZqthVg+h498A6Ddnq7?= X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: ea4a1d05-76d7-4776-7e34-08dbf958554b X-MS-Exchange-CrossTenant-AuthSource: SYBPR01MB6870.ausprd01.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Dec 2023 08:16:38.9013 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MEYPR01MB7339 X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email 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]); Sun, 10 Dec 2023 00:16:57 -0800 (PST) The `perf` util currently has an incomplete implementation for the following event flags. Events with these flags will be dropped or be identified as unknown types: `PERF_CONTEXT_GUEST_KERNEL` `PERF_CONTEXT_GUEST_USER` This patch makes `perf script`, `perf timechart` and `perf data` to correctly identify these flags. Signed-off-by: Tianyi Liu --- tools/perf/builtin-timechart.c | 6 ++++++ tools/perf/util/data-convert-json.c | 6 ++++++ tools/perf/util/machine.c | 6 ++++++ 3 files changed, 18 insertions(+) diff --git a/tools/perf/builtin-timechart.c b/tools/perf/builtin-timechart.c index 19d4542ea18a..6a368b6a323e 100644 --- a/tools/perf/builtin-timechart.c +++ b/tools/perf/builtin-timechart.c @@ -536,6 +536,12 @@ static const char *cat_backtrace(union perf_event *event, case PERF_CONTEXT_USER: cpumode = PERF_RECORD_MISC_USER; break; + case PERF_CONTEXT_GUEST_KERNEL: + cpumode = PERF_RECORD_MISC_GUEST_KERNEL; + break; + case PERF_CONTEXT_GUEST_USER: + cpumode = PERF_RECORD_MISC_GUEST_USER; + break; default: pr_debug("invalid callchain context: " "%"PRId64"\n", (s64) ip); diff --git a/tools/perf/util/data-convert-json.c b/tools/perf/util/data-convert-json.c index 5bb3c2ba95ca..62686f78d973 100644 --- a/tools/perf/util/data-convert-json.c +++ b/tools/perf/util/data-convert-json.c @@ -205,6 +205,12 @@ static int process_sample_event(struct perf_tool *tool, case PERF_CONTEXT_USER: cpumode = PERF_RECORD_MISC_USER; break; + case PERF_CONTEXT_GUEST_KERNEL: + cpumode = PERF_RECORD_MISC_GUEST_KERNEL; + break; + case PERF_CONTEXT_GUEST_USER: + cpumode = PERF_RECORD_MISC_GUEST_USER; + break; default: pr_debug("invalid callchain context: %" PRId64 "\n", (s64) ip); diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c index 90c750150b19..28eac11d0f61 100644 --- a/tools/perf/util/machine.c +++ b/tools/perf/util/machine.c @@ -2343,6 +2343,12 @@ static int add_callchain_ip(struct thread *thread, case PERF_CONTEXT_USER: *cpumode = PERF_RECORD_MISC_USER; break; + case PERF_CONTEXT_GUEST_KERNEL: + *cpumode = PERF_RECORD_MISC_GUEST_KERNEL; + break; + case PERF_CONTEXT_GUEST_USER: + *cpumode = PERF_RECORD_MISC_GUEST_USER; + break; default: pr_debug("invalid callchain context: " "%"PRId64"\n", (s64) ip); -- 2.34.1