From mboxrd@z Thu Jan 1 00:00:00 1970 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="FpPhimtb" 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-Google-Smtp-Source: AGHT+IEUYXbroPWIegwIe9uOSMKwRDxhQ+zZsIaEyJugWTF5WG0C5K8peKi60BHk1tv+7Q4IawZ95Nmnfs8+lJ+y+Pc= 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