Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp942527pxf; Wed, 7 Apr 2021 15:40:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwisqIAQI+s1jzcoxmp5gBUS2XhgAqFHt3wNiS7Oonf2+CanNaqKhYuCBktk3H/vA57n03I X-Received: by 2002:aa7:c98f:: with SMTP id c15mr7411487edt.231.1617835250675; Wed, 07 Apr 2021 15:40:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617835250; cv=none; d=google.com; s=arc-20160816; b=rwG/OzI0kO2R4HKtmZiFEvV2PLHWDUm4jlMJQ2wT8jZOkM90Zwtk7fcYqZN58yLELs 4tugQp7e6pf+JarKg5mX6ysuwFeuUyOheGcZr0B9MHRj8y7s59bNEbOq0PGh1GYzzet6 IeR4pD9R1hXYc/h3Z6Pra4SR3KcG5QO9abyjSMy3E8fzNwKCinfDDEuM8cxGGGkV3fTY 28raeHOWfkE44lyyw+zyC4zRsHZXByAR+dvAdr+6dOXs+Ti924G/UfpgdLqijJ1MhCoF Tbvmxt3LHtfHIq2i1yrsB/TgTilZEjx3huUS7LiKK88/AlYAetN8DX8qOVodg+8J6970 yf+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=cI27ms1y8lLpiUqUNPeuv/2lHvb/2VL0ZjKGdez54dI=; b=ahGpGGIL/gJol2jGtS6tOD6VrGZ7rVSPtKFWKUhfbFFA5e9FNH8gIeXUXrt7nnAMXh Y2/p6pkIMZw7jI4OV4sgvAYzZ8LZQL0391ZgVluybAuk53CxatW9wLrsc9u8ro4I0swD doO6LmPjUpE12IkBaV6/XYkTTdbMB3/N/56BMw/OjiZwTnzketescvGSYig1WmeMyO3i TDQDv5YGAYMGnS65FsiyxAcVjJ51rPa85fGsPxWwkGkmozUmBbknbFPHOi3PFDUgKj1r m73VMei1+qLNuqyTUKUj2PDhMoWKn43zj8rGNqjm36c6obYbiDytrbreljm2OKEk6nmC aGJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=m8esMUoZ; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e9si9942982ejl.539.2021.04.07.15.40.28; Wed, 07 Apr 2021 15:40:50 -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; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=m8esMUoZ; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236124AbhDGPkT (ORCPT + 99 others); Wed, 7 Apr 2021 11:40:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35518 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231366AbhDGPkR (ORCPT ); Wed, 7 Apr 2021 11:40:17 -0400 Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 47ACBC061756; Wed, 7 Apr 2021 08:40:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=cI27ms1y8lLpiUqUNPeuv/2lHvb/2VL0ZjKGdez54dI=; b=m8esMUoZiIDjn8rWXyVjcL8n/p Tebeu5tJPb5RHhNPR2bPTXVG6MfbdxGxuQaiRW7UWmtAfIY+ZgWP5fkQyWRQrwjErk5fF615lslZS hpJaV7SAY1/BZak7RK8Lb8Oz+0JVb0rhMKjEzAoDRQqifDzMl7PO9H1E0O63fi8Bcul0K0XvW97Nm muAxPrigaM17dsfJmfZhehG43FUwxCmnZsGPkoam7LRQ+0ud5G2pqYgbRWyaUT/+VVNm01S7G00J8 K4GIrWYbEh/s2CbFWX/1+xXFJ8UoDzvzc0cJQYjVwAhNUZtjpiCTMieJX2zgdMv3Yw7lGFbaDIukp 6iqzQxmg==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.94 #2 (Red Hat Linux)) id 1lUAHT-005Ij9-3E; Wed, 07 Apr 2021 15:39:47 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id B86393001FB; Wed, 7 Apr 2021 17:39:42 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id A601D2BF09264; Wed, 7 Apr 2021 17:39:42 +0200 (CEST) Date: Wed, 7 Apr 2021 17:39:42 +0200 From: Peter Zijlstra To: Like Xu Cc: Sean Christopherson , Paolo Bonzini , eranian@google.com, andi@firstfloor.org, kan.liang@linux.intel.com, wei.w.wang@intel.com, Wanpeng Li , Vitaly Kuznetsov , Jim Mattson , Joerg Roedel , kvm@vger.kernel.org, x86@kernel.org, linux-kernel@vger.kernel.org, Andi Kleen Subject: Re: [PATCH v4 08/16] KVM: x86/pmu: Add IA32_DS_AREA MSR emulation to manage guest DS buffer Message-ID: References: <20210329054137.120994-1-like.xu@linux.intel.com> <20210329054137.120994-9-like.xu@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210329054137.120994-9-like.xu@linux.intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Mar 29, 2021 at 01:41:29PM +0800, Like Xu wrote: > @@ -3869,10 +3876,12 @@ static struct perf_guest_switch_msr *intel_guest_get_msrs(int *nr, void *data) > > if (arr[1].guest) > arr[0].guest |= arr[1].guest; > - else > + else { > arr[1].guest = arr[1].host; > + arr[2].guest = arr[2].host; > + } What's all this gibberish? The way I read that it says: if guest has PEBS_ENABLED guest GLOBAL_CTRL |= PEBS_ENABLED otherwise guest PEBS_ENABLED = host PEBS_ENABLED guest DS_AREA = host DS_AREA which is just completely random garbage afaict. Why would you leak host msrs into the guest? Why would you change guest GLOBAL_CTRL implicitly; guest had better wrmsr that himself to control when stuff is enabled. This just cannot be right.