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=-7.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS autolearn=ham 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 7B5C8C2D0C0 for ; Mon, 23 Dec 2019 12:18:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4F6C32063A for ; Mon, 23 Dec 2019 12:18:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1577103498; bh=1WuVbiEKphzmWOobGfUMXpC91u7jYsfey1tXhJqm8Lw=; h=To:Subject:Date:From:Cc:In-Reply-To:References:List-ID:From; b=o5VnYHn6y4+vfLtYpghZ22g7x49pur2/DRc8QgoqxcejTyS21vVR+IAUaSRCgfiMp WOqTQJN3F4KCEL8FKYQV/FJP2G9kOgWXtfcrzeBpQzbdqxJY3CbdYoSftsd+eeEJKB A4JqxGSmldVuWkj0xhQCz3CnPij6IQLqc04i+r+0= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726861AbfLWMSR (ORCPT ); Mon, 23 Dec 2019 07:18:17 -0500 Received: from inca-roads.misterjones.org ([213.251.177.50]:34041 "EHLO inca-roads.misterjones.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726257AbfLWMSQ (ORCPT ); Mon, 23 Dec 2019 07:18:16 -0500 Received: from www-data by cheepnis.misterjones.org with local (Exim 4.80) (envelope-from ) id 1ijMf8-0003iS-Ut; Mon, 23 Dec 2019 13:18:14 +0100 To: Andrew Murray Subject: Re: [PATCH v2 15/18] perf: =?UTF-8?Q?arm=5Fspe=3A=20Handle=20gues?= =?UTF-8?Q?t/host=20exclusion=20flags?= X-PHP-Originating-Script: 0:main.inc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Date: Mon, 23 Dec 2019 12:18:14 +0000 From: Marc Zyngier Cc: Marc Zyngier , Catalin Marinas , Will Deacon , , , Sudeep Holla , , In-Reply-To: <20191223121002.GB42593@e119886-lin.cambridge.arm.com> References: <20191220143025.33853-1-andrew.murray@arm.com> <20191220143025.33853-16-andrew.murray@arm.com> <865zi8imr7.wl-maz@kernel.org> <20191223121002.GB42593@e119886-lin.cambridge.arm.com> Message-ID: <0c806e4f5bb465f5b3fb54d167293706@www.loen.fr> X-Sender: maz@kernel.org User-Agent: Roundcube Webmail/0.7.2 X-SA-Exim-Connect-IP: X-SA-Exim-Rcpt-To: andrew.murray@arm.com, marc.zyngier@arm.com, catalin.marinas@arm.com, will.deacon@arm.com, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, sudeep.holla@arm.com, kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on cheepnis.misterjones.org); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2019-12-23 12:10, Andrew Murray wrote: > On Sun, Dec 22, 2019 at 12:10:52PM +0000, Marc Zyngier wrote: >> On Fri, 20 Dec 2019 14:30:22 +0000, >> Andrew Murray wrote: >> > >> > A side effect of supporting the SPE in guests is that we prevent >> the >> > host from collecting data whilst inside a guest thus creating a >> black-out >> > window. This occurs because instead of emulating the SPE, we share >> it >> > with our guests. >> > >> > Let's accurately describe our capabilities by using the perf >> exclude >> > flags to prevent !exclude_guest and exclude_host flags from being >> used. >> > >> > Signed-off-by: Andrew Murray >> > --- >> > drivers/perf/arm_spe_pmu.c | 3 +++ >> > 1 file changed, 3 insertions(+) >> > >> > diff --git a/drivers/perf/arm_spe_pmu.c >> b/drivers/perf/arm_spe_pmu.c >> > index 2d24af4cfcab..3703dbf459de 100644 >> > --- a/drivers/perf/arm_spe_pmu.c >> > +++ b/drivers/perf/arm_spe_pmu.c >> > @@ -679,6 +679,9 @@ static int arm_spe_pmu_event_init(struct >> perf_event *event) >> > if (attr->exclude_idle) >> > return -EOPNOTSUPP; >> > >> > + if (!attr->exclude_guest || attr->exclude_host) >> > + return -EOPNOTSUPP; >> > + >> >> I have the opposite approach. If the host decides to profile the >> guest, why should that be denied? If there is a black hole, it >> should >> take place in the guest. Today, the host does expect this to work, >> and >> there is no way that we unconditionally allow it to regress. > > That seems reasonable. > > Upon entering the guest we'd have to detect if the host is using SPE, > and if > so choose not to restore the guest registers. Instead we'd have to > trap them > and let the guest read/write emulated values until the host has > finished with > SPE - at which time we could restore the guest SPE registers to > hardware. > > Does that approach make sense? Yes, this would be much better. All of this can be found out at vcpu_load() time, and once you've moved most of the SPE sysreg handling there, it will just follow the normal scheduling flow. M. -- Jazz is not dead. It just smells funny...