Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp314120pxb; Fri, 15 Jan 2021 04:06:54 -0800 (PST) X-Google-Smtp-Source: ABdhPJxZgJJMIbVBSfZiV831DjjxSgLCchUIiiyESIW/EOYF1nREA3sxu7dKDL/w++rWyzi3nHgD X-Received: by 2002:a50:d552:: with SMTP id f18mr9222347edj.168.1610712413886; Fri, 15 Jan 2021 04:06:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610712413; cv=none; d=google.com; s=arc-20160816; b=ENFcP+Gt2dUQFTh9VvK7emFUidlieKxfrNQcoJnjRnc1jPx0yf6lnoqymFZg1U4J0Z RMOWF6Gfm+hJom1oGifkUNVlaGY8EYkF/mHmUAN0kGpOKLef31HVRIK0UcLGpL4+r+Ei DT0FN45HIBrDBtcVqvx3v+Zm+kdnW1XqkoEN/l07Eyp5qT3AbtaOnEtHsZxpvyG8tbv+ 0+c6XerhdS7M293kJwuNCfSuSA9Z9xOMBdSIXtjRetFqRx/60UNAdNcAMODjLq6ld1hz sIO7XdgYtsQoP6NNQZq28LwBUBaDEtXFBez0Yt3RPK96fHTb8GO55kZ0eWuVzHUzvS89 AVjw== 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=IEDy//10vz3URBwmS3YNZCnBj0jCnmtUNWcZq8+aI3I=; b=Lkqd2SeAdfe8ZgJISMQssOCc1PB6nRzGfPWuMAiFvkHTSWMfT2DI6jXGfQ+YcSYZx0 gzWmR0b6AaDC/FD34KsIZ6H1VfryncyAn7YkkNz0HD5jpgAaGYP8qOTJhxJCGVURoNeB HMbJ32JdtnBDHP6dwwCdFmbAdcZsgx8SxLkPBvlTepx5gWiEYtcFKIGBgdLcO27cog+x bSYCVfS3rVVb+qBcNPCnlYuRBVQtV2EL3z00cPVhCV+x9fVMSPP6UzQF7JZaHK0Ez8YH BAsbL8rSkOqD544Z3IknfDitPUpW1JhvoOCYO2b27XkYodMRxoZVXIsb13UntKQRCvNq pkxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=merlin.20170209 header.b="Nb/J2rF5"; 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 v3si3509627eje.650.2021.01.15.04.06.29; Fri, 15 Jan 2021 04:06:53 -0800 (PST) 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=merlin.20170209 header.b="Nb/J2rF5"; 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 S1729635AbhAOMC5 (ORCPT + 99 others); Fri, 15 Jan 2021 07:02:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60604 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728020AbhAOMC4 (ORCPT ); Fri, 15 Jan 2021 07:02:56 -0500 Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 41CBDC0613C1; Fri, 15 Jan 2021 04:02:16 -0800 (PST) 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=IEDy//10vz3URBwmS3YNZCnBj0jCnmtUNWcZq8+aI3I=; b=Nb/J2rF5gU4XJiiwYzj6u0+6nm 3r9hlPur9ict7JhQI+BNNhAVV4Llr8F6bjMNNJ1VJ9xTCypx0DvvzTP1w4rlYMZx6SupQPYZOOCvd KX65JfiUIwiVDuaFuRAgbSSG11eVQ3Sq9qK8qmiDGPYUBrcpZLXTW2MCnZeJQPDZRBuV3KwEQ+34V MeU2sBIkrqu22movaTcol5xtmJE3n1YeU4iwJ5pED96YWGMLBrYcE5jtaX0hIzVVGr8JBJx8bG4za XgyYW1Flv/UCjcpPSr1VIeBvllNLuWzzf3SDqDBhWw8KUHQe4I5XgAr/tsDgMeXzVlziHUQtitNpX ebWPE+Lw==; 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 1l0NnJ-000586-3G; Fri, 15 Jan 2021 12:01:33 +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 229A33010CF; Fri, 15 Jan 2021 13:01:27 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id F3E2520B5D699; Fri, 15 Jan 2021 13:01:26 +0100 (CET) Date: Fri, 15 Jan 2021 13:01:26 +0100 From: Peter Zijlstra To: "Xu, Like" Cc: Like Xu , Kan Liang , Paolo Bonzini , eranian@google.com, kvm@vger.kernel.org, Ingo Molnar , Sean Christopherson , Thomas Gleixner , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , Andi Kleen , wei.w.wang@intel.com, luwei.kang@intel.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3 04/17] perf: x86/ds: Handle guest PEBS overflow PMI and inject it to guest Message-ID: References: <20210104131542.495413-1-like.xu@linux.intel.com> <20210104131542.495413-5-like.xu@linux.intel.com> <9c343e40-bbdf-8af0-3307-5274070ee3d2@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <9c343e40-bbdf-8af0-3307-5274070ee3d2@intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jan 14, 2021 at 11:39:00AM +0800, Xu, Like wrote: > > Why do we need to? Can't we simply always forward the PMI if the guest > > has bits set in MSR_IA32_PEBS_ENABLE ? Surely we can access the guest > > MSRs at a reasonable rate.. > > > > Sure, it'll send too many PMIs, but is that really a problem? > > More vPMI means more guest irq handler calls and > more PMI virtualization overhead. Only if you have both guest and host PEBS. And in that case I really can't be arsed about some overhead to the guest. > In addition, > the correctness of some workloads (RR?) depends on > the correct number of PMIs and the PMI trigger times > and virt may not want to break this assumption. Are you sure? Spurious NMI/PMIs are known to happen anyway. We have far too much code to deal with them. > > > + * If PEBS interrupt threshold on host is not exceeded in a NMI, there > > > + * must be a PEBS overflow PMI generated from the guest PEBS counters. > > > + * There is no ambiguity since the reported event in the PMI is guest > > > + * only. It gets handled correctly on a case by case base for each event. > > > + * > > > + * Note: KVM disables the co-existence of guest PEBS and host PEBS. > > Where; I need a code reference here. > > How about: > > Note: KVM will disable the co-existence of guest PEBS and host PEBS. > In the intel_guest_get_msrs(), when we have host PEBS ctrl bit(s) enabled, > KVM will clear the guest PEBS ctrl enable bit(s) before vm-entry. > The guest PEBS users should be notified of this runtime restriction. Since you had me look at that function, can clean up that CONFIG_RETPOLINE crud and replace it with static_call() ?