From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0CBD2C433E6 for ; Tue, 26 Jan 2021 03:05:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C51FF230FC for ; Tue, 26 Jan 2021 03:05:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728530AbhAYM5h (ORCPT ); Mon, 25 Jan 2021 07:57:37 -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: kvm@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