Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp1770628rdb; Mon, 2 Oct 2023 23:37:01 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF/dBUA80puBhNeb9pRNN8hpim8sFlsHIvqRXTLxE17NWdJ9YY5VUHPrE/IGnHVi/IjwPGT X-Received: by 2002:a05:620a:31a5:b0:772:6419:89ab with SMTP id bi37-20020a05620a31a500b00772641989abmr15066099qkb.55.1696315021352; Mon, 02 Oct 2023 23:37:01 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1696315021; cv=pass; d=google.com; s=arc-20160816; b=nzpqUh7cpvZCIyf7rtHu4vFVzuNA5k/RYLnDXE5amyitWmE25I8KfFWONgGKyWHHhm ymZSD/Nk/wexa44pjeV+tvHhgyX3dc3at/pyN3ymEWM0EPhRcJ+D1XC72jgxc5Ym8ZG7 qIKB9C3if3eiIMGmQc5mJAp6wi7ju4qygRc3yoSxjueaksWtzAxupB3eLB9nsRpbN6wl jgQ0GW50FCusRstKFQc0cm/LqaKMQwNAlCMrKV7I9tZh8/PFatut1Qf9sdJCPUdlLSrS snfnymm1U2XnLvT5fP2kITsRFZiXg50SB3yt0zElh6eq80U8u5gAjP5bKK502yOVa2Nt XtZA== 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 :in-reply-to:content-language:references:cc:to:subject:from :user-agent:date:message-id:dkim-signature; bh=3xxKAg0PIb61KY+HwHmXrOVRDacwz6BPcVGu1O/vqco=; fh=qWR5gP7xCble3H9aFifzX5BIe/OCasm7atWjZZahp0w=; b=LuuOjcUohxqud/f//a9UvI0SO28vLSEg56DReLHIRvOdhu5ZP40NwqSq2xAXBaOj6w Bqsxxpaf75xTW9XLiKok2dS5oy1yoox7v1Q1ym666DKQ+WRIreHMJKhSQO5+yww5hnST zaWCoryLRNr8z+eU4NUyQ0OY0NWSymxnroyA62vr2//n5OU9MytGv5aEEfuKP+D1Kzq3 NCpGLZcTXmaJwa7SWIwqnrQdPbPKQLMO3eFWmD9N6UskgZrh3LufcQeRWTo0G87MYvhQ 9QzhVuORQlVkCQl+0St7KUAd87Y9EPsMBiPtNUsvyrQ+upQO+cke46tfSCHc7+NGkBHV AT5Q== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=xT1aDz6F; arc=pass (i=1 spf=pass spfdomain=amd.com dkim=pass dkdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Return-Path: Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id bt8-20020a632908000000b0057745d87b4csi685071pgb.526.2023.10.02.23.37.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Oct 2023 23:37:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=xT1aDz6F; arc=pass (i=1 spf=pass spfdomain=amd.com dkim=pass dkdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id B0DCD803B50B; Mon, 2 Oct 2023 23:36:58 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230271AbjJCGgp (ORCPT + 99 others); Tue, 3 Oct 2023 02:36:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44892 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229453AbjJCGgo (ORCPT ); Tue, 3 Oct 2023 02:36:44 -0400 Received: from NAM04-DM6-obe.outbound.protection.outlook.com (mail-dm6nam04on2057.outbound.protection.outlook.com [40.107.102.57]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B00C58E; Mon, 2 Oct 2023 23:36:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kt9W3h5zvQo9Bu7fsL3L+GIDO727eU9pigJJhBjoQQLjjh6/oFRw3ucmP6z/u/hL0vHa/OrJa4Y3NV6J+WyKHyoXGIg5eYAZPsPO+59h1Q58u5tb1HqVOeRpBG2AiPtoT7qapVqKN3MT5Nxb5cLalkuZD13u7szAUAXoL13IEakkmJ5IUKP1RAPi0y6IgcA/mUakS1tkb4DMq5zM/KPu7UhQZukV4QA049Tf9+C5vRrJ+7D1fCIjs4Q9gBjnQA5JKYYpnauBzjKPmDHs6ktZJuAVdkmRJAi/7i+y7Zxw8aaf0hEhi8DAciRyTWftkxQlzJOOLEmRRdHWRJmM978G8A== 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=3xxKAg0PIb61KY+HwHmXrOVRDacwz6BPcVGu1O/vqco=; b=JEgXrEUe3jBK5RZj7ClAyqV+3mgkdPnQ8invEhFE9Qrk/RIXvE/vfARPgpSe3jjFfQ7C769VCjteWyLQy28Dh29xfScrveavUseh6hNvbamXMILwnKtELiqPF+Q0JXkZgIbQaDW0CBqrrsc49qQY5mLQvJFX4xlcAHu9Ix1lXbbTlSbVOxoccGYaYpQXe9j055ReJUpm9Wk4p8uHSiQtBpjM1vdbqmw8spZMzvQenfGOVyw+lEUOM7MP9B1pZ4cyLl/Nu5XzLE+1mXGvL9zjLFsvkpvjFwC4GFdvC3IcMM1bRt+OhEbMCGrnRPZb+EY60+oGYRnNOb4h6hJ/v3+6aQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=3xxKAg0PIb61KY+HwHmXrOVRDacwz6BPcVGu1O/vqco=; b=xT1aDz6FYNO/m4gAENlfwzmxO+oWwrlAxl0toVgnYOUXAifrJZNqEmM0X1fJeZGlD0Ct6atIoyNxWRpFWejs/NyYhPzPR4nBcWSIEL5Lbt9d98dl+xxOu6t5ob4t4vwuCeuOhSJKhNws2xdiJ4mU10mqg/Ci4ab8KVdMI6HGaoc= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; Received: from PH7PR12MB6588.namprd12.prod.outlook.com (2603:10b6:510:210::10) by CH3PR12MB8969.namprd12.prod.outlook.com (2603:10b6:610:17c::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6838.31; Tue, 3 Oct 2023 06:36:38 +0000 Received: from PH7PR12MB6588.namprd12.prod.outlook.com ([fe80::a4ed:10a6:876a:10d7]) by PH7PR12MB6588.namprd12.prod.outlook.com ([fe80::a4ed:10a6:876a:10d7%3]) with mapi id 15.20.6838.024; Tue, 3 Oct 2023 06:36:38 +0000 Message-ID: Date: Tue, 3 Oct 2023 12:06:12 +0530 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 From: Ravi Bangoria Subject: Re: [Patch v4 07/13] perf/x86: Add constraint for guest perf metrics event To: Peter Zijlstra Cc: Sean Christopherson , Dapeng Mi , Paolo Bonzini , Arnaldo Carvalho de Melo , Kan Liang , Like Xu , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Ian Rogers , Adrian Hunter , kvm@vger.kernel.org, linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, Zhenyu Wang , Zhang Xiong , Lv Zhiyuan , Yang Weijiang , Dapeng Mi , Jim Mattson , David Dunn , Mingwei Zhang , Thomas Gleixner , Ingo Molnar , Manali Shukla , Ravi Bangoria References: <20230927033124.1226509-1-dapeng1.mi@linux.intel.com> <20230927033124.1226509-8-dapeng1.mi@linux.intel.com> <20230927113312.GD21810@noisy.programming.kicks-ass.net> <20230929115344.GE6282@noisy.programming.kicks-ass.net> <957d37c8-c833-e1d3-2afb-45e5ef695b22@amd.com> <20231002122909.GC13957@noisy.programming.kicks-ass.net> Content-Language: en-US In-Reply-To: <20231002122909.GC13957@noisy.programming.kicks-ass.net> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-ClientProxiedBy: PN2PR01CA0153.INDPRD01.PROD.OUTLOOK.COM (2603:1096:c01:26::8) To PH7PR12MB6588.namprd12.prod.outlook.com (2603:10b6:510:210::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH7PR12MB6588:EE_|CH3PR12MB8969:EE_ X-MS-Office365-Filtering-Correlation-Id: ddb88878-350b-4370-06d1-08dbc3db0d16 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: dNjXJHkegZ6ozQOd2QgzTozwGaECYoLyZe3MFYL6MCMvX/vxqx1InnT2hFkROi2J65HBpf6qxQbc9V3DP0rj3poMz/YrylkqjO7GM9oxe7GHLv3iX1zgKAzSaBjxHh0+6ttKKZF4YuwroEwnYpdAGkRTipWUNx5TfrDshr02HAuVKFpSRB5xt/dTOEDoukgjzyWSYo3R11GMuDTah4wEbJlqm3he2MIfni92OEa0JrXOjz9o/ylKloYKiqBuZw1mpXPjFJxm09MRtRI3ibVgH0VnSwWJkR0XSiMXcuQEIwclBVoCfQMzoZ+LebjVQ/7LdJw8B7quhGCvXPtzi95K8ZtvTDOngBHEqG3vFFuC471vkPeNa/t5hYQ3Zb5BhuTAowg+oSr4PZsLN01L1kqudrugj0Omr5/vNoeAPR6Z/If1Eo5IrNJaRAQD+RbRcTHFF5A7Hkc+fzbExBA2dEJg/aQxyvDoy6/RCVPDw1CBbzofiNa5rSOfHmY2mHY/n4D1LnfoSJtNhuh1mqdN7v8q06gJ9soP58t8+3cfZroe3i9Y4d/cFPJ5u30zuZKBmBG062jnbNLR+iGidDCJArpNQH3bxZZ1449py0XHPE5UDil2wze+qrTFoK03w8tiaXlnNYuHlBYnjlyL/9izo9GhsQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH7PR12MB6588.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(366004)(376002)(39860400002)(346002)(396003)(136003)(230922051799003)(186009)(1800799009)(451199024)(64100799003)(31686004)(53546011)(2616005)(6486002)(6512007)(6506007)(31696002)(38100700002)(36756003)(86362001)(478600001)(7416002)(26005)(2906002)(966005)(6666004)(4326008)(8676002)(316002)(8936002)(41300700001)(66476007)(5660300002)(54906003)(44832011)(66946007)(6916009)(66556008)(43740500002)(45980500001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?TDlOeWNLNGl3Ylh3eWhRQmlvRjY0MFVuUXdDYlQvbWNEbEowVW5kOHc4M1dq?= =?utf-8?B?WEVpRW8yaEdRdW5RcmdtTDJGdW94UkZ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-8?B?UG1OK0l3VXJ5bldrVHBxN1R0d29Qd0ttaGFOdzlVSWJDdjFTVk1xUmh2dHBn?= =?utf-8?B?OXV1eFd6MEdDUndrRG5YeWI2TU8wa2gvTDZjc2dsSmNFOGpQZEp0S1JicFk1?= =?utf-8?B?aEVXTmxKMGcyWFpMTXUremNOMllBclduTng2SHZMVk5kSlFWUGJNT2d0SlpB?= =?utf-8?B?Y3Y4bms1dXR4djZxWE02NGJRNHpnb0QyaTZpekdZZmU0VVhsQ2k2Tk81aHFM?= =?utf-8?Q?5xJSr2yVrN8dlePQNZ28MRuzs?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: ddb88878-350b-4370-06d1-08dbc3db0d16 X-MS-Exchange-CrossTenant-AuthSource: PH7PR12MB6588.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Oct 2023 06:36:19.1407 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: W0qNnjrZ1fLW53Bayv42D0WkQVaALQJVRzfA7S7s6l0dBsoJS9+5yWrAkgRE+DVcteoaTs2fqc86WqkH14T5eQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR12MB8969 X-Spam-Status: No, score=-3.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.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 (groat.vger.email [0.0.0.0]); Mon, 02 Oct 2023 23:36:58 -0700 (PDT) On 02-Oct-23 5:59 PM, Peter Zijlstra wrote: > On Fri, Sep 29, 2023 at 08:50:07PM +0530, Ravi Bangoria wrote: >> On 29-Sep-23 5:23 PM, Peter Zijlstra wrote: > >>> I don't think you need to go that far, host can use PMU just fine as >>> long as it doesn't overlap with a vCPU. Basically, if you force >>> perf_attr::exclude_guest on everything your vCPU can haz the full thing. > > ^ this.. > >> How about keying off based on PMU specific KVM module parameter? Something >> like what Manali has proposed for AMD VIBS? Please see solution 1.1: >> >> https://lore.kernel.org/r/3a6c693e-1ef4-6542-bc90-d4468773b97d@amd.com > > So I hadn't read that, but isn't that more or less what I proposed > above? Yes, it's pretty much same as: "Like I wrote, all we need to do is ensure vCPU tasks will never have a perf-event scheduled that covers guest mode. Currently this would be achievable by having event creation for both: - CPU events without attr::exclude_guest=1, and - task events for vCPU task of interest without attr::exclude_guest=1 error with -EBUSY or something." Thanks, Ravi