Message ID | SYBPR01MB68709E1FE3A5056577AAA82F9D88A@SYBPR01MB6870.ausprd01.prod.outlook.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp6414836vqy; Sun, 10 Dec 2023 00:16:22 -0800 (PST) X-Google-Smtp-Source: AGHT+IEXCodjinn5f5DJUM2TVnAIOHabwO98rShWEDiu4DH/3tzrn6wc1tvufpN2wd/hvevM1H4u X-Received: by 2002:a17:902:ea0b:b0:1d0:8e08:35be with SMTP id s11-20020a170902ea0b00b001d08e0835bemr2477131plg.7.1702196182585; Sun, 10 Dec 2023 00:16:22 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1702196182; cv=pass; d=google.com; s=arc-20160816; b=VlBFljl47uCCoJfKPd00j9ID2fGEoLFSRYInsh5KOxSqCpC0dvl3OaIcLTfJNBfM+3 Edhz8nORErlaebQ7yMkqIsRajNgpHTIvgndylD/ckgVr2neSrf2LRg8BATWQXxxdL+V8 Pecd7PDcWM/vEniThUwbp/Pg2CyrxSXHZ1o1kaZh6rHGWwIwWbIc8+/EAAtJFJu+jSD2 SJ2IQlbcgRnyjg17TkGW62HFhpmqtP+St1daqqhYMMHQ6JK/C/JjooqRd1c8s0CVguhx f+VgszUUR/4CtzNA6Ajvk8hngtlyZ/JttlAHxFH55JW4McfBLVibcapNyaVv/IOmmvcZ YR5Q== 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=N1i26DJnKwIxg92MeUs8Z6WMsFGvM3406uFpBVomlXY=; fh=HIpGW3XNt20YYDdrqGWTdutDMTXUX2EnMhGwR8EwV4c=; b=wsFYsbvtjD3/CFQBzRBFDsG9tetLzLdhV1TSSsPoRr8NKUqOT89yW3Cnv1F97vgqRV H89ZNl/Hc5NPG3l/9OEPZYoDYtM9s+aP7fvyt0ps63PnLqQxwuRgKfrIhKesdFUo3kjB CsNX+8GdcdpprvH4z6rIsCfkIT+k+TOZ6oISRTWDO7j4c8EM/vacKfGEKs33Z1HHZ1c2 80x3E4UgWhQsFhgHtENJzNb5eHR9VZWCJ0PuT9wYx50GI8Y516mHBzD3cflwJo02UbG2 NxbrwfY5KXF1g4P9iEh3lFttezycbloQvZNA8kahAAW6fShZebXIqJWk/gA+129/qAGe ex9A== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@outlook.com header.s=selector1 header.b=cUETqePm; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 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 fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id be3-20020a170902aa0300b001cf8d044c2asi4197533plb.544.2023.12.10.00.16.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 Dec 2023 00:16:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@outlook.com header.s=selector1 header.b=cUETqePm; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 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 fry.vger.email (Postfix) with ESMTP id E1953807E447; Sun, 10 Dec 2023 00:15:53 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231681AbjLJIPp (ORCPT <rfc822;rua109.linux@gmail.com> + 99 others); Sun, 10 Dec 2023 03:15:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34880 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229482AbjLJIPn (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Sun, 10 Dec 2023 03:15:43 -0500 Received: from AUS01-SY4-obe.outbound.protection.outlook.com (mail-sy4aus01olkn2154.outbound.protection.outlook.com [40.92.62.154]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B2BB3CB; Sun, 10 Dec 2023 00:15:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=APBNDeChfwMh/HYVKhasrfaaR3luvMG36xMw4L7TxhwDNxSZgS924tl0v6/QV1zpDVbEOKS+4ge23yAUqsM9lxCeWM6l5YWWA0Y9Ro270nC5P4zO8uhLpe1cWX0YD064ozQckE482iAzMf4lLg4zR+WLVWJC/0A3qUZDDZLwwF/Sn5YFb5X49ms0RXkqIrR4fs5B83riF5ywGAwizIHG4jkNgdlRfa2a3BbIL3iZz5Oj7eVeB9LeK9YJexVd5WVxouwtXydjb9HLOZ5+W/BGI5wDsWf5Ci24gXZC3JVaZJ/3GJUrSXgJe5c3HZA8LFUA471+QJJU0c8pGmnF2K6sEQ== 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=N1i26DJnKwIxg92MeUs8Z6WMsFGvM3406uFpBVomlXY=; b=F4cojM3r6QaxB8USzKJ3l24gKvOrzQW2t5FesoMShpETcsTnl0PQI0Um9cxZZTlR4WhK9y+OMrRVoy4TAj7WLYQpw509lkekKPW128lW+NJxHpMvSKp9U3XDQ07zT/7xOE51PT2vc0OOvjbRXFXyCqn2gf1wLdTumtE1Q8+ehqKL0jL2Rx/Uqh9oijfsc6LA2g72OUtntB3tcz4TSA5eLeHwS8ItGONzFMtEfU78HEngcSZ34qWo71MiVimBgdtpBkpDA22uTN+9U5Nt1JBfWStU2hVHQelrDeGexz4SJlZT12UWAQhZDmPzLQK4+HETrHPISctmdjieSV0JXK6knA== 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=N1i26DJnKwIxg92MeUs8Z6WMsFGvM3406uFpBVomlXY=; b=cUETqePmG755InfSZkpI8kyawLtZ00ft0n/rLwuSYpd9GOq2ur1ru5G18zQu7j26IN1NxEFeS3wTPAn4hpLKWepFlctqqVMOQQVteWjGkFWgyGW4QTUAJ9ed5fo0Cdfyg2aP3HDbodRwjj0YRBdpTNVVtNDtVdXZ5qxFlDoybvXWd4MJBsGTz4DtIlXgyXZC8r53grOk2D4o8Qcx1EetWxs90cNGO6WtaDQ9EYKscesvOiAZ/YZosyEQHJTr9CRzWN5KIZAFmkHPu0foU+k8eJ2JzJb1jucLSCfoLrEwK4dTTTTmnZei/fNFrhFSrBTPriuvIsZnA4Gak54i80hnBQ== 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:15:42 +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:15:42 +0000 From: Tianyi Liu <i.pear@outlook.com> 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 <i.pear@outlook.com> Subject: [PATCH v3 3/5] KVM: implement new perf callback interfaces Date: Sun, 10 Dec 2023 16:15:24 +0800 Message-ID: <SYBPR01MB68709E1FE3A5056577AAA82F9D88A@SYBPR01MB6870.ausprd01.prod.outlook.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <SYBPR01MB687069BFC9744585B4EEF8C49D88A@SYBPR01MB6870.ausprd01.prod.outlook.com> References: <SYBPR01MB687069BFC9744585B4EEF8C49D88A@SYBPR01MB6870.ausprd01.prod.outlook.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-TMN: [v6yvaF+JLPh+PCgNnetddSJEklpOTVwqI2vcLPFcfPuR5Ao+D0+oBw==] X-ClientProxiedBy: SG2PR06CA0207.apcprd06.prod.outlook.com (2603:1096:4:68::15) To SYBPR01MB6870.ausprd01.prod.outlook.com (2603:10c6:10:13d::10) X-Microsoft-Original-Message-ID: <20231210081524.2358-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: 959e30c7-68cf-46c7-ed7a-08dbf9583383 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: DTWdeCFFWhDPIiCSiU2WhdHULa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N2AmgmTG9hUqZ3BnZFB58GrcfgNKsLBt7TNWhgzsStBAU7HkEMTcu9F2ex2zX0YuCzik8wkBBFoDUyLa/Pk49KQw2k6Z0W0yf17L2vvjO4isB64V16FS0dh2VtVOLv2GJEDph/yJwNYKnBlutsecTWgr5yKsoR7paHCAuxPu6iYbdQyM80wvDnKhr9Y9ModZ9hC/siluY/YzIssKtzoUd1pymsq2lGIaFmItrjQUFsobDXgLPJ9F6rvG8a+fq6x2DeBRfAvZfl1axOjVeZ1zoVHhkPXWl2SaK6PbxltPORp8HiswfbgHvKYKODyfII9ytb7LWoKLz0+oR8Hgtk53js/LIi6J4HKUBurpO+NHJ1IrMdQrJ8OXyD54Xx594xaTJw7Tfr+JPqpcZb+Auk8aE5Kcd8KO9U3WOYfCxZpPov1uqRS6PC2OLfPN7hPUCIKWUrtGFQEcsxSfaD7XBUY9Kg930Ydtlarazi3bLzZXEyULNnbrxD5AkLUTrQ42+qZU9du4BBPR2wyWGuMIDoFuQS8mcO9F+EzMFRF1VuaweCPd/txgjMsqZ8IyDySK3mav40ToOCpFsJUvr8BObDMOsXJbvgquHR5szXwkW7KMgB0eGLGCgGKG0LbdzL/29w7zpF2CfvT9kPiAcctF3mEyWTkKc/7gVvUry03PILZpjBw/OfgY6SH/5OGVDgFkhxIOfFIfV2KLD7HLxzAuMBP6v4sbD3o8nLMBTn9oVgNEndTEMGb0sFW0jgTO60PJ0oihAtUJUNQHzfmX2DJblXu/KsVruYedjgsyct/jajxwSjoi2ZD+PSCpG4mkrZu7zcmfe8eaAzZbGNluWKzsF219IFcfji8a37OrIAjlO19Uvs2MWWPX X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 959e30c7-68cf-46c7-ed7a-08dbf9583383 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:15:42.2392 (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=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Sun, 10 Dec 2023 00:15:54 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784882064487056597 X-GMAIL-MSGID: 1784882064487056597 |
Series |
perf: KVM: Enable callchains for guests
|
|
Commit Message
Tianyi Liu
Dec. 10, 2023, 8:15 a.m. UTC
This patch provides two KVM implementations for the following two new perf
interfaces, just redirecting them to the arch-specific implementations:
- get_unwind_info
- read_virt
Signed-off-by: Tianyi Liu <i.pear@outlook.com>
---
virt/kvm/kvm_main.c | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index 486800a7024b..c47b6c0f8e94 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c @@ -6032,9 +6032,31 @@ static unsigned long kvm_guest_get_ip(void) return kvm_arch_vcpu_get_ip(vcpu); } +static bool kvm_guest_get_unwind_info(struct perf_kvm_guest_unwind_info *info) +{ + struct kvm_vcpu *vcpu = kvm_get_running_vcpu(); + + if (WARN_ON_ONCE(!kvm_arch_pmi_in_guest(vcpu))) + return false; + + return kvm_arch_vcpu_get_unwind_info(vcpu, info); +} + +static bool kvm_guest_read_virt(unsigned long addr, void *dest, unsigned int length) +{ + struct kvm_vcpu *vcpu = kvm_get_running_vcpu(); + + if (WARN_ON_ONCE(!kvm_arch_pmi_in_guest(vcpu))) + return false; + + return kvm_arch_vcpu_read_virt(vcpu, addr, dest, length); +} + static struct perf_guest_info_callbacks kvm_guest_cbs = { .state = kvm_guest_state, .get_ip = kvm_guest_get_ip, + .get_unwind_info = kvm_guest_get_unwind_info, + .read_virt = kvm_guest_read_virt, .handle_intel_pt_intr = NULL, };