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=-8.6 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_DKIMWL_WL_MED,URIBL_BLOCKED,USER_IN_DEF_DKIM_WL autolearn=unavailable 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 E1B92C04AB5 for ; Mon, 3 Jun 2019 17:30:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B5B9427283 for ; Mon, 3 Jun 2019 17:30:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="XRvFg92K" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729961AbfFCRaf (ORCPT ); Mon, 3 Jun 2019 13:30:35 -0400 Received: from mail-ed1-f68.google.com ([209.85.208.68]:39568 "EHLO mail-ed1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729940AbfFCRae (ORCPT ); Mon, 3 Jun 2019 13:30:34 -0400 Received: by mail-ed1-f68.google.com with SMTP id m10so2453596edv.6 for ; Mon, 03 Jun 2019 10:30:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Ou7nbKSnWzeuJb0ud+C1KMIknjjtf6JpEdGznfm889o=; b=XRvFg92K9MJE+/snsanTpU1Xdnpb0NRNHT7ExLcvgQdboyR5FHMjR/hC7f8R1gO7iW uYqqg60suaErWHcdMrnieaDGtufM5FGiJCI2O2TYx5rUpd8ZLtSBOEE69tYIQ6tDxenc WEJnE5QSwH+b7YmHJlFYI8IrGIxI92lmAKF+/S2kOTOFF/hc1KT0I1V7+2fUBLhKloV+ UTDZiJvLzj5z93XBGXVU1Wr5wnq/KO/bzX97bYXEoFO5KkPOqxTv8X4YqmdoULqoXJx6 zOpfE+vdadaCg6sou0U5/XFLR8PwpIYwiHePvxzvmP/jezse24GN+6RPCFPmGUZUe6IL +suA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Ou7nbKSnWzeuJb0ud+C1KMIknjjtf6JpEdGznfm889o=; b=V4LAGxpLkBs/A96UwNeSd6TnYGKx1e8sQasmaHPtCGFFaYP9UOZhF1VJwHkOopmS1d iVv3WP0Jifqkyz59zCresXweRX1u6xUCzNgW7LNH2qs8Z82y3NciWhpTXcd4xJQpSCbY b/XHK5ZDWvHhxycQMyB9jQxGTvY2VpVv36GYFUFuqRskUGG/P/hs/fcSt4RYiFwbF7vz K0nIiSC786fTu6OZJ9DbHIv2Wv1/yYMi0k/Nmkc09nF8yl+GKR3EoWswAXww6kfxCa+d 7o8n0+uuRxhLs6iaMpI2ss4nOLp+FMvJBpKavr9VmaJZeR/VBz8D+aQzlm+8ZMqUe7cK MH0w== X-Gm-Message-State: APjAAAXbcn3yGvi8TFQ+sR3K8Rid0Xd6rzTPGIIYeDMbi6ZYUGl696Tj TH04zN5X5pS+jbW2CXYBvmktpy68igp/zVTfy4/3gA== X-Google-Smtp-Source: APXvYqyyzQEZJ7Lgq+NCeiqX/TahBk6T/cpgdRssAXOY6KVqhmwwIa6fKnhH+hvWKMEFq+m81C+//5OWgsFx6UqGlWw= X-Received: by 2002:a50:be03:: with SMTP id a3mr30015391edi.5.1559583032398; Mon, 03 Jun 2019 10:30:32 -0700 (PDT) MIME-Version: 1.0 References: <5CEC9667.30100@intel.com> <5CEE3AC4.3020904@intel.com> <5CF07D37.9090805@intel.com> <5CF2599B.3030001@intel.com> In-Reply-To: <5CF2599B.3030001@intel.com> From: Eric Hankland Date: Mon, 3 Jun 2019 10:30:20 -0700 Message-ID: Subject: Re: [PATCH v1] KVM: x86: PMU Whitelist To: Wei Wang Cc: pbonzini@redhat.com, rkrcmar@redhat.com, linux-kernel@vger.kernel.org, kvm@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org On Sat, Jun 1, 2019 at 3:50 AM Wei Wang wrote: > > My question is that have we proved that this indirect info leakage > indeed happens? > The spec states that the counter will count the related events generated by > the logical CPU with AnyThread=0. I would be inclined to trust the > hardware behavior > documented in the spec unless we could prove there is a problem. I'm not disputing the spec with regards to AnyThread=0; my point is that LLC contention can be quantified using the PMU regardless of whether or not you are measuring only the logical CPU you are running on. > From the guest point of view, returning 0 means that the event counting > is running well. > That is, the guest is expecting to get some count numbers. So better not > to zero the value > when the guest does rdpmc/rdmsr to get the count in this case. > > I think we could just ensure "AnyThread=0" in the config, and create the > kernel > counter as usual. If you return non-zero in intel_pmu_set_msr(), KVM emulates a gp fault. Which as you said signals that something went wrong to the guest. However, older guests with panic_on_oops=1 (which is apparently default on RHEL 6) will panic if they get a gpfault while trying to do a wrmsr (see the "Carry on after a non-"safe" MSR access fails without !panic_on_oops" patch). I think that not panicking guests is probably preferable to communicating that we weren't able to program the event. Eric