Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp4442335ybi; Mon, 3 Jun 2019 10:56:00 -0700 (PDT) X-Google-Smtp-Source: APXvYqy5rHmk1T/SIUc9CVDQPM9pmmdOctq1jHiFEm6ydkfB0taSQD2lBf1nA4C5Ximvtz4ocTO1 X-Received: by 2002:a17:90a:7184:: with SMTP id i4mr31990977pjk.49.1559584560803; Mon, 03 Jun 2019 10:56:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559584560; cv=none; d=google.com; s=arc-20160816; b=paWlotnDw4V7Hz0umDTREvUq7ezfDn4fY1cy8325mfRBbgvP/5kOBMA3eE3whYQAn8 Zql8YVjVIM3wE4WS4wTd47ZfEbkvEAU2ZHIzptXRYaUnKefsANSVIzTnvJbXG2qIJOKd GxcJLWPqq6dpWbCWaHReY9SgZ1dG2C2e6F9omEZ4qXbq/0TLWKgPnvrUiS0tFP0SlOww YBtL4zzpE9Zk32ipjpQHzlKYMoZCTM2RSCLgJUMKYrLG4Oni/f+gqPHHBDSTfEwx7R9u rSRLG92LMqMRcmxkCBo9CRsPpG3tsbF9+yhGHOmx6gBtb92et5IdRiz9920QbhnJmAra 0/PQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=Ou7nbKSnWzeuJb0ud+C1KMIknjjtf6JpEdGznfm889o=; b=V4IpZzmZCi/eHpeXEo8d1g4iWozbpyrC4jzJY8HeOnyMqQi0Y23qcNLk+BPMUJp8H0 5e3ff7e3OOYOZK6HcHtRxm//RLGQ4pUkYSAEvCwDi2OeMsr0IHydESF7fssXFRLO1IZE Z/9s+OF8bA9NZGKejD6H5pCi59ZDs7i8a1MkV4rDhXsYcyltI42nxyWRMGYT+fWW76re F/Uzxq6tUvMvQ+bayBhI04wF60rGzAvWq5MVjdsetU+NCcjweQCe+QIfZ2jUeGTBZ6k2 PSiaKkfyu2MAed1XGo3WlJUqpd2ej+UgFo5FJOXxuf2Sxukk41J8UcSxCk1JtQibiT3C qhOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=XRvFg92K; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p21si18322240plq.328.2019.06.03.10.55.45; Mon, 03 Jun 2019 10:56:00 -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; dkim=pass header.i=@google.com header.s=20161025 header.b=XRvFg92K; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729967AbfFCRag (ORCPT + 99 others); Mon, 3 Jun 2019 13:30:36 -0400 Received: from mail-ed1-f65.google.com ([209.85.208.65]:45766 "EHLO mail-ed1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729953AbfFCRae (ORCPT ); Mon, 3 Jun 2019 13:30:34 -0400 Received: by mail-ed1-f65.google.com with SMTP id f20so27918577edt.12 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=HcQ6OR6l1AdzZXlSOAMlCFXfQSEL96oh+uD++TN4gAlbdUywieiPxE39NMq8Qj14Gu foWztcdM7W3rkwdSpdyHpSvnZeZg1IUFgFSUW8hgqOJTC+kNQJOoheX6rQNeeIa+W1lY yUHNLtc7IAYOujoA8ujbgiybFCAWnwAbPl5SsKIQMXrL86cV1I+YxHZcIq+6/QoQ4Nmz EFxv4ognicAxzg7orggadkILb3V0M+amjbSOAbBXw0jfdaLWzQW9h/GuYyTHThv5EOHr KPe8+BpGcSJkBr/jeQo33ikSdVjdFnZti0zeHWuD97ZOQHEanZf1x4cNh5wsDfeggJtR dyYQ== X-Gm-Message-State: APjAAAXuCwAu4LN0+mhbNef7l9JgLi2cyMyyPOr5wv2kvxgKichHacJd ki9NC1GSy0VrjLQKETnVVUIu3l04oxCSBVGdIvYqNw== 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: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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