Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2153030imm; Thu, 20 Sep 2018 08:32:34 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYKZqN5t0+VYQRoC9Hoowd1eg3QC72SJpXPmvUqA+QzHSKSt7db6biim8RFzACbTdkaL4kd X-Received: by 2002:a62:4e56:: with SMTP id c83-v6mr42392214pfb.240.1537457554633; Thu, 20 Sep 2018 08:32:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537457554; cv=none; d=google.com; s=arc-20160816; b=qmOn1ET33aZek4ubDP/lQ4lUqtcbb5RZvRovTiFUaqFPvyp87OqAwcoJWDWE2l3sir 8IvUSUkxd8hlZI+XwFtG2/BYM3MusCkkqp4YpW/jLZvudHAwT0z3sT6dp3Zi4XFPlK2O 0mXFWERkVf26ns9Dloat44aG4PhPivTcJomqVvoBBedIbk4q92fIx4gS2918sMep1FnI eZ1upjNGKsBLmX5w9aHf7wsZZ2UXC9RPAyKinppsF55+eKTMdKlkwXLA5y3aJBbPrM1G vqPykH5jXjVPAErO83xQ2LSiFWK06HHSzZV+acqEdNDNA8AN58PaAEq16Ch9edelHDKA CoUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=s7ANVOriNQsivOZmGx83CWQRYcw4bojgFeP3f+eFKBs=; b=XwhMCeTwvi5viGLwNv2T10lzyQ4YYkROP25wHiN9gFZmi8of9tGsoEZZykVrMgl3XD 07LRNeE8VoGiMb1T6UYLxjUl81nuZV5Gn9Cg3olChy5SWELkSjYiFQbgX8P1TDqftcrd dm6mmpI+2WlVgR4bVwUNxXR8+d9Dxe5tnHaTjkiHmrUmDX4hcPs4JB91rQnO0Qt2j1fb T/ft5ObN35mbe1OR9ShtFU3StA058O0rxAjJVPGPDwkhXjp6XJ0sJ20lWA9ZqIQxeb2x AosQopMRv40y5fN0Woz1qHkxP2c5Mv2/RGgrM4bb7m3sHkyUACFQeUGf+LZUqPVpPgj9 E+Kw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z125-v6si26936715pfz.10.2018.09.20.08.32.11; Thu, 20 Sep 2018 08:32:34 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732892AbeITVP6 (ORCPT + 99 others); Thu, 20 Sep 2018 17:15:58 -0400 Received: from mga05.intel.com ([192.55.52.43]:54579 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728444AbeITVP6 (ORCPT ); Thu, 20 Sep 2018 17:15:58 -0400 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Sep 2018 08:31:53 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.53,398,1531810800"; d="scan'208";a="71571741" Received: from tassilo.jf.intel.com (HELO tassilo.localdomain) ([10.7.201.126]) by fmsmga007.fm.intel.com with ESMTP; 20 Sep 2018 08:30:35 -0700 Received: by tassilo.localdomain (Postfix, from userid 1000) id 455C7301A71; Thu, 20 Sep 2018 08:30:35 -0700 (PDT) Date: Thu, 20 Sep 2018 08:30:35 -0700 From: Andi Kleen To: Wei Wang Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, pbonzini@redhat.com, kan.liang@intel.com, peterz@infradead.org, mingo@redhat.com, rkrcmar@redhat.com, like.xu@intel.com, jannh@google.com, arei.gonglei@huawei.com Subject: Re: [PATCH v3 4/5] KVM/x86/vPMU: Add APIs to support host save/restore the guest lbr stack Message-ID: <20180920153035.GB10360@tassilo.jf.intel.com> References: <1537437959-8751-1-git-send-email-wei.w.wang@intel.com> <1537437959-8751-5-git-send-email-wei.w.wang@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1537437959-8751-5-git-send-email-wei.w.wang@intel.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > +int intel_pmu_enable_save_guest_lbr(struct kvm_vcpu *vcpu) > +{ > + struct kvm_pmu *pmu = vcpu_to_pmu(vcpu); > + struct perf_event *event; > + struct perf_event_attr attr = { > + .type = PERF_TYPE_RAW, > + .size = sizeof(attr), > + .pinned = true, > + .exclude_host = true, > + .sample_type = PERF_SAMPLE_BRANCH_STACK, > + .branch_sample_type = PERF_SAMPLE_BRANCH_CALL_STACK | > + PERF_SAMPLE_BRANCH_USER | > + PERF_SAMPLE_BRANCH_KERNEL, I think that will allocate an extra perfmon counter, right? So if the guest wants to use all perfmon counters we would start to multiplex, which would be bad Would need to fix perf core to not allocate a perfmon counter in this case, if no period and no event count is requested. -Andi