Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp220103pxj; Tue, 18 May 2021 01:39:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzQPy4pHuoV6DJS3H8zy1xlQ7Bhyrefw6I4DYP1uiyM9sX5zeFj+7shGuU2UvD12sxAufla X-Received: by 2002:a92:d34a:: with SMTP id a10mr3135898ilh.123.1621327188780; Tue, 18 May 2021 01:39:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621327188; cv=none; d=google.com; s=arc-20160816; b=H9vj8YS0sK4s71RHQQQxjsdJhOEwzhNcLiTN1pVT6Rd37l/hc6wN8Zh+ja528hiKR/ maioeTleDIpdJVRYmK2/CMibhwpWThwbdLkm9qPl9BSC0J3mQeilyM5PW5xOY8VOBsV8 rsfVxtDweonrRkW/Uw8lxOLus966XtuUCDybSif6qzEKnnP82EQVS8C1IgneEtN2USvA IcHeit+iJ9tsCgkampN2NCptmhuCuuSyHKFdTGQSf0Lb3lwPrzgAxl9uFK7WIwkUvKNM iw9hRvjOH0SwbOpkFWaIsJIVVcVJmcwgc2sx1RJZMP0PNZuzNzHcB+AJCI+CtMKJbJrs Q2RQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-language:content-transfer-encoding :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:ironport-sdr:ironport-sdr; bh=LqYaNGWbW8FVP+m8FqToZdu4Evt5MlCYoJ7O3ycv3mQ=; b=UmicpcKrCgS2j6xMiQF12tOwwM/YVnPIeA51wcf3Xn6KE2okF119/rFeUis7wWLB8s GxZgpur5gUDE1GWbCxC/UtWplmTa5vecVCVSBMZSaPlz/tSkPPeoUYTTF7Lu/ubH7vWl Y2l//yRIVfUYxKKciiW4pq5kDfxuLHYZ7YjxtIaEObfV++8Fzji7PxQWJ6Z0iRUO5Bpx sbYnD/3Vb2OywKqQIuhmvf38PEZTdLdxphgectcTRYLIVGIS5Ldhax5UbCZ6P/0up1GS ESxtN2/ofpidIwZuKxIdhjfu6Q4Q1DoMYZK87oUTP4CHqUqPZ6MrDi0pVzBdh4uQ2tvO UIQg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id j24si22060067jad.22.2021.05.18.01.39.36; Tue, 18 May 2021 01:39:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S242117AbhEQPBr (ORCPT + 99 others); Mon, 17 May 2021 11:01:47 -0400 Received: from mga06.intel.com ([134.134.136.31]:27010 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239859AbhEQOvr (ORCPT ); Mon, 17 May 2021 10:51:47 -0400 IronPort-SDR: 0Qj2DUlxvdl7NKWCgHayz7bOM+fHbPjO6uzH+pVV8Qc7SET3ppW4LQdObW9SnX8HBvaYC6+xS/ BXj4EkW/rzZQ== X-IronPort-AV: E=McAfee;i="6200,9189,9987"; a="261716118" X-IronPort-AV: E=Sophos;i="5.82,307,1613462400"; d="scan'208";a="261716118" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 May 2021 07:44:17 -0700 IronPort-SDR: TVBdBiMGJNmPXfpHnBRHEF8hV71He9y0QgOzdumAeYfZ9h3IdrMQsHpWFbOit0M5yV/LqFnWa3 3ckkIT2XYBaw== X-IronPort-AV: E=Sophos;i="5.82,307,1613462400"; d="scan'208";a="410850924" Received: from akleen-mobl1.amr.corp.intel.com (HELO [10.212.163.36]) ([10.212.163.36]) by orsmga002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 May 2021 07:44:16 -0700 Subject: Re: [PATCH v6 07/16] KVM: x86/pmu: Reprogram PEBS event to emulate guest PEBS counter To: Peter Zijlstra , Like Xu Cc: Paolo Bonzini , Borislav Petkov , Sean Christopherson , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , weijiang.yang@intel.com, Kan Liang , wei.w.wang@intel.com, eranian@google.com, liuxiangdong5@huawei.com, linux-kernel@vger.kernel.org, x86@kernel.org, kvm@vger.kernel.org References: <20210511024214.280733-1-like.xu@linux.intel.com> <20210511024214.280733-8-like.xu@linux.intel.com> From: Andi Kleen Message-ID: Date: Mon, 17 May 2021 07:44:15 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 5/17/2021 1:39 AM, Peter Zijlstra wrote: > On Tue, May 11, 2021 at 10:42:05AM +0800, Like Xu wrote: >> + if (pebs) { >> + /* >> + * The non-zero precision level of guest event makes the ordinary >> + * guest event becomes a guest PEBS event and triggers the host >> + * PEBS PMI handler to determine whether the PEBS overflow PMI >> + * comes from the host counters or the guest. >> + * >> + * For most PEBS hardware events, the difference in the software >> + * precision levels of guest and host PEBS events will not affect >> + * the accuracy of the PEBS profiling result, because the "event IP" >> + * in the PEBS record is calibrated on the guest side. >> + */ >> + attr.precise_ip = 1; >> + } > You've just destroyed precdist, no? precdist can mean multiple things: - Convert cycles to the precise INST_RETIRED event. That is not meaningful for virtualization because "cycles" doesn't exist, just the raw events. - For GLC+ and TNT+ it will force the event to a specific counter that is more precise. This would be indeed "destroyed", but right now the patch kit only supports Icelake which doesn't support that anyways. So I think the code is correct for now, but will need to be changed for later CPUs. Should perhaps fix the comment though to discuss this. -Andi