Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp6855057ybf; Fri, 6 Mar 2020 05:54:41 -0800 (PST) X-Google-Smtp-Source: ADFU+vv3wjNS2P9Su4G8Zcq8y1vitc7QbRQReJZYu0u6g3ax93yUHPf/geIFP/JPQxkstVs2UnZy X-Received: by 2002:a9d:4c87:: with SMTP id m7mr2550514otf.303.1583502881169; Fri, 06 Mar 2020 05:54:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583502881; cv=none; d=google.com; s=arc-20160816; b=VMuSTQ2c2UNz5KrXSqnVhc0WP6uOxftKm5BbEkcHraxNt0ddRIxOenlqec67f24iWI MC0DLaW9AwBYel82FIQk/v+R/vDN9gby2lljYyChwcDgY810s97hZE9c2SYHBXZ+hEa1 DDnig7WE9sXbt7n7zFGDCWEtj2MapViV04wcWRAurRUy/vMfEyL+yPyhFXueCUf+u6Ry rLapBmV3grUHTPLL6vnLkN/CzKZubwQqY5w/01XUxlFU7ydq2t6djHtWhDcLgMGyCp+m NKSHQvY0wAI8FU9Zjamk/I2FyJqolAePPGBS4btQmj75O7B3zlpV1h720cs//5IIZNn/ TXXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=TvqxgncBv+tYz2iLtFMaeCImn2/6WxUyTqpfABjn9is=; b=Ja3Tc7v7OaF13FvryTbPeCGz49hATKzK2Dw+I9v0aJy3JTAAR7o6skpN0RbnmmNT3h VTRdw8E8Zre+FDVbE67qj2UsWyBm67QXxvmbYye7dybv24J7avvkbxoarQzyDSu+VA0A 6o4VYGrwKsucCPns8zxFAWX/je5GK1kukj8RJ0HLxncSw64Tf5QXH8nECsQvkJQx/uBh x478ZH7skfI5O+ims7B6SbZDuKtXH8R1nZ1zUoSs3jfj9K/h1JTtmn7NZ0PpHz28ZMFL 6Wt4vsLvKOhvzlSdOEjz1A+BVt0X4OSAunieirD2JNF068USwqgdVDQrorSaeQ+mOa/y /e0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=Io8IWba5; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x24si1435209otq.261.2020.03.06.05.54.28; Fri, 06 Mar 2020 05:54:41 -0800 (PST) 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=fail header.i=@infradead.org header.s=merlin.20170209 header.b=Io8IWba5; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726811AbgCFNxy (ORCPT + 99 others); Fri, 6 Mar 2020 08:53:54 -0500 Received: from merlin.infradead.org ([205.233.59.134]:59214 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726182AbgCFNxy (ORCPT ); Fri, 6 Mar 2020 08:53:54 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; 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=TvqxgncBv+tYz2iLtFMaeCImn2/6WxUyTqpfABjn9is=; b=Io8IWba5uLU8SqCXUJ77L2t1ia ZduZH4h0JWEmp2q4yD4xGCJ2RZdk4HUvHaDvH7QjjBw5H1zE8VE9yxta9iNFsPYLCZc8YuSwjpVlr rHXrPv3AZatPAvR6rOZdFlJjId0KJ+tyqZUTXskoLVHRRlXf+bcO7zD+vPT2QcJSFbX9Nj5DFxfsa AM/Z6M6wzy8IuSi/nlVYZDZK0VTZnuzxvn7osMG5FUcDeA3/s3GEdhPx+muHEC0fsZw6eUyH/RF4L HMPRD6E0QHTFOFJKaZDGIuHS2/rqs8NTB1Y+0DrKkX6YfoGjpRhZgvEiZIfft3/NJsInJ5wpCRvxM m3ldK9+A==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1jADPl-0007sV-9x; Fri, 06 Mar 2020 13:53:21 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 9D1F83035D4; Fri, 6 Mar 2020 14:53:17 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 8046C20286A0B; Fri, 6 Mar 2020 14:53:17 +0100 (CET) Date: Fri, 6 Mar 2020 14:53:17 +0100 From: Peter Zijlstra To: Luwei Kang Cc: x86@kernel.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, mingo@redhat.com, acme@kernel.org, mark.rutland@arm.com, alexander.shishkin@linux.intel.com, jolsa@redhat.com, namhyung@kernel.org, tglx@linutronix.de, bp@alien8.de, hpa@zytor.com, pbonzini@redhat.com, sean.j.christopherson@intel.com, vkuznets@redhat.com, wanpengli@tencent.com, jmattson@google.com, joro@8bytes.org, pawan.kumar.gupta@linux.intel.com, ak@linux.intel.com, thomas.lendacky@amd.com, fenghua.yu@intel.com, kan.liang@linux.intel.com, like.xu@linux.intel.com Subject: Re: [PATCH v1 01/11] perf/x86/core: Support KVM to assign a dedicated counter for guest PEBS Message-ID: <20200306135317.GD12561@hirez.programming.kicks-ass.net> References: <1583431025-19802-1-git-send-email-luwei.kang@intel.com> <1583431025-19802-2-git-send-email-luwei.kang@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1583431025-19802-2-git-send-email-luwei.kang@intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Mar 06, 2020 at 01:56:55AM +0800, Luwei Kang wrote: > From: Kan Liang > > The PEBS event created by host needs to be assigned specific counters > requested by the guest, which means the guest and host counter indexes > have to be the same or fail to create. This is needed because PEBS leaks > counter indexes into the guest. Otherwise, the guest driver will be > confused by the counter indexes in the status field of the PEBS record. > > A guest_dedicated_idx field is added to indicate the counter index > specifically requested by KVM. The dedicated event constraints would > constrain the counter in the host to the same numbered counter in guest. > > A intel_ctrl_guest_dedicated_mask field is added to indicate the enabled > counters for guest PEBS events. The IA32_PEBS_ENABLE MSR will be switched > during the VMX transitions if intel_ctrl_guest_owned is set. > > + /* the guest specified counter index of KVM owned event, e.g PEBS */ > + int guest_dedicated_idx; We've always objected to guest 'owned' counters, they destroy scheduling freedom. Why are you expecting that to be any different this time?