Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp3020191pxb; Mon, 25 Jan 2021 05:07:08 -0800 (PST) X-Google-Smtp-Source: ABdhPJzSsFfu9mHAQoVFOVQYL7uLxvRhkPUUjztbrr4rg1LadrZAcpJo4TM/w/ToXcpcfN4mi66Q X-Received: by 2002:aa7:d3c5:: with SMTP id o5mr417597edr.122.1611580027966; Mon, 25 Jan 2021 05:07:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611580027; cv=none; d=google.com; s=arc-20160816; b=hYVFzrAAXDIp24NYYmFDNeJXT1lXyNEkkp0qNtmxPh+XelgrZZTiQ6Tpal4LVwpugN zk5gkSpEJwCUvU4OK2CGduEruZgvEBPugV+DY05pplbwxCuYtnbXEqqlNTRN191gBPRR GpDEZIycObuoD95J8Lc+q5ZUJ9tVWv9glSer4o4iGRJHOUplAPGKe6yqXxVso53HKy31 9vHXAEAFKK2WAg+onFToGX73wahhgJ92AfbCBkHhKMUZz7hV4NQMQkibDCc3wIXF1pOA hPJpQ+3y52iglrlJrux2D7G8X+cA1Shbdz+4ByghCgWxnw08XJYuMgWzhMYssIw56mQh Cnbw== 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=irzbhARhRHH0RoASQ42fvX/LhDx5+krpgf0xry/CekE=; b=IitHtWQbN1lzv9pcBZvcPZb6Ypi7usnzVca5Mz8UxJ4QWhsTIKPhnKSEOfq8O+QgkU THm6LJOc5fjrMVz15zBhlsEiIvhQ/4gqtxeobToqrdrem0YaqeWEszCLB2tq09gs/n4r zb9KcLnDvG4JpcvxSTHQt63dPV5grYBM6TJ6BaAAS6wl8vxWfjR/2v2+KH5ozWl1KJuF lVFHKEwBasiYYVlWgf783R3dSrhJ6jVAtUQ8ETwEsU50LEgq3xSD58F+MrsHR1HnB9if Qev7tJduL1dduh3dnbxNX/LZCxwGS8KoTOc+cj4bG4Jc5GUAmAFhexx3+JitlvIykj8t roDQ== 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 i13si6095966ejv.329.2021.01.25.05.06.26; Mon, 25 Jan 2021 05:07:07 -0800 (PST) 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 S1728377AbhAYNB4 (ORCPT + 99 others); Mon, 25 Jan 2021 08:01:56 -0500 Received: from mga04.intel.com ([192.55.52.120]:5384 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728489AbhAYMyQ (ORCPT ); Mon, 25 Jan 2021 07:54:16 -0500 IronPort-SDR: EzCSf1UTVaoAg66S8X5xdI4mPotAfAT+XruT49cMsrZo9qGiB2GWPaKPqA/fdssAAJyDd4JXSI jqTyOzXASRQw== X-IronPort-AV: E=McAfee;i="6000,8403,9874"; a="177147235" X-IronPort-AV: E=Sophos;i="5.79,373,1602572400"; d="scan'208";a="177147235" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Jan 2021 04:53:33 -0800 IronPort-SDR: tWqBdNMhV3hcViy9JOaGmcT+5DWyuLq+FZG/MIYJlpqeviRwZ4SeY/JqdPCEH9QophG81Wz/RK 16TbnkbIEhyg== X-IronPort-AV: E=Sophos;i="5.79,373,1602572400"; d="scan'208";a="387359615" Received: from likexu-mobl1.ccr.corp.intel.com (HELO [10.249.168.247]) ([10.249.168.247]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Jan 2021 04:53:29 -0800 Subject: Re: [PATCH v3 00/17] KVM: x86/pmu: Add support to enable Guest PEBS via DS To: Peter Zijlstra , Sean Christopherson Cc: Andi Kleen , Kan Liang , Paolo Bonzini , eranian@google.com, kvm@vger.kernel.org, Ingo Molnar , Thomas Gleixner , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , wei.w.wang@intel.com, luwei.kang@intel.com, linux-kernel@vger.kernel.org, Like Xu References: <20210104131542.495413-1-like.xu@linux.intel.com> <20210115182700.byczztx3vjhsq3p3@two.firstfloor.org> <076a5c7b-de2e-daf9-e6c0-5a42fb38aaa3@intel.com> From: "Xu, Like" Message-ID: Date: Mon, 25 Jan 2021 20:53:27 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.6.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 2021/1/25 20:18, Peter Zijlstra wrote: > On Mon, Jan 25, 2021 at 08:07:06PM +0800, Xu, Like wrote: > >> So under the premise that counter cross-mapping is allowed, >> how can hypercall help fix it ? > Hypercall or otherwise exposing the mapping, will let the guest fix it > up when it already touches the data. Which avoids the host from having > to access the guest memory and is faster, no? - as you may know, the mapping table is changing rapidly from the time records to be rewritten to the time records to be read; - the patches will modify the records before it is notified via PMI which means it's transparent to normal guests (including Windows); - a malicious guest would ignore the exposed mapping and the hypercall and I don't think it can solve the leakage issue at all; - make the guest aware of that hypercall or mapping requires more code changes in the guest side; but now we can make it on the KVM side and we also know that cross-mapping case rarely happens, and the overhead is acceptable based on our tests; Please let me know if you or Sean are not going to buy in the PEBS records rewrite proposal in the patch 13 - 17. --- thx,likexu