Received: by 2002:ab2:6203:0:b0:1f5:f2ab:c469 with SMTP id o3csp3084421lqt; Tue, 23 Apr 2024 09:51:37 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWaGIhfJcqmVK677f99FaDNyRRajtI0L8VDAgUNJXiMfbsoQ429btVnotSS0p0iyH7R8Y47bNsF9nE3Icf3pv2hgHAo5fBsAE6d1CJYQw== X-Google-Smtp-Source: AGHT+IFcI6cfNoYwEBheysw2oSYFnm1DVazBZFg+DDdciRY87iW8oatj5kFh/lCNV9cKyiibn2Fx X-Received: by 2002:ac8:7f49:0:b0:437:9bd0:238d with SMTP id g9-20020ac87f49000000b004379bd0238dmr18053618qtk.22.1713891097079; Tue, 23 Apr 2024 09:51:37 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713891097; cv=pass; d=google.com; s=arc-20160816; b=0unsgua3xQkEje3v8ChsoDOxIG6IjYMaS6nt+lHq8A/YTJ+edRwWW2f3e1IzJoQqnB LvtxGl7xH86FhrhqhVEG/6BM2fyTxYdVm3QH/GDr+IDhetQCuthLKAh+x+ssuLpgm0LL AiIyrlWMgSNnovbfNKmZfrtdBI+scKUm0osPGOmD4ipXyAwEJ6+RpTofQQtinY5vhILj AsdL57EDCitwVXvw0t4wd1AaoirYdIGSAkTHdgj1XY5cnEuUfm08Dwm8D5a7Dc9bApC+ B0/fn+T0iw3LzBU1sKmEH6CfKwMdQSLQhNjmao5bNj65zq0EtqisZzSHbjxQHxIlwZsg a+Fw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :dkim-signature; bh=2l+5UdzN7ZbavXU6zUsRnpsRb/FYFC3ss2jaeR0uYUU=; fh=Dcn/v3ayUiA91pwJC9AbIiDfZF5noA3Ke1Q27pOieEI=; b=TS1DEC3sVBLsLI1iSUCo43olzrdFAzrdXLc3nfnIyimRvFe7RyAa8NrfmPJMsvkLn5 YXS9gKRvpNEkrfF4aa7VMfwEmblgJlD45ab1DR/edYrnzFgaKyqjz02F2Btv3RTGZhs1 mbQ6L1gxV0OGuQDJ3g1Ipjerm/fveAsmdS2Rp2nIoWs9VKQlBpKBqaPA/sOMppEiu1K7 2GArJtR/IPTpNPGF0wwnkggOyARK3nYlkq+XJaQQ/eMkMKkKTUEbzP1pZ5sa1CfCGaRH 6KjEbwlKRzE1+4nyt0gh8dHA4EkuLK+WIjN0S0vhCqPfX6sdzghT1iF5g5y5r9D5l+Ck voXw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=FpPhimtb; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-155597-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-155597-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id v12-20020a05622a144c00b00437c7c35f76si7267057qtx.8.2024.04.23.09.51.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Apr 2024 09:51:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-155597-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=FpPhimtb; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-155597-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-155597-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id C96F91C23E13 for ; Tue, 23 Apr 2024 16:51:36 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 90D4213D63C; Tue, 23 Apr 2024 16:51:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="FpPhimtb" Received: from mail-ed1-f50.google.com (mail-ed1-f50.google.com [209.85.208.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 529DD13D537 for ; Tue, 23 Apr 2024 16:51:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.50 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713891086; cv=none; b=Oh42k7f7OmcKUcFzLPkh61tidIiRPta6RX+igA1ehV6tRWcpeSXete0K9mw5PqM055lokaU1R53lpKaR3oUskVeSoICbOsPNdhP9xypBA2a8FSnu4MqOiieYbHPE3wnzJIEV4yeMzw+daRO++EnBTWAztDepKqEcBek9cBpOB6M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713891086; c=relaxed/simple; bh=2l+5UdzN7ZbavXU6zUsRnpsRb/FYFC3ss2jaeR0uYUU=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=Ah68MZduEdqMEsgM2LraT1r97wwqxDvi1gAfqmpATK48GCi+oWdW3sf7o8qI18nr84Vt1LIjZOGCl9XhL3xxbaOEYVwWxZ4XQnWA/oY1lSivdmwcpLzQttTpy/2QKM2AY6sNJqXnVZOEYmg6sS11Y3bGjMLSshA7cXkrDFjIQcA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=FpPhimtb; arc=none smtp.client-ip=209.85.208.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Received: by mail-ed1-f50.google.com with SMTP id 4fb4d7f45d1cf-56e1f3462caso7453453a12.3 for ; Tue, 23 Apr 2024 09:51:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1713891083; x=1714495883; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=2l+5UdzN7ZbavXU6zUsRnpsRb/FYFC3ss2jaeR0uYUU=; b=FpPhimtbwTbG8zHDLO7JzciMv2Nwo2AywCncPzBYhjcRP//m55sLeIZQhJFW2AhZgc nXZdl2xoAbKSOgNO8Eqc3hiHMT9D+YFkvFx43YNLrGiC3cXP84LszpQisEETTLBAp8cl TZpXXvalNbMT8hSXXhXV3NjYUl15tHE3nhTBcLdbJ4CK09nkeU6Hy8i+PCXvcMmRKrzm Wwv2qPk7//H2lOmm/M5dq665zAAqEp2POy3S2nwzg6HBKT6OO8r7yDqehHSmFYTQ4pre eagIovl1F4WXt12lSuMJaighnAKAvbfHTHdq3TmWySkYkf/fKA7RBpcVf88owckqXt+k mCHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713891083; x=1714495883; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=2l+5UdzN7ZbavXU6zUsRnpsRb/FYFC3ss2jaeR0uYUU=; b=MVYzcuWu3cVl6mG3eWCDJ4wQxVS6xyHhyJzmpcJgbTEdPqF62mL3K1GiwZhMO4w4jg n0ZUuoUn/C7pZ5stAOTA+LmY/rqT2Aa9/nJomzqwSFfZcwpm/KHXmM2e9zKLL4G89QiK 3TIvrCIhQ4V/57uQpt59j/3A3bCwjzldnVznNWL2bOp+NhuQnE2XhRB9hDUX5hiFVNdc /A1+B/3GdmJ0MoxVPhwWvhF086LfxZi2HRLvj0GNVaSJmA7Wn7ywqD5HyuvWADys6tZw BJTCRNrZjADDYTW/avFj5CSfC5SmOX+9FJLR/eB8WkQTD036+S5kh8m0OPTscTxQH6Ow SBmw== X-Forwarded-Encrypted: i=1; AJvYcCUheeAwZxC801zky9wvmZ7SNdvVXLOJ6fzDu9aRhyw7z4PIN5w1m+4XF1YfeyTTgMt4uT6c0NQnq+DGAqQL+KGtTAK0JyPLpFJFek+o X-Gm-Message-State: AOJu0Yz/kZ36l61szPPbV/ozl82ayMmJ8RdeuPVxIr5WDhXX+mCl1Xnf bsrGoUGpMDN5xneaSjLe8/4mVTDBiql9N39mFd0qfqioQb8gb33myv4VqZcIe912gUelLsZ7EwV +HqJ6j5MtgDmjL/zV/j5YOiz4xIC1mPrh5AgI X-Received: by 2002:a17:906:615:b0:a52:3623:f498 with SMTP id s21-20020a170906061500b00a523623f498mr10162882ejb.31.1713891083421; Tue, 23 Apr 2024 09:51:23 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <18b19dd4-6d76-4ed8-b784-32436ab93d06@linux.intel.com> <737f0c66-2237-4ed3-8999-19fe9cca9ecc@linux.intel.com> <4d60384a-11e0-2f2b-a568-517b40c91b25@loongson.cn> <1ec7a21c-71d0-4f3e-9fa3-3de8ca0f7315@linux.intel.com> <5279eabc-ca46-ee1b-b80d-9a511ba90a36@loongson.cn> <86d1f6d1-197a-ecd9-3349-a64da9ea9789@loongson.cn> <729c4b30-163c-4115-a380-14ece533a8b9@linux.intel.com> <46a889c4-b104-487e-be3e-7f4b57c0b339@linux.intel.com> In-Reply-To: <46a889c4-b104-487e-be3e-7f4b57c0b339@linux.intel.com> From: Mingwei Zhang Date: Tue, 23 Apr 2024 09:50:47 -0700 Message-ID: Subject: Re: [RFC PATCH 23/41] KVM: x86/pmu: Implement the save/restore of PMU state for Intel CPU To: "Mi, Dapeng" Cc: maobibo , Sean Christopherson , Xiong Zhang , pbonzini@redhat.com, peterz@infradead.org, kan.liang@intel.com, zhenyuw@linux.intel.com, jmattson@google.com, kvm@vger.kernel.org, linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, zhiyuan.lv@intel.com, eranian@google.com, irogers@google.com, samantha.alt@intel.com, like.xu.linux@gmail.com, chao.gao@intel.com Content-Type: text/plain; charset="UTF-8" > > Is there any event in the host still having PERF_EVENT_STATE_ACTIVE? > > If so, hmm, it will reach perf_pmu_disable(event->pmu), which will > > access the global ctrl MSR. > > I don't think there is any event with PERF_EVENT_STATE_ACTIVE state on > host when guest owns the PMU HW resource. > > In current solution, VM would fail to create if there is any system-wide > event without exclude_guest attribute. If VM is created successfully and > when vm-entry happens, the helper perf_guest_enter() would put all host > events with exclude_guest attribute into PERF_EVENT_STATE_INACTIVE state > and block host to create system-wide events without exclude_guest attribute. > Yeah, that's perfect. Thanks. -Mingwei